mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-7473: Vm migration is not supported for LXC. When host is put in maintenance mode, stop the Vms instead of migrating
This commit is contained in:
parent
abfb469f91
commit
6f7c4863a2
|
|
@ -1208,7 +1208,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
|
||||
|
||||
protected boolean getExecuteInSequence(HypervisorType hypervisorType) {
|
||||
if (HypervisorType.KVM == hypervisorType) {
|
||||
if (HypervisorType.KVM == hypervisorType || HypervisorType.LXC == hypervisorType) {
|
||||
return false;
|
||||
} else {
|
||||
return ExecuteInSequence.value();
|
||||
|
|
|
|||
|
|
@ -57,13 +57,13 @@ public class KVMInvestigator extends AdapterBase implements Investigator {
|
|||
|
||||
@Override
|
||||
public Status isAgentAlive(Host agent) {
|
||||
if (agent.getHypervisorType() != Hypervisor.HypervisorType.KVM) {
|
||||
if (agent.getHypervisorType() != Hypervisor.HypervisorType.KVM && agent.getHypervisorType() != Hypervisor.HypervisorType.LXC) {
|
||||
return null;
|
||||
}
|
||||
CheckOnHostCommand cmd = new CheckOnHostCommand(agent);
|
||||
List<HostVO> neighbors = _resourceMgr.listHostsInClusterByStatus(agent.getClusterId(), Status.Up);
|
||||
for (HostVO neighbor : neighbors) {
|
||||
if (neighbor.getId() == agent.getId() || neighbor.getHypervisorType() != Hypervisor.HypervisorType.KVM) {
|
||||
if (neighbor.getId() == agent.getId() || (neighbor.getHypervisorType() != Hypervisor.HypervisorType.KVM && neighbor.getHypervisorType() != Hypervisor.HypervisorType.LXC)) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ public class KVMFencer extends AdapterBase implements FenceBuilder {
|
|||
|
||||
@Override
|
||||
public Boolean fenceOff(VirtualMachine vm, Host host) {
|
||||
if (host.getHypervisorType() != HypervisorType.KVM) {
|
||||
if (host.getHypervisorType() != HypervisorType.KVM && host.getHypervisorType() != HypervisorType.LXC) {
|
||||
s_logger.debug("Don't know how to fence non kvm hosts " + host.getHypervisorType());
|
||||
return null;
|
||||
}
|
||||
|
|
@ -83,7 +83,7 @@ public class KVMFencer extends AdapterBase implements FenceBuilder {
|
|||
FenceCommand fence = new FenceCommand(vm, host);
|
||||
|
||||
for (HostVO h : hosts) {
|
||||
if (h.getHypervisorType() == HypervisorType.KVM) {
|
||||
if (h.getHypervisorType() == HypervisorType.KVM || h.getHypervisorType() == HypervisorType.LXC) {
|
||||
if (h.getStatus() != Status.Up) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1195,6 +1195,9 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
|
|||
if (hosts == null || hosts.isEmpty() || !answer.getMigrate()) {
|
||||
// for the last host in this cluster, stop all the VMs
|
||||
_haMgr.scheduleStop(vm, hostId, WorkType.ForceStop);
|
||||
} else if (HypervisorType.LXC.equals(host.getHypervisorType())){
|
||||
//Stop LXC Vms. LXC doesn't support migration
|
||||
_haMgr.scheduleStop(vm, hostId, WorkType.Stop);
|
||||
} else {
|
||||
_haMgr.scheduleMigration(vm);
|
||||
}
|
||||
|
|
@ -2092,7 +2095,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
|
|||
_agentMgr.pullAgentOutMaintenance(hostId);
|
||||
|
||||
// for kvm, need to log into kvm host, restart cloudstack-agent
|
||||
if (host.getHypervisorType() == HypervisorType.KVM) {
|
||||
if (host.getHypervisorType() == HypervisorType.KVM || host.getHypervisorType() == HypervisorType.LXC) {
|
||||
|
||||
boolean sshToAgent = Boolean.parseBoolean(_configDao.getValue(Config.KvmSshToAgentEnabled.key()));
|
||||
if (!sshToAgent) {
|
||||
|
|
@ -2166,7 +2169,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
|
|||
return true;
|
||||
}
|
||||
|
||||
if (host.getHypervisorType() == HypervisorType.KVM) {
|
||||
if (host.getHypervisorType() == HypervisorType.KVM || host.getHypervisorType() == HypervisorType.LXC) {
|
||||
MaintainAnswer answer = (MaintainAnswer)_agentMgr.easySend(hostId, new MaintainCommand());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -641,7 +641,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
|
|||
} else {
|
||||
throw new InvalidParameterValueException("Missing parameter hypervisor. Hypervisor type is required to create zone wide primary storage.");
|
||||
}
|
||||
if (hypervisorType != HypervisorType.KVM && hypervisorType != HypervisorType.VMware && hypervisorType != HypervisorType.Hyperv && hypervisorType != HypervisorType.Any) {
|
||||
if (hypervisorType != HypervisorType.KVM && hypervisorType != HypervisorType.VMware && hypervisorType != HypervisorType.Hyperv && hypervisorType != HypervisorType.LXC && hypervisorType != HypervisorType.Any) {
|
||||
throw new InvalidParameterValueException("zone wide storage pool is not supported for hypervisor type " + hypervisor);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue