cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From weiz...@apache.org
Subject [1/2] git commit: updated refs/heads/master to 1696e8c
Date Wed, 05 Jun 2013 12:29:18 GMT
Updated Branches:
  refs/heads/master 202da411f -> 1696e8cb1


CLOUDSTACK-2856: collectVmDiskStatistics before reboot/stop/migrate


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

Branch: refs/heads/master
Commit: 15265479f644f2745804af456eef9767a7297f01
Parents: f321acd
Author: Wei Zhou <w.zhou@leaseweb.com>
Authored: Wed Jun 5 14:28:43 2013 +0200
Committer: Wei Zhou <w.zhou@leaseweb.com>
Committed: Wed Jun 5 14:28:43 2013 +0200

----------------------------------------------------------------------
 server/src/com/cloud/vm/UserVmManagerImpl.java |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/15265479/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index 8cf05aa..d8a064f 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -755,6 +755,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Use
         }
 
         if (vm.getState() == State.Running && vm.getHostId() != null) {
+            collectVmDiskStatistics(vm);
             return _itMgr.reboot(vm, null, caller, owner);
         } else {
             s_logger.error("Vm id=" + vmId
@@ -3379,9 +3380,6 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Use
         boolean status;
         State vmState = vm.getState();
 
-        // Collect vm disk statistics from host before stopping Vm
-         collectVmDiskStatistics(vm);
-
         try {
             VirtualMachineEntity vmEntity = _orchSrvc.getVirtualMachine(vm.getUuid());
             status = vmEntity.destroy(new Long(userId).toString());
@@ -3830,7 +3828,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Use
                     "No permission to migrate VM, Only Root Admin can migrate a VM!");
         }
 
-        VMInstanceVO vm = _vmInstanceDao.findById(vmId);
+        UserVmVO vm = _vmDao.findById(vmId);
         if (vm == null) {
             throw new InvalidParameterValueException(
                     "Unable to find the VM by id=" + vmId);
@@ -3921,6 +3919,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Use
                             + " already has max Running VMs(count includes system VMs), cannot
migrate to this host");
         }
 
+        collectVmDiskStatistics(vm);
         VMInstanceVO migratedVm = _itMgr.migrate(vm, srcHostId, dest);
         return migratedVm;
     }
@@ -4710,6 +4709,9 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Use
 
     @Override
     public void prepareStop(VirtualMachineProfile<UserVmVO> profile) {
+        UserVmVO vm = profile.getVirtualMachine();
+        if (vm.getState() == State.Running)
+            collectVmDiskStatistics(vm);
     }
 
 }


Mime
View raw message