You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by gi...@apache.org on 2014/01/08 12:46:56 UTC
git commit: updated refs/heads/master to b98c0ee
Updated Branches:
refs/heads/master 5dc0c6023 -> b98c0ee80
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/b98c0ee8
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b98c0ee8
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b98c0ee8
Branch: refs/heads/master
Commit: b98c0ee80953e801cef2ede18f720d0cf8c91194
Parents: 5dc0c60
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Wed Jan 8 17:16:06 2014 +0530
Committer: Girish Shilamkar <gi...@clogeny.com>
Committed: Wed Jan 8 17:16:06 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/b98c0ee8/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/b98c0ee8/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()]