DaanHoogland commented on code in PR #10503:
URL: https://github.com/apache/cloudstack/pull/10503#discussion_r2149200465


##########
test/integration/plugins/storpool/test_storpool_tiers.py:
##########
@@ -542,3 +597,45 @@ def changeOfferingForVolume(self, volume_id, 
disk_offering_id, size, shrinkok=No
         change_offering_for_volume_cmd.shrinkok = shrinkok
 
         return 
self.apiclient.changeOfferingForVolume(change_offering_for_volume_cmd)
+
+    def deploy_vm_from_snapshot_or_template(self, snapshotid, 
is_snapshot=False):
+        if is_snapshot:
+            virtual_machine = VirtualMachine.create(self.apiclient,
+                                                    {"name": "StorPool-%s" % 
uuid.uuid4()},
+                                                    zoneid=self.zone.id,
+                                                    
accountid=self.account.name,
+                                                    
domainid=self.account.domainid,
+                                                    
serviceofferingid=self.service_offering.id,
+                                                    snapshotid=snapshotid,
+                                                    )
+            try:
+                ssh_client = virtual_machine.get_ssh_client()
+            except Exception as e:
+                self.fail("SSH failed for virtual machine: %s - %s" %
+                          (virtual_machine.ipaddress, e))
+
+            return virtual_machine
+        volume = Volume.create_from_snapshot(
+            self.apiclient,
+            snapshot_id=snapshotid,
+            services=self.services,
+            account=self.account.name,
+            domainid=self.account.domainid,
+            disk_offering=self.disk_offerings_tier1_tags.id,
+            zoneid=self.zone.id,
+            size=10
+        )
+        virtual_machine = VirtualMachine.create(self.apiclient,
+                                                {"name": "StorPool-%s" % 
uuid.uuid4()},
+                                                zoneid=self.zone.id,
+                                                accountid=self.account.name,
+                                                domainid=self.account.domainid,
+                                                
serviceofferingid=self.service_offering.id,
+                                                volumeid=volume.id,
+                                                )
+        try:
+            ssh_client = virtual_machine.get_ssh_client()
+        except Exception as e:
+            self.fail("SSH failed for virtual machine: %s - %s" %
+                      (virtual_machine.ipaddress, e))
+        return virtual_machine

Review Comment:
   ```suggestion
           return virtual_machine
   
   ```



-- 
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: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to