Updated Branches: refs/heads/resizevolume 7149d737e -> 17da266c4
Summary: allow resizing of data disk for xen when disk is detached Detail: Disk should be resizable if detached from a user vm. If associated uservm is null, allow resize Signed-off-by: Marcus Sorensen <[email protected]> 1357671066 -0700 Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/17da266c Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/17da266c Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/17da266c Branch: refs/heads/resizevolume Commit: 17da266c4820fa1c206eef1ff47cdf49e08310ae Parents: 7149d73 Author: Marcus Sorensen <[email protected]> Authored: Tue Jan 8 11:51:06 2013 -0700 Committer: Marcus Sorensen <[email protected]> Committed: Tue Jan 8 11:51:06 2013 -0700 ---------------------------------------------------------------------- .../src/com/cloud/storage/StorageManagerImpl.java | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/17da266c/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 aed827f..a6cd85b 100755 --- a/server/src/com/cloud/storage/StorageManagerImpl.java +++ b/server/src/com/cloud/storage/StorageManagerImpl.java @@ -2208,12 +2208,6 @@ public class StorageManagerImpl implements StorageManager, Manager, ClusterManag StoragePool pool = _storagePoolDao.findById(volume.getPoolId()); long currentSize = volume.getSize(); - /*Xen only works offline, SR does not support VDI.resizeOnline*/ - if(_volsDao.getHypervisorType(volume.getId()) == HypervisorType.XenServer - && ! userVm.getState().equals(State.Stopped)) { - throw new InvalidParameterValueException("VM must be stopped in order to resize with the Xen HV"); - } - /* lets make certain they (think they) know what they're doing if they want to shrink, by forcing them to provide the shrinkok parameter. This will be checked again at the hypervisor level where we can see the actual disk size */ @@ -2235,6 +2229,12 @@ public class StorageManagerImpl implements StorageManager, Manager, ClusterManag } else if(userVm.getLastHostId() != null) { hosts = new long[] { userVm.getLastHostId() }; } + + /*Xen only works offline, SR does not support VDI.resizeOnline*/ + if(_volsDao.getHypervisorType(volume.getId()) == HypervisorType.XenServer + && ! userVm.getState().equals(State.Stopped)) { + throw new InvalidParameterValueException("VM must be stopped in order to resize with the Xen HV"); + } } try {
