CLOUDSTACK-2900: Ubuntu 13.04 - Migrate Virtual Router fail - Unable to find the VM by id=
Changes: - Have to search the vm_instance table to find the instance Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/fb31a39e Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/fb31a39e Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/fb31a39e Branch: refs/heads/disk_io_throttling Commit: fb31a39efe7d93a67c7b8c141f434b938a491222 Parents: fea9a0e Author: Prachi Damle <pra...@cloud.com> Authored: Mon Jun 17 16:58:42 2013 -0700 Committer: Prachi Damle <pra...@cloud.com> Committed: Mon Jun 17 16:59:32 2013 -0700 ---------------------------------------------------------------------- server/src/com/cloud/vm/UserVmManagerImpl.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fb31a39e/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 44a7d06..e8ea024 100755 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -3804,7 +3804,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use "No permission to migrate VM, Only Root Admin can migrate a VM!"); } - UserVmVO vm = _vmDao.findById(vmId); + VMInstanceVO vm = _vmInstanceDao.findById(vmId); if (vm == null) { throw new InvalidParameterValueException( "Unable to find the VM by id=" + vmId); @@ -3895,7 +3895,10 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use + " already has max Running VMs(count includes system VMs), cannot migrate to this host"); } - collectVmDiskStatistics(vm); + UserVmVO uservm = _vmDao.findById(vmId); + if (uservm != null) { + collectVmDiskStatistics(uservm); + } VMInstanceVO migratedVm = _itMgr.migrate(vm, srcHostId, dest); return migratedVm; }