slavkap commented on code in PR #11748:
URL: https://github.com/apache/cloudstack/pull/11748#discussion_r2736306204
##########
test/integration/plugins/storpool/test_snapshot_copy_on_primary_storage.py:
##########
@@ -244,12 +246,101 @@ def
test_06_take_snapshot_multi_zone_create_template_additional_zone(self):
"""Test to take volume snapshot in multiple StorPool primary storages
in diff zones and create a volume in one of the additional zones
"""
snapshot = Snapshot.create(self.userapiclient,
volume_id=self.volume.id, zoneids=[str(self.additional_zone.id)],
usestoragereplication=True)
+ self._cleanup.append(snapshot)
self.snapshot_id = snapshot.id
self.helper.verify_snapshot_copies(self.userapiclient,
self.snapshot_id, [self.zone.id, self.additional_zone.id])
self.template =
self.helper.create_snapshot_template(self.userapiclient, self.services,
self.snapshot_id, self.additional_zone.id)
+ self.cleanup.append(self.template)
if self.additional_zone.id != self.template.zoneid:
self.fail("Template from snapshot not created in the additional
zone")
+ return
+
+ @skipTestIf("testsNotSupported")
+ @attr(tags=["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"],
required_hardware="false")
+ def test_07_take_snapshot_multi_zone_deply_vm_additional_zone(self):
+ """Test to take volume snapshot in multiple StorPool primary storages
in diff zones and deploy a VM from snapshot in one of the additional zones
+ """
+ snapshot = Snapshot.create(self.userapiclient,
volume_id=self.volume.id, zoneids=[str(self.additional_zone.id)],
usestoragereplication=True)
+ self._cleanup.append(snapshot)
+ self.snapshot_id = snapshot.id
+ self.helper.verify_snapshot_copies(self.userapiclient,
self.snapshot_id, [self.zone.id, self.additional_zone.id])
+ vm = self.deploy_vm_from_snapshot(snapshot, self.additional_zone.id)
+ if self.additional_zone.id != vm.zoneid:
+ self.fail("VM from snapshot not created in the additional zone")
+ return
+
+
+ @skipTestIf("testsNotSupported")
+ @attr(tags=["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"],
required_hardware="false")
+ def
test_08_take_snapshot_multi_zone_create_volume_additional_zone_deploy_vm(self):
+ """Test to take volume snapshot in multiple StorPool primary storages
in diff zones
+ create a volume from the snapshot in the additional zone
+ and deploy a VM from the volume in one of the additional zones
+ """
+ snapshot = Snapshot.create(self.userapiclient,
volume_id=self.volume.id, zoneids=[str(self.additional_zone.id)],
usestoragereplication=True)
+ self.cleanup.append(snapshot)
+ self.snapshot_id = snapshot.id
+ self.helper.verify_snapshot_copies(self.userapiclient,
self.snapshot_id, [self.zone.id, self.additional_zone.id])
+ vm =
self.create_volume_from_snapshot_deploy_vm(snapshotid=self.snapshot_id,
zoneid=self.additional_zone.id)
time.sleep(420)
- Snapshot.delete(snapshot, self.userapiclient)
- self.cleanup.append(self.template)
+ if self.additional_zone.id != vm.zoneid:
+ self.fail("VM from snapshot not created in the additional zone")
return
+
+ def create_volume_from_snapshot_deploy_vm(self, snapshotid, zoneid=None):
+ volume = Volume.create_from_snapshot(
+ self.apiclient,
+ snapshot_id=snapshotid,
+ services=self.services,
+ disk_offering=self.disk_offerings.id,
+ size=8,
+ account=self.account.name,
+ domainid=self.account.domainid,
+ zoneid=zoneid,
+ )
+ virtual_machine = VirtualMachine.create(self.apiclient,
+ {"name": "Test-%s" %
uuid.uuid4()},
+ accountid=self.account.name,
+ domainid=self.account.domainid,
+ zoneid=zoneid,
+
serviceofferingid=self.service_offering.id,
+ volumeid=volume.id,
+ mode="basic",
+ )
Review Comment:
the volume is attached to the VM as a ROOT which will be deleted when the VM
is destroyed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]