mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-8124: Skipping snapshot tests on hyperv hypervisor
Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>
This commit is contained in:
parent
78b9be07d5
commit
762727439b
@ -18,7 +18,7 @@
|
|||||||
"""
|
"""
|
||||||
#Import Local Modules
|
#Import Local Modules
|
||||||
from nose.plugins.attrib import attr
|
from nose.plugins.attrib import attr
|
||||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
from marvin.cloudstackTestCase import cloudstackTestCase,unittest
|
||||||
#from marvin.cloudstackAPI import *
|
#from marvin.cloudstackAPI import *
|
||||||
from marvin.lib.utils import (cleanup_resources,
|
from marvin.lib.utils import (cleanup_resources,
|
||||||
validateList)
|
validateList)
|
||||||
@ -522,7 +522,7 @@ class TestResourceLimitsProject(cloudstackTestCase):
|
|||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
cls.testClient = super(TestResourceLimitsProject, cls).getClsTestClient()
|
cls.testClient = super(TestResourceLimitsProject, cls).getClsTestClient()
|
||||||
cls.api_client = cls.testClient.getApiClient()
|
cls.api_client = cls.testClient.getApiClient()
|
||||||
|
cls.hypervisor = cls.testClient.getHypervisorInfo()
|
||||||
cls.services = Services().services
|
cls.services = Services().services
|
||||||
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
|
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
|
||||||
cls.services['mode'] = cls.zone.networktype
|
cls.services['mode'] = cls.zone.networktype
|
||||||
@ -758,6 +758,8 @@ class TestResourceLimitsProject(cloudstackTestCase):
|
|||||||
# 5. Try to create another snapshot in this project. It should give
|
# 5. Try to create another snapshot in this project. It should give
|
||||||
# user an appropriate error and an alert should be generated.
|
# user an appropriate error and an alert should be generated.
|
||||||
|
|
||||||
|
if self.hypervisor.lower() in ['hyperv']:
|
||||||
|
raise self.skipTest("Snapshots feature is not supported on Hyper-V")
|
||||||
self.debug(
|
self.debug(
|
||||||
"Updating snapshot resource limits for project: %s" %
|
"Updating snapshot resource limits for project: %s" %
|
||||||
self.project.id)
|
self.project.id)
|
||||||
|
|||||||
@ -46,6 +46,7 @@ from marvin.codes import (PASS,
|
|||||||
FAILED,
|
FAILED,
|
||||||
RESOURCE_PRIMARY_STORAGE)
|
RESOURCE_PRIMARY_STORAGE)
|
||||||
|
|
||||||
|
|
||||||
class TestMultipleChildDomain(cloudstackTestCase):
|
class TestMultipleChildDomain(cloudstackTestCase):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -53,11 +54,14 @@ class TestMultipleChildDomain(cloudstackTestCase):
|
|||||||
cloudstackTestClient = super(TestMultipleChildDomain,
|
cloudstackTestClient = super(TestMultipleChildDomain,
|
||||||
cls).getClsTestClient()
|
cls).getClsTestClient()
|
||||||
cls.api_client = cloudstackTestClient.getApiClient()
|
cls.api_client = cloudstackTestClient.getApiClient()
|
||||||
|
cls.hypervisor = cloudstackTestClient.getHypervisorInfo()
|
||||||
# Fill services from the external config file
|
# Fill services from the external config file
|
||||||
cls.services = cloudstackTestClient.getParsedTestDataConfig()
|
cls.services = cloudstackTestClient.getParsedTestDataConfig()
|
||||||
# Get Zone, Domain and templates
|
# Get Zone, Domain and templates
|
||||||
cls.domain = get_domain(cls.api_client)
|
cls.domain = get_domain(cls.api_client)
|
||||||
cls.zone = get_zone(cls.api_client, cloudstackTestClient.getZoneForTests())
|
cls.zone = get_zone(
|
||||||
|
cls.api_client,
|
||||||
|
cloudstackTestClient.getZoneForTests())
|
||||||
cls.services["mode"] = cls.zone.networktype
|
cls.services["mode"] = cls.zone.networktype
|
||||||
|
|
||||||
cls.template = get_template(
|
cls.template = get_template(
|
||||||
@ -72,7 +76,8 @@ class TestMultipleChildDomain(cloudstackTestCase):
|
|||||||
|
|
||||||
cls._cleanup = []
|
cls._cleanup = []
|
||||||
try:
|
try:
|
||||||
cls.service_offering = ServiceOffering.create(cls.api_client,
|
cls.service_offering = ServiceOffering.create(
|
||||||
|
cls.api_client,
|
||||||
cls.services["service_offering"])
|
cls.services["service_offering"])
|
||||||
cls._cleanup.append(cls.service_offering)
|
cls._cleanup.append(cls.service_offering)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -99,7 +104,7 @@ class TestMultipleChildDomain(cloudstackTestCase):
|
|||||||
self.apiclient,
|
self.apiclient,
|
||||||
self.services["disk_offering"]
|
self.services["disk_offering"]
|
||||||
)
|
)
|
||||||
self.assertNotEqual(self.disk_offering, None, \
|
self.assertNotEqual(self.disk_offering, None,
|
||||||
"Disk offering is None")
|
"Disk offering is None")
|
||||||
self.cleanup.append(self.disk_offering)
|
self.cleanup.append(self.disk_offering)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -140,25 +145,37 @@ class TestMultipleChildDomain(cloudstackTestCase):
|
|||||||
|
|
||||||
def setupAccounts(self):
|
def setupAccounts(self):
|
||||||
try:
|
try:
|
||||||
self.parent_domain = Domain.create(self.apiclient,
|
self.parent_domain = Domain.create(
|
||||||
|
self.apiclient,
|
||||||
services=self.services["domain"],
|
services=self.services["domain"],
|
||||||
parentdomainid=self.domain.id)
|
parentdomainid=self.domain.id)
|
||||||
self.parentd_admin = Account.create(self.apiclient, self.services["account"],
|
self.parentd_admin = Account.create(
|
||||||
admin=True, domainid=self.parent_domain.id)
|
self.apiclient,
|
||||||
|
self.services["account"],
|
||||||
|
admin=True,
|
||||||
|
domainid=self.parent_domain.id)
|
||||||
|
|
||||||
# Create sub-domains and their admin accounts
|
# Create sub-domains and their admin accounts
|
||||||
self.cdomain_1 = Domain.create(self.apiclient,
|
self.cdomain_1 = Domain.create(
|
||||||
|
self.apiclient,
|
||||||
services=self.services["domain"],
|
services=self.services["domain"],
|
||||||
parentdomainid=self.parent_domain.id)
|
parentdomainid=self.parent_domain.id)
|
||||||
self.cdomain_2 = Domain.create(self.apiclient,
|
self.cdomain_2 = Domain.create(
|
||||||
|
self.apiclient,
|
||||||
services=self.services["domain"],
|
services=self.services["domain"],
|
||||||
parentdomainid=self.parent_domain.id)
|
parentdomainid=self.parent_domain.id)
|
||||||
|
|
||||||
self.cadmin_1 = Account.create(self.apiclient, self.services["account"],
|
self.cadmin_1 = Account.create(
|
||||||
admin=True, domainid=self.cdomain_1.id)
|
self.apiclient,
|
||||||
|
self.services["account"],
|
||||||
|
admin=True,
|
||||||
|
domainid=self.cdomain_1.id)
|
||||||
|
|
||||||
self.cadmin_2 = Account.create(self.apiclient, self.services["account"],
|
self.cadmin_2 = Account.create(
|
||||||
admin=True, domainid=self.cdomain_2.id)
|
self.apiclient,
|
||||||
|
self.services["account"],
|
||||||
|
admin=True,
|
||||||
|
domainid=self.cdomain_2.id)
|
||||||
|
|
||||||
# Cleanup the resources created at end of test
|
# Cleanup the resources created at end of test
|
||||||
self.cleanup.append(self.cadmin_1)
|
self.cleanup.append(self.cadmin_1)
|
||||||
@ -204,20 +221,29 @@ class TestMultipleChildDomain(cloudstackTestCase):
|
|||||||
|
|
||||||
# Setting up account and domain hierarchy
|
# Setting up account and domain hierarchy
|
||||||
result = self.setupAccounts()
|
result = self.setupAccounts()
|
||||||
self.assertEqual(result[0], PASS,\
|
self.assertEqual(
|
||||||
"Failure while setting up accounts and domains: %s" % result[1])
|
result[0],
|
||||||
|
PASS,
|
||||||
|
"Failure while setting up accounts and domains: %s" %
|
||||||
|
result[1])
|
||||||
|
|
||||||
templatesize = (self.template.size / (1024 ** 3))
|
templatesize = (self.template.size / (1024 ** 3))
|
||||||
disksize = 10
|
disksize = 10
|
||||||
subdomainlimit = (templatesize + disksize)
|
subdomainlimit = (templatesize + disksize)
|
||||||
|
|
||||||
result = self.updateDomainResourceLimits(((subdomainlimit*3)- 1), subdomainlimit)
|
result = self.updateDomainResourceLimits(
|
||||||
self.assertEqual(result[0], PASS,\
|
((subdomainlimit * 3) - 1),
|
||||||
"Failure while updating resource limits: %s" % result[1])
|
subdomainlimit)
|
||||||
|
self.assertEqual(
|
||||||
|
result[0],
|
||||||
|
PASS,
|
||||||
|
"Failure while updating resource limits: %s" %
|
||||||
|
result[1])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.services["disk_offering"]["disksize"] = disksize
|
self.services["disk_offering"]["disksize"] = disksize
|
||||||
disk_offering_custom = DiskOffering.create(self.apiclient,
|
disk_offering_custom = DiskOffering.create(
|
||||||
|
self.apiclient,
|
||||||
services=self.services["disk_offering"])
|
services=self.services["disk_offering"])
|
||||||
self.cleanup.append(disk_offering_custom)
|
self.cleanup.append(disk_offering_custom)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -227,26 +253,37 @@ class TestMultipleChildDomain(cloudstackTestCase):
|
|||||||
api_client_admin = self.testClient.getUserApiClient(
|
api_client_admin = self.testClient.getUserApiClient(
|
||||||
UserName=self.parentd_admin.name,
|
UserName=self.parentd_admin.name,
|
||||||
DomainName=self.parentd_admin.domain)
|
DomainName=self.parentd_admin.domain)
|
||||||
self.assertNotEqual(api_client_admin, FAILED,\
|
self.assertNotEqual(
|
||||||
"Failed to create api client for account: %s" % self.parentd_admin.name)
|
api_client_admin,
|
||||||
|
FAILED,
|
||||||
|
"Failed to create api client for account: %s" %
|
||||||
|
self.parentd_admin.name)
|
||||||
|
|
||||||
api_client_cadmin_1 = self.testClient.getUserApiClient(
|
api_client_cadmin_1 = self.testClient.getUserApiClient(
|
||||||
UserName=self.cadmin_1.name,
|
UserName=self.cadmin_1.name,
|
||||||
DomainName=self.cadmin_1.domain)
|
DomainName=self.cadmin_1.domain)
|
||||||
self.assertNotEqual(api_client_cadmin_1, FAILED,\
|
self.assertNotEqual(
|
||||||
"Failed to create api client for account: %s" % self.cadmin_1.name)
|
api_client_cadmin_1,
|
||||||
|
FAILED,
|
||||||
|
"Failed to create api client for account: %s" %
|
||||||
|
self.cadmin_1.name)
|
||||||
|
|
||||||
api_client_cadmin_2 = self.testClient.getUserApiClient(
|
api_client_cadmin_2 = self.testClient.getUserApiClient(
|
||||||
UserName=self.cadmin_2.name,
|
UserName=self.cadmin_2.name,
|
||||||
DomainName=self.cadmin_2.domain)
|
DomainName=self.cadmin_2.domain)
|
||||||
self.assertNotEqual(api_client_cadmin_2, FAILED,\
|
self.assertNotEqual(
|
||||||
"Failed to create api client for account: %s" % self.cadmin_2.name)
|
api_client_cadmin_2,
|
||||||
|
FAILED,
|
||||||
|
"Failed to create api client for account: %s" %
|
||||||
|
self.cadmin_2.name)
|
||||||
|
|
||||||
VirtualMachine.create(
|
VirtualMachine.create(
|
||||||
api_client_cadmin_1, self.services["virtual_machine"],
|
api_client_cadmin_1,
|
||||||
accountid=self.cadmin_1.name, domainid=self.cadmin_1.domainid,
|
self.services["virtual_machine"],
|
||||||
diskofferingid=disk_offering_custom.id, serviceofferingid=self.service_offering.id
|
accountid=self.cadmin_1.name,
|
||||||
)
|
domainid=self.cadmin_1.domainid,
|
||||||
|
diskofferingid=disk_offering_custom.id,
|
||||||
|
serviceofferingid=self.service_offering.id)
|
||||||
|
|
||||||
self.initialResourceCount = (templatesize + disksize)
|
self.initialResourceCount = (templatesize + disksize)
|
||||||
result = isDomainResourceCountEqualToExpectedCount(
|
result = isDomainResourceCountEqualToExpectedCount(
|
||||||
@ -257,20 +294,24 @@ class TestMultipleChildDomain(cloudstackTestCase):
|
|||||||
|
|
||||||
# Create VM in second child domain
|
# Create VM in second child domain
|
||||||
vm_2 = VirtualMachine.create(
|
vm_2 = VirtualMachine.create(
|
||||||
api_client_cadmin_2, self.services["virtual_machine"],
|
api_client_cadmin_2,
|
||||||
accountid=self.cadmin_2.name, domainid=self.cadmin_2.domainid,
|
self.services["virtual_machine"],
|
||||||
diskofferingid=disk_offering_custom.id, serviceofferingid=self.service_offering.id
|
accountid=self.cadmin_2.name,
|
||||||
)
|
domainid=self.cadmin_2.domainid,
|
||||||
|
diskofferingid=disk_offering_custom.id,
|
||||||
|
serviceofferingid=self.service_offering.id)
|
||||||
|
|
||||||
# Now the VMs in two child domains have exhausted the primary storage limit
|
# Now the VMs in two child domains have exhausted the primary storage limit
|
||||||
# of parent domain, hence VM creation in parent domain with custom disk offering
|
# of parent domain, hence VM creation in parent domain with custom disk offering
|
||||||
# should fail
|
# should fail
|
||||||
with self.assertRaises(Exception):
|
with self.assertRaises(Exception):
|
||||||
VirtualMachine.create(
|
VirtualMachine.create(
|
||||||
api_client_admin, self.services["virtual_machine"],
|
api_client_admin,
|
||||||
accountid=self.parentd_admin.name, domainid=self.parentd_admin.domainid,
|
self.services["virtual_machine"],
|
||||||
diskofferingid=disk_offering_custom.id, serviceofferingid=self.service_offering.id
|
accountid=self.parentd_admin.name,
|
||||||
)
|
domainid=self.parentd_admin.domainid,
|
||||||
|
diskofferingid=disk_offering_custom.id,
|
||||||
|
serviceofferingid=self.service_offering.id)
|
||||||
|
|
||||||
# Deleting user account
|
# Deleting user account
|
||||||
self.cadmin_1.delete(self.apiclient)
|
self.cadmin_1.delete(self.apiclient)
|
||||||
@ -315,8 +356,11 @@ class TestMultipleChildDomain(cloudstackTestCase):
|
|||||||
|
|
||||||
# Setting up account and domain hierarchy
|
# Setting up account and domain hierarchy
|
||||||
result = self.setupAccounts()
|
result = self.setupAccounts()
|
||||||
self.assertEqual(result[0], PASS,\
|
self.assertEqual(
|
||||||
"Failure while setting up accounts and domains: %s" % result[1])
|
result[0],
|
||||||
|
PASS,
|
||||||
|
"Failure while setting up accounts and domains: %s" %
|
||||||
|
result[1])
|
||||||
users = result[2]
|
users = result[2]
|
||||||
|
|
||||||
templatesize = (self.template.size / (1024 ** 3))
|
templatesize = (self.template.size / (1024 ** 3))
|
||||||
@ -328,14 +372,19 @@ class TestMultipleChildDomain(cloudstackTestCase):
|
|||||||
apiclient = self.testClient.getUserApiClient(
|
apiclient = self.testClient.getUserApiClient(
|
||||||
UserName=self.account.name,
|
UserName=self.account.name,
|
||||||
DomainName=self.account.domain)
|
DomainName=self.account.domain)
|
||||||
self.assertNotEqual(apiclient, FAILED,\
|
self.assertNotEqual(
|
||||||
"Failed to create api client for account: %s" % self.account.name)
|
apiclient,
|
||||||
|
FAILED,
|
||||||
|
"Failed to create api client for account: %s" %
|
||||||
|
self.account.name)
|
||||||
try:
|
try:
|
||||||
vm = VirtualMachine.create(
|
vm = VirtualMachine.create(
|
||||||
apiclient, self.services["virtual_machine"],
|
apiclient,
|
||||||
accountid=self.account.name, domainid=self.account.domainid,
|
self.services["virtual_machine"],
|
||||||
diskofferingid=self.disk_offering.id, serviceofferingid=self.service_offering.id
|
accountid=self.account.name,
|
||||||
)
|
domainid=self.account.domainid,
|
||||||
|
diskofferingid=self.disk_offering.id,
|
||||||
|
serviceofferingid=self.service_offering.id)
|
||||||
|
|
||||||
expectedCount = templatesize + self.disk_offering.disksize
|
expectedCount = templatesize + self.disk_offering.disksize
|
||||||
result = isDomainResourceCountEqualToExpectedCount(
|
result = isDomainResourceCountEqualToExpectedCount(
|
||||||
@ -346,16 +395,19 @@ class TestMultipleChildDomain(cloudstackTestCase):
|
|||||||
|
|
||||||
# Creating service offering with 10 GB volume
|
# Creating service offering with 10 GB volume
|
||||||
self.services["disk_offering"]["disksize"] = 10
|
self.services["disk_offering"]["disksize"] = 10
|
||||||
disk_offering_10_GB = DiskOffering.create(self.apiclient,
|
disk_offering_10_GB = DiskOffering.create(
|
||||||
|
self.apiclient,
|
||||||
services=self.services["disk_offering"])
|
services=self.services["disk_offering"])
|
||||||
|
|
||||||
self.cleanup.append(disk_offering_10_GB)
|
self.cleanup.append(disk_offering_10_GB)
|
||||||
|
|
||||||
volume = Volume.create(
|
volume = Volume.create(
|
||||||
apiclient, self.services["volume"],
|
apiclient,
|
||||||
zoneid=self.zone.id, account=self.account.name,
|
self.services["volume"],
|
||||||
domainid=self.account.domainid, diskofferingid=disk_offering_10_GB.id
|
zoneid=self.zone.id,
|
||||||
)
|
account=self.account.name,
|
||||||
|
domainid=self.account.domainid,
|
||||||
|
diskofferingid=disk_offering_10_GB.id)
|
||||||
|
|
||||||
volumeSize = (volume.size / (1024 ** 3))
|
volumeSize = (volume.size / (1024 ** 3))
|
||||||
expectedCount += volumeSize
|
expectedCount += volumeSize
|
||||||
@ -397,7 +449,9 @@ class TestMultipleChildDomain(cloudstackTestCase):
|
|||||||
# Setting up account and domain hierarchy
|
# Setting up account and domain hierarchy
|
||||||
result = self.setupAccounts()
|
result = self.setupAccounts()
|
||||||
if result[0] == FAIL:
|
if result[0] == FAIL:
|
||||||
self.fail("Failure while setting up accounts and domains: %s" % result[1])
|
self.fail(
|
||||||
|
"Failure while setting up accounts and domains: %s" %
|
||||||
|
result[1])
|
||||||
else:
|
else:
|
||||||
users = result[2]
|
users = result[2]
|
||||||
|
|
||||||
@ -410,15 +464,20 @@ class TestMultipleChildDomain(cloudstackTestCase):
|
|||||||
apiclient = self.testClient.getUserApiClient(
|
apiclient = self.testClient.getUserApiClient(
|
||||||
UserName=self.account.name,
|
UserName=self.account.name,
|
||||||
DomainName=self.account.domain)
|
DomainName=self.account.domain)
|
||||||
self.assertNotEqual(apiclient, FAILED,\
|
self.assertNotEqual(
|
||||||
"Failed to create api client for account: %s" % self.account.name)
|
apiclient,
|
||||||
|
FAILED,
|
||||||
|
"Failed to create api client for account: %s" %
|
||||||
|
self.account.name)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
vm = VirtualMachine.create(
|
vm = VirtualMachine.create(
|
||||||
apiclient, self.services["virtual_machine"],
|
apiclient,
|
||||||
accountid=self.account.name, domainid=self.account.domainid,
|
self.services["virtual_machine"],
|
||||||
diskofferingid=self.disk_offering.id, serviceofferingid=self.service_offering.id
|
accountid=self.account.name,
|
||||||
)
|
domainid=self.account.domainid,
|
||||||
|
diskofferingid=self.disk_offering.id,
|
||||||
|
serviceofferingid=self.service_offering.id)
|
||||||
|
|
||||||
expectedCount = templatesize + self.disk_offering.disksize
|
expectedCount = templatesize + self.disk_offering.disksize
|
||||||
result = isDomainResourceCountEqualToExpectedCount(
|
result = isDomainResourceCountEqualToExpectedCount(
|
||||||
@ -428,28 +487,34 @@ class TestMultipleChildDomain(cloudstackTestCase):
|
|||||||
self.assertTrue(result[2], "Resource count does not match")
|
self.assertTrue(result[2], "Resource count does not match")
|
||||||
|
|
||||||
volume1size = self.services["disk_offering"]["disksize"] = 15
|
volume1size = self.services["disk_offering"]["disksize"] = 15
|
||||||
disk_offering_15_GB = DiskOffering.create(self.apiclient,
|
disk_offering_15_GB = DiskOffering.create(
|
||||||
|
self.apiclient,
|
||||||
services=self.services["disk_offering"])
|
services=self.services["disk_offering"])
|
||||||
|
|
||||||
self.cleanup.append(disk_offering_15_GB)
|
self.cleanup.append(disk_offering_15_GB)
|
||||||
|
|
||||||
volume2size = self.services["disk_offering"]["disksize"] = 20
|
volume2size = self.services["disk_offering"]["disksize"] = 20
|
||||||
disk_offering_20_GB = DiskOffering.create(self.apiclient,
|
disk_offering_20_GB = DiskOffering.create(
|
||||||
|
self.apiclient,
|
||||||
services=self.services["disk_offering"])
|
services=self.services["disk_offering"])
|
||||||
|
|
||||||
self.cleanup.append(disk_offering_20_GB)
|
self.cleanup.append(disk_offering_20_GB)
|
||||||
|
|
||||||
volume_1 = Volume.create(
|
volume_1 = Volume.create(
|
||||||
apiclient, self.services["volume"],
|
apiclient,
|
||||||
zoneid=self.zone.id, account=self.account.name,
|
self.services["volume"],
|
||||||
domainid=self.account.domainid, diskofferingid=disk_offering_15_GB.id
|
zoneid=self.zone.id,
|
||||||
)
|
account=self.account.name,
|
||||||
|
domainid=self.account.domainid,
|
||||||
|
diskofferingid=disk_offering_15_GB.id)
|
||||||
|
|
||||||
volume_2 = Volume.create(
|
volume_2 = Volume.create(
|
||||||
apiclient, self.services["volume"],
|
apiclient,
|
||||||
zoneid=self.zone.id, account=self.account.name,
|
self.services["volume"],
|
||||||
domainid=self.account.domainid, diskofferingid=disk_offering_20_GB.id
|
zoneid=self.zone.id,
|
||||||
)
|
account=self.account.name,
|
||||||
|
domainid=self.account.domainid,
|
||||||
|
diskofferingid=disk_offering_20_GB.id)
|
||||||
|
|
||||||
vm.attach_volume(apiclient, volume=volume_1)
|
vm.attach_volume(apiclient, volume=volume_1)
|
||||||
vm.attach_volume(apiclient, volume=volume_2)
|
vm.attach_volume(apiclient, volume=volume_2)
|
||||||
@ -498,9 +563,14 @@ class TestMultipleChildDomain(cloudstackTestCase):
|
|||||||
# 5. Delete volume which was created from snapshot and verify primary storage
|
# 5. Delete volume which was created from snapshot and verify primary storage
|
||||||
resource count"""
|
resource count"""
|
||||||
|
|
||||||
|
if self.hypervisor.lower() in ['hyperv']:
|
||||||
|
self.skipTest("Snapshots feature is not supported on Hyper-V")
|
||||||
|
|
||||||
result = self.setupAccounts()
|
result = self.setupAccounts()
|
||||||
if result[0] == FAIL:
|
if result[0] == FAIL:
|
||||||
self.fail("Failure while setting up accounts and domains: %s" % result[1])
|
self.fail(
|
||||||
|
"Failure while setting up accounts and domains: %s" %
|
||||||
|
result[1])
|
||||||
users = result[2]
|
users = result[2]
|
||||||
|
|
||||||
for domain, admin in users.items():
|
for domain, admin in users.items():
|
||||||
@ -511,18 +581,24 @@ class TestMultipleChildDomain(cloudstackTestCase):
|
|||||||
apiclient = self.testClient.getUserApiClient(
|
apiclient = self.testClient.getUserApiClient(
|
||||||
UserName=self.account.name,
|
UserName=self.account.name,
|
||||||
DomainName=self.account.domain)
|
DomainName=self.account.domain)
|
||||||
self.assertNotEqual(apiclient, FAILED,\
|
self.assertNotEqual(
|
||||||
"Failed to create api client for account: %s" % self.account.name)
|
apiclient,
|
||||||
|
FAILED,
|
||||||
|
"Failed to create api client for account: %s" %
|
||||||
|
self.account.name)
|
||||||
|
|
||||||
vm = VirtualMachine.create(
|
vm = VirtualMachine.create(
|
||||||
apiclient, self.services["virtual_machine"],
|
apiclient,
|
||||||
accountid=self.account.name, domainid=self.account.domainid,
|
self.services["virtual_machine"],
|
||||||
diskofferingid=self.disk_offering.id, serviceofferingid=self.service_offering.id
|
accountid=self.account.name,
|
||||||
)
|
domainid=self.account.domainid,
|
||||||
|
diskofferingid=self.disk_offering.id,
|
||||||
|
serviceofferingid=self.service_offering.id)
|
||||||
|
|
||||||
templatesize = (self.template.size / (1024 ** 3))
|
templatesize = (self.template.size / (1024 ** 3))
|
||||||
|
|
||||||
initialResourceCount = expectedCount = templatesize + self.disk_offering.disksize
|
initialResourceCount = expectedCount = templatesize + \
|
||||||
|
self.disk_offering.disksize
|
||||||
result = isDomainResourceCountEqualToExpectedCount(
|
result = isDomainResourceCountEqualToExpectedCount(
|
||||||
self.apiclient, self.domain.id,
|
self.apiclient, self.domain.id,
|
||||||
initialResourceCount, RESOURCE_PRIMARY_STORAGE)
|
initialResourceCount, RESOURCE_PRIMARY_STORAGE)
|
||||||
@ -531,15 +607,22 @@ class TestMultipleChildDomain(cloudstackTestCase):
|
|||||||
|
|
||||||
vm.stop(self.apiclient)
|
vm.stop(self.apiclient)
|
||||||
|
|
||||||
response = createSnapshotFromVirtualMachineVolume(apiclient, self.account, vm.id)
|
response = createSnapshotFromVirtualMachineVolume(
|
||||||
|
apiclient,
|
||||||
|
self.account,
|
||||||
|
vm.id)
|
||||||
self.assertEqual(response[0], PASS, response[1])
|
self.assertEqual(response[0], PASS, response[1])
|
||||||
snapshot = response[1]
|
snapshot = response[1]
|
||||||
|
|
||||||
response = snapshot.validateState(apiclient, Snapshot.BACKED_UP)
|
response = snapshot.validateState(
|
||||||
|
apiclient,
|
||||||
|
Snapshot.BACKED_UP)
|
||||||
self.assertEqual(response[0], PASS, response[1])
|
self.assertEqual(response[0], PASS, response[1])
|
||||||
|
|
||||||
self.services["volume"]["size"] = self.services["disk_offering"]["disksize"]
|
self.services["volume"]["size"] = self.services[
|
||||||
volume = Volume.create_from_snapshot(apiclient,
|
"disk_offering"]["disksize"]
|
||||||
|
volume = Volume.create_from_snapshot(
|
||||||
|
apiclient,
|
||||||
snapshot_id=snapshot.id,
|
snapshot_id=snapshot.id,
|
||||||
services=self.services["volume"],
|
services=self.services["volume"],
|
||||||
account=self.account.name,
|
account=self.account.name,
|
||||||
@ -592,15 +675,20 @@ class TestMultipleChildDomain(cloudstackTestCase):
|
|||||||
apiclient = self.testClient.getUserApiClient(
|
apiclient = self.testClient.getUserApiClient(
|
||||||
UserName=self.cadmin_1.name,
|
UserName=self.cadmin_1.name,
|
||||||
DomainName=self.cadmin_1.domain)
|
DomainName=self.cadmin_1.domain)
|
||||||
self.assertNotEqual(apiclient, FAILED,\
|
self.assertNotEqual(
|
||||||
"Failed to create api client for account: %s" % self.cadmin_1.name)
|
apiclient,
|
||||||
|
FAILED,
|
||||||
|
"Failed to create api client for account: %s" %
|
||||||
|
self.cadmin_1.name)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
vm_1 = VirtualMachine.create(
|
vm_1 = VirtualMachine.create(
|
||||||
apiclient, self.services["virtual_machine"],
|
apiclient,
|
||||||
accountid=self.cadmin_1.name, domainid=self.cadmin_1.domainid,
|
self.services["virtual_machine"],
|
||||||
diskofferingid=self.disk_offering.id, serviceofferingid=self.service_offering.id
|
accountid=self.cadmin_1.name,
|
||||||
)
|
domainid=self.cadmin_1.domainid,
|
||||||
|
diskofferingid=self.disk_offering.id,
|
||||||
|
serviceofferingid=self.service_offering.id)
|
||||||
|
|
||||||
templatesize = (self.template.size / (1024 ** 3))
|
templatesize = (self.template.size / (1024 ** 3))
|
||||||
|
|
||||||
@ -612,7 +700,9 @@ class TestMultipleChildDomain(cloudstackTestCase):
|
|||||||
self.assertTrue(result[2], "Resource count does not match")
|
self.assertTrue(result[2], "Resource count does not match")
|
||||||
|
|
||||||
vm_1.stop(apiclient)
|
vm_1.stop(apiclient)
|
||||||
vm_1.assign_virtual_machine(self.apiclient, account=self.cadmin_2.name,
|
vm_1.assign_virtual_machine(
|
||||||
|
self.apiclient,
|
||||||
|
account=self.cadmin_2.name,
|
||||||
domainid=self.cadmin_2.domainid)
|
domainid=self.cadmin_2.domainid)
|
||||||
|
|
||||||
result = isDomainResourceCountEqualToExpectedCount(
|
result = isDomainResourceCountEqualToExpectedCount(
|
||||||
@ -656,10 +746,12 @@ class TestMultipleChildDomain(cloudstackTestCase):
|
|||||||
self.domain = domain
|
self.domain = domain
|
||||||
try:
|
try:
|
||||||
vm_1 = VirtualMachine.create(
|
vm_1 = VirtualMachine.create(
|
||||||
self.apiclient, self.services["virtual_machine"],
|
self.apiclient,
|
||||||
accountid=self.account.name, domainid=self.account.domainid,
|
self.services["virtual_machine"],
|
||||||
diskofferingid=self.disk_offering.id, serviceofferingid=self.service_offering.id
|
accountid=self.account.name,
|
||||||
)
|
domainid=self.account.domainid,
|
||||||
|
diskofferingid=self.disk_offering.id,
|
||||||
|
serviceofferingid=self.service_offering.id)
|
||||||
|
|
||||||
templatesize = (self.template.size / (1024 ** 3))
|
templatesize = (self.template.size / (1024 ** 3))
|
||||||
|
|
||||||
|
|||||||
@ -56,6 +56,7 @@ class TestVolumeLimits(cloudstackTestCase):
|
|||||||
cloudstackTestClient = super(TestVolumeLimits,
|
cloudstackTestClient = super(TestVolumeLimits,
|
||||||
cls).getClsTestClient()
|
cls).getClsTestClient()
|
||||||
cls.api_client = cloudstackTestClient.getApiClient()
|
cls.api_client = cloudstackTestClient.getApiClient()
|
||||||
|
cls.hypervisor = cloudstackTestClient.getHypervisorInfo()
|
||||||
# Fill services from the external config file
|
# Fill services from the external config file
|
||||||
cls.services = cloudstackTestClient.getParsedTestDataConfig()
|
cls.services = cloudstackTestClient.getParsedTestDataConfig()
|
||||||
# Get Zone, Domain and templates
|
# Get Zone, Domain and templates
|
||||||
@ -505,7 +506,8 @@ class TestVolumeLimits(cloudstackTestCase):
|
|||||||
# 3. Create volume againt from this snapshto and attach to VM
|
# 3. Create volume againt from this snapshto and attach to VM
|
||||||
# 4. Verify that primary storage count increases by the volume size
|
# 4. Verify that primary storage count increases by the volume size
|
||||||
# 5. Detach and delete volume, verify primary storage count decreaes by volume size"""
|
# 5. Detach and delete volume, verify primary storage count decreaes by volume size"""
|
||||||
|
if self.hypervisor.lower() in ['hyperv']:
|
||||||
|
self.skipTest("Snapshots feature is not supported on Hyper-V")
|
||||||
response = self.setupAccount(value)
|
response = self.setupAccount(value)
|
||||||
self.debug(response[0])
|
self.debug(response[0])
|
||||||
self.debug(response[1])
|
self.debug(response[1])
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
"""
|
"""
|
||||||
#Import Local Modules
|
#Import Local Modules
|
||||||
from nose.plugins.attrib import attr
|
from nose.plugins.attrib import attr
|
||||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
from marvin.cloudstackTestCase import cloudstackTestCase,unittest
|
||||||
from marvin.lib.base import (VirtualMachine,
|
from marvin.lib.base import (VirtualMachine,
|
||||||
Snapshot,
|
Snapshot,
|
||||||
Template,
|
Template,
|
||||||
@ -129,7 +129,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
|
|||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
cls.testClient = super(TestResourceLimitsAccount, cls).getClsTestClient()
|
cls.testClient = super(TestResourceLimitsAccount, cls).getClsTestClient()
|
||||||
cls.api_client = cls.testClient.getApiClient()
|
cls.api_client = cls.testClient.getApiClient()
|
||||||
|
cls.hypervisor = cls.testClient.getHypervisorInfo()
|
||||||
cls.services = Services().services
|
cls.services = Services().services
|
||||||
# Get Zone, Domain and templates
|
# Get Zone, Domain and templates
|
||||||
cls.domain = get_domain(cls.api_client)
|
cls.domain = get_domain(cls.api_client)
|
||||||
@ -448,6 +448,8 @@ class TestResourceLimitsAccount(cloudstackTestCase):
|
|||||||
# 5. Create 2 snapshot in account 2. Verify account 2 should be able to
|
# 5. Create 2 snapshot in account 2. Verify account 2 should be able to
|
||||||
# create snapshots without any warning
|
# create snapshots without any warning
|
||||||
|
|
||||||
|
if self.hypervisor.lower() in ['hyperv']:
|
||||||
|
self.skipTest("Snapshots feature is not supported on Hyper-V")
|
||||||
self.debug(
|
self.debug(
|
||||||
"Updating public IP resource limit for account: %s" %
|
"Updating public IP resource limit for account: %s" %
|
||||||
self.account_1.name)
|
self.account_1.name)
|
||||||
@ -914,7 +916,7 @@ class TestResourceLimitsDomain(cloudstackTestCase):
|
|||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
cls.testClient = super(TestResourceLimitsDomain, cls).getClsTestClient()
|
cls.testClient = super(TestResourceLimitsDomain, cls).getClsTestClient()
|
||||||
cls.api_client = cls.testClient.getApiClient()
|
cls.api_client = cls.testClient.getApiClient()
|
||||||
|
cls.hypervisor = cls.testClient.getHypervisorInfo()
|
||||||
cls.services = Services().services
|
cls.services = Services().services
|
||||||
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
|
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
|
||||||
cls.services['mode'] = cls.zone.networktype
|
cls.services['mode'] = cls.zone.networktype
|
||||||
@ -1132,7 +1134,8 @@ class TestResourceLimitsDomain(cloudstackTestCase):
|
|||||||
# created
|
# created
|
||||||
# 5. Try to create another snapshot in this domain. It should give the
|
# 5. Try to create another snapshot in this domain. It should give the
|
||||||
# user an appropriate error and an alert should be generated.
|
# user an appropriate error and an alert should be generated.
|
||||||
|
if self.hypervisor.lower() in ['hyperv']:
|
||||||
|
self.skipTest("Snapshots feature is not supported on Hyper-V")
|
||||||
self.debug(
|
self.debug(
|
||||||
"Updating snapshot resource limits for domain: %s" %
|
"Updating snapshot resource limits for domain: %s" %
|
||||||
self.account.domainid)
|
self.account.domainid)
|
||||||
|
|||||||
@ -48,8 +48,8 @@ from marvin.cloudstackAPI import detachVolume
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Services:
|
class Services:
|
||||||
|
|
||||||
"""Test Snapshots Services
|
"""Test Snapshots Services
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -116,7 +116,8 @@ class Services:
|
|||||||
"maxsnaps": 1, # Should be min 2
|
"maxsnaps": 1, # Should be min 2
|
||||||
"schedule": 1,
|
"schedule": 1,
|
||||||
"timezone": 'US/Arizona',
|
"timezone": 'US/Arizona',
|
||||||
# Timezone Formats - http://cloud.mindtouch.us/CloudStack_Documentation/Developer's_Guide%3A_CloudStack
|
# Timezone Formats -
|
||||||
|
# http://cloud.mindtouch.us/CloudStack_Documentation/Developer's_Guide%3A_CloudStack
|
||||||
},
|
},
|
||||||
"templates": {
|
"templates": {
|
||||||
"displaytext": 'Template',
|
"displaytext": 'Template',
|
||||||
@ -177,7 +178,8 @@ class TestSnapshots(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
cls.services["domainid"] = cls.domain.id
|
cls.services["domainid"] = cls.domain.id
|
||||||
cls.services["volume"]["zoneid"] = cls.services["server_with_disk"]["zoneid"] = cls.zone.id
|
cls.services["volume"]["zoneid"] = cls.services[
|
||||||
|
"server_with_disk"]["zoneid"] = cls.zone.id
|
||||||
cls.services["server_with_disk"]["diskoffering"] = cls.disk_offering.id
|
cls.services["server_with_disk"]["diskoffering"] = cls.disk_offering.id
|
||||||
|
|
||||||
cls.services["server_without_disk"]["zoneid"] = cls.zone.id
|
cls.services["server_without_disk"]["zoneid"] = cls.zone.id
|
||||||
@ -286,18 +288,31 @@ class TestSnapshots(cloudstackTestCase):
|
|||||||
snapshot.id,
|
snapshot.id,
|
||||||
"Check resource id in list resources call"
|
"Check resource id in list resources call"
|
||||||
)
|
)
|
||||||
self.assertTrue(is_snapshot_on_nfs(self.apiclient, self.dbclient, self.config, self.zone.id, snapshot.id))
|
self.assertTrue(
|
||||||
|
is_snapshot_on_nfs(
|
||||||
|
self.apiclient,
|
||||||
|
self.dbclient,
|
||||||
|
self.config,
|
||||||
|
self.zone.id,
|
||||||
|
snapshot.id))
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(speed="slow")
|
@attr(speed="slow")
|
||||||
@attr(tags=["advanced", "advancedns", "basic", "sg"], required_hardware="true")
|
@attr(
|
||||||
|
tags=[
|
||||||
|
"advanced",
|
||||||
|
"advancedns",
|
||||||
|
"basic",
|
||||||
|
"sg"],
|
||||||
|
required_hardware="true")
|
||||||
def test_01_volume_from_snapshot(self):
|
def test_01_volume_from_snapshot(self):
|
||||||
"""Test Creating snapshot from volume having spaces in name(KVM)
|
"""Test Creating snapshot from volume having spaces in name(KVM)
|
||||||
"""
|
"""
|
||||||
# Validate the following
|
# Validate the following
|
||||||
# 1. Create a virtual machine and data volume
|
# 1. Create a virtual machine and data volume
|
||||||
# 2. Attach data volume to VM
|
# 2. Attach data volume to VM
|
||||||
#3. Login to machine; create temp/test directories on data volume and write some random data
|
# 3. Login to machine; create temp/test directories on data volume
|
||||||
|
# and write some random data
|
||||||
# 4. Snapshot the Volume
|
# 4. Snapshot the Volume
|
||||||
# 5. Create another Volume from snapshot
|
# 5. Create another Volume from snapshot
|
||||||
# 6. Mount/Attach volume to another virtual machine
|
# 6. Mount/Attach volume to another virtual machine
|
||||||
@ -331,48 +346,45 @@ class TestSnapshots(cloudstackTestCase):
|
|||||||
self.debug("Attach volume: %s to VM: %s" %
|
self.debug("Attach volume: %s to VM: %s" %
|
||||||
(volume.id, self.virtual_machine.id))
|
(volume.id, self.virtual_machine.id))
|
||||||
|
|
||||||
|
|
||||||
self.debug("Formatting volume: %s to ext3" % volume.id)
|
self.debug("Formatting volume: %s to ext3" % volume.id)
|
||||||
# Format partition using ext3
|
# Format partition using ext3
|
||||||
# Note that this is the second data disk partition of virtual machine as it was already containing
|
# Note that this is the second data disk partition of virtual machine
|
||||||
# data disk before attaching the new volume, Hence datadiskdevice_2
|
# as it was already containing data disk before attaching the new
|
||||||
|
# volume, Hence datadiskdevice_2
|
||||||
format_volume_to_ext3(
|
format_volume_to_ext3(
|
||||||
ssh_client,
|
ssh_client,
|
||||||
self.services["volume"][self.hypervisor]["datadiskdevice_2"]
|
self.services["volume"][self.hypervisor]["datadiskdevice_2"]
|
||||||
)
|
)
|
||||||
cmds = [ "fdisk -l",
|
cmds = [
|
||||||
"mkdir -p %s" % self.services["paths"]["mount_dir"],
|
"fdisk -l",
|
||||||
"mount -t ext3 %s1 %s" % (
|
"mkdir -p %s" %
|
||||||
self.services["volume"][self.hypervisor]["datadiskdevice_2"],
|
self.services["paths"]["mount_dir"],
|
||||||
self.services["paths"]["mount_dir"]
|
"mount -t ext3 %s1 %s" %
|
||||||
),
|
(self.services["volume"][
|
||||||
"mkdir -p %s/%s/{%s,%s} " % (
|
self.hypervisor]["datadiskdevice_2"],
|
||||||
|
self.services["paths"]["mount_dir"]),
|
||||||
|
"mkdir -p %s/%s/{%s,%s} " %
|
||||||
|
(self.services["paths"]["mount_dir"],
|
||||||
|
self.services["paths"]["sub_dir"],
|
||||||
|
self.services["paths"]["sub_lvl_dir1"],
|
||||||
|
self.services["paths"]["sub_lvl_dir2"]),
|
||||||
|
"echo %s > %s/%s/%s/%s" %
|
||||||
|
(random_data_0,
|
||||||
self.services["paths"]["mount_dir"],
|
self.services["paths"]["mount_dir"],
|
||||||
self.services["paths"]["sub_dir"],
|
self.services["paths"]["sub_dir"],
|
||||||
self.services["paths"]["sub_lvl_dir1"],
|
self.services["paths"]["sub_lvl_dir1"],
|
||||||
self.services["paths"]["sub_lvl_dir2"]
|
self.services["paths"]["random_data"]),
|
||||||
),
|
"echo %s > %s/%s/%s/%s" %
|
||||||
"echo %s > %s/%s/%s/%s" % (
|
(random_data_1,
|
||||||
random_data_0,
|
|
||||||
self.services["paths"]["mount_dir"],
|
|
||||||
self.services["paths"]["sub_dir"],
|
|
||||||
self.services["paths"]["sub_lvl_dir1"],
|
|
||||||
self.services["paths"]["random_data"]
|
|
||||||
),
|
|
||||||
"echo %s > %s/%s/%s/%s" % (
|
|
||||||
random_data_1,
|
|
||||||
self.services["paths"]["mount_dir"],
|
self.services["paths"]["mount_dir"],
|
||||||
self.services["paths"]["sub_dir"],
|
self.services["paths"]["sub_dir"],
|
||||||
self.services["paths"]["sub_lvl_dir2"],
|
self.services["paths"]["sub_lvl_dir2"],
|
||||||
self.services["paths"]["random_data"]
|
self.services["paths"]["random_data"]),
|
||||||
),
|
"cat %s/%s/%s/%s" %
|
||||||
"cat %s/%s/%s/%s" % (
|
(self.services["paths"]["mount_dir"],
|
||||||
self.services["paths"]["mount_dir"],
|
|
||||||
self.services["paths"]["sub_dir"],
|
self.services["paths"]["sub_dir"],
|
||||||
self.services["paths"]["sub_lvl_dir1"],
|
self.services["paths"]["sub_lvl_dir1"],
|
||||||
self.services["paths"]["random_data"]
|
self.services["paths"]["random_data"])]
|
||||||
)
|
|
||||||
]
|
|
||||||
for c in cmds:
|
for c in cmds:
|
||||||
self.debug("Command: %s" % c)
|
self.debug("Command: %s" % c)
|
||||||
result = ssh_client.execute(c)
|
result = ssh_client.execute(c)
|
||||||
@ -479,13 +491,16 @@ class TestSnapshots(cloudstackTestCase):
|
|||||||
# Login to VM to verify test directories and files
|
# Login to VM to verify test directories and files
|
||||||
ssh = new_virtual_machine.get_ssh_client()
|
ssh = new_virtual_machine.get_ssh_client()
|
||||||
|
|
||||||
# Mount datadiskdevice_1 because this is the first data disk of the new virtual machine
|
# Mount datadiskdevice_1 because this is the first data disk of the
|
||||||
cmds = ["fdisk -l",
|
# new virtual machine
|
||||||
"mkdir -p %s" % self.services["paths"]["mount_dir"],
|
cmds = [
|
||||||
"mount -t ext3 %s1 %s" % (
|
"fdisk -l",
|
||||||
self.services["volume"][self.hypervisor]["datadiskdevice_1"],
|
"mkdir -p %s" %
|
||||||
self.services["paths"]["mount_dir"]
|
self.services["paths"]["mount_dir"],
|
||||||
),
|
"mount -t ext3 %s1 %s" %
|
||||||
|
(self.services["volume"][
|
||||||
|
self.hypervisor]["datadiskdevice_1"],
|
||||||
|
self.services["paths"]["mount_dir"]),
|
||||||
]
|
]
|
||||||
|
|
||||||
for c in cmds:
|
for c in cmds:
|
||||||
@ -590,11 +605,23 @@ class TestSnapshots(cloudstackTestCase):
|
|||||||
None,
|
None,
|
||||||
"Check if result exists in list item call"
|
"Check if result exists in list item call"
|
||||||
)
|
)
|
||||||
self.assertFalse(is_snapshot_on_nfs(self.apiclient, self.dbclient, self.config, self.zone.id, snapshot.id))
|
self.assertFalse(
|
||||||
|
is_snapshot_on_nfs(
|
||||||
|
self.apiclient,
|
||||||
|
self.dbclient,
|
||||||
|
self.config,
|
||||||
|
self.zone.id,
|
||||||
|
snapshot.id))
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(speed="slow")
|
@attr(speed="slow")
|
||||||
@attr(tags=["advanced", "advancedns", "basic", "sg"], required_hardware="true")
|
@attr(
|
||||||
|
tags=[
|
||||||
|
"advanced",
|
||||||
|
"advancedns",
|
||||||
|
"basic",
|
||||||
|
"sg"],
|
||||||
|
required_hardware="true")
|
||||||
def test_03_snapshot_detachedDisk(self):
|
def test_03_snapshot_detachedDisk(self):
|
||||||
"""Test snapshot from detached disk
|
"""Test snapshot from detached disk
|
||||||
"""
|
"""
|
||||||
@ -631,31 +658,31 @@ class TestSnapshots(cloudstackTestCase):
|
|||||||
self.services["volume"][self.hypervisor]["datadiskdevice_1"]
|
self.services["volume"][self.hypervisor]["datadiskdevice_1"]
|
||||||
)
|
)
|
||||||
cmds = [
|
cmds = [
|
||||||
"mkdir -p %s" % self.services["paths"]["mount_dir"],
|
"mkdir -p %s" %
|
||||||
"mount %s1 %s" % (
|
self.services["paths"]["mount_dir"],
|
||||||
self.services["volume"][self.hypervisor]["datadiskdevice_1"],
|
"mount %s1 %s" %
|
||||||
self.services["paths"]["mount_dir"]
|
(self.services["volume"][
|
||||||
),
|
self.hypervisor]["datadiskdevice_1"],
|
||||||
"pushd %s" % self.services["paths"]["mount_dir"],
|
self.services["paths"]["mount_dir"]),
|
||||||
"mkdir -p %s/{%s,%s} " % (
|
"pushd %s" %
|
||||||
|
self.services["paths"]["mount_dir"],
|
||||||
|
"mkdir -p %s/{%s,%s} " %
|
||||||
|
(self.services["paths"]["sub_dir"],
|
||||||
|
self.services["paths"]["sub_lvl_dir1"],
|
||||||
|
self.services["paths"]["sub_lvl_dir2"]),
|
||||||
|
"echo %s > %s/%s/%s" %
|
||||||
|
(random_data_0,
|
||||||
self.services["paths"]["sub_dir"],
|
self.services["paths"]["sub_dir"],
|
||||||
self.services["paths"]["sub_lvl_dir1"],
|
self.services["paths"]["sub_lvl_dir1"],
|
||||||
self.services["paths"]["sub_lvl_dir2"]
|
self.services["paths"]["random_data"]),
|
||||||
),
|
"echo %s > %s/%s/%s" %
|
||||||
"echo %s > %s/%s/%s" % (
|
(random_data_1,
|
||||||
random_data_0,
|
|
||||||
self.services["paths"]["sub_dir"],
|
|
||||||
self.services["paths"]["sub_lvl_dir1"],
|
|
||||||
self.services["paths"]["random_data"]
|
|
||||||
),
|
|
||||||
"echo %s > %s/%s/%s" % (
|
|
||||||
random_data_1,
|
|
||||||
self.services["paths"]["sub_dir"],
|
self.services["paths"]["sub_dir"],
|
||||||
self.services["paths"]["sub_lvl_dir2"],
|
self.services["paths"]["sub_lvl_dir2"],
|
||||||
self.services["paths"]["random_data"]
|
self.services["paths"]["random_data"]),
|
||||||
),
|
|
||||||
"sync",
|
"sync",
|
||||||
"umount %s" % (self.services["paths"]["mount_dir"]),
|
"umount %s" %
|
||||||
|
(self.services["paths"]["mount_dir"]),
|
||||||
]
|
]
|
||||||
for c in cmds:
|
for c in cmds:
|
||||||
self.debug(ssh_client.execute(c))
|
self.debug(ssh_client.execute(c))
|
||||||
@ -701,7 +728,7 @@ class TestSnapshots(cloudstackTestCase):
|
|||||||
(self.virtual_machine.ssh_ip, e))
|
(self.virtual_machine.ssh_ip, e))
|
||||||
|
|
||||||
qresultset = self.dbclient.execute(
|
qresultset = self.dbclient.execute(
|
||||||
"select id from snapshots where uuid = '%s';" \
|
"select id from snapshots where uuid = '%s';"
|
||||||
% snapshot.id
|
% snapshot.id
|
||||||
)
|
)
|
||||||
self.assertNotEqual(
|
self.assertNotEqual(
|
||||||
@ -719,7 +746,13 @@ class TestSnapshots(cloudstackTestCase):
|
|||||||
return
|
return
|
||||||
|
|
||||||
@attr(speed="slow")
|
@attr(speed="slow")
|
||||||
@attr(tags=["advanced", "advancedns", "smoke", "xen"], required_hardware="true")
|
@attr(
|
||||||
|
tags=[
|
||||||
|
"advanced",
|
||||||
|
"advancedns",
|
||||||
|
"smoke",
|
||||||
|
"xen"],
|
||||||
|
required_hardware="true")
|
||||||
def test_07_template_from_snapshot(self):
|
def test_07_template_from_snapshot(self):
|
||||||
"""Create Template from snapshot
|
"""Create Template from snapshot
|
||||||
"""
|
"""
|
||||||
@ -729,7 +762,8 @@ class TestSnapshots(cloudstackTestCase):
|
|||||||
# 3. Create Template from snapshot
|
# 3. Create Template from snapshot
|
||||||
# 4. Deploy Virtual machine using this template
|
# 4. Deploy Virtual machine using this template
|
||||||
# 5. Login to newly created virtual machine
|
# 5. Login to newly created virtual machine
|
||||||
#6. Compare data in the root disk with the one that was written on the volume, it should match
|
# 6. Compare data in the root disk with the one that was written on the
|
||||||
|
# volume, it should match
|
||||||
|
|
||||||
userapiclient = self.testClient.getUserApiClient(
|
userapiclient = self.testClient.getUserApiClient(
|
||||||
UserName=self.account.name,
|
UserName=self.account.name,
|
||||||
@ -823,8 +857,7 @@ class TestSnapshots(cloudstackTestCase):
|
|||||||
# Verify created template
|
# Verify created template
|
||||||
templates = list_templates(
|
templates = list_templates(
|
||||||
userapiclient,
|
userapiclient,
|
||||||
templatefilter=\
|
templatefilter=self.services["templates"]["templatefilter"],
|
||||||
self.services["templates"]["templatefilter"],
|
|
||||||
id=template.id
|
id=template.id
|
||||||
)
|
)
|
||||||
self.assertNotEqual(
|
self.assertNotEqual(
|
||||||
@ -912,9 +945,11 @@ class TestCreateVMSnapshotTemplate(cloudstackTestCase):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
cls.testClient = super(TestCreateVMSnapshotTemplate, cls).getClsTestClient()
|
cls.testClient = super(
|
||||||
|
TestCreateVMSnapshotTemplate,
|
||||||
|
cls).getClsTestClient()
|
||||||
cls.api_client = cls.testClient.getApiClient()
|
cls.api_client = cls.testClient.getApiClient()
|
||||||
|
cls.hypervisor = cls.testClient.getHypervisorInfo()
|
||||||
cls.services = Services().services
|
cls.services = Services().services
|
||||||
# Get Zone, Domain and templates
|
# Get Zone, Domain and templates
|
||||||
cls.domain = get_domain(cls.api_client)
|
cls.domain = get_domain(cls.api_client)
|
||||||
@ -929,7 +964,6 @@ class TestCreateVMSnapshotTemplate(cloudstackTestCase):
|
|||||||
cls.services["domainid"] = cls.domain.id
|
cls.services["domainid"] = cls.domain.id
|
||||||
cls.services["server"]["zoneid"] = cls.zone.id
|
cls.services["server"]["zoneid"] = cls.zone.id
|
||||||
|
|
||||||
|
|
||||||
# Create VMs, NAT Rules etc
|
# Create VMs, NAT Rules etc
|
||||||
cls.account = Account.create(
|
cls.account = Account.create(
|
||||||
cls.api_client,
|
cls.api_client,
|
||||||
@ -984,7 +1018,8 @@ class TestCreateVMSnapshotTemplate(cloudstackTestCase):
|
|||||||
# 4. Create a instance from above created template.
|
# 4. Create a instance from above created template.
|
||||||
# 5. listSnapshots should list the snapshot that was created.
|
# 5. listSnapshots should list the snapshot that was created.
|
||||||
# 6. verify that secondary storage NFS share contains the reqd
|
# 6. verify that secondary storage NFS share contains the reqd
|
||||||
# volume under /secondary/snapshots/$accountid/$volumeid/$snapshot_uuid
|
# volume under /secondary/snapshots/$accountid/
|
||||||
|
# $volumeid/$snapshot_uuid
|
||||||
# 7. verify backup_snap_id was non null in the `snapshots` table
|
# 7. verify backup_snap_id was non null in the `snapshots` table
|
||||||
# 8. listTemplates() should return the newly created Template,
|
# 8. listTemplates() should return the newly created Template,
|
||||||
# and check for template state as READY"
|
# and check for template state as READY"
|
||||||
@ -993,6 +1028,9 @@ class TestCreateVMSnapshotTemplate(cloudstackTestCase):
|
|||||||
|
|
||||||
# Create Virtual Machine
|
# Create Virtual Machine
|
||||||
|
|
||||||
|
if self.hypervisor.lower() in ['hyperv']:
|
||||||
|
self.skipTest("Snapshots feature is not supported on Hyper-V")
|
||||||
|
|
||||||
userapiclient = self.testClient.getUserApiClient(
|
userapiclient = self.testClient.getUserApiClient(
|
||||||
UserName=self.account.name,
|
UserName=self.account.name,
|
||||||
DomainName=self.account.domain)
|
DomainName=self.account.domain)
|
||||||
@ -1039,8 +1077,9 @@ class TestCreateVMSnapshotTemplate(cloudstackTestCase):
|
|||||||
snapshot.id,
|
snapshot.id,
|
||||||
"Check snapshot id in list resources call"
|
"Check snapshot id in list resources call"
|
||||||
)
|
)
|
||||||
self.debug("select backup_snap_id, account_id, volume_id from snapshots where uuid = '%s';" \
|
self.debug(
|
||||||
% snapshot.id)
|
"select backup_snap_id, account_id, volume_id from snapshots where uuid = '%s';" %
|
||||||
|
snapshot.id)
|
||||||
snapshot_uuid = snapshot.id
|
snapshot_uuid = snapshot.id
|
||||||
|
|
||||||
# Generate template from the snapshot
|
# Generate template from the snapshot
|
||||||
@ -1054,8 +1093,7 @@ class TestCreateVMSnapshotTemplate(cloudstackTestCase):
|
|||||||
|
|
||||||
templates = list_templates(
|
templates = list_templates(
|
||||||
userapiclient,
|
userapiclient,
|
||||||
templatefilter=\
|
templatefilter=self.services["templates"]["templatefilter"],
|
||||||
self.services["templates"]["templatefilter"],
|
|
||||||
id=template.id
|
id=template.id
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1109,17 +1147,23 @@ class TestCreateVMSnapshotTemplate(cloudstackTestCase):
|
|||||||
'Running',
|
'Running',
|
||||||
"Check list VM response for Running state"
|
"Check list VM response for Running state"
|
||||||
)
|
)
|
||||||
self.assertTrue(is_snapshot_on_nfs(self.apiclient, self.dbclient, self.config, self.zone.id, snapshot_uuid))
|
self.assertTrue(
|
||||||
|
is_snapshot_on_nfs(
|
||||||
|
self.apiclient,
|
||||||
|
self.dbclient,
|
||||||
|
self.config,
|
||||||
|
self.zone.id,
|
||||||
|
snapshot_uuid))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
class TestSnapshotEvents(cloudstackTestCase):
|
class TestSnapshotEvents(cloudstackTestCase):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
cls.testClient = super(TestSnapshotEvents, cls).getClsTestClient()
|
cls.testClient = super(TestSnapshotEvents, cls).getClsTestClient()
|
||||||
cls.api_client = cls.testClient.getApiClient()
|
cls.api_client = cls.testClient.getApiClient()
|
||||||
|
cls.hypervisor = cls.testClient.getHypervisorInfo()
|
||||||
|
|
||||||
cls.services = Services().services
|
cls.services = Services().services
|
||||||
# Get Zone, Domain and templates
|
# Get Zone, Domain and templates
|
||||||
cls.domain = get_domain(cls.api_client)
|
cls.domain = get_domain(cls.api_client)
|
||||||
@ -1193,10 +1237,14 @@ class TestSnapshotEvents(cloudstackTestCase):
|
|||||||
"""Test snapshot events
|
"""Test snapshot events
|
||||||
"""
|
"""
|
||||||
# Validate the following
|
# Validate the following
|
||||||
# 1. Perform snapshot on the root disk of this VM and check the events/alerts.
|
# 1. Perform snapshot on the root disk of this VM and
|
||||||
|
# check the events/alerts.
|
||||||
# 2. delete the snapshots and check the events/alerts
|
# 2. delete the snapshots and check the events/alerts
|
||||||
# 3. listEvents() shows created/deleted snapshot events
|
# 3. listEvents() shows created/deleted snapshot events
|
||||||
|
|
||||||
|
if self.hypervisor.lower() in ['hyperv']:
|
||||||
|
self.skipTest("Snapshots feature is not supported on Hyper-V")
|
||||||
|
|
||||||
# Get the Root disk of VM
|
# Get the Root disk of VM
|
||||||
volumes = list_volumes(
|
volumes = list_volumes(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
|
|||||||
@ -58,6 +58,7 @@ class TestSecondaryStorageLimits(cloudstackTestCase):
|
|||||||
cloudstackTestClient = super(TestSecondaryStorageLimits,
|
cloudstackTestClient = super(TestSecondaryStorageLimits,
|
||||||
cls).getClsTestClient()
|
cls).getClsTestClient()
|
||||||
cls.api_client = cloudstackTestClient.getApiClient()
|
cls.api_client = cloudstackTestClient.getApiClient()
|
||||||
|
cls.hypervisor = cloudstackTestClient.getHypervisorInfo()
|
||||||
# Fill services from the external config file
|
# Fill services from the external config file
|
||||||
cls.services = cloudstackTestClient.getParsedTestDataConfig()
|
cls.services = cloudstackTestClient.getParsedTestDataConfig()
|
||||||
# Get Zone, Domain and templates
|
# Get Zone, Domain and templates
|
||||||
@ -205,6 +206,9 @@ class TestSecondaryStorageLimits(cloudstackTestCase):
|
|||||||
5. Verify that the secondary storage count of the account equals
|
5. Verify that the secondary storage count of the account equals
|
||||||
the size of the template"""
|
the size of the template"""
|
||||||
|
|
||||||
|
if self.hypervisor.lower() in ['hyperv']:
|
||||||
|
self.skipTest("Snapshots feature is not supported on Hyper-V")
|
||||||
|
|
||||||
response = self.setupAccount(value)
|
response = self.setupAccount(value)
|
||||||
self.assertEqual(response[0], PASS, response[1])
|
self.assertEqual(response[0], PASS, response[1])
|
||||||
|
|
||||||
|
|||||||
@ -43,7 +43,9 @@ from marvin.lib.common import (get_zone,
|
|||||||
from marvin.codes import FAILED
|
from marvin.codes import FAILED
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
||||||
class Services:
|
class Services:
|
||||||
|
|
||||||
"""Test tags Services
|
"""Test tags Services
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -192,7 +194,7 @@ class TestResourceTags(cloudstackTestCase):
|
|||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
cls.testClient = super(TestResourceTags, cls).getClsTestClient()
|
cls.testClient = super(TestResourceTags, cls).getClsTestClient()
|
||||||
cls.api_client = cls.testClient.getApiClient()
|
cls.api_client = cls.testClient.getApiClient()
|
||||||
|
cls.hypervisor = cls.testClient.getHypervisorInfo()
|
||||||
cls.services = Services().services
|
cls.services = Services().services
|
||||||
|
|
||||||
# Get Zone, Domain and templates
|
# Get Zone, Domain and templates
|
||||||
@ -205,7 +207,8 @@ class TestResourceTags(cloudstackTestCase):
|
|||||||
cls.services["ostype"]
|
cls.services["ostype"]
|
||||||
)
|
)
|
||||||
if cls.template == FAILED:
|
if cls.template == FAILED:
|
||||||
assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
|
assert False, "get_template() failed to return template\
|
||||||
|
with description %s" % cls.services["ostype"]
|
||||||
|
|
||||||
cls.account = Account.create(
|
cls.account = Account.create(
|
||||||
cls.api_client,
|
cls.api_client,
|
||||||
@ -1013,8 +1016,7 @@ class TestResourceTags(cloudstackTestCase):
|
|||||||
|
|
||||||
Template.list(
|
Template.list(
|
||||||
self.user_api_client,
|
self.user_api_client,
|
||||||
templatefilter=\
|
templatefilter=self.services["template"]["templatefilter"],
|
||||||
self.services["template"]["templatefilter"],
|
|
||||||
listall=True,
|
listall=True,
|
||||||
key='OS',
|
key='OS',
|
||||||
value='CentOS'
|
value='CentOS'
|
||||||
@ -1238,6 +1240,9 @@ class TestResourceTags(cloudstackTestCase):
|
|||||||
# 1. Create a tag on snapshot using createTags API
|
# 1. Create a tag on snapshot using createTags API
|
||||||
# 2. Delete above created tag using deleteTags API
|
# 2. Delete above created tag using deleteTags API
|
||||||
|
|
||||||
|
if self.hypervisor.lower() in ['hyperv']:
|
||||||
|
self.skipTest("Snapshots feature is not supported on Hyper-V")
|
||||||
|
|
||||||
self.debug("Creating snapshot on ROOT volume for VM: %s " %
|
self.debug("Creating snapshot on ROOT volume for VM: %s " %
|
||||||
self.vm_1.name)
|
self.vm_1.name)
|
||||||
# Get the Root disk of VM
|
# Get the Root disk of VM
|
||||||
@ -1742,7 +1747,6 @@ class TestResourceTags(cloudstackTestCase):
|
|||||||
"List Project should return valid list"
|
"List Project should return valid list"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
self.debug("Deleting the created tag..")
|
self.debug("Deleting the created tag..")
|
||||||
try:
|
try:
|
||||||
tag.delete(
|
tag.delete(
|
||||||
@ -1953,12 +1957,16 @@ class TestResourceTags(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
self.debug("Tag created: %s" % tag.__dict__)
|
self.debug("Tag created: %s" % tag.__dict__)
|
||||||
|
|
||||||
# Add tag for removal during teardown. vm_1 is shared resource if it is tagged
|
# Add tag for removal during teardown. vm_1 is shared
|
||||||
|
# resource if it is tagged
|
||||||
# and the test fails with exception then the tag is not deleted. And
|
# and the test fails with exception then the tag is not deleted. And
|
||||||
# subsequent tests fail to tag the vm_1 with same key-pair
|
# subsequent tests fail to tag the vm_1 with same key-pair
|
||||||
# breaking the tests.
|
# breaking the tests.
|
||||||
self.rm_tags.append({'tag_obj': tag,'restype': 'userVM', 'resid': self.vm_1.id,
|
self.rm_tags.append({'tag_obj': tag,
|
||||||
'key': 'region', 'value': 'India'})
|
'restype': 'userVM',
|
||||||
|
'resid': self.vm_1.id,
|
||||||
|
'key': 'region',
|
||||||
|
'value': 'India'})
|
||||||
|
|
||||||
self.debug("Passing invalid key parameter to the listAPI for vms")
|
self.debug("Passing invalid key parameter to the listAPI for vms")
|
||||||
|
|
||||||
|
|||||||
@ -284,7 +284,7 @@ class TestTemplates(cloudstackTestCase):
|
|||||||
|
|
||||||
cls.testClient = super(TestTemplates, cls).getClsTestClient()
|
cls.testClient = super(TestTemplates, cls).getClsTestClient()
|
||||||
cls.api_client = cls.testClient.getApiClient()
|
cls.api_client = cls.testClient.getApiClient()
|
||||||
|
cls.hypervisor = cls.testClient.getHypervisorInfo()
|
||||||
cls.services = Services().services
|
cls.services = Services().services
|
||||||
# Get Zone, Domain and templates
|
# Get Zone, Domain and templates
|
||||||
cls.domain = get_domain(cls.api_client)
|
cls.domain = get_domain(cls.api_client)
|
||||||
@ -495,6 +495,9 @@ class TestTemplates(cloudstackTestCase):
|
|||||||
# 4. Deploy Virtual machine using this template
|
# 4. Deploy Virtual machine using this template
|
||||||
# 5. VM should be in running state
|
# 5. VM should be in running state
|
||||||
|
|
||||||
|
if self.hypervisor.lower() in ['hyperv']:
|
||||||
|
self.skipTest("Snapshots feature is not supported on Hyper-V")
|
||||||
|
|
||||||
userapiclient = self.testClient.getUserApiClient(
|
userapiclient = self.testClient.getUserApiClient(
|
||||||
UserName=self.account.name,
|
UserName=self.account.name,
|
||||||
DomainName=self.account.domain)
|
DomainName=self.account.domain)
|
||||||
|
|||||||
@ -39,7 +39,9 @@ from marvin.lib.common import (get_zone,
|
|||||||
get_domain,
|
get_domain,
|
||||||
get_template)
|
get_template)
|
||||||
|
|
||||||
|
|
||||||
class Services:
|
class Services:
|
||||||
|
|
||||||
"""Test Snapshots Services
|
"""Test Snapshots Services
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -191,7 +193,15 @@ class TestVmUsage(cloudstackTestCase):
|
|||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags=["advanced", "basic", "sg", "eip", "advancedns", "simulator"], required_hardware="false")
|
@attr(
|
||||||
|
tags=[
|
||||||
|
"advanced",
|
||||||
|
"basic",
|
||||||
|
"sg",
|
||||||
|
"eip",
|
||||||
|
"advancedns",
|
||||||
|
"simulator"],
|
||||||
|
required_hardware="false")
|
||||||
def test_01_vm_usage(self):
|
def test_01_vm_usage(self):
|
||||||
"""Test Create/Destroy VM and verify usage calculation
|
"""Test Create/Destroy VM and verify usage calculation
|
||||||
"""
|
"""
|
||||||
@ -219,11 +229,11 @@ class TestVmUsage(cloudstackTestCase):
|
|||||||
self.fail("Failed to destroy VM: %s" % e)
|
self.fail("Failed to destroy VM: %s" % e)
|
||||||
|
|
||||||
# Fetch account ID from account_uuid
|
# Fetch account ID from account_uuid
|
||||||
self.debug("select id from account where uuid = '%s';" \
|
self.debug("select id from account where uuid = '%s';"
|
||||||
% self.account.id)
|
% self.account.id)
|
||||||
|
|
||||||
qresultset = self.dbclient.execute(
|
qresultset = self.dbclient.execute(
|
||||||
"select id from account where uuid = '%s';" \
|
"select id from account where uuid = '%s';"
|
||||||
% self.account.id
|
% self.account.id
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
@ -240,11 +250,11 @@ class TestVmUsage(cloudstackTestCase):
|
|||||||
qresult = qresultset[0]
|
qresult = qresultset[0]
|
||||||
|
|
||||||
account_id = qresult[0]
|
account_id = qresult[0]
|
||||||
self.debug("select type from usage_event where account_id = '%s';" \
|
self.debug("select type from usage_event where account_id = '%s';"
|
||||||
% account_id)
|
% account_id)
|
||||||
|
|
||||||
qresultset = self.dbclient.execute(
|
qresultset = self.dbclient.execute(
|
||||||
"select type from usage_event where account_id = '%s';" \
|
"select type from usage_event where account_id = '%s';"
|
||||||
% account_id
|
% account_id
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
@ -390,7 +400,13 @@ class TestPublicIPUsage(cloudstackTestCase):
|
|||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags=["advanced", "eip", "advancedns", "simulator"], required_hardware="false")
|
@attr(
|
||||||
|
tags=[
|
||||||
|
"advanced",
|
||||||
|
"eip",
|
||||||
|
"advancedns",
|
||||||
|
"simulator"],
|
||||||
|
required_hardware="false")
|
||||||
def test_01_public_ip_usage(self):
|
def test_01_public_ip_usage(self):
|
||||||
"""Test Assign new IP and verify usage calculation
|
"""Test Assign new IP and verify usage calculation
|
||||||
"""
|
"""
|
||||||
@ -408,11 +424,11 @@ class TestPublicIPUsage(cloudstackTestCase):
|
|||||||
self.public_ip.delete(self.apiclient)
|
self.public_ip.delete(self.apiclient)
|
||||||
|
|
||||||
# Fetch account ID from account_uuid
|
# Fetch account ID from account_uuid
|
||||||
self.debug("select id from account where uuid = '%s';" \
|
self.debug("select id from account where uuid = '%s';"
|
||||||
% self.account.id)
|
% self.account.id)
|
||||||
|
|
||||||
qresultset = self.dbclient.execute(
|
qresultset = self.dbclient.execute(
|
||||||
"select id from account where uuid = '%s';" \
|
"select id from account where uuid = '%s';"
|
||||||
% self.account.id
|
% self.account.id
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
@ -428,11 +444,11 @@ class TestPublicIPUsage(cloudstackTestCase):
|
|||||||
qresult = qresultset[0]
|
qresult = qresultset[0]
|
||||||
|
|
||||||
account_id = qresult[0]
|
account_id = qresult[0]
|
||||||
self.debug("select type from usage_event where account_id = '%s';" \
|
self.debug("select type from usage_event where account_id = '%s';"
|
||||||
% account_id)
|
% account_id)
|
||||||
|
|
||||||
qresultset = self.dbclient.execute(
|
qresultset = self.dbclient.execute(
|
||||||
"select type from usage_event where account_id = '%s';" \
|
"select type from usage_event where account_id = '%s';"
|
||||||
% account_id
|
% account_id
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -540,7 +556,15 @@ class TestVolumeUsage(cloudstackTestCase):
|
|||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags=["advanced", "basic", "sg", "eip", "advancedns", "simulator"], required_hardware="false")
|
@attr(
|
||||||
|
tags=[
|
||||||
|
"advanced",
|
||||||
|
"basic",
|
||||||
|
"sg",
|
||||||
|
"eip",
|
||||||
|
"advancedns",
|
||||||
|
"simulator"],
|
||||||
|
required_hardware="false")
|
||||||
def test_01_volume_usage(self):
|
def test_01_volume_usage(self):
|
||||||
"""Test Create/delete a volume and verify correct usage is recorded
|
"""Test Create/delete a volume and verify correct usage is recorded
|
||||||
"""
|
"""
|
||||||
@ -585,11 +609,11 @@ class TestVolumeUsage(cloudstackTestCase):
|
|||||||
self.apiclient.deleteVolume(cmd)
|
self.apiclient.deleteVolume(cmd)
|
||||||
|
|
||||||
# Fetch account ID from account_uuid
|
# Fetch account ID from account_uuid
|
||||||
self.debug("select id from account where uuid = '%s';" \
|
self.debug("select id from account where uuid = '%s';"
|
||||||
% self.account.id)
|
% self.account.id)
|
||||||
|
|
||||||
qresultset = self.dbclient.execute(
|
qresultset = self.dbclient.execute(
|
||||||
"select id from account where uuid = '%s';" \
|
"select id from account where uuid = '%s';"
|
||||||
% self.account.id
|
% self.account.id
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
@ -606,11 +630,11 @@ class TestVolumeUsage(cloudstackTestCase):
|
|||||||
qresult = qresultset[0]
|
qresult = qresultset[0]
|
||||||
|
|
||||||
account_id = qresult[0]
|
account_id = qresult[0]
|
||||||
self.debug("select type from usage_event where account_id = '%s';" \
|
self.debug("select type from usage_event where account_id = '%s';"
|
||||||
% account_id)
|
% account_id)
|
||||||
|
|
||||||
qresultset = self.dbclient.execute(
|
qresultset = self.dbclient.execute(
|
||||||
"select type from usage_event where account_id = '%s';" \
|
"select type from usage_event where account_id = '%s';"
|
||||||
% account_id
|
% account_id
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -730,7 +754,14 @@ class TestTemplateUsage(cloudstackTestCase):
|
|||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags=["advanced", "basic", "sg", "eip", "advancedns"], required_hardware="false")
|
@attr(
|
||||||
|
tags=[
|
||||||
|
"advanced",
|
||||||
|
"basic",
|
||||||
|
"sg",
|
||||||
|
"eip",
|
||||||
|
"advancedns"],
|
||||||
|
required_hardware="false")
|
||||||
def test_01_template_usage(self):
|
def test_01_template_usage(self):
|
||||||
"""Test Upload/ delete a template and verify correct usage is generated
|
"""Test Upload/ delete a template and verify correct usage is generated
|
||||||
for the template uploaded
|
for the template uploaded
|
||||||
@ -757,11 +788,11 @@ class TestTemplateUsage(cloudstackTestCase):
|
|||||||
self.debug("Deleted template with ID: %s" % self.template.id)
|
self.debug("Deleted template with ID: %s" % self.template.id)
|
||||||
|
|
||||||
# Fetch account ID from account_uuid
|
# Fetch account ID from account_uuid
|
||||||
self.debug("select id from account where uuid = '%s';" \
|
self.debug("select id from account where uuid = '%s';"
|
||||||
% self.account.id)
|
% self.account.id)
|
||||||
|
|
||||||
qresultset = self.dbclient.execute(
|
qresultset = self.dbclient.execute(
|
||||||
"select id from account where uuid = '%s';" \
|
"select id from account where uuid = '%s';"
|
||||||
% self.account.id
|
% self.account.id
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
@ -778,11 +809,11 @@ class TestTemplateUsage(cloudstackTestCase):
|
|||||||
qresult = qresultset[0]
|
qresult = qresultset[0]
|
||||||
|
|
||||||
account_id = qresult[0]
|
account_id = qresult[0]
|
||||||
self.debug("select type from usage_event where account_id = '%s';" \
|
self.debug("select type from usage_event where account_id = '%s';"
|
||||||
% account_id)
|
% account_id)
|
||||||
|
|
||||||
qresultset = self.dbclient.execute(
|
qresultset = self.dbclient.execute(
|
||||||
"select type from usage_event where account_id = '%s';" \
|
"select type from usage_event where account_id = '%s';"
|
||||||
% account_id
|
% account_id
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -878,7 +909,14 @@ class TestISOUsage(cloudstackTestCase):
|
|||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags=["advanced", "basic", "sg", "eip", "advancedns"], required_hardware="false")
|
@attr(
|
||||||
|
tags=[
|
||||||
|
"advanced",
|
||||||
|
"basic",
|
||||||
|
"sg",
|
||||||
|
"eip",
|
||||||
|
"advancedns"],
|
||||||
|
required_hardware="false")
|
||||||
def test_01_ISO_usage(self):
|
def test_01_ISO_usage(self):
|
||||||
"""Test Create/Delete a ISO and verify its usage is generated correctly
|
"""Test Create/Delete a ISO and verify its usage is generated correctly
|
||||||
"""
|
"""
|
||||||
@ -895,11 +933,11 @@ class TestISOUsage(cloudstackTestCase):
|
|||||||
self.iso.delete(self.apiclient)
|
self.iso.delete(self.apiclient)
|
||||||
|
|
||||||
# Fetch account ID from account_uuid
|
# Fetch account ID from account_uuid
|
||||||
self.debug("select id from account where uuid = '%s';" \
|
self.debug("select id from account where uuid = '%s';"
|
||||||
% self.account.id)
|
% self.account.id)
|
||||||
|
|
||||||
qresultset = self.dbclient.execute(
|
qresultset = self.dbclient.execute(
|
||||||
"select id from account where uuid = '%s';" \
|
"select id from account where uuid = '%s';"
|
||||||
% self.account.id
|
% self.account.id
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
@ -916,11 +954,11 @@ class TestISOUsage(cloudstackTestCase):
|
|||||||
qresult = qresultset[0]
|
qresult = qresultset[0]
|
||||||
|
|
||||||
account_id = qresult[0]
|
account_id = qresult[0]
|
||||||
self.debug("select type from usage_event where account_id = '%s';" \
|
self.debug("select type from usage_event where account_id = '%s';"
|
||||||
% account_id)
|
% account_id)
|
||||||
|
|
||||||
qresultset = self.dbclient.execute(
|
qresultset = self.dbclient.execute(
|
||||||
"select type from usage_event where account_id = '%s';" \
|
"select type from usage_event where account_id = '%s';"
|
||||||
% account_id
|
% account_id
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1032,7 +1070,13 @@ class TestLBRuleUsage(cloudstackTestCase):
|
|||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags=["advanced", "eip", "advancedns", "simulator"], required_hardware="false")
|
@attr(
|
||||||
|
tags=[
|
||||||
|
"advanced",
|
||||||
|
"eip",
|
||||||
|
"advancedns",
|
||||||
|
"simulator"],
|
||||||
|
required_hardware="false")
|
||||||
def test_01_lb_usage(self):
|
def test_01_lb_usage(self):
|
||||||
"""Test Create/Delete a LB rule and verify correct usage is recorded
|
"""Test Create/Delete a LB rule and verify correct usage is recorded
|
||||||
"""
|
"""
|
||||||
@ -1059,11 +1103,11 @@ class TestLBRuleUsage(cloudstackTestCase):
|
|||||||
lb_rule.delete(self.apiclient)
|
lb_rule.delete(self.apiclient)
|
||||||
|
|
||||||
# Fetch account ID from account_uuid
|
# Fetch account ID from account_uuid
|
||||||
self.debug("select id from account where uuid = '%s';" \
|
self.debug("select id from account where uuid = '%s';"
|
||||||
% self.account.id)
|
% self.account.id)
|
||||||
|
|
||||||
qresultset = self.dbclient.execute(
|
qresultset = self.dbclient.execute(
|
||||||
"select id from account where uuid = '%s';" \
|
"select id from account where uuid = '%s';"
|
||||||
% self.account.id
|
% self.account.id
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
@ -1080,11 +1124,11 @@ class TestLBRuleUsage(cloudstackTestCase):
|
|||||||
qresult = qresultset[0]
|
qresult = qresultset[0]
|
||||||
|
|
||||||
account_id = qresult[0]
|
account_id = qresult[0]
|
||||||
self.debug("select type from usage_event where account_id = '%s';" \
|
self.debug("select type from usage_event where account_id = '%s';"
|
||||||
% account_id)
|
% account_id)
|
||||||
|
|
||||||
qresultset = self.dbclient.execute(
|
qresultset = self.dbclient.execute(
|
||||||
"select type from usage_event where account_id = '%s';" \
|
"select type from usage_event where account_id = '%s';"
|
||||||
% account_id
|
% account_id
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1124,7 +1168,7 @@ class TestSnapshotUsage(cloudstackTestCase):
|
|||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
cls.testClient = super(TestSnapshotUsage, cls).getClsTestClient()
|
cls.testClient = super(TestSnapshotUsage, cls).getClsTestClient()
|
||||||
cls.api_client = cls.testClient.getApiClient()
|
cls.api_client = cls.testClient.getApiClient()
|
||||||
|
cls.hypervisor = cls.testClient.getHypervisorInfo()
|
||||||
cls.services = Services().services
|
cls.services = Services().services
|
||||||
# Get Zone, Domain and templates
|
# Get Zone, Domain and templates
|
||||||
cls.domain = get_domain(cls.api_client)
|
cls.domain = get_domain(cls.api_client)
|
||||||
@ -1191,7 +1235,15 @@ class TestSnapshotUsage(cloudstackTestCase):
|
|||||||
return
|
return
|
||||||
|
|
||||||
@attr(speed="slow")
|
@attr(speed="slow")
|
||||||
@attr(tags=["advanced", "basic", "sg", "eip", "advancedns", "simulator"], required_hardware="false")
|
@attr(
|
||||||
|
tags=[
|
||||||
|
"advanced",
|
||||||
|
"basic",
|
||||||
|
"sg",
|
||||||
|
"eip",
|
||||||
|
"advancedns",
|
||||||
|
"simulator"],
|
||||||
|
required_hardware="false")
|
||||||
def test_01_snapshot_usage(self):
|
def test_01_snapshot_usage(self):
|
||||||
"""Test Create/Delete a manual snap shot and verify
|
"""Test Create/Delete a manual snap shot and verify
|
||||||
correct usage is recorded
|
correct usage is recorded
|
||||||
@ -1204,6 +1256,10 @@ class TestSnapshotUsage(cloudstackTestCase):
|
|||||||
# 3. Delete the account
|
# 3. Delete the account
|
||||||
|
|
||||||
# Get the Root disk of VM
|
# Get the Root disk of VM
|
||||||
|
|
||||||
|
if self.hypervisor.lower() in ['hyperv']:
|
||||||
|
self.skipTest("Snapshots feature is not supported on Hyper-V")
|
||||||
|
|
||||||
volumes = Volume.list(
|
volumes = Volume.list(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
virtualmachineid=self.virtual_machine.id,
|
virtualmachineid=self.virtual_machine.id,
|
||||||
@ -1224,11 +1280,11 @@ class TestSnapshotUsage(cloudstackTestCase):
|
|||||||
snapshot.delete(self.apiclient)
|
snapshot.delete(self.apiclient)
|
||||||
|
|
||||||
# Fetch account ID from account_uuid
|
# Fetch account ID from account_uuid
|
||||||
self.debug("select id from account where uuid = '%s';" \
|
self.debug("select id from account where uuid = '%s';"
|
||||||
% self.account.id)
|
% self.account.id)
|
||||||
|
|
||||||
qresultset = self.dbclient.execute(
|
qresultset = self.dbclient.execute(
|
||||||
"select id from account where uuid = '%s';" \
|
"select id from account where uuid = '%s';"
|
||||||
% self.account.id
|
% self.account.id
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
@ -1245,11 +1301,11 @@ class TestSnapshotUsage(cloudstackTestCase):
|
|||||||
qresult = qresultset[0]
|
qresult = qresultset[0]
|
||||||
|
|
||||||
account_id = qresult[0]
|
account_id = qresult[0]
|
||||||
self.debug("select type from usage_event where account_id = '%s';" \
|
self.debug("select type from usage_event where account_id = '%s';"
|
||||||
% account_id)
|
% account_id)
|
||||||
|
|
||||||
qresultset = self.dbclient.execute(
|
qresultset = self.dbclient.execute(
|
||||||
"select type from usage_event where account_id = '%s';" \
|
"select type from usage_event where account_id = '%s';"
|
||||||
% account_id
|
% account_id
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1268,8 +1324,8 @@ class TestSnapshotUsage(cloudstackTestCase):
|
|||||||
qresult = str(qresultset)
|
qresult = str(qresultset)
|
||||||
self.debug("Query Result: %s" % qresult)
|
self.debug("Query Result: %s" % qresult)
|
||||||
|
|
||||||
# Check for SNAPSHOT.CREATE, SNAPSHOT.DELETE events in cloud.usage_event
|
# Check for SNAPSHOT.CREATE, SNAPSHOT.DELETE events in
|
||||||
# table
|
# cloud.usage_event table
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
qresult.count('SNAPSHOT.CREATE'),
|
qresult.count('SNAPSHOT.CREATE'),
|
||||||
1,
|
1,
|
||||||
@ -1362,7 +1418,12 @@ class TestNatRuleUsage(cloudstackTestCase):
|
|||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags=["advanced", "advancedns", "simulator"], required_hardware="false")
|
@attr(
|
||||||
|
tags=[
|
||||||
|
"advanced",
|
||||||
|
"advancedns",
|
||||||
|
"simulator"],
|
||||||
|
required_hardware="false")
|
||||||
def test_01_nat_usage(self):
|
def test_01_nat_usage(self):
|
||||||
"""Test Create/Delete a PF rule and verify correct usage is recorded
|
"""Test Create/Delete a PF rule and verify correct usage is recorded
|
||||||
"""
|
"""
|
||||||
@ -1390,11 +1451,11 @@ class TestNatRuleUsage(cloudstackTestCase):
|
|||||||
nat_rule.delete(self.apiclient)
|
nat_rule.delete(self.apiclient)
|
||||||
|
|
||||||
# Fetch account ID from account_uuid
|
# Fetch account ID from account_uuid
|
||||||
self.debug("select id from account where uuid = '%s';" \
|
self.debug("select id from account where uuid = '%s';"
|
||||||
% self.account.id)
|
% self.account.id)
|
||||||
|
|
||||||
qresultset = self.dbclient.execute(
|
qresultset = self.dbclient.execute(
|
||||||
"select id from account where uuid = '%s';" \
|
"select id from account where uuid = '%s';"
|
||||||
% self.account.id
|
% self.account.id
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
@ -1411,11 +1472,11 @@ class TestNatRuleUsage(cloudstackTestCase):
|
|||||||
qresult = qresultset[0]
|
qresult = qresultset[0]
|
||||||
|
|
||||||
account_id = qresult[0]
|
account_id = qresult[0]
|
||||||
self.debug("select type from usage_event where account_id = '%s';" \
|
self.debug("select type from usage_event where account_id = '%s';"
|
||||||
% account_id)
|
% account_id)
|
||||||
|
|
||||||
qresultset = self.dbclient.execute(
|
qresultset = self.dbclient.execute(
|
||||||
"select type from usage_event where account_id = '%s';" \
|
"select type from usage_event where account_id = '%s';"
|
||||||
% account_id
|
% account_id
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1568,11 +1629,11 @@ class TestVpnUsage(cloudstackTestCase):
|
|||||||
vpn.delete(self.apiclient)
|
vpn.delete(self.apiclient)
|
||||||
|
|
||||||
# Fetch account ID from account_uuid
|
# Fetch account ID from account_uuid
|
||||||
self.debug("select id from account where uuid = '%s';" \
|
self.debug("select id from account where uuid = '%s';"
|
||||||
% self.account.id)
|
% self.account.id)
|
||||||
|
|
||||||
qresultset = self.dbclient.execute(
|
qresultset = self.dbclient.execute(
|
||||||
"select id from account where uuid = '%s';" \
|
"select id from account where uuid = '%s';"
|
||||||
% self.account.id
|
% self.account.id
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
@ -1589,11 +1650,11 @@ class TestVpnUsage(cloudstackTestCase):
|
|||||||
qresult = qresultset[0]
|
qresult = qresultset[0]
|
||||||
|
|
||||||
account_id = qresult[0]
|
account_id = qresult[0]
|
||||||
self.debug("select type from usage_event where account_id = '%s';" \
|
self.debug("select type from usage_event where account_id = '%s';"
|
||||||
% account_id)
|
% account_id)
|
||||||
|
|
||||||
qresultset = self.dbclient.execute(
|
qresultset = self.dbclient.execute(
|
||||||
"select type from usage_event where account_id = '%s';" \
|
"select type from usage_event where account_id = '%s';"
|
||||||
% account_id
|
% account_id
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user