mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Cycle all possible device combinations for ISO attach/detach
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
This commit is contained in:
parent
694391ad04
commit
c1e37f60ac
@ -116,7 +116,7 @@ class Services:
|
|||||||
"name": "Cent OS Template",
|
"name": "Cent OS Template",
|
||||||
"passwordenabled": True,
|
"passwordenabled": True,
|
||||||
},
|
},
|
||||||
"diskdevice": '/dev/xvdd',
|
"diskdevice": ['/dev/xvdd', '/dev/cdrom', '/dev/sr0', '/dev/cdrom1' ],
|
||||||
# Disk device where ISO is attached to instance
|
# Disk device where ISO is attached to instance
|
||||||
"mount_dir": "/mnt/tmp",
|
"mount_dir": "/mnt/tmp",
|
||||||
"sleep": 60,
|
"sleep": 60,
|
||||||
@ -696,9 +696,9 @@ class TestVMLifeCycle(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"])
|
@attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "needle"])
|
||||||
def test_10_attachAndDetach_iso(self):
|
def test_10_attachAndDetach_iso(self):
|
||||||
"""Test for detach ISO to virtual machine"""
|
"""Test for attach and detach ISO to virtual machine"""
|
||||||
|
|
||||||
# Validate the following
|
# Validate the following
|
||||||
# 1. Create ISO
|
# 1. Create ISO
|
||||||
@ -747,20 +747,20 @@ class TestVMLifeCycle(cloudstackTestCase):
|
|||||||
self.fail("SSH failed for virtual machine: %s - %s" %
|
self.fail("SSH failed for virtual machine: %s - %s" %
|
||||||
(self.virtual_machine.ipaddress, e))
|
(self.virtual_machine.ipaddress, e))
|
||||||
|
|
||||||
cmds = [
|
cmds = [ "mkdir -p %s" % self.services["mount_dir"] ]
|
||||||
"mkdir -p %s" % self.services["mount_dir"],
|
self.assert_(ssh_client.execute(cmds) == [], "mkdir failed within guest")
|
||||||
"mount -rt iso9660 %s %s" \
|
|
||||||
% (
|
for diskdevice in self.services["diskdevice"]:
|
||||||
self.services["diskdevice"],
|
res = ssh_client.execute("mount -rt iso9660 {} {}".format(diskdevice, self.services["mount_dir"]))
|
||||||
self.services["mount_dir"]
|
if res == []:
|
||||||
),
|
self.services["mount"] = diskdevice
|
||||||
]
|
break
|
||||||
for c in cmds:
|
else:
|
||||||
res = ssh_client.execute(c)
|
self.skipTest("No mount points matched. Mount was unsuccessful")
|
||||||
self.assertEqual(res, [], "Check mount is successful or not")
|
|
||||||
c = "fdisk -l|grep %s|head -1" % self.services["diskdevice"]
|
c = "fdisk -l|grep %s|head -1" % self.services["mount"]
|
||||||
res = ssh_client.execute(c)
|
res = ssh_client.execute(c)
|
||||||
#Disk /dev/xvdd: 4393 MB, 4393723904 bytes
|
self.debug("Found a mount point at %s" % res)
|
||||||
|
|
||||||
# Res may contain more than one strings depending on environment
|
# Res may contain more than one strings depending on environment
|
||||||
# Split strings to form new list which is used for assertion on ISO size
|
# Split strings to form new list which is used for assertion on ISO size
|
||||||
@ -806,7 +806,7 @@ class TestVMLifeCycle(cloudstackTestCase):
|
|||||||
(self.virtual_machine.ipaddress, e))
|
(self.virtual_machine.ipaddress, e))
|
||||||
|
|
||||||
# Check if ISO is properly detached from VM (using fdisk)
|
# Check if ISO is properly detached from VM (using fdisk)
|
||||||
result = self.services["diskdevice"] in str(res)
|
result = self.services["mount"] in str(res)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
result,
|
result,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user