mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
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 <dirk.klahre@itelligence.de> Co-authored-by: mib1185 <mail@mib85.de>
This commit is contained in:
parent
eff2da2518
commit
c23cbdff8d
@ -1159,10 +1159,6 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
|
|||||||
UserVmVO userVm = _userVmDao.findById(volume.getInstanceId());
|
UserVmVO userVm = _userVmDao.findById(volume.getInstanceId());
|
||||||
|
|
||||||
if (userVm != null) {
|
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
|
// serialize VM operation
|
||||||
AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext();
|
AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext();
|
||||||
|
|
||||||
|
|||||||
@ -228,16 +228,14 @@ class TestResizeVolume(cloudstackTestCase):
|
|||||||
listall='True'
|
listall='True'
|
||||||
)
|
)
|
||||||
rootvolume = list_volume_response[0]
|
rootvolume = list_volume_response[0]
|
||||||
if vm.state == "Running" and \
|
if vm.state == "Running" and vm.hypervisor.lower() == "xenserver":
|
||||||
(vm.hypervisor.lower() == "xenserver" or \
|
|
||||||
vm.hypervisor.lower() == "vmware"):
|
|
||||||
self.virtual_machine.stop(apiclient)
|
self.virtual_machine.stop(apiclient)
|
||||||
time.sleep(self.services["sleep"])
|
time.sleep(self.services["sleep"])
|
||||||
if vm.hypervisor.lower() == "vmware":
|
if vm.hypervisor.lower() == "vmware":
|
||||||
rootdiskcontroller = self.getDiskController(vm)
|
rootdiskcontroller = self.getDiskController(vm)
|
||||||
if rootdiskcontroller!="scsi":
|
if rootdiskcontroller!="scsi":
|
||||||
raise Exception("root volume resize only supported on scsi disk ,"
|
raise Exception("root volume resize only supported on scsi disk ,"
|
||||||
"please check rootdiskcontroller type")
|
"please check rootdiskcontroller type")
|
||||||
|
|
||||||
rootvolobj = Volume(rootvolume.__dict__)
|
rootvolobj = Volume(rootvolume.__dict__)
|
||||||
newsize = (rootvolume.size >> 30) + 2
|
newsize = (rootvolume.size >> 30) + 2
|
||||||
@ -245,8 +243,7 @@ class TestResizeVolume(cloudstackTestCase):
|
|||||||
if rootvolume is not None:
|
if rootvolume is not None:
|
||||||
try:
|
try:
|
||||||
rootvolobj.resize(apiclient, size=newsize)
|
rootvolobj.resize(apiclient, size=newsize)
|
||||||
if vm.hypervisor.lower() == "xenserver" or \
|
if vm.hypervisor.lower() == "xenserver":
|
||||||
vm.hypervisor.lower() == "vmware":
|
|
||||||
self.virtual_machine.start(apiclient)
|
self.virtual_machine.start(apiclient)
|
||||||
time.sleep(self.services["sleep"])
|
time.sleep(self.services["sleep"])
|
||||||
ssh = SshClient(self.virtual_machine.ssh_ip, 22,
|
ssh = SshClient(self.virtual_machine.ssh_ip, 22,
|
||||||
@ -916,9 +913,7 @@ class TestResizeVolume(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
res = validateList(list_volume_response)
|
res = validateList(list_volume_response)
|
||||||
self.assertNotEqual(res[2], INVALID_INPUT, "listVolumes returned invalid object in response")
|
self.assertNotEqual(res[2], INVALID_INPUT, "listVolumes returned invalid object in response")
|
||||||
if vm.state == "Running" and (
|
if vm.state == "Running" and vm.hypervisor.lower() == "xenserver":
|
||||||
vm.hypervisor.lower() == "xenserver" or
|
|
||||||
vm.hypervisor.lower() == "vmware"):
|
|
||||||
self.virtual_machine.stop(self.apiclient)
|
self.virtual_machine.stop(self.apiclient)
|
||||||
time.sleep(self.services["sleep"])
|
time.sleep(self.services["sleep"])
|
||||||
|
|
||||||
@ -998,9 +993,7 @@ class TestResizeVolume(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
res = validateList(list_volume_response)
|
res = validateList(list_volume_response)
|
||||||
self.assertNotEqual(res[2], INVALID_INPUT, "listVolumes returned invalid object in response")
|
self.assertNotEqual(res[2], INVALID_INPUT, "listVolumes returned invalid object in response")
|
||||||
if vm.state == "Running" and (
|
if vm.state == "Running" and vm.hypervisor.lower() == "xenserver":
|
||||||
vm.hypervisor.lower() == "xenserver" or
|
|
||||||
vm.hypervisor.lower() == "vmware"):
|
|
||||||
self.virtual_machine.stop(self.apiclient)
|
self.virtual_machine.stop(self.apiclient)
|
||||||
time.sleep(self.services["sleep"])
|
time.sleep(self.services["sleep"])
|
||||||
rootvolume = list_volume_response[0]
|
rootvolume = list_volume_response[0]
|
||||||
@ -1115,9 +1108,7 @@ class TestResizeVolume(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
res = validateList(list_volume_response)
|
res = validateList(list_volume_response)
|
||||||
self.assertNotEqual(res[2], INVALID_INPUT, "listVolumes returned invalid object in response")
|
self.assertNotEqual(res[2], INVALID_INPUT, "listVolumes returned invalid object in response")
|
||||||
if vm.state == "Running" and \
|
if vm.state == "Running" and vm.hypervisor.lower() == "xenserver":
|
||||||
(vm.hypervisor.lower() == "xenserver" or
|
|
||||||
vm.hypervisor.lower() == "vmware"):
|
|
||||||
self.virtual_machine.stop(self.apiclient)
|
self.virtual_machine.stop(self.apiclient)
|
||||||
time.sleep(self.services["sleep"])
|
time.sleep(self.services["sleep"])
|
||||||
rootvolume = list_volume_response[0]
|
rootvolume = list_volume_response[0]
|
||||||
|
|||||||
@ -627,8 +627,8 @@ class TestVolumes(cloudstackTestCase):
|
|||||||
|
|
||||||
if hosts[0].hypervisor == "XenServer":
|
if hosts[0].hypervisor == "XenServer":
|
||||||
self.virtual_machine.stop(self.apiClient)
|
self.virtual_machine.stop(self.apiClient)
|
||||||
elif hosts[0].hypervisor.lower() in ("vmware", "hyperv"):
|
elif hosts[0].hypervisor.lower() == "hyperv":
|
||||||
self.skipTest("Resize Volume is unsupported on VmWare and Hyper-V")
|
self.skipTest("Resize Volume is unsupported on Hyper-V")
|
||||||
|
|
||||||
# Attempting to resize it should throw an exception, as we're using a non
|
# Attempting to resize it should throw an exception, as we're using a non
|
||||||
# customisable disk offering, therefore our size parameter should be ignored
|
# customisable disk offering, therefore our size parameter should be ignored
|
||||||
@ -659,8 +659,8 @@ class TestVolumes(cloudstackTestCase):
|
|||||||
|
|
||||||
if hosts[0].hypervisor == "XenServer":
|
if hosts[0].hypervisor == "XenServer":
|
||||||
self.virtual_machine.stop(self.apiClient)
|
self.virtual_machine.stop(self.apiClient)
|
||||||
elif hosts[0].hypervisor.lower() in ("vmware", "hyperv"):
|
elif hosts[0].hypervisor.lower() == "hyperv":
|
||||||
self.skipTest("Resize Volume is unsupported on VmWare and Hyper-V")
|
self.skipTest("Resize Volume is unsupported on Hyper-V")
|
||||||
|
|
||||||
# resize the data disk
|
# resize the data disk
|
||||||
self.debug("Resize Volume ID: %s" % self.volume.id)
|
self.debug("Resize Volume ID: %s" % self.volume.id)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user