cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gir...@apache.org
Subject git commit: updated refs/heads/4.3 to 4e0b44c
Date Wed, 08 Jan 2014 11:47:56 GMT
Updated Branches:
  refs/heads/4.3 5aa0bc3f8 -> 4e0b44c0d


CLOUDSTACK-5630: Fixed snapshots' test cases


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

Branch: refs/heads/4.3
Commit: 4e0b44c0d683dec2c4f28b3e05aa1d136e949fdd
Parents: 5aa0bc3
Author: Gaurav Aradhye <gaurav.aradhye@clogeny.com>
Authored: Wed Jan 8 17:16:06 2014 +0530
Committer: Girish Shilamkar <girish@clogeny.com>
Committed: Wed Jan 8 17:17:47 2014 +0530

----------------------------------------------------------------------
 .../component/test_resource_limits.py           | 20 +++++++++------
 tools/marvin/marvin/integration/lib/utils.py    | 27 ++++++++++----------
 2 files changed, 26 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4e0b44c0/test/integration/component/test_resource_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_resource_limits.py b/test/integration/component/test_resource_limits.py
index b543e7b..f0d558e 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

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4e0b44c0/tools/marvin/marvin/integration/lib/utils.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/utils.py b/tools/marvin/marvin/integration/lib/utils.py
index 25ebe28..e870158 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()]


Mime
View raw message