use of com.emc.storageos.coordinator.client.service.DistributedPersistentLock in project coprhd-controller by CoprHD.
the class UpgradeManager method hasUpgradeLock.
/**
* Helper method to provide backward compatibility for upgrade from pre-Yoda releases
* This should be replaced with hasRebootLock() when pre-Yoda releases are no longer in the direct upgrade path
*
* @param svcId
* @throws Exception needs to be caught by the caller
* @return
*/
private boolean hasUpgradeLock(String svcId) throws Exception {
if (backCompatPreYoda) {
log.info("Pre-yoda back compatible flag detected. Check upgrade lock from the global area");
// The lock content has changed in Yoda, previously there's only svcId in the lock node
String oldSvcId = coordinator.getMySvcId();
DistributedPersistentLock lock = coordinator.getCoordinatorClient().getPersistentLock(DISTRIBUTED_UPGRADE_LOCK);
log.info("Acquiring the upgrade lock for {}...", oldSvcId);
if (lock != null) {
String lockOwner = lock.getLockOwner();
if (lockOwner != null && lockOwner.equals(oldSvcId)) {
log.info("Current owner of the upgrade lock: {} ", lockOwner);
return true;
}
}
return false;
} else {
return hasRebootLock(svcId);
}
}
use of com.emc.storageos.coordinator.client.service.DistributedPersistentLock in project coprhd-controller by CoprHD.
the class UpgradeManager method getUpgradeLock.
/**
* Helper method to provide backward compatibility for upgrade from pre-Yoda releases
* This should be replaced with getRebootLock() when pre-Yoda releases are no longer in the direct upgrade path
*
* @param svcId
* @throws Exception needs to be caught by the caller
* @return
*/
private boolean getUpgradeLock(String svcId) throws Exception {
if (backCompatPreYoda) {
log.info("Pre-yoda back compatible flag detected. Check upgrade lock from the global area");
// The lock content has changed in Yoda, previously there's only svcId in the lock node
String oldSvcId = coordinator.getMySvcId();
DistributedPersistentLock lock = coordinator.getCoordinatorClient().getPersistentLock(DISTRIBUTED_UPGRADE_LOCK);
log.info("Acquiring the upgrade lock for {}...", oldSvcId);
boolean result = lock.acquireLock(oldSvcId);
if (!result) {
log.info("Acquiring reboot lock failed. Retrying...");
return false;
}
log.info("Successfully acquired the reboot lock.");
return true;
} else {
return getRebootLock(svcId);
}
}
Aggregations