You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2020/10/21 06:47:54 UTC

[GitHub] [cloudstack] DaanHoogland commented on a change in pull request #4307: [VMware] vSphere advanced capabilities and Full OVF properties support

DaanHoogland commented on a change in pull request #4307:
URL: https://github.com/apache/cloudstack/pull/4307#discussion_r509023955



##########
File path: test/integration/smoke/test_storage_policy.py
##########
@@ -0,0 +1,263 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+""" Test for VMWare storage policies
+"""
+# Import Local Modules
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.lib.utils import cleanup_resources
+from marvin.lib.base import (Account,
+                             VirtualMachine,
+                             ServiceOffering,
+                             NetworkOffering,
+                             Network,
+                             Volume,
+                             DiskOffering)
+from marvin.lib.common import (get_zone,
+                               get_domain,
+                               get_test_template)
+from marvin.codes import PASS
+from marvin.cloudstackAPI import (importVsphereStoragePolicies)
+from marvin.cloudstackAPI import (listVsphereStoragePolicies)
+
+
+class TestVMWareStoragePolicies(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.testClient = super(TestVMWareStoragePolicies, cls).getClsTestClient()
+        cls.apiclient = cls.testClient.getApiClient()
+
+        cls.testdata = cls.testClient.getParsedTestDataConfig()
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.apiclient)
+        cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
+        cls._cleanup = []
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
+        cls.network_offering = NetworkOffering.create(
+            cls.apiclient,
+            cls.testdata["l2-network_offering"],
+        )
+        cls.network_offering.update(cls.apiclient, state='Enabled')
+        cls.template = get_test_template(
+            cls.apiclient,
+            cls.zone.id,
+            cls.hypervisor,
+        )
+        cls.cleanup = [cls.network_offering]

Review comment:
       this will not be cleaned, needs to be something like below
   ```suggestion
           cls._cleanup.append(cls.network_offering)
   ```

##########
File path: test/integration/smoke/test_storage_policy.py
##########
@@ -0,0 +1,263 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+""" Test for VMWare storage policies
+"""
+# Import Local Modules
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.lib.utils import cleanup_resources
+from marvin.lib.base import (Account,
+                             VirtualMachine,
+                             ServiceOffering,
+                             NetworkOffering,
+                             Network,
+                             Volume,
+                             DiskOffering)
+from marvin.lib.common import (get_zone,
+                               get_domain,
+                               get_test_template)
+from marvin.codes import PASS
+from marvin.cloudstackAPI import (importVsphereStoragePolicies)
+from marvin.cloudstackAPI import (listVsphereStoragePolicies)
+
+
+class TestVMWareStoragePolicies(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.testClient = super(TestVMWareStoragePolicies, cls).getClsTestClient()
+        cls.apiclient = cls.testClient.getApiClient()
+
+        cls.testdata = cls.testClient.getParsedTestDataConfig()
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.apiclient)
+        cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
+        cls._cleanup = []
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
+        cls.network_offering = NetworkOffering.create(
+            cls.apiclient,
+            cls.testdata["l2-network_offering"],
+        )
+        cls.network_offering.update(cls.apiclient, state='Enabled')
+        cls.template = get_test_template(
+            cls.apiclient,
+            cls.zone.id,
+            cls.hypervisor,
+        )
+        cls.cleanup = [cls.network_offering]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cleanup_resources(cls.apiclient, cls.cleanup)

Review comment:
       ```suggestion
               cleanup_resources(cls.apiclient, reverved(cls._cleanup))
   ```

