Smoke tests: Xenserver - Fix consistent failure noticed on scale VM test (#10741)

* Smoke tests: Xenserver - Fix consistent failure noticed on scale VM test

* update test
This commit is contained in:
Pearl Dsilva 2025-04-25 14:19:04 +05:30 committed by GitHub
parent 603cd84b49
commit 1adfaf90ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -48,7 +48,7 @@ class TestScaleVm(cloudstackTestCase):
cls.apiclient = testClient.getApiClient() cls.apiclient = testClient.getApiClient()
cls.services = testClient.getParsedTestDataConfig() cls.services = testClient.getParsedTestDataConfig()
cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][ cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][
0].__dict__ 0].__dict__
cls._cleanup = [] cls._cleanup = []
cls.unsupportedHypervisor = False cls.unsupportedHypervisor = False
cls.hypervisor = cls.testClient.getHypervisorInfo() cls.hypervisor = cls.testClient.getHypervisorInfo()
@ -115,10 +115,10 @@ class TestScaleVm(cloudstackTestCase):
cls._cleanup.append(cls.big_offering) cls._cleanup.append(cls.big_offering)
Configurations.update( Configurations.update(
cls.apiclient, cls.apiclient,
name="enable.dynamic.scale.vm", name="enable.dynamic.scale.vm",
value="true" value="true"
) )
cls.small_offering_dynamic_scaling_disabled = ServiceOffering.create( cls.small_offering_dynamic_scaling_disabled = ServiceOffering.create(
cls.apiclient, cls.apiclient,
@ -228,11 +228,11 @@ class TestScaleVm(cloudstackTestCase):
if self.hypervisor.lower() != 'simulator': if self.hypervisor.lower() != 'simulator':
hostid = self.virtual_machine.hostid hostid = self.virtual_machine.hostid
host = Host.list( host = Host.list(
self.apiclient, self.apiclient,
zoneid=self.zone.id, zoneid=self.zone.id,
hostid=hostid, hostid=hostid,
type='Routing' type='Routing'
)[0] )[0]
try: try:
username = self.hostConfig["username"] username = self.hostConfig["username"]
@ -566,11 +566,11 @@ class TestScaleVm(cloudstackTestCase):
)[0] )[0]
hostid = list_vm_response.hostid hostid = list_vm_response.hostid
host = Host.list( host = Host.list(
self.apiclient, self.apiclient,
zoneid=self.zone.id, zoneid=self.zone.id,
hostid=hostid, hostid=hostid,
type='Routing' type='Routing'
)[0] )[0]
try: try:
username = self.hostConfig["username"] username = self.hostConfig["username"]
@ -664,11 +664,49 @@ class TestScaleVm(cloudstackTestCase):
# update setting allow.diskOffering.change.during.scale.vm to true # update setting allow.diskOffering.change.during.scale.vm to true
# scale up the VM to serviceoffering3 # scale up the VM to serviceoffering3
# Check disk offering of root volume to be diskoffering3 since setting allow.diskOffering.change.during.scale.vm is true # Check disk offering of root volume to be diskoffering3 since setting allow.diskOffering.change.during.scale.vm is true
template = self.template
if self.hypervisor.lower() in ['xenserver']:
test_template = get_test_template(self.apiclient, self.zone.id, self.hypervisor)
self.services["template_2"]["url"] = test_template["url"]
self.services["template_2"]["hypervisor"] = test_template["hypervisor"]
self.services["template_2"]["format"] = test_template["format"]
self.services["template_2"]["ostype"] = "CentOS 5.6 (64-bit)"
try:
template = Template.register(self.apiclient,
self.services["template_2"],
zoneid=self.zone.id,
account=self.account.name,
domainid=self.account.domainid,
hypervisor=self.hypervisor
)
template.download(self.apiclient)
except Exception as e:
self.fail("Failed to register template: %s" % e)
time.sleep(120)
template = Template.update(
template,
self.apiclient,
isdynamicallyscalable='true'
)
templates = Template.list(self.apiclient,
templatefilter= \
self.services["template_2"]["templatefilter"],
id=template.id,
)
template = templates[0]
disk_offering = self.services["disk_offering"]
disk_offering["name"] = "Disk Offering 1"
self.disk_offering1 = DiskOffering.create( self.disk_offering1 = DiskOffering.create(
self.apiclient, self.apiclient,
self.services["disk_offering"], disk_offering,
) )
self._cleanup.append(self.disk_offering1) self._cleanup.append(self.disk_offering1)
offering_data = { offering_data = {
'displaytext': 'ServiceOffering1WithDiskOffering1', 'displaytext': 'ServiceOffering1WithDiskOffering1',
@ -689,6 +727,7 @@ class TestScaleVm(cloudstackTestCase):
self.virtual_machine_test = VirtualMachine.create( self.virtual_machine_test = VirtualMachine.create(
self.apiclient, self.apiclient,
self.services["small"], self.services["small"],
templateid=template.id,
accountid=self.account.name, accountid=self.account.name,
domainid=self.account.domainid, domainid=self.account.domainid,
serviceofferingid=self.ServiceOffering1WithDiskOffering1.id, serviceofferingid=self.ServiceOffering1WithDiskOffering1.id,
@ -707,11 +746,11 @@ class TestScaleVm(cloudstackTestCase):
if self.hypervisor.lower() != 'simulator': if self.hypervisor.lower() != 'simulator':
hostid = self.virtual_machine_test.hostid hostid = self.virtual_machine_test.hostid
host = Host.list( host = Host.list(
self.apiclient, self.apiclient,
zoneid=self.zone.id, zoneid=self.zone.id,
hostid=hostid, hostid=hostid,
type='Routing' type='Routing'
)[0] )[0]
try: try:
username = self.hostConfig["username"] username = self.hostConfig["username"]
@ -728,10 +767,12 @@ class TestScaleVm(cloudstackTestCase):
self.apiclient, self.apiclient,
isdynamicallyscalable='true') isdynamicallyscalable='true')
disk_offering2 = self.services["disk_offering"]
disk_offering2["name"] = "Disk Offering 2"
self.disk_offering2 = DiskOffering.create( self.disk_offering2 = DiskOffering.create(
self.apiclient, self.apiclient,
self.services["disk_offering"], disk_offering2
) )
self._cleanup.append(self.disk_offering2) self._cleanup.append(self.disk_offering2)
offering_data = { offering_data = {
'displaytext': 'ServiceOffering2WithDiskOffering2', 'displaytext': 'ServiceOffering2WithDiskOffering2',
@ -809,6 +850,7 @@ class TestScaleVm(cloudstackTestCase):
self.debug("Simulator doesn't support changing disk offering, volume resize") self.debug("Simulator doesn't support changing disk offering, volume resize")
return return
disk_offering_data = self.services["disk_offering"] disk_offering_data = self.services["disk_offering"]
disk_offering_data["name"] = "Disk Offering 3"
if self.hypervisor.lower() in ['xenserver']: if self.hypervisor.lower() in ['xenserver']:
self.debug("For hypervisor %s, do not resize volume and just change try to change the disk offering") self.debug("For hypervisor %s, do not resize volume and just change try to change the disk offering")
volume_response = Volume.list( volume_response = Volume.list(
@ -818,9 +860,9 @@ class TestScaleVm(cloudstackTestCase):
)[0] )[0]
disk_offering_data["disksize"] = int(volume_response.size / (1024 ** 3)) disk_offering_data["disksize"] = int(volume_response.size / (1024 ** 3))
self.disk_offering3 = DiskOffering.create( self.disk_offering3 = DiskOffering.create(
self.apiclient, self.apiclient,
disk_offering_data, disk_offering_data,
) )
self._cleanup.append(self.disk_offering3) self._cleanup.append(self.disk_offering3)
offering_data = { offering_data = {
'displaytext': 'ServiceOffering3WithDiskOffering3', 'displaytext': 'ServiceOffering3WithDiskOffering3',
@ -846,6 +888,8 @@ class TestScaleVm(cloudstackTestCase):
value="true" value="true"
) )
time.sleep(30)
self.debug("Scaling VM-ID: %s to service offering: %s and state %s" % ( self.debug("Scaling VM-ID: %s to service offering: %s and state %s" % (
self.virtual_machine_test.id, self.virtual_machine_test.id,
self.ServiceOffering3WithDiskOffering3.id, self.ServiceOffering3WithDiskOffering3.id,