|
19 | 19 | """ |
20 | 20 | # Import Local Modules |
21 | 21 | from nose.plugins.attrib import attr |
22 | | -from marvin.cloudstackTestCase import cloudstackTestCase,unittest |
| 22 | +from marvin.cloudstackTestCase import cloudstackTestCase |
23 | 23 | from marvin.lib.utils import cleanup_resources |
24 | 24 | from marvin.lib.base import (Account, |
25 | 25 | VirtualMachine, |
@@ -55,11 +55,12 @@ def setUpClass(cls): |
55 | 55 | cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) |
56 | 56 |
|
57 | 57 | cls.hypervisor = cls.testClient.getHypervisorInfo() |
| 58 | + cls.skip = False |
58 | 59 |
|
59 | 60 | if cls.hypervisor.lower() == 'lxc': |
60 | 61 | if not find_storage_pool_type(cls.apiclient, storagetype='rbd'): |
61 | | - raise unittest.SkipTest("RBD storage type is required for data volumes for LXC") |
62 | | - |
| 62 | + cls.skip = True |
| 63 | + return |
63 | 64 |
|
64 | 65 | cls.template = get_template( |
65 | 66 | cls.api_client, |
@@ -92,6 +93,9 @@ def tearDownClass(cls): |
92 | 93 |
|
93 | 94 | def setUp(self): |
94 | 95 |
|
| 96 | + if self.skip: |
| 97 | + self.skipTest("RBD storage type is required for data volumes for LXC") |
| 98 | + |
95 | 99 | self.apiclient = self.testClient.getApiClient() |
96 | 100 | self.dbclient = self.testClient.getDbConnection() |
97 | 101 | self.testdata["virtual_machine"]["zoneid"] = self.zone.id |
@@ -635,11 +639,11 @@ def test_09_stop_vm_migrate_vol(self): |
635 | 639 | # 4. Stop the vm |
636 | 640 | # 5.list primary storages in the cluster , should be more than one |
637 | 641 | # 6.Migrate voluem to another available primary storage |
638 | | - self.hypervisor = self.testClient.getHypervisorInfo() |
639 | 642 | if self.hypervisor.lower() in ['lxc']: |
640 | 643 | self.skipTest( |
641 | 644 | "vm migrate is not supported in %s" % |
642 | 645 | self.hypervisor) |
| 646 | + |
643 | 647 | clusters = Cluster.list( |
644 | 648 | self.apiclient, |
645 | 649 | zoneid=self.zone.id |
@@ -752,10 +756,12 @@ def setUpClass(cls): |
752 | 756 | cls.testdata = cls.testClient.getParsedTestDataConfig() |
753 | 757 | # Get Zone, Domain and templates |
754 | 758 | cls.hypervisor = cls.testClient.getHypervisorInfo() |
755 | | - |
| 759 | + cls.skip = False |
| 760 | + |
756 | 761 | if cls.hypervisor.lower() == 'lxc': |
757 | 762 | if not find_storage_pool_type(cls.apiclient, storagetype='rbd'): |
758 | | - raise unittest.SkipTest("RBD storage type is required for data volumes for LXC") |
| 763 | + cls.skip = True |
| 764 | + return |
759 | 765 |
|
760 | 766 | cls.domain = get_domain(cls.api_client) |
761 | 767 | cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) |
@@ -792,6 +798,9 @@ def tearDownClass(cls): |
792 | 798 |
|
793 | 799 | def setUp(self): |
794 | 800 |
|
| 801 | + if self.skip: |
| 802 | + self.skipTest("RBD storage type is required for data volumes for LXC ") |
| 803 | + |
795 | 804 | self.apiclient = self.testClient.getApiClient() |
796 | 805 | self.dbclient = self.testClient.getDbConnection() |
797 | 806 | self.hypervisor = self.testClient.getHypervisorInfo() |
@@ -865,7 +874,6 @@ def test_02_deploy_ha_vm_from_iso(self): |
865 | 874 | # 1. deployHA enabled Vm using ISO with the startvm parameter=true |
866 | 875 | # 2. listVM command should return the deployed VM. State of this VM |
867 | 876 | # should be "Running". |
868 | | - self.hypervisor = self.testClient.getHypervisorInfo() |
869 | 877 | if self.hypervisor.lower() in ['lxc']: |
870 | 878 | self.skipTest( |
871 | 879 | "vm deploy from ISO feature is not supported on %s" % |
@@ -923,10 +931,8 @@ def test_03_deploy_ha_vm_iso_startvm_false(self): |
923 | 931 | # 1. deployHA enabled Vm using ISO with the startvm parameter=false |
924 | 932 | # 2. listVM command should return the deployed VM. State of this VM |
925 | 933 | # should be "Stopped". |
926 | | - self.hypervisor = self.testClient.getHypervisorInfo() |
927 | 934 | if self.hypervisor.lower() in ['lxc']: |
928 | | - self.skipTest( |
929 | | - "vm deploy from ISO feature is not supported on %s" % |
| 935 | + self.skipTest("vm deploy from ISO feature is not supported on %s" % |
930 | 936 | self.hypervisor.lower()) |
931 | 937 |
|
932 | 938 | self.debug("Deploying instance in the account: %s" % |
@@ -961,10 +967,12 @@ def setUpClass(cls): |
961 | 967 | cls.testdata = cls.testClient.getParsedTestDataConfig() |
962 | 968 | # Get Zone, Domain and templates |
963 | 969 | cls.hypervisor = cls.testClient.getHypervisorInfo() |
| 970 | + cls.skip = False |
964 | 971 |
|
965 | 972 | if cls.hypervisor.lower() == 'lxc': |
966 | 973 | if not find_storage_pool_type(cls.apiclient, storagetype='rbd'): |
967 | | - raise unittest.SkipTest("RBD storage type is required for data volumes for LXC") |
| 974 | + cls.skip = True |
| 975 | + return |
968 | 976 |
|
969 | 977 | cls.domain = get_domain(cls.api_client) |
970 | 978 | cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) |
@@ -1000,6 +1008,9 @@ def tearDownClass(cls): |
1000 | 1008 |
|
1001 | 1009 | def setUp(self): |
1002 | 1010 |
|
| 1011 | + if self.skip: |
| 1012 | + self.skipTest("RBD storage type is required for data volumes for LXC") |
| 1013 | + |
1003 | 1014 | self.apiclient = self.testClient.getApiClient() |
1004 | 1015 | self.dbclient = self.testClient.getDbConnection() |
1005 | 1016 | self.testdata["virtual_machine"]["zoneid"] = self.zone.id |
@@ -1123,10 +1134,12 @@ def setUpClass(cls): |
1123 | 1134 | cls.testdata = cls.testClient.getParsedTestDataConfig() |
1124 | 1135 | # Get Zone, Domain and templates |
1125 | 1136 | cls.hypervisor = cls.testClient.getHypervisorInfo() |
| 1137 | + cls.skip = False |
1126 | 1138 |
|
1127 | 1139 | if cls.hypervisor.lower() == 'lxc': |
1128 | 1140 | if not find_storage_pool_type(cls.apiclient, storagetype='rbd'): |
1129 | | - raise unittest.SkipTest("RBD storage type is required for data volumes for LXC") |
| 1141 | + cls.skip = True |
| 1142 | + return |
1130 | 1143 |
|
1131 | 1144 | cls.domain = get_domain(cls.api_client) |
1132 | 1145 | cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) |
@@ -1162,6 +1175,9 @@ def tearDownClass(cls): |
1162 | 1175 |
|
1163 | 1176 | def setUp(self): |
1164 | 1177 |
|
| 1178 | + if self.skip: |
| 1179 | + self.skipTest("RBD storage type is required for data volumes for LXC") |
| 1180 | + |
1165 | 1181 | self.apiclient = self.testClient.getApiClient() |
1166 | 1182 | self.dbclient = self.testClient.getDbConnection() |
1167 | 1183 | self.testdata["virtual_machine"]["zoneid"] = self.zone.id |
@@ -1448,10 +1464,11 @@ def setUpClass(cls): |
1448 | 1464 |
|
1449 | 1465 | cls.testdata = cls.testClient.getParsedTestDataConfig() |
1450 | 1466 | cls.hypervisor = cls.testClient.getHypervisorInfo() |
| 1467 | + cls.skip = False |
1451 | 1468 |
|
1452 | 1469 | if cls.hypervisor.lower() == 'lxc': |
1453 | 1470 | if not find_storage_pool_type(cls.apiclient, storagetype='rbd'): |
1454 | | - raise unittest.SkipTest("RBD storage type is required for data volumes for LXC") |
| 1471 | + cls.skip = True |
1455 | 1472 |
|
1456 | 1473 | # Get Zone, Domain and templates |
1457 | 1474 | cls.domain = get_domain(cls.api_client) |
@@ -1491,6 +1508,9 @@ def tearDownClass(cls): |
1491 | 1508 | return |
1492 | 1509 |
|
1493 | 1510 | def setUp(self): |
| 1511 | + if self.skip: |
| 1512 | + self.skipTest("RBD storage type is required for data volumes for LXC") |
| 1513 | + |
1494 | 1514 | self.apiclient = self.testClient.getApiClient() |
1495 | 1515 | self.dbclient = self.testClient.getDbConnection() |
1496 | 1516 | self.cleanup = [] |
|
0 commit comments