##########
File path: test/integration/smoke/test_storage_policy.py
##########
@@ -0,0 +1,263 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+""" Test for VMWare storage policies
+"""
+# Import Local Modules
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.lib.utils import cleanup_resources
+from marvin.lib.base import (Account,
+                             VirtualMachine,
+                             ServiceOffering,
+                             NetworkOffering,
+                             Network,
+                             Volume,
+                             DiskOffering)
+from marvin.lib.common import (get_zone,
+                               get_domain,
+                               get_test_template)
+from marvin.codes import PASS
+from marvin.cloudstackAPI import (importVsphereStoragePolicies)
+from marvin.cloudstackAPI import (listVsphereStoragePolicies)
+
+
+class TestVMWareStoragePolicies(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.testClient = super(TestVMWareStoragePolicies, cls).getClsTestClient()
+        cls.apiclient = cls.testClient.getApiClient()
+
+        cls.testdata = cls.testClient.getParsedTestDataConfig()
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.apiclient)
+        cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
+        cls._cleanup = []
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
+        cls.network_offering = NetworkOffering.create(
+            cls.apiclient,
+            cls.testdata["l2-network_offering"],
+        )
+        cls.network_offering.update(cls.apiclient, state='Enabled')
+        cls.template = get_test_template(
+            cls.apiclient,
+            cls.zone.id,
+            cls.hypervisor,
+        )
+        cls.cleanup = [cls.network_offering]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cleanup_resources(cls.apiclient, cls.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+    def setUp(self):
+
+        self.dbclient = self.testClient.getDbConnection()
+        self.hypervisor = self.testClient.getHypervisorInfo()
+        self.testdata["virtual_machine"]["zoneid"] = self.zone.id
+        self.testdata["virtual_machine"]["template"] = self.template.id
+        self.account = Account.create(
+            self.apiclient,
+            self.testdata["account"],
+            domainid=self.domain.id
+        )
+        self.cleanup = [self.account]
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            self.debug("Warning! Exception in tearDown: %s" % e)
+
+    def import_vmware_storage_policies(self, apiclient):
+        cmd = importVsphereStoragePolicies.importVsphereStoragePoliciesCmd()
+        cmd.zoneid = self.zone.id
+        return apiclient.importVsphereStoragePolicies(cmd)
+
+    def list_storage_policies(self, apiclient):
+        cmd = listVsphereStoragePolicies.listVsphereStoragePoliciesCmd()
+        cmd.zoneid = self.zone.id
+        return apiclient.listVsphereStoragePolicies(cmd)
+
+    def create_volume(self, apiclient):
+        cmd = create
+    @attr(
+        tags=[
+            "advanced",
+            "eip",
+            "advancedns",
+            "basic",
+            "sg"],
+        required_hardware="true")
+    def test_01_import_storage_policies(self):
+        """Test VMWare storage policies
+        """
+
+        # Validate the following:
+        # 1. Import VMWare storage policies - the command should return non-zero result
+        # 2. List current VMWare storage policies - the command should return non-zero result
+        # 3. Create service offering with first of the imported policies
+        # 4. Create disk offering with first of the imported policies
+        # 5. Create VM using the already created service offering
+        # 6. Create volume using the already created disk offering
+        # 7. Attach this volume to our VM
+        # 8. Detach the volume from our VM

Review comment:
       sensible comments, but I would like to see this be partitioned into methods of which the names reflect these comments. this method is long and thus rather hard to understand. also it is hard to check if it does what it says on the tin, certainly after a few rounds of maintenance.

##########
File path: test/integration/smoke/test_storage_policy.py
##########
@@ -0,0 +1,263 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+""" Test for VMWare storage policies
+"""
+# Import Local Modules
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.lib.utils import cleanup_resources
+from marvin.lib.base import (Account,
+                             VirtualMachine,
+                             ServiceOffering,
+                             NetworkOffering,
+                             Network,
+                             Volume,
+                             DiskOffering)
+from marvin.lib.common import (get_zone,
+                               get_domain,
+                               get_test_template)
+from marvin.codes import PASS
+from marvin.cloudstackAPI import (importVsphereStoragePolicies)
+from marvin.cloudstackAPI import (listVsphereStoragePolicies)
+
+
+class TestVMWareStoragePolicies(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.testClient = super(TestVMWareStoragePolicies, cls).getClsTestClient()
+        cls.apiclient = cls.testClient.getApiClient()
+
+        cls.testdata = cls.testClient.getParsedTestDataConfig()
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.apiclient)
+        cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
+        cls._cleanup = []
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
+        cls.network_offering = NetworkOffering.create(
+            cls.apiclient,
+            cls.testdata["l2-network_offering"],
+        )
+        cls.network_offering.update(cls.apiclient, state='Enabled')
+        cls.template = get_test_template(
+            cls.apiclient,
+            cls.zone.id,
+            cls.hypervisor,
+        )
+        cls.cleanup = [cls.network_offering]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cleanup_resources(cls.apiclient, cls.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+    def setUp(self):
+
+        self.dbclient = self.testClient.getDbConnection()
+        self.hypervisor = self.testClient.getHypervisorInfo()
+        self.testdata["virtual_machine"]["zoneid"] = self.zone.id
+        self.testdata["virtual_machine"]["template"] = self.template.id
+        self.account = Account.create(
+            self.apiclient,
+            self.testdata["account"],
+            domainid=self.domain.id
+        )
+        self.cleanup = [self.account]
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            self.debug("Warning! Exception in tearDown: %s" % e)
+
+    def import_vmware_storage_policies(self, apiclient):
+        cmd = importVsphereStoragePolicies.importVsphereStoragePoliciesCmd()
+        cmd.zoneid = self.zone.id
+        return apiclient.importVsphereStoragePolicies(cmd)
+
+    def list_storage_policies(self, apiclient):
+        cmd = listVsphereStoragePolicies.listVsphereStoragePoliciesCmd()
+        cmd.zoneid = self.zone.id
+        return apiclient.listVsphereStoragePolicies(cmd)
+
+    def create_volume(self, apiclient):
+        cmd = create

Review comment:
       ```suggestion
           cmd = create
   
   ```

##########
File path: test/integration/smoke/test_storage_policy.py
##########
@@ -0,0 +1,263 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+""" Test for VMWare storage policies
+"""
+# Import Local Modules
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.lib.utils import cleanup_resources
+from marvin.lib.base import (Account,
+                             VirtualMachine,
+                             ServiceOffering,
+                             NetworkOffering,
+                             Network,
+                             Volume,
+                             DiskOffering)
+from marvin.lib.common import (get_zone,
+                               get_domain,
+                               get_test_template)
+from marvin.codes import PASS
+from marvin.cloudstackAPI import (importVsphereStoragePolicies)
+from marvin.cloudstackAPI import (listVsphereStoragePolicies)
+
+
+class TestVMWareStoragePolicies(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.testClient = super(TestVMWareStoragePolicies, cls).getClsTestClient()
+        cls.apiclient = cls.testClient.getApiClient()
+
+        cls.testdata = cls.testClient.getParsedTestDataConfig()
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.apiclient)
+        cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
+        cls._cleanup = []
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
+        cls.network_offering = NetworkOffering.create(
+            cls.apiclient,
+            cls.testdata["l2-network_offering"],
+        )
+        cls.network_offering.update(cls.apiclient, state='Enabled')
+        cls.template = get_test_template(
+            cls.apiclient,
+            cls.zone.id,
+            cls.hypervisor,
+        )
+        cls.cleanup = [cls.network_offering]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cleanup_resources(cls.apiclient, cls.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+    def setUp(self):
+
+        self.dbclient = self.testClient.getDbConnection()
+        self.hypervisor = self.testClient.getHypervisorInfo()
+        self.testdata["virtual_machine"]["zoneid"] = self.zone.id
+        self.testdata["virtual_machine"]["template"] = self.template.id
+        self.account = Account.create(
+            self.apiclient,
+            self.testdata["account"],
+            domainid=self.domain.id
+        )
+        self.cleanup = [self.account]
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            self.debug("Warning! Exception in tearDown: %s" % e)
+
+    def import_vmware_storage_policies(self, apiclient):
+        cmd = importVsphereStoragePolicies.importVsphereStoragePoliciesCmd()
+        cmd.zoneid = self.zone.id
+        return apiclient.importVsphereStoragePolicies(cmd)
+
+    def list_storage_policies(self, apiclient):
+        cmd = listVsphereStoragePolicies.listVsphereStoragePoliciesCmd()
+        cmd.zoneid = self.zone.id
+        return apiclient.listVsphereStoragePolicies(cmd)
+
+    def create_volume(self, apiclient):
+        cmd = create
+    @attr(
+        tags=[

Review comment:
       isn't a tag for vmware in order?

##########
File path: test/integration/smoke/test_storage_policy.py
##########
@@ -0,0 +1,263 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+""" Test for VMWare storage policies
+"""
+# Import Local Modules
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.lib.utils import cleanup_resources
+from marvin.lib.base import (Account,
+                             VirtualMachine,
+                             ServiceOffering,
+                             NetworkOffering,
+                             Network,
+                             Volume,
+                             DiskOffering)
+from marvin.lib.common import (get_zone,
+                               get_domain,
+                               get_test_template)
+from marvin.codes import PASS
+from marvin.cloudstackAPI import (importVsphereStoragePolicies)
+from marvin.cloudstackAPI import (listVsphereStoragePolicies)
+
+
+class TestVMWareStoragePolicies(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.testClient = super(TestVMWareStoragePolicies, cls).getClsTestClient()
+        cls.apiclient = cls.testClient.getApiClient()
+
+        cls.testdata = cls.testClient.getParsedTestDataConfig()
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.apiclient)
+        cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
+        cls._cleanup = []
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
+        cls.network_offering = NetworkOffering.create(
+            cls.apiclient,
+            cls.testdata["l2-network_offering"],
+        )
+        cls.network_offering.update(cls.apiclient, state='Enabled')
+        cls.template = get_test_template(
+            cls.apiclient,
+            cls.zone.id,
+            cls.hypervisor,
+        )
+        cls.cleanup = [cls.network_offering]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cleanup_resources(cls.apiclient, cls.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+    def setUp(self):
+
+        self.dbclient = self.testClient.getDbConnection()
+        self.hypervisor = self.testClient.getHypervisorInfo()
+        self.testdata["virtual_machine"]["zoneid"] = self.zone.id
+        self.testdata["virtual_machine"]["template"] = self.template.id
+        self.account = Account.create(
+            self.apiclient,
+            self.testdata["account"],
+            domainid=self.domain.id
+        )
+        self.cleanup = [self.account]

Review comment:
       would be a good habbit to use
   ```suggestion
           self.cleanup = []
           self.cleanup.append(self.account)
   ```

##########
File path: test/integration/smoke/test_storage_policy.py
##########
@@ -0,0 +1,263 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+""" Test for VMWare storage policies
+"""
+# Import Local Modules
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.lib.utils import cleanup_resources
+from marvin.lib.base import (Account,
+                             VirtualMachine,
+                             ServiceOffering,
+                             NetworkOffering,
+                             Network,
+                             Volume,
+                             DiskOffering)
+from marvin.lib.common import (get_zone,
+                               get_domain,
+                               get_test_template)
+from marvin.codes import PASS
+from marvin.cloudstackAPI import (importVsphereStoragePolicies)
+from marvin.cloudstackAPI import (listVsphereStoragePolicies)
+
+
+class TestVMWareStoragePolicies(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.testClient = super(TestVMWareStoragePolicies, cls).getClsTestClient()
+        cls.apiclient = cls.testClient.getApiClient()
+
+        cls.testdata = cls.testClient.getParsedTestDataConfig()
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.apiclient)
+        cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
+        cls._cleanup = []
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
+        cls.network_offering = NetworkOffering.create(
+            cls.apiclient,
+            cls.testdata["l2-network_offering"],
+        )
+        cls.network_offering.update(cls.apiclient, state='Enabled')
+        cls.template = get_test_template(
+            cls.apiclient,
+            cls.zone.id,
+            cls.hypervisor,
+        )
+        cls.cleanup = [cls.network_offering]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cleanup_resources(cls.apiclient, cls.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+    def setUp(self):
+
+        self.dbclient = self.testClient.getDbConnection()
+        self.hypervisor = self.testClient.getHypervisorInfo()
+        self.testdata["virtual_machine"]["zoneid"] = self.zone.id
+        self.testdata["virtual_machine"]["template"] = self.template.id
+        self.account = Account.create(
+            self.apiclient,
+            self.testdata["account"],
+            domainid=self.domain.id
+        )
+        self.cleanup = [self.account]
+        return
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            cleanup_resources(self.apiclient, self.cleanup)

Review comment:
       also a good habit;
   ```suggestion
               cleanup_resources(self.apiclient, reversed(self.cleanup))
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org