Skip to content

Commit 9e6a1ea

Browse files
Gaurav AradhyeGirish Shilamkar
authored andcommitted
CLOUDSTACK-5107: Decreasing memory in service offering so as
not to run out of resources Signed-off-by: Girish Shilamkar <girish@clogeny.com>
1 parent 9d00bfe commit 9e6a1ea

3 files changed

Lines changed: 50 additions & 51 deletions

File tree

‎test/integration/component/test_mm_domain_limits.py‎

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def __init__(self):
5656
"displaytext": "Tiny Instance",
5757
"cpunumber": 1,
5858
"cpuspeed": 100, # in MHz
59-
"memory": 5120, # In MBs
59+
"memory": 2048, # In MBs
6060
},
6161
"virtual_machine": {
6262
"displayname": "TestVM",
@@ -183,7 +183,7 @@ def setupAccounts(self):
183183

184184
Resources.updateLimit(self.apiclient,
185185
resourcetype=9,
186-
max=15360,
186+
max=6144,
187187
account=self.child_do_admin_1.name,
188188
domainid=self.child_do_admin_1.domainid)
189189

@@ -203,17 +203,17 @@ def setupAccounts(self):
203203

204204
Resources.updateLimit(self.apiclient,
205205
resourcetype=9,
206-
max=15360,
206+
max=6144,
207207
account=self.child_do_admin_2.name,
208208
domainid=self.child_do_admin_2.domainid)
209209
return
210210

211211
@attr(tags=["advanced", "advancedns","simulator"])
212212
def test_01_change_service_offering(self):
213-
"""Test Deploy VM with 5 GB RAM & verify the usage"""
213+
"""Test Deploy VM with specified RAM & verify the usage"""
214214

215215
# Validate the following
216-
# 1. Create compute offering with 5 GB RAM & Deploy VM in the created domain
216+
# 1. Create compute offering with specified RAM & Deploy VM in the created domain
217217
# 2. List Resource count for the root admin Memory usage
218218
# 3. Upgrade and downgrade service offering
219219
# 4. Resource count should list properly for the domain
@@ -228,7 +228,7 @@ def test_01_change_service_offering(self):
228228
self.domain = domain
229229

230230
#Resetting memory count in service offering
231-
self.services["service_offering"]["memory"] = 5120
231+
self.services["service_offering"]["memory"] = 2048
232232

233233
self.debug("Creating an instance with service offering: %s" %
234234
self.service_offering.name)
@@ -266,24 +266,24 @@ def test_01_change_service_offering(self):
266266
self.assertEqual(resource_count_after_stop, expected_resource_count,
267267
"Resource count should be same after stopping the instance")
268268

269-
self.debug("Creating service offering with 7 GB RAM")
270-
self.services["service_offering"]["memory"] = 7168
271-
self.service_offering_7gb = ServiceOffering.create(
269+
self.debug("Creating service offering with 5 GB RAM")
270+
self.services["service_offering"]["memory"] = 5120
271+
self.service_offering_5gb = ServiceOffering.create(
272272
self.apiclient,
273273
self.services["service_offering"]
274274
)
275275
# Adding to cleanup list after execution
276-
self.cleanup.append(self.service_offering_7gb)
276+
self.cleanup.append(self.service_offering_5gb)
277277

278278
self.debug(
279279
"Upgrade service offering of instance %s from %s to %s" %
280280
(vm.name,
281281
self.service_offering.name,
282-
self.service_offering_7gb.name))
282+
self.service_offering_5gb.name))
283283

284284
try:
285285
vm.change_service_offering(self.apiclient,
286-
serviceOfferingId=self.service_offering_7gb.id)
286+
serviceOfferingId=self.service_offering_5gb.id)
287287
except Exception as e:
288288
self.fail("Failed to change service offering of vm %s - %s" %
289289
(vm.name, e))
@@ -305,7 +305,7 @@ def test_01_change_service_offering(self):
305305
self.debug(
306306
"Down grade service offering of instance %s from %s to %s" %
307307
(vm.name,
308-
self.service_offering_7gb.name,
308+
self.service_offering_5gb.name,
309309
self.service_offering.name))
310310

311311
try:
@@ -349,15 +349,15 @@ def test_01_change_service_offering(self):
349349

350350
@attr(tags=["advanced", "advancedns","simulator"])
351351
def test_02_migrate_vm(self):
352-
"""Test Deploy VM with 5 GB RAM & verify the usage"""
352+
"""Test Deploy VM with specified RAM & verify the usage"""
353353

354354
# Validate the following
355-
# 1. Create compute offering with 5 GB RAM & Deploy VM in the created domain
355+
# 1. Create compute offering with specified RAM & Deploy VM in the created domain
356356
# 2. List Resource count for the root admin Memory usage
357357
# 3. Migrate vm to another host, resource count should list properly.
358358

359359
#Resetting memory count in service offering
360-
self.services["service_offering"]["memory"] = 5120
360+
self.services["service_offering"]["memory"] = 2048
361361

362362
self.debug("Setting up account and domain hierarchy")
363363
self.setupAccounts()
@@ -408,15 +408,15 @@ def test_02_migrate_vm(self):
408408

409409
@attr(tags=["advanced", "advancedns","simulator"])
410410
def test_03_delete_vm(self):
411-
"""Test Deploy VM with 5 GB RAM & verify the usage"""
411+
"""Test Deploy VM with specified RAM & verify the usage"""
412412

413413
# Validate the following
414-
# 1. Create compute offering with 5 GB RAM & Deploy VM in the created domain
414+
# 1. Create compute offering with specified RAM & Deploy VM in the created domain
415415
# 2. List Resource count for the root admin Memory usage
416416
# 3. Delete vm, resource count should list as 0 after delete operation.
417417

418418
# Resetting the memory count of service offering
419-
self.services["service_offering"]["memory"] = 5120
419+
self.services["service_offering"]["memory"] = 2048
420420

421421
self.debug("Setting up account and domain hierarchy")
422422
self.setupAccounts()
@@ -467,16 +467,16 @@ def test_03_delete_vm(self):
467467

468468
@attr(tags=["advanced", "advancedns","simulator"])
469469
def test_04_deploy_multiple_vm(self):
470-
"""Test Deploy multiple VM with 5 GB RAM & verify the usage"""
470+
"""Test Deploy multiple VM with specified RAM & verify the usage"""
471471

472472
# Validate the following
473-
# 1. Create compute offering with 5 GB RAM
473+
# 1. Create compute offering with specified RAM
474474
# 2. Deploy multiple VMs with this service offering
475475
# 3. List Resource count for the root admin Memory usage
476476
# 4. Memory usage should list properly
477477

478478
# Resetting the memory count of service offering
479-
self.services["service_offering"]["memory"] = 5120
479+
self.services["service_offering"]["memory"] = 2048
480480

481481
self.debug("Setting up account and domain hierarchy")
482482
self.setupAccounts()
@@ -607,7 +607,7 @@ def setupAccounts(self):
607607
self.domain.name)
608608
Resources.updateLimit(self.apiclient,
609609
resourcetype=9,
610-
max=10240,
610+
max=4096,
611611
account=self.parentd_admin.name,
612612
domainid=self.parentd_admin.domainid)
613613
self.debug("Creating a sub-domain under: %s" % self.parent_domain.name)
@@ -631,14 +631,14 @@ def setupAccounts(self):
631631
self.cdomain_1.name)
632632
Resources.updateLimit(self.apiclient,
633633
resourcetype=9,
634-
max=5120,
634+
max=2048,
635635
domainid=self.cadmin_1.domainid)
636636

637637
self.debug("Updating the Memory resource count for account: %s" %
638638
self.cadmin_1.name)
639639
Resources.updateLimit(self.apiclient,
640640
resourcetype=9,
641-
max=2148,
641+
max=2048,
642642
account=self.cadmin_1.name,
643643
domainid=self.cadmin_1.domainid)
644644

@@ -653,14 +653,14 @@ def setupAccounts(self):
653653
self.cdomain_2.name)
654654
Resources.updateLimit(self.apiclient,
655655
resourcetype=9,
656-
max=5120,
656+
max=2048,
657657
domainid=self.cadmin_2.domainid)
658658

659659
self.debug("Updating the Memory resource count for domain: %s" %
660660
self.cadmin_2.name)
661661
Resources.updateLimit(self.apiclient,
662662
resourcetype=9,
663-
max=2148,
663+
max=2048,
664664
account=self.cadmin_2.name,
665665
domainid=self.cadmin_2.domainid)
666666

@@ -684,9 +684,8 @@ def test_01_multiple_child_domains(self):
684684
"""Test memory limits with multiple child domains"""
685685

686686
# Validate the following
687-
# 1. Create Domain1 with 10 GB RAM and 2 child domains with 5 GB
688-
# each.Assign 2 GB for Domain1 admin1 & Domain1 User1 .Assign 2
689-
# GB for Domain2 admin1 & Domain2 User1
687+
# 1. Create Domain1 with 4 GB RAM and 2 child domains with 2 GB
688+
# each.
690689
# 2. Deploy VM's by Domain1 admin1/user1/ Domain2 user1/Admin1 account
691690
# and verify the resource updates
692691
# 3. Deploy VM by admin account after reaching max parent domain limit

‎test/integration/component/test_mm_limits.py‎

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def __init__(self):
5555
"displaytext": "Tiny Instance",
5656
"cpunumber": 1,
5757
"cpuspeed": 100, # in MHz
58-
"memory": 5120, # In MBs
58+
"memory": 2048, # In MBs
5959
},
6060
"virtual_machine": {
6161
"displayname": "TestVM",
@@ -177,10 +177,10 @@ def createInstance(self, service_off, networks=None, api_client=None):
177177

178178
@attr(tags=["advanced", "advancedns","simulator"])
179179
def test_01_stop_start_instance(self):
180-
"""Test Deploy VM with 5 GB RAM & verify the usage"""
180+
"""Test Deploy VM with specified RAM & verify the usage"""
181181

182182
# Validate the following
183-
# 1. Create compute offering with 5 GB RAM & Deploy VM as root admin
183+
# 1. Create compute offering with specified RAM & Deploy VM as root admin
184184
# 2 .List Resource count for the root admin Memory usage
185185
# 3. Stop and start instance, resource count should list properly.
186186

@@ -229,10 +229,10 @@ def test_01_stop_start_instance(self):
229229

230230
@attr(tags=["advanced", "advancedns","simulator"])
231231
def test_02_migrate_instance(self):
232-
"""Test Deploy VM with 5 GB RAM & verify the usage"""
232+
"""Test Deploy VM with specified RAM & verify the usage"""
233233

234234
# Validate the following
235-
# 1. Create compute offering with 5 GB RAM & Deploy VM as root admin
235+
# 1. Create compute offering with specified RAM & Deploy VM as root admin
236236
# 2. List Resource count for the root admin Memory usage
237237
# 3. Migrate vm, resource count should list properly.
238238

@@ -268,10 +268,10 @@ def test_02_migrate_instance(self):
268268

269269
@attr(tags=["advanced", "advancedns","simulator"])
270270
def test_03_delete_instance(self):
271-
"""Test Deploy VM with 5 GB RAM & verify the usage"""
271+
"""Test Deploy VM with specified GB RAM & verify the usage"""
272272

273273
# Validate the following
274-
# 1. Create compute offering with 5 GB RAM & Deploy VM as root admin
274+
# 1. Create compute offering with specified RAM & Deploy VM as root admin
275275
# 2. List Resource count for the root admin Memory usage
276276
# 3. Delete instance, resource count should be 0 after delete operation.
277277

@@ -306,11 +306,11 @@ def test_03_delete_instance(self):
306306
return
307307

308308
@attr(tags=["advanced", "advancedns","simulator"])
309-
def test_04_deploy_multiple_vm_with_5gb_ram(self):
310-
"""Test Deploy multiple VM with 5 GB RAM & verify the usage"""
309+
def test_04_deploy_multiple_vm(self):
310+
"""Test Deploy multiple VM with specified RAM & verify the usage"""
311311

312312
# Validate the following
313-
# 1. Create compute offering with 5 GB RAM
313+
# 1. Create compute offering with specified RAM
314314
# 2. Deploy multiple VMs with this service offering
315315
# 3. List Resource count for the root admin Memory usage
316316
# 4. Memory usage should list properly
@@ -550,10 +550,10 @@ def test_01_stop_start_instance(self):
550550

551551
@attr(tags=["advanced", "advancedns","simulator"])
552552
def test_02_migrate_instance(self):
553-
"""Test Deploy VM with 5 GB memory & verify the usage"""
553+
"""Test Deploy VM with specified memory & verify the usage"""
554554

555555
# Validate the following
556-
# 1. Create compute offering with 5 GB memory in child domains of root domain & Deploy VM
556+
# 1. Create compute offering with specified memory in child domains of root domain & Deploy VM
557557
# 2. List Resource count
558558
# 3. Migrate instance to another host
559559
# 4. Resource count should list properly.
@@ -608,10 +608,10 @@ def test_02_migrate_instance(self):
608608

609609
@attr(tags=["advanced", "advancedns","simulator"])
610610
def test_03_delete_instance(self):
611-
"""Test Deploy VM with 5 GB RAM & verify the usage"""
611+
"""Test Deploy VM with specified RAM & verify the usage"""
612612

613613
# Validate the following
614-
# 1. Create compute offering with 5 GB RAM in child domains of root domain & Deploy VM
614+
# 1. Create compute offering with specified RAM in child domains of root domain & Deploy VM
615615
# 2. List Resource count for the Memory usage
616616
# 3. Delete instance
617617
# 4. Resource count should list as 0
@@ -663,16 +663,16 @@ def test_03_delete_instance(self):
663663
@attr(tags=["advanced", "advancedns","simulator"])
664664
@attr(configuration='max.account.memory')
665665
def test_04_deploy_multiple_vm(self):
666-
"""Test Deploy multiple VM with 5 GB memory & verify the usage"""
667-
#keep the configuration value - max.account.memory = 20480
666+
"""Test Deploy multiple VM with 2 GB memory & verify the usage"""
667+
#keep the configuration value - max.account.memory = 8192 (maximum 4 instances per account with 2 GB RAM)
668668

669669
# Validate the following
670-
# 1. Create compute offering with 5 GB RAM
670+
# 1. Create compute offering with 2 GB RAM
671671
# 2. Deploy multiple VMs with this service offering in child domains of root domain
672672
# 3. List Resource count for the root admin Memory usage
673673
# 4. Memory usage should list properly
674674

675-
self.debug("Creating service offering with 5 GB RAM")
675+
self.debug("Creating service offering with 2 GB RAM")
676676
self.service_offering = ServiceOffering.create(
677677
self.apiclient,
678678
self.services["service_offering"]
@@ -695,8 +695,8 @@ def test_04_deploy_multiple_vm(self):
695695
domainid = self.domain.id
696696
)
697697

698-
if memory_account_gc[0].max != 20480:
699-
self.skipTest("This test case requires configuration value max.account.memory to be 20480")
698+
if memory_account_gc[0].max != 8192:
699+
self.skipTest("This test case requires configuration value max.account.memory to be 8192")
700700

701701
api_client = self.testClient.createUserApiClient(
702702
UserName=self.account.name,

‎test/integration/component/test_mm_project_limits.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def __init__(self):
5555
"displaytext": "Tiny Instance",
5656
"cpunumber": 1,
5757
"cpuspeed": 100, # in MHz
58-
"memory": 5120, # In MBs
58+
"memory": 2048, # In MBs
5959
},
6060
"virtual_machine": {
6161
"displayname": "TestVM",

0 commit comments

Comments
 (0)