From 17da266c4820fa1c206eef1ff47cdf49e08310ae Mon Sep 17 00:00:00 2001 From: Marcus Sorensen Date: Tue, 8 Jan 2013 11:51:06 -0700 Subject: [PATCH] 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 1357671066 -0700 --- server/src/com/cloud/storage/StorageManagerImpl.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java index aed827f9eb5..a6cd85bfdd7 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 {