You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by nv...@apache.org on 2021/07/22 01:34:18 UTC
[cloudstack] branch main updated: Remove condition that are prevent
resizing for root volumes (vmware) (#5186)
This is an automated email from the ASF dual-hosted git repository.
nvazquez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/main by this push:
new c23cbdf Remove condition that are prevent resizing for root volumes (vmware) (#5186)
c23cbdf is described below
commit c23cbdff8d066b8c7a8570ba88a05d3cf4afe398
Author: DK101010 <57...@users.noreply.github.com>
AuthorDate: Thu Jul 22 03:33:51 2021 +0200
Remove condition that are prevent resizing for root volumes (vmware) (#5186)
* remove condition that are prevent resizing for root volumes
* adjust tests acordingly
* enable disk resize tests for VMware
Co-authored-by: DK101010 <di...@itelligence.de>
Co-authored-by: mib1185 <ma...@mib85.de>
---
.../com/cloud/storage/VolumeApiServiceImpl.java | 4 ---
.../component/test_rootvolume_resize.py | 29 ++++++++--------------
test/integration/smoke/test_volumes.py | 8 +++---
3 files changed, 14 insertions(+), 27 deletions(-)
diff --git a/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
index 8d67950..3c6460b 100644
--- a/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
@@ -1159,10 +1159,6 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
UserVmVO userVm = _userVmDao.findById(volume.getInstanceId());
if (userVm != null) {
- if (volume.getVolumeType().equals(Volume.Type.ROOT) && userVm.getPowerState() != VirtualMachine.PowerState.PowerOff && hypervisorType == HypervisorType.VMware) {
- s_logger.error(" For ROOT volume resize VM should be in Power Off state.");
- throw new InvalidParameterValueException("VM current state is : " + userVm.getPowerState() + ". But VM should be in " + VirtualMachine.PowerState.PowerOff + " state.");
- }
// serialize VM operation
AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext();
diff --git a/test/integration/component/test_rootvolume_resize.py b/test/integration/component/test_rootvolume_resize.py
index f5bd47d..06b8278 100644
--- a/test/integration/component/test_rootvolume_resize.py
+++ b/test/integration/component/test_rootvolume_resize.py
@@ -228,16 +228,14 @@ class TestResizeVolume(cloudstackTestCase):
listall='True'
)
rootvolume = list_volume_response[0]
- if vm.state == "Running" and \
- (vm.hypervisor.lower() == "xenserver" or \
- vm.hypervisor.lower() == "vmware"):
+ if vm.state == "Running" and vm.hypervisor.lower() == "xenserver":
self.virtual_machine.stop(apiclient)
time.sleep(self.services["sleep"])
- if vm.hypervisor.lower() == "vmware":
- rootdiskcontroller = self.getDiskController(vm)
- if rootdiskcontroller!="scsi":
- raise Exception("root volume resize only supported on scsi disk ,"
- "please check rootdiskcontroller type")
+ if vm.hypervisor.lower() == "vmware":
+ rootdiskcontroller = self.getDiskController(vm)
+ if rootdiskcontroller!="scsi":
+ raise Exception("root volume resize only supported on scsi disk ,"
+ "please check rootdiskcontroller type")
rootvolobj = Volume(rootvolume.__dict__)
newsize = (rootvolume.size >> 30) + 2
@@ -245,8 +243,7 @@ class TestResizeVolume(cloudstackTestCase):
if rootvolume is not None:
try:
rootvolobj.resize(apiclient, size=newsize)
- if vm.hypervisor.lower() == "xenserver" or \
- vm.hypervisor.lower() == "vmware":
+ if vm.hypervisor.lower() == "xenserver":
self.virtual_machine.start(apiclient)
time.sleep(self.services["sleep"])
ssh = SshClient(self.virtual_machine.ssh_ip, 22,
@@ -916,9 +913,7 @@ class TestResizeVolume(cloudstackTestCase):
)
res = validateList(list_volume_response)
self.assertNotEqual(res[2], INVALID_INPUT, "listVolumes returned invalid object in response")
- if vm.state == "Running" and (
- vm.hypervisor.lower() == "xenserver" or
- vm.hypervisor.lower() == "vmware"):
+ if vm.state == "Running" and vm.hypervisor.lower() == "xenserver":
self.virtual_machine.stop(self.apiclient)
time.sleep(self.services["sleep"])
@@ -998,9 +993,7 @@ class TestResizeVolume(cloudstackTestCase):
)
res = validateList(list_volume_response)
self.assertNotEqual(res[2], INVALID_INPUT, "listVolumes returned invalid object in response")
- if vm.state == "Running" and (
- vm.hypervisor.lower() == "xenserver" or
- vm.hypervisor.lower() == "vmware"):
+ if vm.state == "Running" and vm.hypervisor.lower() == "xenserver":
self.virtual_machine.stop(self.apiclient)
time.sleep(self.services["sleep"])
rootvolume = list_volume_response[0]
@@ -1115,9 +1108,7 @@ class TestResizeVolume(cloudstackTestCase):
)
res = validateList(list_volume_response)
self.assertNotEqual(res[2], INVALID_INPUT, "listVolumes returned invalid object in response")
- if vm.state == "Running" and \
- (vm.hypervisor.lower() == "xenserver" or
- vm.hypervisor.lower() == "vmware"):
+ if vm.state == "Running" and vm.hypervisor.lower() == "xenserver":
self.virtual_machine.stop(self.apiclient)
time.sleep(self.services["sleep"])
rootvolume = list_volume_response[0]
diff --git a/test/integration/smoke/test_volumes.py b/test/integration/smoke/test_volumes.py
index e1d419f..1308285 100644
--- a/test/integration/smoke/test_volumes.py
+++ b/test/integration/smoke/test_volumes.py
@@ -627,8 +627,8 @@ class TestVolumes(cloudstackTestCase):
if hosts[0].hypervisor == "XenServer":
self.virtual_machine.stop(self.apiClient)
- elif hosts[0].hypervisor.lower() in ("vmware", "hyperv"):
- self.skipTest("Resize Volume is unsupported on VmWare and Hyper-V")
+ elif hosts[0].hypervisor.lower() == "hyperv":
+ self.skipTest("Resize Volume is unsupported on Hyper-V")
# Attempting to resize it should throw an exception, as we're using a non
# customisable disk offering, therefore our size parameter should be ignored
@@ -659,8 +659,8 @@ class TestVolumes(cloudstackTestCase):
if hosts[0].hypervisor == "XenServer":
self.virtual_machine.stop(self.apiClient)
- elif hosts[0].hypervisor.lower() in ("vmware", "hyperv"):
- self.skipTest("Resize Volume is unsupported on VmWare and Hyper-V")
+ elif hosts[0].hypervisor.lower() == "hyperv":
+ self.skipTest("Resize Volume is unsupported on Hyper-V")
# resize the data disk
self.debug("Resize Volume ID: %s" % self.volume.id)