mirror of https://github.com/apache/cloudstack.git
for mycloud: if no system vm required do not start it
This commit is contained in:
parent
9ef6f9ff54
commit
87867c8f39
|
|
@ -55,6 +55,7 @@ import com.cloud.certificate.dao.CertificateDao;
|
|||
import com.cloud.cluster.ClusterManager;
|
||||
import com.cloud.cluster.StackMaid;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.ZoneConfig;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.DataCenter.NetworkType;
|
||||
|
|
@ -906,8 +907,24 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean isConsoleProxyVmRequired(long dcId) {
|
||||
DataCenterVO dc = _dcDao.findById(dcId);
|
||||
_dcDao.loadDetails(dc);
|
||||
String cpvmReq = dc.getDetail(ZoneConfig.EnableConsoleProxyVm.key());
|
||||
if (cpvmReq != null) {
|
||||
return Boolean.parseBoolean(cpvmReq);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean allowToLaunchNew(long dcId) {
|
||||
if (!isConsoleProxyVmRequired(dcId)) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Console proxy vm not required in zone " + dcId + " not launching");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
List<ConsoleProxyVO> l = _consoleProxyDao.getProxyListInStates(dcId, VirtualMachine.State.Starting, VirtualMachine.State.Running, VirtualMachine.State.Stopping, VirtualMachine.State.Stopped,
|
||||
VirtualMachine.State.Migrating, VirtualMachine.State.Shutdowned, VirtualMachine.State.Unknown);
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ import com.cloud.agent.api.check.CheckSshCommand;
|
|||
import com.cloud.agent.manager.Commands;
|
||||
import com.cloud.cluster.ClusterManager;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.ZoneConfig;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.DataCenter.NetworkType;
|
||||
|
|
@ -327,9 +328,25 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean isSecondaryStorageVmRequired(long dcId) {
|
||||
DataCenterVO dc = _dcDao.findById(dcId);
|
||||
_dcDao.loadDetails(dc);
|
||||
String ssvmReq = dc.getDetail(ZoneConfig.EnableSecStorageVm.key());
|
||||
if (ssvmReq != null) {
|
||||
return Boolean.parseBoolean(ssvmReq);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public SecondaryStorageVmVO startNew(long dataCenterId, SecondaryStorageVm.Role role) {
|
||||
|
||||
if (!isSecondaryStorageVmRequired(dataCenterId)) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Secondary storage vm not required in zone " + dataCenterId + " acc. to zone config");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Assign secondary storage vm from a newly started instance for request from data center : " + dataCenterId);
|
||||
}
|
||||
|
|
@ -475,6 +492,13 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
|
|||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace("Allocate secondary storage vm standby capacity for data center : " + dataCenterId);
|
||||
}
|
||||
|
||||
if (!isSecondaryStorageVmRequired(dataCenterId)) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Secondary storage vm not required in zone " + dataCenterId + " acc. to zone config");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
boolean secStorageVmFromStoppedPool = false;
|
||||
SecondaryStorageVmVO secStorageVm = assignSecStorageVmFromStoppedPool(dataCenterId, role);
|
||||
|
|
|
|||
Loading…
Reference in New Issue