CLOUDSTACK-5635: Fixed issue (Max volumes has been exceeded for domain during test)

This commit is contained in:
Gaurav Aradhye 2013-12-30 18:05:04 +05:30 committed by Girish Shilamkar
parent 785931b6f0
commit 013f100078

View File

@ -17,14 +17,29 @@
""" P1 tests for Resource limits """ P1 tests for Resource limits
""" """
#Import Local Modules #Import Local Modules
import marvin
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import * from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.cloudstackAPI import * from marvin.integration.lib.base import (VirtualMachine,
from marvin.integration.lib.utils import * Snapshot,
from marvin.integration.lib.base import * Template,
from marvin.integration.lib.common import * PublicIPAddress,
import datetime Account,
Domain,
Volume,
Network,
DiskOffering,
NetworkOffering,
ServiceOffering,
Configurations)
from marvin.integration.lib.common import (list_volumes,
get_domain,
get_zone,
get_template,
update_resource_limit,
list_configurations,
wait_for_cleanup)
from marvin.integration.lib.utils import cleanup_resources
import time
class Services: class Services:
@ -174,6 +189,8 @@ class TestResourceLimitsAccount(cloudstackTestCase):
try: try:
#Clean up, terminate the created instance, volumes and snapshots #Clean up, terminate the created instance, volumes and snapshots
cleanup_resources(self.apiclient, self.cleanup) cleanup_resources(self.apiclient, self.cleanup)
# Wait for VMs to expunge
wait_for_cleanup(self.apiclient, ["expunge.delay", "expunge.interval"])
except Exception as e: except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@ -362,7 +379,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
# Exception should be raised for second instance (account_1) # Exception should be raised for second instance (account_1)
with self.assertRaises(Exception): with self.assertRaises(Exception):
public_ip_2 = PublicIPAddress.create( PublicIPAddress.create(
self.apiclient, self.apiclient,
virtual_machine_1.account, virtual_machine_1.account,
virtual_machine_1.zoneid, virtual_machine_1.zoneid,
@ -537,7 +554,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
self.debug("Creating snapshot from volume: %s" % volumes[0].id) self.debug("Creating snapshot from volume: %s" % volumes[0].id)
# Create a snapshot from the ROOTDISK (Account 2) # Create a snapshot from the ROOTDISK (Account 2)
snapshot_2 = Snapshot.create(self.apiclient, snapshot_2 = Snapshot.create(self.apiclient,
volumes[0].id, volume.id,
account=self.account_2.name, account=self.account_2.name,
domainid=self.account_2.domainid, domainid=self.account_2.domainid,
) )
@ -555,7 +572,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
self.debug("Creating snapshot from volume: %s" % volumes[0].id) self.debug("Creating snapshot from volume: %s" % volumes[0].id)
# Create a second snapshot from the ROOTDISK (Account 2) # Create a second snapshot from the ROOTDISK (Account 2)
snapshot_3 = Snapshot.create(self.apiclient, snapshot_3 = Snapshot.create(self.apiclient,
volumes[0].id, volume.id,
account=self.account_2.name, account=self.account_2.name,
domainid=self.account_2.domainid, domainid=self.account_2.domainid,
) )
@ -940,6 +957,8 @@ class TestResourceLimitsDomain(cloudstackTestCase):
try: try:
#Clean up, terminate the created instance, volumes and snapshots #Clean up, terminate the created instance, volumes and snapshots
cleanup_resources(self.apiclient, self.cleanup) cleanup_resources(self.apiclient, self.cleanup)
# Wait for VMs to expunge
wait_for_cleanup(self.apiclient, ["expunge.delay", "expunge.interval"])
except Exception as e: except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@ -1071,7 +1090,7 @@ class TestResourceLimitsDomain(cloudstackTestCase):
# Exception should be raised for second Public IP # Exception should be raised for second Public IP
with self.assertRaises(Exception): with self.assertRaises(Exception):
public_ip_2 = PublicIPAddress.create( PublicIPAddress.create(
self.apiclient, self.apiclient,
virtual_machine_1.account, virtual_machine_1.account,
virtual_machine_1.zoneid, virtual_machine_1.zoneid,
@ -1140,7 +1159,7 @@ class TestResourceLimitsDomain(cloudstackTestCase):
self.debug("Creating snapshot from volume: %s" % volumes[0].id) self.debug("Creating snapshot from volume: %s" % volumes[0].id)
# Create a snapshot from the ROOTDISK # Create a snapshot from the ROOTDISK
snapshot_1 = Snapshot.create(self.apiclient, snapshot_1 = Snapshot.create(self.apiclient,
volumes[0].id, volume.id,
account=self.account.name, account=self.account.name,
domainid=self.account.domainid, domainid=self.account.domainid,
) )
@ -1158,7 +1177,7 @@ class TestResourceLimitsDomain(cloudstackTestCase):
# Exception should be raised for second snapshot # Exception should be raised for second snapshot
with self.assertRaises(Exception): with self.assertRaises(Exception):
Snapshot.create(self.apiclient, Snapshot.create(self.apiclient,
volumes[0].id, volume.id,
account=self.account.name, account=self.account.name,
domainid=self.account.domainid, domainid=self.account.domainid,
) )