Skip to content

Commit 85d073b

Browse files
committed
Merge pull request #2021 from nvazquez/CLOUDSTACK-9854
CLOUDSTACK-9854: Fix test_primary_storage test failure due to live migrationFix for test_primary_storage integration tests on simulator. When finding storage pool migration options for volume on running vm, API returns None as hypervisor doesn't support live migration. ```` 2017-03-28 06:07:55,958 - DEBUG - ========Sending GET Cmd : findStoragePoolsForMigration======= 2017-03-28 06:07:55,977 - DEBUG - Response : None 2017-03-28 06:07:55,983 - CRITICAL - EXCEPTION: test_03_migration_options_storage_tags: ['Traceback (most recent call last):\n', ' File "/opt/python/2.7.12/lib/python2.7/unittest/case.py", line 329, in run\n testMethod()\n', ' File "/home/travis/.local/lib/python2.7/site-packages/marvin/lib/decoratorGenerators.py", line 30, in test_wrapper\n return test(self, *args, **kwargs)\n', ' File "/home/travis/build/apache/cloudstack/test/integration/smoke/test_primary_storage.py", line 547, in test_03_migration_options_storage_tags\n pools_suitable = filter(lambda p : p.suitableformigration, pools_response)\n', "TypeError: 'NoneType' object is not iterable\n"] ```` So we simply stop vm before sending findStoragePoolsForMigration command * pr/2021: CLOUDSTACK-9854: Fix test_primary_storage test failure due to live migration Signed-off-by: Rajani Karuturi <rajani.karuturi@accelerite.com>
2 parents 0f0d908 + 11562dc commit 85d073b

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

test/integration/smoke/test_primary_storage.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ def setUpClass(cls):
306306
podid=cls.pod.id,
307307
tags=cls.services["storage_tags"]["a"]
308308
)
309-
cls._cleanup.append(cls.storage_pool_1)
309+
#PS not appended to _cleanup, it is removed on tearDownClass before cleaning up resources
310310
assert cls.storage_pool_1.state == 'Up'
311311
storage_pools_response = list_storage_pools(cls.apiclient,
312312
id=cls.storage_pool_1.id)
@@ -369,7 +369,18 @@ def setUpClass(cls):
369369
def tearDownClass(cls):
370370
try:
371371
# First expunge vm, so PS can be cleaned up
372-
cls.virtual_machine_1.delete(cls.apiclient, expunge=True)
372+
cls.virtual_machine_1.delete(cls.apiclient)
373+
374+
# Force delete primary storage
375+
cmd = enableStorageMaintenance.enableStorageMaintenanceCmd()
376+
cmd.id = cls.storage_pool_1.id
377+
cls.apiclient.enableStorageMaintenance(cmd)
378+
time.sleep(30)
379+
cmd = deleteStoragePool.deleteStoragePoolCmd()
380+
cmd.id = cls.storage_pool_1.id
381+
cmd.forced = True
382+
cls.apiclient.deleteStoragePool(cmd)
383+
373384
cleanup_resources(cls.apiclient, cls._cleanup)
374385
except Exception as e:
375386
raise Exception("Cleanup failed with %s" % e)
@@ -539,6 +550,9 @@ def test_03_migration_options_storage_tags(self):
539550
)
540551
vol = vm_1_volumes[0]
541552

553+
if self.hypervisor.lower() not in ["vmware", "xenserver"]:
554+
self.virtual_machine_1.stop(self.apiclient)
555+
542556
# Check migration options for volume
543557
pools_response = StoragePool.listForMigration(
544558
self.apiclient,

0 commit comments

Comments
 (0)