cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kelv...@apache.org
Subject [17/33] git commit: updated refs/heads/master to 90262a8
Date Fri, 28 Feb 2014 23:37:37 GMT
do not shutdown alien VMs upon host startup. Send StopCommand for out-of-band stopped VM to
restore legacy XS/KVM behave


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/18b5fb5a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/18b5fb5a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/18b5fb5a

Branch: refs/heads/master
Commit: 18b5fb5a3c6d4dc2d4b132964bc242fe267ec664
Parents: e051490
Author: Kelven Yang <kelveny@gmail.com>
Authored: Mon Feb 3 17:01:20 2014 -0800
Committer: Kelven Yang <kelveny@gmail.com>
Committed: Fri Feb 28 15:35:58 2014 -0800

----------------------------------------------------------------------
 .../src/com/cloud/vm/VirtualMachineManagerImpl.java      |  4 +++-
 .../hypervisor/xen/resource/CitrixResourceBase.java      | 11 ++++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/18b5fb5a/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 84c56ae..e7e49b8 100755
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -4132,7 +4132,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
 
             s_logger.info("VM " + vm.getInstanceName() + " is sync-ed to at Stopped state
according to power-off report from hypervisor");
 
-            // TODO: we need to forcely release all resource allocation
+            VirtualMachineGuru vmGuru = getVmGuru(vm);
+            VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);
+            sendStop(vmGuru, profile, true);
             break;
 
         case Destroyed:

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/18b5fb5a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index 12ba7c9..33e7462 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -347,6 +347,15 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
         return _host;
     }
 
+    private static boolean isAlienVm(VM vm, Connection conn) throws XenAPIException, XmlRpcException
{
+        // TODO : we need a better way to tell whether or not the VM belongs to CloudStack
+        String vmName = vm.getNameLabel(conn);
+        if (vmName.matches("^[ivs]-\\d+-.+"))
+            return false;
+
+        return true;
+    }
+
     protected boolean cleanupHaltedVms(Connection conn) throws XenAPIException, XmlRpcException
{
         Host host = Host.getByUuid(conn, _host.uuid);
         Map<VM, VM.Record> vms = VM.getAllRecords(conn);
@@ -358,7 +367,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
                 continue;
             }
 
-            if (VmPowerState.HALTED.equals(vmRec.powerState) && vmRec.affinity.equals(host))
{
+            if (VmPowerState.HALTED.equals(vmRec.powerState) && vmRec.affinity.equals(host)
&& !isAlienVm(vm, conn)) {
                 try {
                     vm.destroy(conn);
                 } catch (Exception e) {


Mime
View raw message