use of com.emc.storageos.db.client.util.VdcConfigUtil in project coprhd-controller by CoprHD.
the class VdcManager method innerRun.
@Override
protected void innerRun() {
// need to distinguish persistent locks acquired from UpgradeManager/VdcManager/PropertyManager
// otherwise they might release locks acquired by others when they start
final String svcId = String.format("%s,vdc", coordinator.getMySvcId());
vdcConfigUtil = new VdcConfigUtil(coordinator.getCoordinatorClient());
vdcConfigUtil.setBackCompatPreYoda(backCompatPreYoda);
addSiteInfoListener();
while (doRun) {
log.debug("Main loop: Start");
// Step0: check if we have the reboot lock
boolean hasLock;
try {
hasLock = hasRebootLock(svcId);
} catch (Exception e) {
log.info("Step0: Failed to verify if the current node has the reboot lock ", e);
retrySleep();
continue;
}
if (hasLock) {
try {
releaseRebootLock(svcId);
log.info("Step0: Released reboot lock for node: {}", svcId);
wakeupOtherNodes();
} catch (InvalidLockOwnerException e) {
log.error("Step0: Failed to release the reboot lock: Not owner.");
} catch (Exception e) {
log.info("Step0: Failed to release the reboot lock and will retry: {}", e.getMessage());
retrySleep();
continue;
}
}
// Step1: publish current state, and set target if empty
try {
initializeLocalAndTargetInfo();
} catch (Exception e) {
log.info("Step1 failed and will be retried:", e);
retrySleep();
continue;
}
// Step2: power off if all nodes agree.
log.info("Step2: Power off if poweroff state != NONE. {}", targetPowerOffState);
try {
gracefulPowerOffCluster();
} catch (Exception e) {
log.error("Step2: Failed to poweroff. {}", e);
}
// Step3: set site error state if on active
try {
updateSiteErrors();
} catch (Exception e) {
log.error("Step3: Failed to set site errors. {}", e);
}
// Step4: record DR operation audit log if on active
try {
auditCompletedDrOperation();
} catch (RuntimeException e) {
log.error("Step4: Failed to record DR operation audit log. {}", e);
}
// Step5: update vdc configuration if changed
log.info("Step5: If VDC configuration is changed update");
if (vdcPropertiesChanged()) {
log.info("Step5: Current vdc properties are not same as target vdc properties. Updating.");
log.debug("Current local vdc properties: " + localVdcPropInfo);
log.debug("Target vdc properties: " + targetVdcPropInfo);
try {
updateVdcProperties(svcId);
} catch (Exception e) {
log.info("Step5: VDC properties update failed and will be retried:", e);
// Restart the loop immediately so that we release the upgrade lock.
continue;
}
continue;
}
// Step 6 : check backward compatible upgrade flag
try {
if (backCompatPreYoda) {
if (isGeoConfig() && !isLeadVdcForGeoUpgrade()) {
log.info("Skip pre-yoda upgrade handling for non lead vdc");
} else {
log.info("Check if pre-yoda upgrade is done");
checkPreYodaUpgrade();
continue;
}
}
} catch (Exception ex) {
log.error("Step6: Failed to set back compat yoda upgrade. {}", ex);
continue;
}
// Step7: sleep
log.info("Step7: sleep");
longSleep();
}
}
Aggregations