mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-4780: Fixed BVT test case TestSnapshotRootDisk.test_01_snapshot_root_disk
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
This commit is contained in:
parent
0a8bce5cf6
commit
986ac0f124
@ -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"
|
||||
)
|
||||
self.assertTrue(is_snapshot_on_nfs(self.apiclient, self.dbclient, self.config, self.zone.id, snapshot.id))
|
||||
return
|
||||
Loading…
x
Reference in New Issue
Block a user