You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by sw...@apache.org on 2013/09/05 15:24:48 UTC
git commit: updated refs/heads/master to 883b980
Updated Branches:
refs/heads/master 8b5cb374b -> 883b9802d
CLOUDSTACK-4203: Adding a test for migrating volumes of stopped vms to test_stopped_vm.py
Signed-off-by: sanjeevneelarapu <sa...@citrix.com>
Signed-off-by: venkataswamybabu budumuru <ve...@citrix.com>
s
(cherry picked from commit dfee47e3b6c35d08cba7f28433b9e1bce12b4078)
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/883b9802
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/883b9802
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/883b9802
Branch: refs/heads/master
Commit: 883b9802d4a58633ae9bc75023e063751282783a
Parents: 8b5cb37
Author: sanjeevneelarapu <sa...@citrix.com>
Authored: Wed Sep 4 22:37:15 2013 +0530
Committer: venkataswamybabu budumuru <ve...@citrix.com>
Committed: Thu Sep 5 18:54:33 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/883b9802/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):