Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import org.apache.cloudstack.agent.lb.IndirectAgentLB;
import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
import org.apache.cloudstack.framework.config.ConfigKey;
import org.apache.cloudstack.framework.config.Configurable;
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.framework.security.keys.KeysManager;
import org.apache.cloudstack.framework.security.keystore.KeystoreDao;
Expand Down Expand Up @@ -153,7 +155,7 @@
// Starting, HA, Migrating, Running state are all counted as "Open" for available capacity calculation
// because sooner or later, it will be driven into Running state
//
public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxyManager, VirtualMachineGuru, SystemVmLoadScanHandler<Long>, ResourceStateAdapter {
public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxyManager, VirtualMachineGuru, SystemVmLoadScanHandler<Long>, ResourceStateAdapter, Configurable {
private static final Logger s_logger = Logger.getLogger(ConsoleProxyManagerImpl.class);

private static final int DEFAULT_CAPACITY_SCAN_INTERVAL = 30000; // 30 seconds
Expand Down Expand Up @@ -250,6 +252,19 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
@Inject
private KeystoreManager _ksMgr;

private static final ConfigKey<String> ConsoleProxyTemplateXenServer = new ConfigKey<String>("Console Proxy", String.class, "consoleproxy.template.xenserver",
"SystemVM Template (XenServer)", "Name of the console proxy template on Xenserver.", true);
private static final ConfigKey<String> ConsoleProxyTemplateKVM = new ConfigKey<String>("Console Proxy", String.class, "consoleproxy.template.kvm", "SystemVM Template (KVM)",
"Name of the console proxy template on KVM.", true);
private static final ConfigKey<String> ConsoleProxyTemplateVMware = new ConfigKey<String>("Console Proxy", String.class, "consoleproxy.template.vmware",
"SystemVM Template (vSphere)", "Name of the console proxy template on VMware.", true);
private static final ConfigKey<String> ConsoleProxyTemplateHyperV = new ConfigKey<String>("Console Proxy", String.class, "consoleproxy.template.hyperv",
"SystemVM Template (HyperV)", "Name of the console proxy template on Hyperv.", true);
private static final ConfigKey<String> ConsoleProxyTemplateLxc = new ConfigKey<String>("Console Proxy", String.class, "consoleproxy.template.lxc", "SystemVM Template (LXC)",
"Name of the console proxy template on LXC.", true);
private static final ConfigKey<String> ConsoleProxyTemplateOvm3 = new ConfigKey<String>("Console Proxy", String.class, "consoleproxy.template.ovm3", "SystemVM Template (Ovm3)",
"Name of the console proxy template on Ovm3.", true);

public class VmBasedAgentHook extends AgentHookBase {

public VmBasedAgentHook(VMInstanceDao instanceDao, HostDao hostDao, ConfigurationDao cfgDao, KeystoreManager ksMgr, AgentManager agentMgr, KeysManager keysMgr) {
Expand Down Expand Up @@ -642,9 +657,34 @@ public ConsoleProxyVO startNew(long dataCenterId) throws ConcurrentOperationExce

VMTemplateVO template = null;
HypervisorType availableHypervisor = _resourceMgr.getAvailableHypervisor(dataCenterId);
template = _templateDao.findSystemVMReadyTemplate(dataCenterId, availableHypervisor);

String templateName = null;
switch (availableHypervisor) {
case XenServer:
templateName = ConsoleProxyTemplateXenServer.value();
break;
case KVM:
templateName = ConsoleProxyTemplateKVM.value();
break;
case VMware:
templateName = ConsoleProxyTemplateVMware.value();
break;
case Hyperv:
templateName = ConsoleProxyTemplateHyperV.value();
break;
case LXC:
templateName = ConsoleProxyTemplateLxc.value();
break;
case Ovm3:
templateName = ConsoleProxyTemplateOvm3.value();
break;
default:
break;
}
template = _templateDao.findRoutingTemplate(availableHypervisor, templateName);

if (template == null) {
throw new CloudRuntimeException("Not able to find the System templates or not downloaded in zone " + dataCenterId);
throw new CloudRuntimeException("Not able to find the Console Proxy System template or not downloaded in zone " + dataCenterId);
}

Map<String, Object> context = createProxyInstance(dataCenterId, template);
Expand Down Expand Up @@ -1735,4 +1775,15 @@ public void setConsoleProxyAllocators(List<ConsoleProxyAllocator> consoleProxyAl
_consoleProxyAllocators = consoleProxyAllocators;
}

@Override
public String getConfigComponentName() {
return ConsoleProxyManagerImpl.class.getSimpleName();
}

@Override
public ConfigKey<?>[] getConfigKeys() {
return new ConfigKey<?>[] {ConsoleProxyTemplateXenServer, ConsoleProxyTemplateKVM, ConsoleProxyTemplateVMware, ConsoleProxyTemplateHyperV, ConsoleProxyTemplateLxc,
ConsoleProxyTemplateOvm3};
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,18 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar

private final GlobalLock _allocLock = GlobalLock.getInternLock(getAllocLockName());

private static final ConfigKey<String> SsvmTemplateXenServer = new ConfigKey<String>("Storage", String.class, "ssvm.template.xenserver", "SystemVM Template (XenServer)",
"Name of the SSVM template on Xenserver.", true);
private static final ConfigKey<String> SsvmTemplateKVM = new ConfigKey<String>("Storage", String.class, "ssvm.template.kvm", "SystemVM Template (KVM)",
"Name of the SSVM template on KVM.", true);
private static final ConfigKey<String> SsvmTemplateVMware = new ConfigKey<String>("Storage", String.class, "ssvm.template.vmware", "SystemVM Template (vSphere)",
"Name of the SSVM template on VMware.", true);
private static final ConfigKey<String> SsvmTemplateHyperV = new ConfigKey<String>("Storage", String.class, "ssvm.template.hyperv", "SystemVM Template (HyperV)",
"Name of the SSVM template on Hyperv.", true);
private static final ConfigKey<String> SsvmTemplateLxc = new ConfigKey<String>("Storage", String.class, "ssvm.template.lxc", "SystemVM Template (LXC)",
"Name of the SSVM template on LXC.", true);
private static final ConfigKey<String> SsvmTemplateOvm3 = new ConfigKey<String>("Storage", String.class, "ssvm.template.ovm3", "SystemVM Template (Ovm3)",
"Name of the SSVM template on Ovm3.", true);
static final ConfigKey<String> NTPServerConfig = new ConfigKey<String>(String.class, "ntp.server.list", "Advanced", null,
"Comma separated list of NTP servers to configure in Secondary storage VM", false, ConfigKey.Scope.Global, null);

Expand Down Expand Up @@ -642,9 +654,33 @@ protected Map<String, Object> createSecStorageVmInstance(long dataCenterId, Seco

VMTemplateVO template = null;
HypervisorType availableHypervisor = _resourceMgr.getAvailableHypervisor(dataCenterId);
template = _templateDao.findSystemVMReadyTemplate(dataCenterId, availableHypervisor);

String templateName = null;
switch (availableHypervisor) {
case XenServer:
templateName = SsvmTemplateXenServer.value();
break;
case KVM:
templateName = SsvmTemplateKVM.value();
break;
case VMware:
templateName = SsvmTemplateVMware.value();
break;
case Hyperv:
templateName = SsvmTemplateHyperV.value();
break;
case LXC:
templateName = SsvmTemplateLxc.value();
case Ovm3:
templateName = SsvmTemplateOvm3.value();
break;
default:
break;
}
template = _templateDao.findRoutingTemplate(availableHypervisor, templateName);

if (template == null) {
throw new CloudRuntimeException("Not able to find the System templates or not downloaded in zone " + dataCenterId);
throw new CloudRuntimeException("Not able to find the Secondary Storage System template or not downloaded in zone " + dataCenterId);
}

ServiceOfferingVO serviceOffering = _serviceOffering;
Expand Down Expand Up @@ -1510,7 +1546,7 @@ public String getConfigComponentName() {

@Override
public ConfigKey<?>[] getConfigKeys() {
return new ConfigKey<?>[] {NTPServerConfig};
return new ConfigKey<?>[] {NTPServerConfig, SsvmTemplateXenServer, SsvmTemplateKVM, SsvmTemplateVMware, SsvmTemplateHyperV, SsvmTemplateLxc, SsvmTemplateOvm3};
}

}