Repository: cloudstack Updated Branches: refs/heads/master abfb469f9 -> 6f7c4863a
CLOUDSTACK-7473: Vm migration is not supported for LXC. When host is put in maintenance mode, stop the Vms instead of migrating Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/6f7c4863 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6f7c4863 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6f7c4863 Branch: refs/heads/master Commit: 6f7c4863a2e40b05a3bd43f992bd114bae485462 Parents: abfb469 Author: Kishan Kavala <[email protected]> Authored: Thu Sep 4 20:59:04 2014 +0530 Committer: Kishan Kavala <[email protected]> Committed: Thu Sep 4 20:59:19 2014 +0530 ---------------------------------------------------------------------- .../src/com/cloud/vm/VirtualMachineManagerImpl.java | 2 +- plugins/hypervisors/kvm/src/com/cloud/ha/KVMInvestigator.java | 4 ++-- server/src/com/cloud/ha/KVMFencer.java | 4 ++-- server/src/com/cloud/resource/ResourceManagerImpl.java | 7 +++++-- server/src/com/cloud/storage/StorageManagerImpl.java | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f7c4863/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java ---------------------------------------------------------------------- diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java index 2943047..8edef77 100755 --- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -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(); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f7c4863/plugins/hypervisors/kvm/src/com/cloud/ha/KVMInvestigator.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/kvm/src/com/cloud/ha/KVMInvestigator.java b/plugins/hypervisors/kvm/src/com/cloud/ha/KVMInvestigator.java index 184053b..e750ced 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/ha/KVMInvestigator.java +++ b/plugins/hypervisors/kvm/src/com/cloud/ha/KVMInvestigator.java @@ -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 { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f7c4863/server/src/com/cloud/ha/KVMFencer.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/ha/KVMFencer.java b/server/src/com/cloud/ha/KVMFencer.java index 516a579..7392dff 100755 --- a/server/src/com/cloud/ha/KVMFencer.java +++ b/server/src/com/cloud/ha/KVMFencer.java @@ -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; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f7c4863/server/src/com/cloud/resource/ResourceManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java index 3405f99..242063e 100755 --- a/server/src/com/cloud/resource/ResourceManagerImpl.java +++ b/server/src/com/cloud/resource/ResourceManagerImpl.java @@ -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()); } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6f7c4863/server/src/com/cloud/storage/StorageManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java index c1e6be2..153c25a 100755 --- a/server/src/com/cloud/storage/StorageManagerImpl.java +++ b/server/src/com/cloud/storage/StorageManagerImpl.java @@ -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); } }
