Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions test/integration/smoke/test_attach_multiple_volumes.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
DiskOffering,
)
from marvin.lib.common import (get_domain,
get_zone,
get_template,
find_storage_pool_type)
get_zone,
get_suitable_test_template,
find_storage_pool_type)
from marvin.codes import (
PASS,
FAILED,
Expand Down Expand Up @@ -69,13 +69,13 @@ def setUpClass(cls):
)
cls._cleanup.append(cls.disk_offering)

template = get_template(
cls.apiclient,
cls.zone.id,
cls.services["ostype"]
)
template = get_suitable_test_template(
cls.apiclient,
cls.zone.id,
cls.services["ostype"],
cls.hypervisor)
if template == FAILED:
assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
assert False, "get_suitable_test_template() failed to return template with description %s" % cls.services["ostype"]

cls.services["domainid"] = cls.domain.id
cls.services["zoneid"] = cls.zone.id
Expand Down
9 changes: 7 additions & 2 deletions test/integration/smoke/test_network_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

from marvin.lib.common import (get_domain,
get_zone,
get_template)
get_suitable_test_template)

NETWORK_FILTER_ACCOUNT = 'account'
NETWORK_FILTER_DOMAIN = 'domain'
Expand All @@ -66,7 +66,12 @@ def setUpClass(cls):

zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
cls.zone = Zone(zone.__dict__)
cls.template = get_template(cls.apiclient, cls.zone.id)
cls.hypervisor = cls.testClient.getHypervisorInfo()
cls.template = get_suitable_test_template(
cls.apiclient,
cls.zone.id,
cls.services["ostype"],
cls.hypervisor)
cls._cleanup = []

cls.logger = logging.getLogger("TestNetworkPermissions")
Expand Down
124 changes: 62 additions & 62 deletions test/integration/smoke/test_volumes.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,67 +726,6 @@ def test_08_resize_volume(self):
time.sleep(30)
return

@attr(tags=["advanced", "advancedns", "smoke", "basic"], required_hardware="true")
def test_12_resize_volume_with_only_size_parameter(self):
"""Test resize a volume by providing only size parameter, disk offering id is not mandatory"""
# Verify the size is the new size is what we wanted it to be.
self.debug(
"Attaching volume (ID: %s) to VM (ID: %s)" % (
self.volume.id,
self.virtual_machine.id
))

self.virtual_machine.attach_volume(self.apiClient, self.volume)
self.attached = True
hosts = Host.list(self.apiClient, id=self.virtual_machine.hostid)
self.assertTrue(isinstance(hosts, list))
self.assertTrue(len(hosts) > 0)
self.debug("Found %s host" % hosts[0].hypervisor)

if hosts[0].hypervisor == "XenServer":
self.virtual_machine.stop(self.apiClient)
elif hosts[0].hypervisor.lower() == "hyperv":
self.skipTest("Resize Volume is unsupported on Hyper-V")

# resize the data disk
self.debug("Resize Volume ID: %s" % self.volume.id)

cmd = resizeVolume.resizeVolumeCmd()
cmd.id = self.volume.id
cmd.size = 20

self.apiClient.resizeVolume(cmd)

count = 0
success = False
while count < 3:
list_volume_response = Volume.list(
self.apiClient,
id=self.volume.id,
type='DATADISK'
)
for vol in list_volume_response:
if vol.id == self.volume.id and int(vol.size) == (20 * (1024 ** 3)) and vol.state == 'Ready':
success = True
if success:
break
else:
time.sleep(10)
count += 1

self.assertEqual(
success,
True,
"Check if the data volume resized appropriately"
)

# start the vm if it is on xenserver

if hosts[0].hypervisor == "XenServer":
self.virtual_machine.start(self.apiClient)
time.sleep(30)
return

@attr(tags=["advanced", "advancedns", "smoke", "basic"], required_hardware="false")
def test_09_delete_detached_volume(self):
"""Delete a Volume unattached to an VM
Expand Down Expand Up @@ -943,6 +882,67 @@ def test_11_attach_volume_with_unstarted_vm(self):

return

@attr(tags=["advanced", "advancedns", "smoke", "basic"], required_hardware="true")
def test_12_resize_volume_with_only_size_parameter(self):
"""Test resize a volume by providing only size parameter, disk offering id is not mandatory"""
# Verify the size is the new size is what we wanted it to be.
self.debug(
"Attaching volume (ID: %s) to VM (ID: %s)" % (
self.volume.id,
self.virtual_machine.id
))

self.virtual_machine.attach_volume(self.apiClient, self.volume)
self.attached = True
hosts = Host.list(self.apiClient, id=self.virtual_machine.hostid)
self.assertTrue(isinstance(hosts, list))
self.assertTrue(len(hosts) > 0)
self.debug("Found %s host" % hosts[0].hypervisor)

if hosts[0].hypervisor == "XenServer":
self.virtual_machine.stop(self.apiClient)
elif hosts[0].hypervisor.lower() == "hyperv":
self.skipTest("Resize Volume is unsupported on Hyper-V")

# resize the data disk
self.debug("Resize Volume ID: %s" % self.volume.id)

cmd = resizeVolume.resizeVolumeCmd()
cmd.id = self.volume.id
cmd.size = 20

self.apiClient.resizeVolume(cmd)

count = 0
success = False
while count < 3:
list_volume_response = Volume.list(
self.apiClient,
id=self.volume.id,
type='DATADISK'
)
for vol in list_volume_response:
if vol.id == self.volume.id and int(vol.size) == (20 * (1024 ** 3)) and vol.state == 'Ready':
success = True
if success:
break
else:
time.sleep(10)
count += 1

self.assertEqual(
success,
True,
"Check if the data volume resized appropriately"
)

# start the vm if it is on xenserver

if hosts[0].hypervisor == "XenServer":
self.virtual_machine.start(self.apiClient)
time.sleep(30)
return

def wait_for_attributes_and_return_root_vol(self):
def checkVolumeResponse():
list_volume_response = Volume.list(
Expand All @@ -963,7 +963,7 @@ def checkVolumeResponse():
return response

@attr(tags=["advanced", "advancedns", "smoke", "basic"], required_hardware="true")
def test_11_migrate_volume_and_change_offering(self):
def test_13_migrate_volume_and_change_offering(self):
"""
Validates the following
1. Creates a new Volume with a small disk offering
Expand Down