cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sw...@apache.org
Subject git commit: updated refs/heads/4.2-forward to dfee47e
Date Thu, 05 Sep 2013 13:23:48 GMT
Updated Branches:
  refs/heads/4.2-forward c1ea61a0e -> dfee47e3b


CLOUDSTACK-4203: Adding a test for migrating volumes of stopped vms to test_stopped_vm.py

Signed-off-by: sanjeevneelarapu <sanjeev.neelarapu@citrix.com>
Signed-off-by: venkataswamybabu budumuru <venkataswamybabu.budumuru@citrix.com>

s


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/dfee47e3
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/dfee47e3
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/dfee47e3

Branch: refs/heads/4.2-forward
Commit: dfee47e3b6c35d08cba7f28433b9e1bce12b4078
Parents: c1ea61a
Author: sanjeevneelarapu <sanjeev.neelarapu@citrix.com>
Authored: Wed Sep 4 22:37:15 2013 +0530
Committer: venkataswamybabu budumuru <venkataswamybabu.budumuru@citrix.com>
Committed: Thu Sep 5 18:53:02 2013 +0530

----------------------------------------------------------------------
 test/integration/component/test_stopped_vm.py | 148 +++++++++++++++++++++
 1 file changed, 148 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dfee47e3/test/integration/component/test_stopped_vm.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_stopped_vm.py b/test/integration/component/test_stopped_vm.py
index 41eeb46..7903f0e 100644
--- a/test/integration/component/test_stopped_vm.py
+++ b/test/integration/component/test_stopped_vm.py
@@ -809,6 +809,154 @@ class TestDeployVM(cloudstackTestCase):
                          )
         return
 
+    @attr(tags = ["advanced", "eip", "advancedns", "basic", "sg"])
+    def test_09_stop_vm_migrate_vol(self):
+        """Test Stopped Virtual Machine's ROOT volume migration
+        """
+
+        # Validate the following:
+        # 1. deploy Vm with startvm=true
+        # 2. Should not be able to login to the VM.
+        # 3. listVM command should return the deployed VM.State of this VM
+        #    should be "Running".
+        # 4. Stop the vm
+        # 5.list primary storages in the cluster , should be more than one
+        # 6.Migrate voluem to another available primary storage
+        clusters = Cluster.list(
+                                self.apiclient,
+                                zoneid = self.zone.id
+                                )
+        self.assertEqual(
+                            isinstance(clusters, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        i = 0
+        for cluster in clusters :
+            storage_pools = StoragePool.list(
+                                             self.apiclient,
+                                             clusterid = cluster.id
+                                             )
+            if len(storage_pools) > 1 :
+                self.cluster_id = cluster.id
+                i += 1
+                break
+        if i == 0 :
+            self.skipTest("No cluster with more than one primary storage pool to perform
migrate volume test")
+
+        hosts = Host.list(
+                          self.apiclient,
+                          clusterid = self.cluster_id
+                          )
+        self.assertEqual(
+                            isinstance(hosts, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        host = hosts[0]
+        self.debug("Deploying instance on host: %s" % host.id)
+        self.debug("Deploying instance in the account: %s" %
+                                                self.account.name)
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.name,
+                                    domainid=self.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    diskofferingid=self.disk_offering.id,
+                                    hostid=host.id,
+                                    mode=self.zone.networktype
+                                )
+
+        self.debug("Deployed instance in account: %s" %
+                                                    self.account.name)
+        list_vm_response = list_virtual_machines(
+                                                 self.apiclient,
+                                                 id=self.virtual_machine.id
+                                                 )
+
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % self.virtual_machine.id
+            )
+
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+        self.assertEqual(
+                            vm_response.state,
+                            "Running",
+                            "VM should be in Running state after deployment"
+                        )
+        self.debug("Stopping instance: %s" % self.virtual_machine.name)
+        self.virtual_machine.stop(self.apiclient)
+        self.debug("Instance is stopped!")
+        self.debug(
+                "Verify listVirtualMachines response for virtual machine: %s" \
+                % self.virtual_machine.id
+            )
+        list_vm_response = list_virtual_machines(
+                                                 self.apiclient,
+                                                 id=self.virtual_machine.id
+                                                 )
+        self.assertEqual(
+                            isinstance(list_vm_response, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        vm_response = list_vm_response[0]
+        self.assertEqual(
+                            vm_response.state,
+                            "Stopped",
+                            "VM should be in Stopped state after stoping vm"
+                        )
+        volumes = Volume.list(
+                              self.apiclient,
+                              virtualmachineid=self.virtual_machine.id,
+                              type='ROOT',
+                              listall=True
+                              )
+        self.assertEqual(
+                            isinstance(volumes, list),
+                            True,
+                            "Check volume list response returns a valid list"
+                        )
+        vol_response = volumes[0]
+        #get the storage name in which volume is stored
+        storage_name = vol_response.storage
+        storage_pools = StoragePool.list(
+                                         self.apiclient,
+                                         clusterid = self.cluster_id
+                                         )
+        #Get storage pool to migrate volume
+        for spool in storage_pools:
+            if spool.name == storage_name:
+                continue
+            else:
+                self.storage_id = spool.id
+                self.storage_name = spool.name
+                break
+        self.debug("Migrating volume to storage pool: %s" % self.storage_name)
+        Volume.migrate(
+                       self.apiclient,
+                       storageid = self.storage_id,
+                       volumeid = vol_response.id
+                       )
+        volume = Volume.list(
+                              self.apiclient,
+                              virtualmachineid=self.virtual_machine.id,
+                              type='ROOT',
+                              listall=True
+                              )
+        self.assertEqual(
+                         volume[0].storage,
+                         self.storage_name,
+                         "Check volume migration response")
+        
+        return
 
 class TestDeployHaEnabledVM(cloudstackTestCase):
 


Mime
View raw message