mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-8623: CPVM fails to start after MS is restarted during its initial start-up process
If SSVM cannot be started then the existing entry is removed and a new SSVM gets created. Made similar changes for CPVM as well. Also cleaned up some log messages in SSVM and CPVM manager code.
This commit is contained in:
parent
76a10351a5
commit
9ec2a6c29c
|
|
@ -72,6 +72,7 @@ public class ConsoleProxyVO extends VMInstanceVO implements ConsoleProxy {
|
|||
long accountId, long userId, int activeSession, boolean haEnabled) {
|
||||
super(id, serviceOfferingId, name, name, Type.ConsoleProxy, templateId, hypervisorType, guestOSId, domainId, accountId, userId, haEnabled);
|
||||
this.activeSession = activeSession;
|
||||
this.dataCenterId = dataCenterId;
|
||||
}
|
||||
|
||||
protected ConsoleProxyVO() {
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ public class SecondaryStorageVmVO extends VMInstanceVO implements SecondaryStora
|
|||
long domainId, long accountId, long userId, Role role, boolean haEnabled) {
|
||||
super(id, serviceOfferingId, name, name, Type.SecondaryStorageVm, templateId, hypervisorType, guestOSId, domainId, accountId, userId, haEnabled);
|
||||
this.role = role;
|
||||
this.dataCenterId = dataCenterId;
|
||||
}
|
||||
|
||||
protected SecondaryStorageVmVO() {
|
||||
|
|
|
|||
|
|
@ -543,9 +543,7 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
|
|||
|
||||
// For VMs that are in Stopping, Starting, Migrating state, let client to wait by returning null
|
||||
// as sooner or later, Starting/Migrating state will be transited to Running and Stopping will be transited
|
||||
// to
|
||||
// Stopped to allow
|
||||
// Starting of it
|
||||
// to Stopped to allow Starting of it
|
||||
s_logger.warn("Console proxy is not in correct state to be started: " + proxy.getState());
|
||||
return null;
|
||||
} catch (StorageUnavailableException e) {
|
||||
|
|
@ -889,32 +887,32 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
|
|||
|
||||
ConsoleProxyVO proxy = null;
|
||||
String errorString = null;
|
||||
try{
|
||||
if (_allocProxyLock.lock(ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_SYNC)) {
|
||||
try {
|
||||
proxy = assignProxyFromStoppedPool(dataCenterId);
|
||||
if (proxy == null) {
|
||||
if (s_logger.isInfoEnabled()) {
|
||||
s_logger.info("No stopped console proxy is available, need to allocate a new console proxy");
|
||||
}
|
||||
try {
|
||||
boolean consoleProxyVmFromStoppedPool = false;
|
||||
proxy = assignProxyFromStoppedPool(dataCenterId);
|
||||
if (proxy == null) {
|
||||
if (s_logger.isInfoEnabled()) {
|
||||
s_logger.info("No stopped console proxy is available, need to allocate a new console proxy");
|
||||
}
|
||||
|
||||
try {
|
||||
proxy = startNew(dataCenterId);
|
||||
} catch (ConcurrentOperationException e) {
|
||||
s_logger.info("Concurrent Operation caught " + e);
|
||||
}
|
||||
} else {
|
||||
if (s_logger.isInfoEnabled()) {
|
||||
s_logger.info("Found a stopped console proxy, bring it up to running pool. proxy vm id : " + proxy.getId());
|
||||
}
|
||||
if (_allocProxyLock.lock(ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_SYNC)) {
|
||||
try {
|
||||
proxy = startNew(dataCenterId);
|
||||
} catch (ConcurrentOperationException e) {
|
||||
s_logger.info("Concurrent operation exception caught " + e);
|
||||
} finally {
|
||||
_allocProxyLock.unlock();
|
||||
}
|
||||
} else {
|
||||
if (s_logger.isInfoEnabled()) {
|
||||
s_logger.info("Unable to acquire synchronization lock for console proxy vm allocation, wait for next scan");
|
||||
}
|
||||
} finally {
|
||||
_allocProxyLock.unlock();
|
||||
}
|
||||
} else {
|
||||
if (s_logger.isInfoEnabled()) {
|
||||
s_logger.info("Unable to acquire proxy allocation lock, skip for next time");
|
||||
s_logger.info("Found a stopped console proxy, starting it. Vm id : " + proxy.getId());
|
||||
}
|
||||
consoleProxyVmFromStoppedPool = true;
|
||||
}
|
||||
|
||||
if (proxy != null) {
|
||||
|
|
@ -927,19 +925,26 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
|
|||
}
|
||||
SubscriptionMgr.getInstance().notifySubscribers(ConsoleProxyManager.ALERT_SUBJECT, this,
|
||||
new ConsoleProxyAlertEventArgs(ConsoleProxyAlertEventArgs.PROXY_UP, dataCenterId, proxy.getId(), proxy, null));
|
||||
} else {
|
||||
if (s_logger.isInfoEnabled()) {
|
||||
s_logger.info("Unable to start console proxy vm for standby capacity, vm id : " + proxyVmId + ", will recycle it and start a new one");
|
||||
}
|
||||
|
||||
if (consoleProxyVmFromStoppedPool) {
|
||||
destroyProxy(proxyVmId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
errorString = e.getMessage();
|
||||
throw e;
|
||||
}finally {
|
||||
} finally {
|
||||
// TODO - For now put all the alerts as creation failure. Distinguish between creation vs start failure in future.
|
||||
// Also add failure reason since startvm masks some of them.
|
||||
if(proxy == null || proxy.getState() != State.Running)
|
||||
if (proxy == null || proxy.getState() != State.Running)
|
||||
SubscriptionMgr.getInstance().notifySubscribers(ConsoleProxyManager.ALERT_SUBJECT, this,
|
||||
new ConsoleProxyAlertEventArgs(ConsoleProxyAlertEventArgs.PROXY_CREATE_FAILURE, dataCenterId, 0l, null, errorString));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isZoneReady(Map<Long, ZoneHostInfo> zoneHostInfoMap, long dataCenterId) {
|
||||
|
|
@ -1544,14 +1549,14 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
|
|||
|
||||
if (!reserveStandbyCapacity()) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Reserving standby capacity is disable, skip capacity scan");
|
||||
s_logger.debug("Reserving standby capacity is disabled, skip capacity scan");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
List<StoragePoolVO> upPools = _storagePoolDao.listByStatus(StoragePoolStatus.Up);
|
||||
if (upPools == null || upPools.size() == 0) {
|
||||
s_logger.debug("Skip capacity scan due to there is no Primary Storage UPintenance mode");
|
||||
s_logger.debug("Skip capacity scan as there is no Primary Storage in 'Up' state");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -656,13 +656,13 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
|
|||
|
||||
if (!isSecondaryStorageVmRequired(dataCenterId)) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Secondary storage vm not required in zone " + dataCenterId + " acc. to zone config");
|
||||
s_logger.debug("Secondary storage vm not required in zone " + dataCenterId + " according to zone config");
|
||||
}
|
||||
return;
|
||||
}
|
||||
SecondaryStorageVmVO secStorageVm = null;
|
||||
String errorString = null;
|
||||
try{
|
||||
try {
|
||||
boolean secStorageVmFromStoppedPool = false;
|
||||
secStorageVm = assignSecStorageVmFromStoppedPool(dataCenterId, role);
|
||||
if (secStorageVm == null) {
|
||||
|
|
@ -681,13 +681,13 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
|
|||
}
|
||||
} else {
|
||||
if (s_logger.isInfoEnabled()) {
|
||||
s_logger.info("Unable to acquire synchronization lock to allocate secStorageVm resource for standby capacity, wait for next scan");
|
||||
s_logger.info("Unable to acquire synchronization lock for secondary storage vm allocation, wait for next scan");
|
||||
}
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (s_logger.isInfoEnabled()) {
|
||||
s_logger.info("Found a stopped secondary storage vm, bring it up to running pool. secStorageVm vm id : " + secStorageVm.getId());
|
||||
s_logger.info("Found a stopped secondary storage vm, starting it. Vm id : " + secStorageVm.getId());
|
||||
}
|
||||
secStorageVmFromStoppedPool = true;
|
||||
}
|
||||
|
|
@ -704,7 +704,7 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
|
|||
}
|
||||
} else {
|
||||
if (s_logger.isInfoEnabled()) {
|
||||
s_logger.info("Unable to acquire synchronization lock to start secStorageVm for standby capacity, secStorageVm vm id : " + secStorageVm.getId());
|
||||
s_logger.info("Unable to acquire synchronization lock for starting secondary storage vm id : " + secStorageVm.getId());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -714,8 +714,7 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
|
|||
|
||||
if (secStorageVm == null) {
|
||||
if (s_logger.isInfoEnabled()) {
|
||||
s_logger.info("Unable to start secondary storage vm for standby capacity, secStorageVm vm Id : " + secStorageVmId +
|
||||
", will recycle it and start a new one");
|
||||
s_logger.info("Unable to start secondary storage vm for standby capacity, vm id : " + secStorageVmId + ", will recycle it and start a new one");
|
||||
}
|
||||
|
||||
if (secStorageVmFromStoppedPool) {
|
||||
|
|
@ -729,10 +728,10 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
|
|||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
errorString = e.getMessage();
|
||||
throw e;
|
||||
}finally{
|
||||
} finally {
|
||||
// TODO - For now put all the alerts as creation failure. Distinguish between creation vs start failure in future.
|
||||
// Also add failure reason since startvm masks some of them.
|
||||
if(secStorageVm == null || secStorageVm.getState() != State.Running)
|
||||
|
|
|
|||
Loading…
Reference in New Issue