Skip to content

Commit c2d1990

Browse files
committed
Merge branch '4.20' of https://github.com/apache/cloudstack into support-xen84-py3
2 parents 1ae4276 + c1923a2 commit c2d1990

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

test/integration/smoke/test_guest_os.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,14 @@ def setUpClass(cls):
4747

4848
cls.hypervisor = cls.get_hypervisor_type()
4949

50-
@classmethod
5150
def setUp(self):
5251
self.apiclient = self.testClient.getApiClient()
5352

5453
#build cleanup list
5554
self.cleanup = []
5655

57-
@classmethod
5856
def tearDown(self):
59-
try:
60-
cleanup_resources(self.apiclient, self.cleanup)
61-
except Exception as e:
62-
self.debug("Warning! Exception in tearDown: %s" % e)
57+
super(TestGuestOS, self).tearDown()
6358

6459
@classmethod
6560
def get_hypervisor_type(cls):
@@ -95,6 +90,7 @@ def test_CRUD_operations_guest_OS(self):
9590
osdisplayname="testCentOS",
9691
oscategoryid=os_category.id
9792
)
93+
self.cleanup.append(self.guestos1)
9894
list_guestos = GuestOS.list(self.apiclient, id=self.guestos1.id, listall=True)
9995
self.assertNotEqual(
10096
len(list_guestos),
@@ -112,6 +108,7 @@ def test_CRUD_operations_guest_OS(self):
112108
self.apiclient,
113109
id=self.guestos1.id
114110
)
111+
self.cleanup.remove(self.guestos1)
115112

116113
@attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
117114
def test_CRUD_operations_guest_OS_mapping(self):
@@ -127,6 +124,7 @@ def test_CRUD_operations_guest_OS_mapping(self):
127124
osdisplayname="testCentOS",
128125
oscategoryid=os_category.id
129126
)
127+
self.cleanup.append(self.guestos1)
130128

131129
if self.hypervisor.hypervisor.lower() not in ["xenserver", "vmware"]:
132130
raise unittest.SkipTest("OS name check with hypervisor is supported only on XenServer and VMware")
@@ -138,6 +136,7 @@ def test_CRUD_operations_guest_OS_mapping(self):
138136
hypervisorversion=self.hypervisor.hypervisorversion,
139137
osnameforhypervisor="testOSMappingName"
140138
)
139+
self.cleanup.append(self.guestosmapping1)
141140

142141
list_guestos_mapping = GuestOsMapping.list(self.apiclient, id=self.guestosmapping1.id, listall=True)
143142
self.assertNotEqual(
@@ -156,11 +155,13 @@ def test_CRUD_operations_guest_OS_mapping(self):
156155
self.apiclient,
157156
id=self.guestosmapping1.id
158157
)
158+
self.cleanup.remove(self.guestosmapping1)
159159

160160
GuestOS.remove(
161161
self.apiclient,
162162
id=self.guestos1.id
163163
)
164+
self.cleanup.remove(self.guestos1)
164165

165166
@attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
166167
def test_guest_OS_mapping_check_with_hypervisor(self):
@@ -176,6 +177,7 @@ def test_guest_OS_mapping_check_with_hypervisor(self):
176177
osdisplayname="testOSname1",
177178
oscategoryid=os_category.id
178179
)
180+
self.cleanup.append(self.guestos1)
179181

180182
if self.hypervisor.hypervisor.lower() not in ["xenserver", "vmware"]:
181183
raise unittest.SkipTest("OS name check with hypervisor is supported only on XenServer and VMware")
@@ -196,6 +198,7 @@ def test_guest_OS_mapping_check_with_hypervisor(self):
196198
osnameforhypervisor=testosname,
197199
osmappingcheckenabled=True
198200
)
201+
self.cleanup.append(self.guestosmapping1)
199202

200203
list_guestos_mapping = GuestOsMapping.list(self.apiclient, id=self.guestosmapping1.id, listall=True)
201204
self.assertNotEqual(
@@ -214,11 +217,13 @@ def test_guest_OS_mapping_check_with_hypervisor(self):
214217
self.apiclient,
215218
id=self.guestosmapping1.id
216219
)
220+
self.cleanup.remove(self.guestosmapping1)
217221

218222
GuestOS.remove(
219223
self.apiclient,
220224
id=self.guestos1.id
221225
)
226+
self.cleanup.remove(self.guestos1)
222227

223228
@attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
224229
def test_guest_OS_mapping_check_with_hypervisor_failure(self):
@@ -234,6 +239,7 @@ def test_guest_OS_mapping_check_with_hypervisor_failure(self):
234239
osdisplayname="testOSname2",
235240
oscategoryid=os_category.id
236241
)
242+
self.cleanup.append(self.guestos1)
237243

238244
if self.hypervisor.hypervisor.lower() not in ["xenserver", "vmware"]:
239245
raise unittest.SkipTest("OS name check with hypervisor is supported only on XenServer and VMware")
@@ -249,15 +255,18 @@ def test_guest_OS_mapping_check_with_hypervisor_failure(self):
249255
osnameforhypervisor=testosname,
250256
osmappingcheckenabled=True
251257
)
258+
self.cleanup.append(self.guestosmapping1)
252259
GuestOsMapping.remove(
253260
self.apiclient,
254261
id=self.guestosmapping1.id
255262
)
263+
self.cleanup.remove(self.guestosmapping1)
256264
self.fail("Since os mapping name is wrong, this API should fail")
257265
except CloudstackAPIException as e:
258266
self.debug("Addition guest OS mapping failed as expected %s " % e)
259267
GuestOS.remove(
260268
self.apiclient,
261269
id=self.guestos1.id
262270
)
271+
self.cleanup.remove(self.guestos1)
263272
return

tools/marvin/marvin/lib/base.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4576,6 +4576,7 @@ class Project:
45764576
def __init__(self, items):
45774577
self.__dict__.update(items)
45784578

4579+
45794580
@classmethod
45804581
def create(cls, apiclient, services, account=None, domainid=None, userid=None, accountid=None):
45814582
"""Create project"""
@@ -6720,7 +6721,7 @@ def list(cls, apiclient, id=None, name=None, **kwargs):
67206721
class GuestOS:
67216722
"""Manage Guest OS"""
67226723

6723-
def __init__(self, items, services):
6724+
def __init__(self, items):
67246725
self.__dict__.update(items)
67256726

67266727
@classmethod
@@ -6735,7 +6736,7 @@ def add(cls, apiclient, osdisplayname=None,
67356736
if details is not None:
67366737
cmd.details = details
67376738

6738-
return (apiclient.addGuestOs(cmd))
6739+
return GuestOS(apiclient.addGuestOs(cmd).__dict__)
67396740

67406741
@classmethod
67416742
def remove(cls, apiclient, id):
@@ -6772,10 +6773,13 @@ def list(cls, apiclient, id=None, oscategoryid=None, description=None, **kwargs)
67726773

67736774
return (apiclient.listOsTypes(cmd))
67746775

6776+
def delete(self, apiclient):
6777+
self.remove(apiclient, self.id)
6778+
67756779
class GuestOsMapping:
67766780
"""Manage Guest OS Mappings"""
67776781

6778-
def __init__(self, items, services):
6782+
def __init__(self, items):
67796783
self.__dict__.update(items)
67806784

67816785
@classmethod
@@ -6793,7 +6797,7 @@ def add(cls, apiclient, ostypeid=None,
67936797
if forced is not None:
67946798
cmd.forced = forced
67956799

6796-
return (apiclient.addGuestOsMapping(cmd))
6800+
return GuestOsMapping(apiclient.addGuestOsMapping(cmd).__dict__)
67976801

67986802
@classmethod
67996803
def remove(cls, apiclient, id):
@@ -6837,6 +6841,9 @@ def list(cls, apiclient, id=None, ostypeid=None, osdisplayname=None,
68376841

68386842
return (apiclient.listGuestOsMapping(cmd))
68396843

6844+
def delete(self, apiclient):
6845+
self.remove(apiclient, self.id)
6846+
68406847
class VMSchedule:
68416848

68426849
def __init__(self, items):

0 commit comments

Comments
 (0)