You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bf...@apache.org on 2013/10/15 22:20:15 UTC
[20/25] git commit: updated refs/heads/ui-restyle to 3fdb61f
CLOUDSTACK-4647: Fixed snapshot_gc test case and common util function is_snapshot_on_nfs
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/0a8bce5c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/0a8bce5c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/0a8bce5c
Branch: refs/heads/ui-restyle
Commit: 0a8bce5cf6ee96f52911e4c185db026850085d4e
Parents: 7b5daae
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Wed Sep 25 22:55:29 2013 -0400
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Tue Oct 15 13:37:08 2013 +0530
----------------------------------------------------------------------
test/integration/component/test_snapshot_gc.py | 17 +++++------------
tools/marvin/marvin/integration/lib/utils.py | 20 +++++++++++---------
2 files changed, 16 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a8bce5c/test/integration/component/test_snapshot_gc.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_snapshot_gc.py b/test/integration/component/test_snapshot_gc.py
index aec9761..1e1cc5d 100644
--- a/test/integration/component/test_snapshot_gc.py
+++ b/test/integration/component/test_snapshot_gc.py
@@ -148,7 +148,6 @@ class TestAccountSnapshotClean(cloudstackTestCase):
)
cls.services["account"] = cls.account.name
- cls._cleanup.append(cls.account)
if cls.zone.localstorageenabled:
cls.services["service_offering"]["storagetype"] = "local"
@@ -156,7 +155,7 @@ class TestAccountSnapshotClean(cloudstackTestCase):
cls.api_client,
cls.services["service_offering"]
)
- cls._cleanup.append(cls.service_offering)
+
cls.virtual_machine = VirtualMachine.create(
cls.api_client,
cls.services["server"],
@@ -165,7 +164,7 @@ class TestAccountSnapshotClean(cloudstackTestCase):
domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id
)
- cls._cleanup.append(cls.virtual_machine)
+
# Get the Root disk of VM
volumes = list_volumes(
cls.api_client,
@@ -177,13 +176,10 @@ class TestAccountSnapshotClean(cloudstackTestCase):
# Create a snapshot from the ROOTDISK
cls.snapshot = Snapshot.create(cls.api_client, volumes[0].id)
- cls._cleanup.append(cls.snapshot)
except Exception, e:
cls.tearDownClass()
unittest.SkipTest("setupClass fails for %s" % cls.__name__)
raise e
- else:
- cls._cleanup.remove(cls.account)
return
@classmethod
@@ -296,15 +292,12 @@ class TestAccountSnapshotClean(cloudstackTestCase):
# Wait for account cleanup interval
wait_for_cleanup(self.apiclient, configs=["account.cleanup.interval"])
- accounts = list_accounts(
+
+ with self.assertRaises(Exception):
+ accounts = list_accounts(
self.apiclient,
id=self.account.id
)
- self.assertEqual(
- accounts,
- None,
- "List accounts should return empty list after account deletion"
- )
self.assertFalse(is_snapshot_on_nfs(self.apiclient, self.dbclient, self.config, self.zone.id, self.snapshot.id),
"Snapshot was still found on NFS after account gc")
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a8bce5c/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 a6abe06..d81e80d 100644
--- a/tools/marvin/marvin/integration/lib/utils.py
+++ b/tools/marvin/marvin/integration/lib/utils.py
@@ -5,9 +5,9 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -269,30 +269,32 @@ def is_snapshot_on_nfs(apiclient, dbconn, config, zoneid, snapshotid):
)
assert isinstance(qresultset, list), "Invalid db query response for snapshot %s" % snapshotid
- assert len(qresultset) != 0, "No such snapshot %s found in the cloudstack db" % snapshotid
+
+ if len(qresultset) == 0:
+ #Snapshot does not exist
+ return False
snapshotPath = qresultset[0][0]
nfsurl = secondaryStore.url
- # parse_url = ['nfs:', '', '192.168.100.21', 'export', 'test']
from urllib2 import urlparse
parse_url = urlparse.urlsplit(nfsurl, scheme='nfs')
host, path = parse_url.netloc, parse_url.path
if not config.mgtSvr:
raise Exception("Your marvin configuration does not contain mgmt server credentials")
- host, user, passwd = config.mgtSvr[0].mgtSvrIp, config.mgtSvr[0].user, config.mgtSvr[0].passwd
+ mgtSvr, user, passwd = config.mgtSvr[0].mgtSvrIp, config.mgtSvr[0].user, config.mgtSvr[0].passwd
try:
ssh_client = remoteSSHClient(
- host,
+ mgtSvr,
22,
user,
- passwd,
+ passwd
)
cmds = [
"mkdir -p %s /mnt/tmp",
- "mount -t %s %s:%s /mnt/tmp" % (
+ "mount -t %s %s%s /mnt/tmp" % (
'nfs',
host,
path,
@@ -314,5 +316,5 @@ def is_snapshot_on_nfs(apiclient, dbconn, config, zoneid, snapshotid):
ssh_client.execute(c)
except Exception as e:
raise Exception("SSH failed for management server: %s - %s" %
- (config[0].mgtSvrIp, e))
+ (config.mgtSvr[0].mgtSvrIp, e))
return 'snapshot exists' in result