use of com.emc.storageos.systemservices.impl.upgrade.LocalRepository in project coprhd-controller by CoprHD.
the class BuildEsrsDevice method buildDevice.
/**
* Build the Device object using the controller license information.
*
* @param feature
* @param device
* @throws LocalRepositoryException
*/
private void buildDevice(LicenseInfoExt licenseInfo, Device device) throws LocalRepositoryException {
if (licenseInfo != null) {
LocalRepository localRepository = LocalRepository.getInstance();
// this is in the format of node1, node2, etc. We need to get the integer portion.
String nodeId = _coordinator.getPropertyInfo().getProperties().get("node_id");
String node;
if (nodeId != null) {
node = nodeId.substring(4);
} else {
node = CallHomeConstants.STANDALONE;
}
device.setSerialNumber(licenseInfo.getProductId() + "-" + node);
device.setModelName(getBaseModelId(licenseInfo.getLicenseType().toString()) + MODEL_NAME_SUFFIX);
device.setIpAddress(_networkIpAddress);
}
}
use of com.emc.storageos.systemservices.impl.upgrade.LocalRepository in project coprhd-controller by CoprHD.
the class ControlService method resetDbdata.
/**
* Internal call to reset db data for vapp node recovery include cleanup db file,stop db service,create startup file.
*/
@POST
@Path("internal/node/db-reset")
@Produces({ MediaType.APPLICATION_JSON })
public Response resetDbdata(@QueryParam("node_id") String nodeId) {
_log.info("stop dbsvc/geosvc for node recovery");
LocalRepository localRepository = LocalRepository.getInstance();
localRepository.stop("geodbsvc");
localRepository.stop("dbsvc");
purgeDbData();
return Response.ok().build();
}
use of com.emc.storageos.systemservices.impl.upgrade.LocalRepository in project coprhd-controller by CoprHD.
the class IPSecMonitor method run.
@Override
public void run() {
try {
log.info("step 1: start checking ipsec connections");
String[] problemNodes = LocalRepository.getInstance().checkIpsecConnection();
if (problemNodes == null || problemNodes.length == 0 || problemNodes[0].isEmpty()) {
log.info("all connections are good, skip ipsec sync step");
return;
}
log.info("Found problem nodes which are: " + Arrays.toString(problemNodes));
log.info("step 2: get latest ipsec properties of all remote nodes of the cluster");
String[] allRemoteNodes = LocalRepository.getInstance().getAllRemoteNodesIncluster();
log.info("all remote nodes in the cluster are: " + Arrays.toString(allRemoteNodes));
Map<String, String> latest = getLatestIPSecProperties(allRemoteNodes);
if (latest == null) {
log.info("no latest ipsec properties found, skip following check steps");
return;
}
log.info("step 3: compare the latest ipsec properties with local, to determine if sync needed");
if (isSyncNeeded(latest)) {
String latestKey = latest.get(Constants.IPSEC_KEY);
String latestStatus = latest.get(Constants.IPSEC_STATUS);
LocalRepository localRepository = LocalRepository.getInstance();
log.info("syncing latest properties to local: key=" + maskIpsecKey(latestKey) + ", status=" + latestStatus);
localRepository.syncIpsecKeyToLocal(latestKey);
localRepository.syncIpsecStatusToLocal(latestStatus);
log.info("reloading ipsec");
localRepository.reconfigProperties("ipsec");
localRepository.reload("ipsec");
} else {
log.info("Local property file already has latest ipsec key, checking local ipsec config file...");
LocalRepository localRepository = LocalRepository.getInstance();
if (!localRepository.isLocalIpsecConfigSynced()) {
log.info("Local IPsec config files mismatched, need to reconfig");
localRepository.reconfigProperties("ipsec");
} else {
log.info("ipsec key config files match.");
}
// for COP-22199, ipsec reload will affect zk links.
// so if no ipsec key sync, we should not reload ipsec.
// localRepository.reload("ipsec");
}
shortSleep();
log.info("Step 4: rechecking ipsec status ...");
problemNodes = LocalRepository.getInstance().checkIpsecConnection();
if (problemNodes == null || problemNodes.length == 0 || problemNodes[0].isEmpty()) {
log.info("All connections issues are fixed.");
} else {
log.info("ipsec still has problems on : " + Arrays.toString(problemNodes));
}
} catch (Exception ex) {
ex.printStackTrace();
log.warn("error when run ipsec monitor: ", ex);
}
}
use of com.emc.storageos.systemservices.impl.upgrade.LocalRepository in project coprhd-controller by CoprHD.
the class LocalRepositoryTest method localRepositoryTest.
@Test
public void localRepositoryTest() throws Exception {
// getVersions() returns an empty List but never null
LocalRepository _localRepo = LocalRepository.getInstance();
RepositoryInfo state = _localRepo.getRepositoryInfo();
SoftwareVersion current = state.getCurrentVersion();
Assert.assertNotNull(current);
System.out.println("current=" + current);
List<SoftwareVersion> available = state.getVersions();
Assert.assertNotNull(available);
System.out.println("available=");
byte[] buf = new byte[100];
for (SoftwareVersion v : available) {
System.out.println(v);
InputStream in = _localRepo.getImageInputStream(v);
try {
Assert.assertTrue(in.read(buf) == buf.length);
} finally {
in.close();
}
}
}
Aggregations