You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ts...@apache.org on 2013/10/15 10:07:26 UTC
[1/2] git commit: updated refs/heads/master to 986ac0f
Updated Branches:
refs/heads/master 7b5daaea2 -> 986ac0f12
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/master
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
[2/2] git commit: updated refs/heads/master to 986ac0f
Posted by ts...@apache.org.
CLOUDSTACK-4780: Fixed BVT test case TestSnapshotRootDisk.test_01_snapshot_root_disk
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/986ac0f1
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/986ac0f1
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/986ac0f1
Branch: refs/heads/master
Commit: 986ac0f124ab2960e13455736dfd467350e7f9e1
Parents: 0a8bce5
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Mon Oct 14 20:56:16 2013 -0400
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Tue Oct 15 13:37:11 2013 +0530
----------------------------------------------------------------------
test/integration/smoke/test_snapshots.py | 76 +--------------------------
1 file changed, 2 insertions(+), 74 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/986ac0f1/test/integration/smoke/test_snapshots.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_snapshots.py b/test/integration/smoke/test_snapshots.py
index 06777e4..6ee7c62 100644
--- a/test/integration/smoke/test_snapshots.py
+++ b/test/integration/smoke/test_snapshots.py
@@ -269,77 +269,5 @@ class TestSnapshotRootDisk(cloudstackTestCase):
"Check if backup_snap_id is not null"
)
- # Get the Secondary Storage details from list Hosts
- hosts = list_hosts(
- self.apiclient,
- type='SecondaryStorage',
- zoneid=self.zone.id
- )
- self.assertEqual(
- isinstance(hosts, list),
- True,
- "Check list response returns a valid list"
- )
- uuids = []
- for host in hosts:
- # hosts[0].name = "nfs://192.168.100.21/export/test"
- parse_url = (host.name).split('/')
- # parse_url = ['nfs:', '', '192.168.100.21', 'export', 'test']
-
- # Split IP address and export path from name
- sec_storage_ip = parse_url[2]
- # Sec Storage IP: 192.168.100.21
-
- export_path = '/'.join(parse_url[3:])
- # Export path: export/test
-
- try:
- # Login to VM to check snapshot present on sec disk
- ssh_client = self.virtual_machine_with_disk.get_ssh_client()
-
- cmds = [
- "mkdir -p %s" % self.services["paths"]["mount_dir"],
- "mount %s/%s %s" % (
- sec_storage_ip,
- export_path,
- self.services["paths"]["mount_dir"]
- ),
- "ls %s/snapshots/%s/%s" % (
- self.services["paths"]["mount_dir"],
- account_id,
- volume_id
- ),
- ]
-
- for c in cmds:
- self.debug(c)
- result = ssh_client.execute(c)
- self.debug(result)
-
- except Exception:
- self.fail("SSH failed for Virtual machine: %s" %
- self.virtual_machine_with_disk.ipaddress)
-
- uuids.append(result)
- # Unmount the Sec Storage
- cmds = [
- "umount %s" % (self.services["mount_dir"]),
- ]
- try:
- for c in cmds:
- self.debug(c)
- result = ssh_client.execute(c)
- self.debug(result)
-
- except Exception as e:
- self.fail("SSH failed for Virtual machine: %s" %
- self.virtual_machine_with_disk.ipaddress)
-
- res = str(uuids)
- # Check snapshot UUID in secondary storage and database
- self.assertEqual(
- res.count(snapshot_uuid),
- 1,
- "Check snapshot UUID in secondary storage and database"
- )
- return
\ No newline at end of file
+ self.assertTrue(is_snapshot_on_nfs(self.apiclient, self.dbclient, self.config, self.zone.id, snapshot.id))
+ return