CLOUDSTACK-5763: if vm is stopped, then don't check hypervisor support live storage migration capabilities.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/550834e4 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/550834e4 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/550834e4 Branch: refs/heads/master Commit: 550834e4b9bd86c735316db61f38716fca083efe Parents: 5bfef62 Author: edison <[email protected]> Authored: Wed Jan 8 15:25:26 2014 -0800 Committer: Anthony Xu <[email protected]> Committed: Fri Mar 28 16:23:09 2014 -0700 ---------------------------------------------------------------------- server/src/com/cloud/storage/VolumeApiServiceImpl.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/550834e4/server/src/com/cloud/storage/VolumeApiServiceImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/com/cloud/storage/VolumeApiServiceImpl.java index 5ffa99b..f0b7497 100644 --- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java +++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java @@ -1535,12 +1535,11 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic liveMigrateVolume = capabilities.isStorageMotionSupported(); } } - } - // If the disk is not attached to any VM then it can be moved. Otherwise, it needs to be attached to a vm - // running on a hypervisor that supports storage motion so that it be be migrated. - if (instanceId != null && !liveMigrateVolume) { - throw new InvalidParameterValueException("Volume needs to be detached from VM"); + // If vm is running, and hypervisor doesn't support live migration, then return error + if (!liveMigrateVolume) { + throw new InvalidParameterValueException("Volume needs to be detached from VM"); + } } if (liveMigrateVolume && !cmd.isLiveMigrate()) {
