diff --git a/test/integration/component/test_resource_limits.py b/test/integration/component/test_resource_limits.py index b543e7b0024..f0d558ec2d4 100644 --- a/test/integration/component/test_resource_limits.py +++ b/test/integration/component/test_resource_limits.py @@ -523,10 +523,11 @@ class TestResourceLimitsAccount(cloudstackTestCase): self.assertEqual( snapshot_1.state in [ 'BackedUp', - 'CreatedOnPrimary' + 'CreatedOnPrimary', + 'Allocated' ], True, - "Check Snapshot state is Running or not" + "Snapshot state is not valid, it is %s" % snapshot_1.state ) # Exception should be raised for second snapshot (account_1) @@ -563,10 +564,11 @@ class TestResourceLimitsAccount(cloudstackTestCase): self.assertEqual( snapshot_2.state in [ 'BackedUp', - 'CreatedOnPrimary' + 'CreatedOnPrimary', + 'Allocated' ], True, - "Check Snapshot state is Running or not" + "Snapshot state is not valid, it is %s" % snapshot_2.state ) self.debug("Creating snapshot from volume: %s" % volumes[0].id) @@ -581,10 +583,11 @@ class TestResourceLimitsAccount(cloudstackTestCase): self.assertEqual( snapshot_3.state in [ 'BackedUp', - 'CreatedOnPrimary' + 'CreatedOnPrimary', + 'Allocated' ], True, - "Check Snapshot state is Running or not" + "Snapshot state is not valid, it is %s" % snapshot_3.state ) return @@ -1168,10 +1171,11 @@ class TestResourceLimitsDomain(cloudstackTestCase): self.assertEqual( snapshot_1.state in [ 'BackedUp', - 'CreatedOnPrimary' + 'CreatedOnPrimary', + 'Allocated' ], True, - "Check Snapshot state is Running or not" + "Snapshot state is not valid, it is %s" % snapshot_1.state ) # Exception should be raised for second snapshot diff --git a/tools/marvin/marvin/integration/lib/utils.py b/tools/marvin/marvin/integration/lib/utils.py index 25ebe28d9b2..e870158cfb5 100644 --- a/tools/marvin/marvin/integration/lib/utils.py +++ b/tools/marvin/marvin/integration/lib/utils.py @@ -268,18 +268,6 @@ def is_snapshot_on_nfs(apiclient, dbconn, config, zoneid, snapshotid): "kvm": "", "xenserver": ".vhd"} - from base import ImageStore - secondaryStores = ImageStore.list(apiclient, zoneid=zoneid) - - assert isinstance(secondaryStores, list), "Not a valid response for listImageStores" - assert len(secondaryStores) != 0, "No image stores found in zone %s" % zoneid - - secondaryStore = secondaryStores[0] - - if str(secondaryStore.providername).lower() != "nfs": - raise Exception( - "is_snapshot_on_nfs works only against nfs secondary storage. found %s" % str(secondaryStore.providername)) - qresultset = dbconn.execute( "select id from snapshots where uuid = '%s';" \ % str(snapshotid) @@ -291,7 +279,7 @@ def is_snapshot_on_nfs(apiclient, dbconn, config, zoneid, snapshotid): snapshotid = qresultset[0][0] qresultset = dbconn.execute( - "select install_path from snapshot_store_ref where snapshot_id='%s' and store_role='Image';" % snapshotid + "select install_path,store_id from snapshot_store_ref where snapshot_id='%s' and store_role='Image';" % snapshotid ) assert isinstance(qresultset, list), "Invalid db query response for snapshot %s" % snapshotid @@ -300,6 +288,19 @@ def is_snapshot_on_nfs(apiclient, dbconn, config, zoneid, snapshotid): #Snapshot does not exist return False + from base import ImageStore + #pass store_id to get the exact storage pool where snapshot is stored + secondaryStores = ImageStore.list(apiclient, zoneid=zoneid, id=int(qresultset[0][1])) + + assert isinstance(secondaryStores, list), "Not a valid response for listImageStores" + assert len(secondaryStores) != 0, "No image stores found in zone %s" % zoneid + + secondaryStore = secondaryStores[0] + + if str(secondaryStore.providername).lower() != "nfs": + raise Exception( + "is_snapshot_on_nfs works only against nfs secondary storage. found %s" % str(secondaryStore.providername)) + hypervisor = get_hypervisor_type(apiclient) # append snapshot extension based on hypervisor, to the snapshot path snapshotPath = str(qresultset[0][0]) + snapshot_extensions[str(hypervisor).lower()]