DaanHoogland closed pull request #3028: Adding zone disablement during deletion
of the range plus one more tr…
URL: https://github.com/apache/cloudstack/pull/3028
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/test/integration/smoke/test_public_ip_range.py
b/test/integration/smoke/test_public_ip_range.py
index 92b35ad3fa4..40bc098c809 100644
--- a/test/integration/smoke/test_public_ip_range.py
+++ b/test/integration/smoke/test_public_ip_range.py
@@ -297,6 +297,12 @@ def base_system_vm(self, services, systemvmtype):
"Check whether System VM Public IP is in range dedicated to system
vms"
)
+ # Disable Zone to be sure System VMs will not get recreated between
calls
+ cmd = updateZone.updateZoneCmd()
+ cmd.id = self.zone.id
+ cmd.allocationstate = 'Disabled'
+ self.apiclient.updateZone(cmd)
+
# Delete System VM and IP range, so System VM can get IP from original
ranges
self.debug("Destroying System VM: %s" % systemvm_id)
cmd = destroySystemVm.destroySystemVmCmd()
@@ -306,6 +312,12 @@ def base_system_vm(self, services, systemvmtype):
domain_id = public_ip_range.vlan.domainid
public_ip_range.delete(self.apiclient)
+ # Enable Zone
+ cmd = updateZone.updateZoneCmd()
+ cmd.id = self.zone.id
+ cmd.allocationstate = 'Enabled'
+ self.apiclient.updateZone(cmd)
+
# Wait for System VM to start and check System VM public IP
systemvm_id = self.wait_for_system_vm_start(
domain_id,
@@ -353,10 +365,14 @@ def
test_dedicate_public_ip_range_for_system_vms_01_ssvm(self):
"vlan":self.services["vlan"]
}
- self.base_system_vm(
- services,
- 'secondarystoragevm'
- )
+ try:
+ self.base_system_vm(
+ services,
+ 'secondarystoragevm'
+ )
+ except Exception:
+ self.delete_range()
+
return
@attr(tags = ["advanced", "publiciprange", "dedicate", "release"],
required_hardware="false")
@@ -377,8 +393,45 @@ def
test_dedicate_public_ip_range_for_system_vms_02_cpvm(self):
"vlan":self.services["vlan"]
}
- self.base_system_vm(
- services,
- 'consoleproxy'
- )
+ try:
+ self.base_system_vm(
+ services,
+ 'consoleproxy'
+ )
+ except Exception:
+ self.delete_range()
+
return
+
+ def delete_range(self):
+
+ # List System VMs
+ system_vms = list_ssvms(
+ self.apiclient,
+ )
+
+ # Disable Zone to be sure System VMs will not get recreated between
calls
+ cmd = updateZone.updateZoneCmd()
+ cmd.id = self.zone.id
+ cmd.allocationstate = 'Disabled'
+ self.apiclient.updateZone(cmd)
+
+ # Delete System VM and IP range, so System VM can get IP from original
ranges
+ for v in system_vms:
+ self.debug("Destroying System VM: %s" % v.id)
+ cmd = destroySystemVm.destroySystemVmCmd()
+ cmd.id = v.id
+ self.apiclient.destroySystemVm(cmd)
+
+ public_ip_range = PublicIpRange.list(
+ self.apiclient,
+ forsystemvms=True
+ )
+
+ public_ip_range.delete(self.apiclient)
+
+ # Enable Zone
+ cmd = updateZone.updateZoneCmd()
+ cmd.id = self.zone.id
+ cmd.allocationstate = 'Enabled'
+ self.apiclient.updateZone(cmd)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services