You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by sa...@apache.org on 2015/01/06 16:33:15 UTC

[01/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4

Repository: cloudstack
Updated Branches:
  refs/heads/vmware-disk-controllers c7b23d0a1 -> e8a54f471


CLOUDSTACK-8134. Worker VMs don't have MS id set in vCenter annotation 'cloud.vm.workertag'.
Correctly register node info for a newly created VMware context.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/13bdc1ce
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/13bdc1ce
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/13bdc1ce

Branch: refs/heads/vmware-disk-controllers
Commit: 13bdc1cef4ee0fae2f263777317c170302c49689
Parents: c7b23d0
Author: Likitha Shetty <li...@citrix.com>
Authored: Tue Dec 30 11:48:06 2014 +0530
Committer: Likitha Shetty <li...@citrix.com>
Committed: Tue Dec 30 11:52:56 2014 +0530

----------------------------------------------------------------------
 .../VmwareSecondaryStorageResourceHandler.java  | 23 +++++++++-----------
 1 file changed, 10 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/13bdc1ce/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageResourceHandler.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageResourceHandler.java b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageResourceHandler.java
index e67fed6..8a27799 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageResourceHandler.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageResourceHandler.java
@@ -209,23 +209,20 @@ public class VmwareSecondaryStorageResourceHandler implements SecondaryStorageRe
             _resource.ensureOutgoingRuleForAddress(vCenterAddress);
 
             VmwareContext context = currentContext.get();
-            if (context != null) {
-                if(!context.validate()) {
-                    invalidateServiceContext(context);
-                    context = null;
-                } else {
-                    context.registerStockObject("serviceconsole", cmd.getContextParam("serviceconsole"));
-                    context.registerStockObject("manageportgroup", cmd.getContextParam("manageportgroup"));
-                    context.registerStockObject("noderuninfo", cmd.getContextParam("noderuninfo"));
-                }
+            if (context != null && !context.validate()) {
+                invalidateServiceContext(context);
+                context = null;
             }
-            if(context == null) {
-                s_logger.info("Open new VmwareContext. vCenter: " + vCenterAddress + ", user: " + username + ", password: " +
-                        StringUtils.getMaskedPasswordForDisplay(password));
+            if (context == null) {
+                s_logger.info("Open new VmwareContext. vCenter: " + vCenterAddress + ", user: " + username + ", password: " + StringUtils.getMaskedPasswordForDisplay(password));
                 VmwareSecondaryStorageContextFactory.setVcenterSessionTimeout(vCenterSessionTimeout);
                 context = VmwareSecondaryStorageContextFactory.getContext(vCenterAddress, username, password);
             }
-
+            if (context != null) {
+                context.registerStockObject("serviceconsole", cmd.getContextParam("serviceconsole"));
+                context.registerStockObject("manageportgroup", cmd.getContextParam("manageportgroup"));
+                context.registerStockObject("noderuninfo", cmd.getContextParam("noderuninfo"));
+            }
             currentContext.set(context);
             return context;
         } catch (Exception e) {


[13/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4

Posted by sa...@apache.org.
CLOUDSTACK-8130: Fixed test_escalations_templates.py - Removed test case dependency on each other

Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/17da2e9c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/17da2e9c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/17da2e9c

Branch: refs/heads/vmware-disk-controllers
Commit: 17da2e9ce9894b67c32306fb36d02786d34ad0d0
Parents: 214d63e
Author: Ashutosh K <as...@clogeny.com>
Authored: Fri Dec 26 12:24:29 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Mon Jan 5 18:05:17 2015 +0530

----------------------------------------------------------------------
 .../component/test_escalations_templates.py     | 1001 +++++++++---------
 1 file changed, 509 insertions(+), 492 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/17da2e9c/test/integration/component/test_escalations_templates.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_templates.py b/test/integration/component/test_escalations_templates.py
index 3dc24c1..a7787c7 100644
--- a/test/integration/component/test_escalations_templates.py
+++ b/test/integration/component/test_escalations_templates.py
@@ -16,15 +16,23 @@
 # under the License.
 
 # Import Local Modules
-from marvin.cloudstackTestCase import *
-from marvin.cloudstackAPI import *
-from marvin.lib.utils import *
-from marvin.lib.base import *
-from marvin.lib.common import *
+from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.lib.utils import (cleanup_resources,
+                              validateList)
+from marvin.lib.base import (Account,
+                             Zone,
+                             Template,
+                             Hypervisor)
+from marvin.lib.common import (get_domain,
+                               get_zone,
+                               get_template,
+                               list_os_types,
+                               get_builtin_template_info)
 from marvin.codes import PASS
 from nose.plugins.attrib import attr
 import time
 
+
 class TestTemplates(cloudstackTestCase):
 
     @classmethod
@@ -36,23 +44,21 @@ class TestTemplates(cloudstackTestCase):
             cls.services = cls.testClient.getParsedTestDataConfig()
             # Get Domain, Zone, Template
             cls.domain = get_domain(cls.api_client)
-            cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+            cls.zone = get_zone(
+                cls.api_client,
+                cls.testClient.getZoneForTests())
             cls.template = get_template(
-                                cls.api_client,
-                                cls.zone.id,
-                                cls.services["ostype"]
-                                )
+                cls.api_client,
+                cls.zone.id,
+                cls.services["ostype"]
+            )
             cls.hypervisor = cls.testClient.getHypervisorInfo()
             cls.services['mode'] = cls.zone.networktype
-            cls.account = Account.create(
-                                cls.api_client,
-                                cls.services["account"],
-                                domainid=cls.domain.id
-                                )
-            # Getting authentication for user in newly created Account
-            cls.user = cls.account.user[0]
-            cls.userapiclient = cls.testClient.getUserApiClient(cls.user.username, cls.domain.name)
-            cls._cleanup.append(cls.account)
+
+            builtin_info = get_builtin_template_info(cls.api_client, cls.zone.id)
+            cls.services["privatetemplate"]["url"] = builtin_info[0]
+            cls.services["privatetemplate"]["hypervisor"] = builtin_info[1]
+            cls.services["privatetemplate"]["format"] = builtin_info[2]
         except Exception as e:
             cls.tearDownClass()
             raise Exception("Warning: Exception in setup : %s" % e)
@@ -62,6 +68,17 @@ class TestTemplates(cloudstackTestCase):
 
         self.apiClient = self.testClient.getApiClient()
         self.cleanup = []
+        self.account = Account.create(
+                self.apiClient,
+                self.services["account"],
+                domainid=self.domain.id
+        )
+        # Getting authentication for user in newly created Account
+        self.user = self.account.user[0]
+        self.userapiclient = self.testClient.getUserApiClient(
+            self.user.username,
+            self.domain.name)
+        self.cleanup.append(self.account)
 
     def tearDown(self):
         # Clean up, terminate the created resources
@@ -102,10 +119,9 @@ class TestTemplates(cloudstackTestCase):
                 return_flag = return_flag and True
             else:
                 return_flag = return_flag and False
-                self.debug("expected Value: %s, is not matching with actual value: %s" % (
-                                                                                          exp_val,
-                                                                                          act_val
-                                                                                          ))
+                self.debug(
+                    "expected Value: %s, is not matching with actual value: %s" %
+                    (exp_val, act_val))
         return return_flag
 
     @attr(tags=["advanced", "basic"], required_hardware="true")
@@ -132,105 +148,104 @@ class TestTemplates(cloudstackTestCase):
         """
         # Listing all the Templates for a User
         list_templates_before = Template.list(
-                                              self.userapiclient,
-                                              listall=self.services["listall"],
-                                              templatefilter=self.services["templatefilter"]
-                                              )
+            self.userapiclient,
+            listall=self.services["listall"],
+            templatefilter=self.services["templatefilter"]
+        )
         # Verifying that no Templates are listed
         self.assertIsNone(
-                          list_templates_before,
-                          "Templates listed for newly created User"
-                          )
-        self.services["templateregister"]["ostype"] = self.services["ostype"]
+            list_templates_before,
+            "Templates listed for newly created User"
+        )
+        self.services["privatetemplate"]["ostype"] = self.services["ostype"]
         # Creating pagesize + 1 number of Templates
         for i in range(0, (self.services["pagesize"] + 1)):
             template_created = Template.register(
-                                                 self.userapiclient,
-                                                 self.services["templateregister"],
-                                                 self.zone.id,
-                                                 hypervisor=self.hypervisor
-                                                 )
+                self.userapiclient,
+                self.services["privatetemplate"],
+                self.zone.id,
+                hypervisor=self.hypervisor
+            )
             self.assertIsNotNone(
-                                 template_created,
-                                 "Template creation failed"
-                                 )
-            if(i < self.services["pagesize"]):
-                self.cleanup.append(template_created)
+                template_created,
+                "Template creation failed"
+            )
 
         # Listing all the Templates for a User
         list_templates_after = Template.list(
-                                             self.userapiclient,
-                                             listall=self.services["listall"],
-                                             templatefilter=self.services["templatefilter"]
-                                             )
+            self.userapiclient,
+            listall=self.services["listall"],
+            templatefilter=self.services["templatefilter"]
+        )
         status = validateList(list_templates_after)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Templates creation failed"
-                          )
+            PASS,
+            status[0],
+            "Templates creation failed"
+        )
         # Verifying that list size is pagesize + 1
         self.assertEquals(
-                          self.services["pagesize"] + 1,
-                          len(list_templates_after),
-                          "Failed to create pagesize + 1 number of Templates"
-                          )
+            self.services["pagesize"] + 1,
+            len(list_templates_after),
+            "Failed to create pagesize + 1 number of Templates"
+        )
         # Listing all the Templates in page 1
         list_templates_page1 = Template.list(
-                                             self.userapiclient,
-                                             listall=self.services["listall"],
-                                             templatefilter=self.services["templatefilter"],
-                                             page=1,
-                                             pagesize=self.services["pagesize"]
-                                             )
+            self.userapiclient,
+            listall=self.services["listall"],
+            templatefilter=self.services["templatefilter"],
+            page=1,
+            pagesize=self.services["pagesize"]
+        )
         status = validateList(list_templates_page1)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Failed to list Templates in page 1"
-                          )
+            PASS,
+            status[0],
+            "Failed to list Templates in page 1"
+        )
         # Verifying the list size to be equal to pagesize
         self.assertEquals(
-                          self.services["pagesize"],
-                          len(list_templates_page1),
-                          "Size of Templates in page 1 is not matching"
-                          )
+            self.services["pagesize"],
+            len(list_templates_page1),
+            "Size of Templates in page 1 is not matching"
+        )
         # Listing all the Templates in page 2
         list_templates_page2 = Template.list(
-                                             self.userapiclient,
-                                             listall=self.services["listall"],
-                                             templatefilter=self.services["templatefilter"],
-                                             page=2,
-                                             pagesize=self.services["pagesize"]
-                                             )
+            self.userapiclient,
+            listall=self.services["listall"],
+            templatefilter=self.services["templatefilter"],
+            page=2,
+            pagesize=self.services["pagesize"]
+        )
         status = validateList(list_templates_page2)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Failed to list Templates in page 2"
-                          )
+            PASS,
+            status[0],
+            "Failed to list Templates in page 2"
+        )
         # Verifying the list size to be equal to 1
         self.assertEquals(
-                          1,
-                          len(list_templates_page2),
-                          "Size of Templates in page 2 is not matching"
-                          )
-        # Verifying the state of the template to be ready. If not waiting for state to become ready
+            1,
+            len(list_templates_page2),
+            "Size of Templates in page 2 is not matching"
+        )
+        # Verifying the state of the template to be ready. If not waiting for
+        # state to become ready
         template_ready = False
         count = 0
         while template_ready is False:
             list_template = Template.list(
-                                          self.userapiclient,
-                                          id=template_created.id,
-                                          listall=self.services["listall"],
-                                          templatefilter=self.services["templatefilter"],
-                                          )
+                self.userapiclient,
+                id=template_created.id,
+                listall=self.services["listall"],
+                templatefilter=self.services["templatefilter"],
+            )
             status = validateList(list_template)
             self.assertEquals(
-                              PASS,
-                              status[0],
-                              "Failed to list Templates by Id"
-                              )
+                PASS,
+                status[0],
+                "Failed to list Templates by Id"
+            )
             if list_template[0].isready is True:
                 template_ready = True
             elif (str(list_template[0].status) == "Error"):
@@ -245,23 +260,23 @@ class TestTemplates(cloudstackTestCase):
 
         # Deleting the Template present in page 2
         Template.delete(
-                        template_created,
-                        self.userapiclient
-                        )
+            template_created,
+            self.userapiclient
+        )
         # Listing all the Templates in page 2 again
         list_templates_page2 = Template.list(
-                                             self.userapiclient,
-                                             listall=self.services["listall"],
-                                             templatefilter=self.services["templatefilter"],
-                                             page=2,
-                                             pagesize=self.services["pagesize"]
-                                             )
+            self.userapiclient,
+            listall=self.services["listall"],
+            templatefilter=self.services["templatefilter"],
+            page=2,
+            pagesize=self.services["pagesize"]
+        )
         # Verifying that there are no Templates listed
         self.assertIsNone(
-                          list_templates_page2,
-                          "Templates not deleted from page 2"
-                          )
-        del self.services["templateregister"]["ostype"]
+            list_templates_page2,
+            "Templates not deleted from page 2"
+        )
+        del self.services["privatetemplate"]["ostype"]
         return
 
     @attr(tags=["advanced", "basic"], required_hardware="true")
@@ -282,63 +297,63 @@ class TestTemplates(cloudstackTestCase):
         """
         # Listing all the Templates for a User
         list_templates_before = Template.list(
-                                              self.userapiclient,
-                                              listall=self.services["listall"],
-                                              templatefilter=self.services["templatefilter"]
-                                              )
+            self.userapiclient,
+            listall=self.services["listall"],
+            templatefilter=self.services["templatefilter"]
+        )
         # Verifying that no Templates are listed
         self.assertIsNone(
-                          list_templates_before,
-                          "Templates listed for newly created User"
-                          )
-        self.services["templateregister"]["ostype"] = self.services["ostype"]
-        self.services["templateregister"]["isextractable"] = True
+            list_templates_before,
+            "Templates listed for newly created User"
+        )
+        self.services["privatetemplate"]["ostype"] = self.services["ostype"]
+        self.services["privatetemplate"]["isextractable"] = True
         # Creating aTemplate
         template_created = Template.register(
-                                             self.userapiclient,
-                                             self.services["templateregister"],
-                                             self.zone.id,
-                                             hypervisor=self.hypervisor
-                                             )
+            self.userapiclient,
+            self.services["privatetemplate"],
+            self.zone.id,
+            hypervisor=self.hypervisor
+        )
         self.assertIsNotNone(
-                             template_created,
-                             "Template creation failed"
-                             )
-        self.cleanup.append(template_created)
+            template_created,
+            "Template creation failed"
+        )
         # Listing all the Templates for a User
         list_templates_after = Template.list(
-                                             self.userapiclient,
-                                             listall=self.services["listall"],
-                                             templatefilter=self.services["templatefilter"]
-                                             )
+            self.userapiclient,
+            listall=self.services["listall"],
+            templatefilter=self.services["templatefilter"]
+        )
         status = validateList(list_templates_after)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Templates creation failed"
-                          )
+            PASS,
+            status[0],
+            "Templates creation failed"
+        )
         # Verifying that list size is 1
         self.assertEquals(
-                          1,
-                          len(list_templates_after),
-                          "Failed to create a Template"
-                          )
-        # Verifying the state of the template to be ready. If not waiting for state to become ready till time out
+            1,
+            len(list_templates_after),
+            "Failed to create a Template"
+        )
+        # Verifying the state of the template to be ready. If not waiting for
+        # state to become ready till time out
         template_ready = False
         count = 0
         while template_ready is False:
             list_template = Template.list(
-                                          self.userapiclient,
-                                          id=template_created.id,
-                                          listall=self.services["listall"],
-                                          templatefilter=self.services["templatefilter"],
-                                          )
+                self.userapiclient,
+                id=template_created.id,
+                listall=self.services["listall"],
+                templatefilter=self.services["templatefilter"],
+            )
             status = validateList(list_template)
             self.assertEquals(
-                              PASS,
-                              status[0],
-                              "Failed to list Templates by Id"
-                              )
+                PASS,
+                status[0],
+                "Failed to list Templates by Id"
+            )
             if list_template[0].isready is True:
                 template_ready = True
             elif (str(list_template[0].status) == "Error"):
@@ -353,32 +368,32 @@ class TestTemplates(cloudstackTestCase):
 
         # Downloading the Template name
         download_template = Template.extract(
-                                             self.userapiclient,
-                                             template_created.id,
-                                             mode="HTTP_DOWNLOAD",
-                                             zoneid=self.zone.id
-                                             )
+            self.userapiclient,
+            template_created.id,
+            mode="HTTP_DOWNLOAD",
+            zoneid=self.zone.id
+        )
         self.assertIsNotNone(
-                             download_template,
-                             "Download Template failed"
-                             )
-         # Verifying the details of downloaded template
+            download_template,
+            "Download Template failed"
+        )
+        # Verifying the details of downloaded template
         self.assertEquals(
-                          "DOWNLOAD_URL_CREATED",
-                          download_template.state,
-                          "Download URL not created for Template"
-                          )
+            "DOWNLOAD_URL_CREATED",
+            download_template.state,
+            "Download URL not created for Template"
+        )
         self.assertIsNotNone(
-                             download_template.url,
-                             "Download URL not created for Template"
-                             )
+            download_template.url,
+            "Download URL not created for Template"
+        )
         self.assertEquals(
-                          template_created.id,
-                          download_template.id,
-                          "Download Template details are not same as Template created"
-                          )
-        del self.services["templateregister"]["ostype"]
-        del self.services["templateregister"]["isextractable"]
+            template_created.id,
+            download_template.id,
+            "Download Template details are not same as Template created"
+        )
+        del self.services["privatetemplate"]["ostype"]
+        del self.services["privatetemplate"]["isextractable"]
         return
 
     @attr(tags=["advanced", "basic"], required_hardware="true")
@@ -407,62 +422,62 @@ class TestTemplates(cloudstackTestCase):
         """
         # Listing all the Templates for a User
         list_templates_before = Template.list(
-                                              self.userapiclient,
-                                              listall=self.services["listall"],
-                                              templatefilter=self.services["templatefilter"]
-                                              )
+            self.userapiclient,
+            listall=self.services["listall"],
+            templatefilter=self.services["templatefilter"]
+        )
         # Verifying that no Templates are listed
         self.assertIsNone(
-                          list_templates_before,
-                          "Templates listed for newly created User"
-                          )
-        self.services["templateregister"]["ostype"] = self.services["ostype"]
+            list_templates_before,
+            "Templates listed for newly created User"
+        )
+        self.services["privatetemplate"]["ostype"] = self.services["ostype"]
         # Creating aTemplate
         template_created = Template.register(
-                                             self.userapiclient,
-                                             self.services["templateregister"],
-                                             self.zone.id,
-                                             hypervisor=self.hypervisor
-                                             )
+            self.userapiclient,
+            self.services["privatetemplate"],
+            self.zone.id,
+            hypervisor=self.hypervisor
+        )
         self.assertIsNotNone(
-                             template_created,
-                             "Template creation failed"
-                             )
-        self.cleanup.append(template_created)
+            template_created,
+            "Template creation failed"
+        )
         # Listing all the Templates for a User
         list_templates_after = Template.list(
-                                             self.userapiclient,
-                                             listall=self.services["listall"],
-                                             templatefilter=self.services["templatefilter"]
-                                             )
+            self.userapiclient,
+            listall=self.services["listall"],
+            templatefilter=self.services["templatefilter"]
+        )
         status = validateList(list_templates_after)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Templates creation failed"
-                          )
+            PASS,
+            status[0],
+            "Templates creation failed"
+        )
         # Verifying that list size is 1
         self.assertEquals(
-                          1,
-                          len(list_templates_after),
-                          "Failed to create a Template"
-                          )
-        # Verifying the state of the template to be ready. If not waiting for state to become ready till time out
+            1,
+            len(list_templates_after),
+            "Failed to create a Template"
+        )
+        # Verifying the state of the template to be ready. If not waiting for
+        # state to become ready till time out
         template_ready = False
         count = 0
         while template_ready is False:
             list_template = Template.list(
-                                          self.userapiclient,
-                                          id=template_created.id,
-                                          listall=self.services["listall"],
-                                          templatefilter=self.services["templatefilter"],
-                                          )
+                self.userapiclient,
+                id=template_created.id,
+                listall=self.services["listall"],
+                templatefilter=self.services["templatefilter"],
+            )
             status = validateList(list_template)
             self.assertEquals(
-                              PASS,
-                              status[0],
-                              "Failed to list Templates by Id"
-                              )
+                PASS,
+                status[0],
+                "Failed to list Templates by Id"
+            )
             if list_template[0].isready is True:
                 template_ready = True
             elif (str(list_template[0].status) == "Error"):
@@ -477,220 +492,220 @@ class TestTemplates(cloudstackTestCase):
 
         # Editing the Template name
         edited_template = Template.update(
-                                          template_created,
-                                          self.userapiclient,
-                                          name="NewTemplateName"
-                                          )
+            template_created,
+            self.userapiclient,
+            name="NewTemplateName"
+        )
         self.assertIsNotNone(
-                             edited_template,
-                             "Editing Template failed"
-                             )
-         # Verifying the details of edited template
+            edited_template,
+            "Editing Template failed"
+        )
+        # Verifying the details of edited template
         expected_dict = {
-                         "id":template_created.id,
-                         "name":"NewTemplateName",
-                         "displaytest":template_created.displaytext,
-                         "account":template_created.account,
-                         "domainid":template_created.domainid,
-                         "format":template_created.format,
-                         "ostypeid":template_created.ostypeid,
-                         "templatetype":template_created.templatetype,
-                         }
+            "id": template_created.id,
+            "name": "NewTemplateName",
+            "displaytest": template_created.displaytext,
+            "account": template_created.account,
+            "domainid": template_created.domainid,
+            "format": template_created.format,
+            "ostypeid": template_created.ostypeid,
+            "templatetype": template_created.templatetype,
+        }
         actual_dict = {
-                       "id":edited_template.id,
-                       "name":edited_template.name,
-                       "displaytest":edited_template.displaytext,
-                       "account":edited_template.account,
-                       "domainid":edited_template.domainid,
-                       "format":edited_template.format,
-                       "ostypeid":edited_template.ostypeid,
-                       "templatetype":edited_template.templatetype,
-                       }
+            "id": edited_template.id,
+            "name": edited_template.name,
+            "displaytest": edited_template.displaytext,
+            "account": edited_template.account,
+            "domainid": edited_template.domainid,
+            "format": edited_template.format,
+            "ostypeid": edited_template.ostypeid,
+            "templatetype": edited_template.templatetype,
+        }
         edit_template_status = self.__verify_values(
-                                                    expected_dict,
-                                                    actual_dict
-                                                    )
+            expected_dict,
+            actual_dict
+        )
         self.assertEqual(
-                         True,
-                         edit_template_status,
-                         "Edited Template details are not as expected"
-                         )
+            True,
+            edit_template_status,
+            "Edited Template details are not as expected"
+        )
         # Editing the Template displaytext
         edited_template = Template.update(
-                                          template_created,
-                                          self.userapiclient,
-                                          displaytext="TemplateDisplaytext"
-                                          )
+            template_created,
+            self.userapiclient,
+            displaytext="TemplateDisplaytext"
+        )
         self.assertIsNotNone(
-                             edited_template,
-                             "Editing Template failed"
-                             )
-         # Verifying the details of edited template
+            edited_template,
+            "Editing Template failed"
+        )
+        # Verifying the details of edited template
         expected_dict = {
-                         "id":template_created.id,
-                         "name":"NewTemplateName",
-                         "displaytest":"TemplateDisplaytext",
-                         "account":template_created.account,
-                         "domainid":template_created.domainid,
-                         "format":template_created.format,
-                         "ostypeid":template_created.ostypeid,
-                         "templatetype":template_created.templatetype,
-                         }
+            "id": template_created.id,
+            "name": "NewTemplateName",
+            "displaytest": "TemplateDisplaytext",
+            "account": template_created.account,
+            "domainid": template_created.domainid,
+            "format": template_created.format,
+            "ostypeid": template_created.ostypeid,
+            "templatetype": template_created.templatetype,
+        }
         actual_dict = {
-                       "id":edited_template.id,
-                       "name":edited_template.name,
-                       "displaytest":edited_template.displaytext,
-                       "account":edited_template.account,
-                       "domainid":edited_template.domainid,
-                       "format":edited_template.format,
-                       "ostypeid":edited_template.ostypeid,
-                       "templatetype":edited_template.templatetype,
-                       }
+            "id": edited_template.id,
+            "name": edited_template.name,
+            "displaytest": edited_template.displaytext,
+            "account": edited_template.account,
+            "domainid": edited_template.domainid,
+            "format": edited_template.format,
+            "ostypeid": edited_template.ostypeid,
+            "templatetype": edited_template.templatetype,
+        }
         edit_template_status = self.__verify_values(
-                                                    expected_dict,
-                                                    actual_dict
-                                                    )
+            expected_dict,
+            actual_dict
+        )
         self.assertEqual(
-                         True,
-                         edit_template_status,
-                         "Edited Template details are not as expected"
-                         )
+            True,
+            edit_template_status,
+            "Edited Template details are not as expected"
+        )
         # Editing the Template ostypeid
         ostype_list = list_os_types(self.userapiclient)
         status = validateList(ostype_list)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Failed to list OS Types"
-                          )
+            PASS,
+            status[0],
+            "Failed to list OS Types"
+        )
         for i in range(0, len(ostype_list)):
             if ostype_list[i].id != template_created.ostypeid:
                 newostypeid = ostype_list[i].id
                 break
 
         edited_template = Template.update(
-                                          template_created,
-                                          self.userapiclient,
-                                          ostypeid=newostypeid
-                                          )
+            template_created,
+            self.userapiclient,
+            ostypeid=newostypeid
+        )
         self.assertIsNotNone(
-                             edited_template,
-                             "Editing Template failed"
-                             )
-         # Verifying the details of edited template
+            edited_template,
+            "Editing Template failed"
+        )
+        # Verifying the details of edited template
         expected_dict = {
-                         "id":template_created.id,
-                         "name":"NewTemplateName",
-                         "displaytest":"TemplateDisplaytext",
-                         "account":template_created.account,
-                         "domainid":template_created.domainid,
-                         "format":template_created.format,
-                         "ostypeid":newostypeid,
-                         "templatetype":template_created.templatetype,
-                         }
+            "id": template_created.id,
+            "name": "NewTemplateName",
+            "displaytest": "TemplateDisplaytext",
+            "account": template_created.account,
+            "domainid": template_created.domainid,
+            "format": template_created.format,
+            "ostypeid": newostypeid,
+            "templatetype": template_created.templatetype,
+        }
         actual_dict = {
-                       "id":edited_template.id,
-                       "name":edited_template.name,
-                       "displaytest":edited_template.displaytext,
-                       "account":edited_template.account,
-                       "domainid":edited_template.domainid,
-                       "format":edited_template.format,
-                       "ostypeid":edited_template.ostypeid,
-                       "templatetype":edited_template.templatetype,
-                       }
+            "id": edited_template.id,
+            "name": edited_template.name,
+            "displaytest": edited_template.displaytext,
+            "account": edited_template.account,
+            "domainid": edited_template.domainid,
+            "format": edited_template.format,
+            "ostypeid": edited_template.ostypeid,
+            "templatetype": edited_template.templatetype,
+        }
         edit_template_status = self.__verify_values(
-                                                    expected_dict,
-                                                    actual_dict
-                                                    )
+            expected_dict,
+            actual_dict
+        )
         self.assertEqual(
-                         True,
-                         edit_template_status,
-                         "Edited Template details are not as expected"
-                         )
+            True,
+            edit_template_status,
+            "Edited Template details are not as expected"
+        )
         # Editing the Template name, displaytext
         edited_template = Template.update(
-                                          template_created,
-                                          self.userapiclient,
-                                          name=template_created.name,
-                                          displaytext=template_created.displaytext
-                                          )
+            template_created,
+            self.userapiclient,
+            name=template_created.name,
+            displaytext=template_created.displaytext
+        )
         self.assertIsNotNone(
-                             edited_template,
-                             "Editing Template failed"
-                             )
-         # Verifying the details of edited template
+            edited_template,
+            "Editing Template failed"
+        )
+        # Verifying the details of edited template
         expected_dict = {
-                         "id":template_created.id,
-                         "name":template_created.name,
-                         "displaytest":template_created.displaytext,
-                         "account":template_created.account,
-                         "domainid":template_created.domainid,
-                         "format":template_created.format,
-                         "ostypeid":newostypeid,
-                         "templatetype":template_created.templatetype,
-                         }
+            "id": template_created.id,
+            "name": template_created.name,
+            "displaytest": template_created.displaytext,
+            "account": template_created.account,
+            "domainid": template_created.domainid,
+            "format": template_created.format,
+            "ostypeid": newostypeid,
+            "templatetype": template_created.templatetype,
+        }
         actual_dict = {
-                       "id":edited_template.id,
-                       "name":edited_template.name,
-                       "displaytest":edited_template.displaytext,
-                       "account":edited_template.account,
-                       "domainid":edited_template.domainid,
-                       "format":edited_template.format,
-                       "ostypeid":edited_template.ostypeid,
-                       "templatetype":edited_template.templatetype,
-                       }
+            "id": edited_template.id,
+            "name": edited_template.name,
+            "displaytest": edited_template.displaytext,
+            "account": edited_template.account,
+            "domainid": edited_template.domainid,
+            "format": edited_template.format,
+            "ostypeid": edited_template.ostypeid,
+            "templatetype": edited_template.templatetype,
+        }
         edit_template_status = self.__verify_values(
-                                                    expected_dict,
-                                                    actual_dict
-                                                    )
+            expected_dict,
+            actual_dict
+        )
         self.assertEqual(
-                         True,
-                         edit_template_status,
-                         "Edited Template details are not as expected"
-                         )
+            True,
+            edit_template_status,
+            "Edited Template details are not as expected"
+        )
         # Editing the Template name, displaytext, ostypeid
         edited_template = Template.update(
-                                          template_created,
-                                          self.userapiclient,
-                                          name="NewTemplateName",
-                                          displaytext="TemplateDisplaytext",
-                                          ostypeid=template_created.ostypeid
-                                          )
+            template_created,
+            self.userapiclient,
+            name="NewTemplateName",
+            displaytext="TemplateDisplaytext",
+            ostypeid=template_created.ostypeid
+        )
         self.assertIsNotNone(
-                             edited_template,
-                             "Editing Template failed"
-                             )
-         # Verifying the details of edited template
+            edited_template,
+            "Editing Template failed"
+        )
+        # Verifying the details of edited template
         expected_dict = {
-                         "id":template_created.id,
-                         "name":"NewTemplateName",
-                         "displaytest":"TemplateDisplaytext",
-                         "account":template_created.account,
-                         "domainid":template_created.domainid,
-                         "format":template_created.format,
-                         "ostypeid":template_created.ostypeid,
-                         "templatetype":template_created.templatetype,
-                         }
+            "id": template_created.id,
+            "name": "NewTemplateName",
+            "displaytest": "TemplateDisplaytext",
+            "account": template_created.account,
+            "domainid": template_created.domainid,
+            "format": template_created.format,
+            "ostypeid": template_created.ostypeid,
+            "templatetype": template_created.templatetype,
+        }
         actual_dict = {
-                       "id":edited_template.id,
-                       "name":edited_template.name,
-                       "displaytest":edited_template.displaytext,
-                       "account":edited_template.account,
-                       "domainid":edited_template.domainid,
-                       "format":edited_template.format,
-                       "ostypeid":edited_template.ostypeid,
-                       "templatetype":edited_template.templatetype,
-                       }
+            "id": edited_template.id,
+            "name": edited_template.name,
+            "displaytest": edited_template.displaytext,
+            "account": edited_template.account,
+            "domainid": edited_template.domainid,
+            "format": edited_template.format,
+            "ostypeid": edited_template.ostypeid,
+            "templatetype": edited_template.templatetype,
+        }
         edit_template_status = self.__verify_values(
-                                                    expected_dict,
-                                                    actual_dict
-                                                    )
+            expected_dict,
+            actual_dict
+        )
         self.assertEqual(
-                         True,
-                         edit_template_status,
-                         "Edited Template details are not as expected"
-                         )
-        del self.services["templateregister"]["ostype"]
+            True,
+            edit_template_status,
+            "Edited Template details are not as expected"
+        )
+        del self.services["privatetemplate"]["ostype"]
         return
 
     @attr(tags=["advanced", "basic"], required_hardware="true")
@@ -719,120 +734,122 @@ class TestTemplates(cloudstackTestCase):
         """
         # Listing Zones available for a user
         zones_list = Zone.list(
-                               self.userapiclient,
-                               available=True
-                               )
+            self.userapiclient,
+            available=True
+        )
         status = validateList(zones_list)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Failed to list Zones"
-                          )
+            PASS,
+            status[0],
+            "Failed to list Zones"
+        )
         if not len(zones_list) > 1:
             raise unittest.SkipTest("Not enough zones exist to copy template")
         else:
             # Listing all the Templates for a User in Zone 1
             list_templates_zone1 = Template.list(
-                                                 self.userapiclient,
-                                                 listall=self.services["listall"],
-                                                 templatefilter=self.services["templatefilter"],
-                                                 zoneid=zones_list[0].id
-                                                 )
+                self.userapiclient,
+                listall=self.services["listall"],
+                templatefilter=self.services["templatefilter"],
+                zoneid=zones_list[0].id
+            )
             # Verifying that no Templates are listed
             self.assertIsNone(
-                              list_templates_zone1,
-                              "Templates listed for newly created User in Zone1"
-                              )
+                list_templates_zone1,
+                "Templates listed for newly created User in Zone1"
+            )
             # Listing all the Templates for a User in Zone 2
             list_templates_zone2 = Template.list(
-                                                 self.userapiclient,
-                                                 listall=self.services["listall"],
-                                                 templatefilter=self.services["templatefilter"],
-                                                 zoneid=zones_list[1].id
-                                                 )
+                self.userapiclient,
+                listall=self.services["listall"],
+                templatefilter=self.services["templatefilter"],
+                zoneid=zones_list[1].id
+            )
             # Verifying that no Templates are listed
             self.assertIsNone(
-                              list_templates_zone2,
-                              "Templates listed for newly created User in Zone2"
-                              )
-            self.services["templateregister"]["ostype"] = self.services["ostype"]
+                list_templates_zone2,
+                "Templates listed for newly created User in Zone2"
+            )
+            self.services["privatetemplate"][
+                "ostype"] = self.services["ostype"]
             # Listing Hypervisors in Zone 1
             hypervisor_list = Hypervisor.list(
-                                              self.apiClient,
-                                              zoneid=zones_list[0].id
-                                              )
+                self.apiClient,
+                zoneid=zones_list[0].id
+            )
             status = validateList(zones_list)
             self.assertEquals(
-                              PASS,
-                              status[0],
-                              "Failed to list Hypervisors in Zone 1"
-                              )
+                PASS,
+                status[0],
+                "Failed to list Hypervisors in Zone 1"
+            )
             # Creating aTemplate in Zone 1
             template_created = Template.register(
-                                                 self.userapiclient,
-                                                 self.services["templateregister"],
-                                                 zones_list[0].id,
-                                                 hypervisor=hypervisor_list[0].name
-                                                 )
+                self.userapiclient,
+                self.services["privatetemplate"],
+                zones_list[0].id,
+                hypervisor=hypervisor_list[0].name
+            )
             self.assertIsNotNone(
-                                 template_created,
-                                 "Template creation failed"
-                                 )
-            self.cleanup.append(template_created)
+                template_created,
+                "Template creation failed"
+            )
             # Listing all the Templates for a User in Zone 1
             list_templates_zone1 = Template.list(
-                                                 self.userapiclient,
-                                                 listall=self.services["listall"],
-                                                 templatefilter=self.services["templatefilter"],
-                                                 zoneid=zones_list[0].id
-                                                 )
+                self.userapiclient,
+                listall=self.services["listall"],
+                templatefilter=self.services["templatefilter"],
+                zoneid=zones_list[0].id
+            )
             status = validateList(list_templates_zone1)
             self.assertEquals(
-                              PASS,
-                              status[0],
-                              "Templates creation failed in Zone1"
-                              )
+                PASS,
+                status[0],
+                "Templates creation failed in Zone1"
+            )
             # Verifying that list size is 1
             self.assertEquals(
-                              1,
-                              len(list_templates_zone1),
-                              "Failed to create a Template"
-                              )
+                1,
+                len(list_templates_zone1),
+                "Failed to create a Template"
+            )
             # Listing all the Templates for a User in Zone 2
             list_templates_zone2 = Template.list(
-                                                 self.userapiclient,
-                                                 listall=self.services["listall"],
-                                                 templatefilter=self.services["templatefilter"],
-                                                 zoneid=zones_list[1].id
-                                                 )
+                self.userapiclient,
+                listall=self.services["listall"],
+                templatefilter=self.services["templatefilter"],
+                zoneid=zones_list[1].id
+            )
             # Verifying that no Templates are listed
             self.assertIsNone(
-                              list_templates_zone2,
-                              "Templates listed for newly created User in Zone2"
-                              )
-            # Verifying the state of the template to be ready. If not waiting for state to become ready till time out
+                list_templates_zone2,
+                "Templates listed for newly created User in Zone2"
+            )
+            # Verifying the state of the template to be ready. If not waiting
+            # for state to become ready till time out
             template_ready = False
             count = 0
             while template_ready is False:
                 list_template = Template.list(
-                                              self.userapiclient,
-                                              id=template_created.id,
-                                              listall=self.services["listall"],
-                                              templatefilter=self.services["templatefilter"],
-                                              )
+                    self.userapiclient,
+                    id=template_created.id,
+                    listall=self.services["listall"],
+                    templatefilter=self.services["templatefilter"],
+                )
                 status = validateList(list_template)
                 self.assertEquals(
-                                  PASS,
-                                  status[0],
-                                  "Failed to list Templates by Id"
-                                  )
+                    PASS,
+                    status[0],
+                    "Failed to list Templates by Id"
+                )
                 if list_template[0].isready is True:
                     template_ready = True
                 elif (str(list_template[0].status) == "Error"):
                     self.fail("Created Template is in Errored state")
                     break
                 elif count > 10:
-                    self.fail("Timed out before Template came into ready state")
+                    self.fail(
+                        "Timed out before Template came into ready state")
                     break
                 else:
                     time.sleep(self.services["sleep"])
@@ -840,61 +857,61 @@ class TestTemplates(cloudstackTestCase):
 
             # Copying the Template from Zone1 to Zone2
             copied_template = template_created.copy(
-                                            self.userapiclient,
-                                            sourcezoneid=template_created.zoneid,
-                                            destzoneid=zones_list[1].id
-                                            )
+                self.userapiclient,
+                sourcezoneid=template_created.zoneid,
+                destzoneid=zones_list[1].id
+            )
             self.assertIsNotNone(
-                                 copied_template,
-                                 "Copying Template from Zone1 to Zone2 failed"
-                                 )
+                copied_template,
+                "Copying Template from Zone1 to Zone2 failed"
+            )
             # Listing all the Templates for a User in Zone 1
             list_templates_zone1 = Template.list(
-                                                 self.userapiclient,
-                                                 listall=self.services["listall"],
-                                                 templatefilter=self.services["templatefilter"],
-                                                 zoneid=zones_list[0].id
-                                                 )
+                self.userapiclient,
+                listall=self.services["listall"],
+                templatefilter=self.services["templatefilter"],
+                zoneid=zones_list[0].id
+            )
             status = validateList(list_templates_zone1)
             self.assertEquals(
-                              PASS,
-                              status[0],
-                              "Templates creation failed in Zone1"
-                              )
+                PASS,
+                status[0],
+                "Templates creation failed in Zone1"
+            )
             # Verifying that list size is 1
             self.assertEquals(
-                              1,
-                              len(list_templates_zone1),
-                              "Failed to create a Template"
-                              )
+                1,
+                len(list_templates_zone1),
+                "Failed to create a Template"
+            )
             # Listing all the Templates for a User in Zone 2
             list_templates_zone2 = Template.list(
-                                                 self.userapiclient,
-                                                 listall=self.services["listall"],
-                                                 templatefilter=self.services["templatefilter"],
-                                                 zoneid=zones_list[1].id
-                                                 )
+                self.userapiclient,
+                listall=self.services["listall"],
+                templatefilter=self.services["templatefilter"],
+                zoneid=zones_list[1].id
+            )
             status = validateList(list_templates_zone2)
             self.assertEquals(
-                              PASS,
-                              status[0],
-                              "Template failed to copy into Zone2"
-                              )
+                PASS,
+                status[0],
+                "Template failed to copy into Zone2"
+            )
             # Verifying that list size is 1
             self.assertEquals(
-                              1,
-                              len(list_templates_zone2),
-                              "Template failed to copy into Zone2"
-                              )
+                1,
+                len(list_templates_zone2),
+                "Template failed to copy into Zone2"
+            )
             self.assertNotEquals(
-                                 "Connection refused",
-                                 list_templates_zone2[0].status,
-                                 "Failed to copy Template"
-                                 )
+                "Connection refused",
+                list_templates_zone2[0].status,
+                "Failed to copy Template"
+            )
             self.assertEquals(
-                              True,
-                              list_templates_zone2[0].isready,
-                              "Failed to copy Template"
-                              )
-        del self.services["templateregister"]["ostype"]
+                True,
+                list_templates_zone2[0].isready,
+                "Failed to copy Template"
+            )
+        del self.services["privatetemplate"]["ostype"]
         return


[23/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4

Posted by sa...@apache.org.
Housekeeping, properly declare required maven version and update build plugin versions to recent versions


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ec32ea30
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ec32ea30
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ec32ea30

Branch: refs/heads/vmware-disk-controllers
Commit: ec32ea30f7b3e5351e661786955d9fa0929047bd
Parents: 84c44b6
Author: Hugo Trippaers <ht...@schubergphilis.com>
Authored: Tue Jan 6 11:58:58 2015 +0100
Committer: Hugo Trippaers <ht...@schubergphilis.com>
Committed: Tue Jan 6 11:58:58 2015 +0100

----------------------------------------------------------------------
 plugins/hypervisors/hyperv/pom.xml       |  3 --
 plugins/user-authenticators/ldap/pom.xml |  2 +-
 pom.xml                                  | 40 ++++++++++++++++++---------
 tools/checkstyle/pom.xml                 |  8 +++++-
 4 files changed, 35 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ec32ea30/plugins/hypervisors/hyperv/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/pom.xml b/plugins/hypervisors/hyperv/pom.xml
index 9e658f6..e09fb43 100644
--- a/plugins/hypervisors/hyperv/pom.xml
+++ b/plugins/hypervisors/hyperv/pom.xml
@@ -70,7 +70,6 @@
       <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>exec-maven-plugin</artifactId>
-        <version>1.2.1</version>
         <configuration>
           <executable>java</executable>
           <mainClass>com.cloud.agent.AgentShell</mainClass>
@@ -124,7 +123,6 @@
       <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>exec-maven-plugin</artifactId>
-        <version>1.2.1</version>
         <executions>
           <execution>
             <phase>compile</phase>
@@ -144,7 +142,6 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
-        <version>2.12</version>
         <configuration>
             <excludes>
               <exclude>none</exclude>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ec32ea30/plugins/user-authenticators/ldap/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/user-authenticators/ldap/pom.xml b/plugins/user-authenticators/ldap/pom.xml
index 22cdeb7..d24a5be 100644
--- a/plugins/user-authenticators/ldap/pom.xml
+++ b/plugins/user-authenticators/ldap/pom.xml
@@ -24,7 +24,7 @@
       <plugin>
         <groupId>org.codehaus.gmaven</groupId>
         <artifactId>gmaven-plugin</artifactId>
-        <version>1.3</version>
+        <version>1.5</version>
         <configuration>
           <providerSelection>1.7</providerSelection>
         </configuration>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ec32ea30/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index e63769e..d3694bc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,6 +32,10 @@
     <system>jira</system>
     <url>https://issues.apache.org/jira/browse/CLOUDSTACK</url>
   </issueManagement>
+  
+  <prerequisites>
+    <maven>3.0.4</maven>
+  </prerequisites>
 
   <properties>
     <cs.jdk.version>1.7</cs.jdk.version>
@@ -92,10 +96,10 @@
     <cs.target.dir>target</cs.target.dir>
     <cs.daemon.version>1.0.15</cs.daemon.version>
     <cs.jna.version>4.0.0</cs.jna.version>
-    <cs.checkstyle.version>2.11</cs.checkstyle.version>
-    <cs.mycila.license.version>2.5</cs.mycila.license.version>
-    <cs.findbugs.version>2.5.3</cs.findbugs.version>
-    <cs.javadoc.version>2.9.1</cs.javadoc.version>
+    <cs.checkstyle.version>2.13</cs.checkstyle.version>
+    <cs.mycila.license.version>2.7</cs.mycila.license.version>
+    <cs.findbugs.version>3.0.0</cs.findbugs.version>
+    <cs.javadoc.version>2.10.1</cs.javadoc.version>
     <cs.opensaml.version>2.6.1</cs.opensaml.version>
   </properties>
 
@@ -612,7 +616,7 @@
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-release-plugin</artifactId>
-          <version>2.2.1</version>
+          <version>2.5.1</version>
           <executions>
             <execution>
               <id>default</id>
@@ -695,12 +699,12 @@
         <plugin>
           <groupId>org.apache.tomcat.maven</groupId>
           <artifactId>tomcat7-maven-plugin</artifactId>
-          <version>2.0</version>
+          <version>2.2</version>
         </plugin>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-antrun-plugin</artifactId>
-          <version>1.7</version>
+          <version>1.8</version>
         </plugin>
         <plugin>
           <groupId>org.apache.rat</groupId>
@@ -837,7 +841,7 @@
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-compiler-plugin</artifactId>
-          <version>2.5.1</version>
+          <version>3.2</version>
           <configuration>
             <source>${cs.jdk.version}</source>
             <target>${cs.jdk.version}</target>
@@ -850,7 +854,7 @@
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-jar-plugin</artifactId>
-          <version>2.4</version>
+          <version>2.5</version>
           <configuration>
             <archive>
               <manifest>
@@ -863,7 +867,7 @@
         <plugin>
           <groupId>org.codehaus.mojo</groupId>
           <artifactId>build-helper-maven-plugin</artifactId>
-          <version>1.7</version>
+          <version>1.9.1</version>
           <executions>
             <execution>
               <id>remove-old-installers</id>
@@ -879,7 +883,7 @@
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-dependency-plugin</artifactId>
-          <version>2.5.1</version>
+          <version>2.9</version>
         </plugin>
         <plugin>
           <groupId>org.codehaus.mojo</groupId>
@@ -922,7 +926,7 @@
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-pmd-plugin</artifactId>
-          <version>3.1</version>
+          <version>3.3</version>
           <dependencies>
             <dependency>
               <groupId>org.apache.cloudstack</groupId>
@@ -946,6 +950,16 @@
             </execution>
           </executions>
         </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-surefire-plugin</artifactId>
+          <version>2.18.1</version>
+        </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-failsafe-plugin</artifactId>
+          <version>2.18.1</version>
+        </plugin>
       </plugins>
     </pluginManagement>
   </build>
@@ -983,7 +997,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-site-plugin</artifactId>
-        <version>3.3</version>
+        <version>3.4</version>
       </plugin>
     </plugins>
   </reporting>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ec32ea30/tools/checkstyle/pom.xml
----------------------------------------------------------------------
diff --git a/tools/checkstyle/pom.xml b/tools/checkstyle/pom.xml
index a993237..afba4a5 100644
--- a/tools/checkstyle/pom.xml
+++ b/tools/checkstyle/pom.xml
@@ -25,12 +25,18 @@
     <groupId>org.apache.cloudstack</groupId>
     <artifactId>checkstyle</artifactId>
     <version>4.6.0-SNAPSHOT</version>
+    
+    
+    <prerequisites>
+      <maven>3.0.4</maven>
+    </prerequisites>
+    
     <build>
       <plugins>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-checkstyle-plugin</artifactId>
-          <version>2.11</version>
+          <version>2.13</version>
           <executions>
             <execution>
               <phase>none</phase>


[16/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4

Posted by sa...@apache.org.
CLOUDSTACK-8137: Fixed cleanup issue in sec group tests in test_escalations_instances.py

Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/eae9f0f0
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/eae9f0f0
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/eae9f0f0

Branch: refs/heads/vmware-disk-controllers
Commit: eae9f0f0b0904a9dad025d4278b5e9b4fdf02b5e
Parents: 1ee4188
Author: K@clogeny.com <K...@clogeny.com>
Authored: Tue Dec 30 15:04:38 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Mon Jan 5 18:32:30 2015 +0530

----------------------------------------------------------------------
 test/integration/component/test_escalations_instances.py | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eae9f0f0/test/integration/component/test_escalations_instances.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_instances.py b/test/integration/component/test_escalations_instances.py
index b089ed5..15eb6f1 100644
--- a/test/integration/component/test_escalations_instances.py
+++ b/test/integration/component/test_escalations_instances.py
@@ -3652,7 +3652,6 @@ class TestInstances(cloudstackTestCase):
                 security_group,
                 "Security Group creation failed"
             )
-            self.cleanup.append(security_group)
             security_groups_list_size = security_groups_list_size + 1
 
         # Listing the networks again


[03/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4

Posted by sa...@apache.org.
CLOUDSTACK-8139: UI > create compute offering > server-side only supports one single host tag instead of multiple host tags. So, change UI to take in only one single host tag instead of multiple host tags in create compute dialog.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/61154b92
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/61154b92
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/61154b92

Branch: refs/heads/vmware-disk-controllers
Commit: 61154b92f73ecae5f5622eae53b3f0124a6709d5
Parents: 25a4f0d
Author: Jessica Wang <je...@apache.org>
Authored: Wed Dec 31 16:21:13 2014 -0800
Committer: Jessica Wang <je...@apache.org>
Committed: Fri Jan 2 11:17:35 2015 -0800

----------------------------------------------------------------------
 ui/scripts/configuration.js | 40 ++++------------------------------------
 1 file changed, 4 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/61154b92/ui/scripts/configuration.js
----------------------------------------------------------------------
diff --git a/ui/scripts/configuration.js b/ui/scripts/configuration.js
index 76b5b7b..3997e53 100644
--- a/ui/scripts/configuration.js
+++ b/ui/scripts/configuration.js
@@ -358,41 +358,9 @@
                                             });
                                         }
                                     },
-                                    hostTags: {
-                                        label: 'label.host.tags',
-                                        docID: 'helpComputeOfferingHostTags',
-                                        isTokenInput: true,
-                                        dataProvider: function(args) {
-                                            $.ajax({
-                                                url: createURL("listHostTags"),
-                                                dataType: "json",
-                                                success: function(json) {
-                                                    var item = json.listhosttagsresponse.hosttag;
-                                                    var tags = [];
-
-                                                    if (item != null)
-                                                    {
-                                                        tags = $.map(item, function(tag) {
-                                                            return {
-                                                                       id: tag.name,
-                                                                       name: tag.name
-                                                                   };
-                                                        });
-                                                    }
-
-                                                    args.response.success({
-                                                        data: tags,
-                                                        hintText: _l('hint.type.part.host.tag'),
-                                                        noResultsText: _l('hint.no.host.tags')
-                                                    });
-                                                },
-                                                error: function(XMLHttpResponse) {
-                                                    var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
-
-                                                    args.response.error(errorMsg);
-                                                }
-                                            });
-                                        }
+                                    hostTags: { //Only one single host tag is supported at server-side. Multiple host tags are NOT supported at server-side.
+                                        label: 'Host Tag',
+                                        docID: 'helpComputeOfferingHostTags'                                        
                                     },
                                     cpuCap: {
                                         label: 'label.CPU.cap',
@@ -979,7 +947,7 @@
                                         label: 'label.storage.tags'
                                     },
                                     hosttags: {
-                                        label: 'label.host.tags'
+                                        label: 'Host Tag'
                                     },
                                     domain: {
                                         label: 'label.domain'


[14/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4

Posted by sa...@apache.org.
CLOUDSTACK-8132: Fixed issue related to secondary storage count of template

Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f938a5e1
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f938a5e1
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f938a5e1

Branch: refs/heads/vmware-disk-controllers
Commit: f938a5e1c352971aa61e75a60935c735c3d3920c
Parents: 17da2e9
Author: Ashutosh K <as...@clogeny.com>
Authored: Mon Dec 29 03:34:37 2014 -0800
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Mon Jan 5 18:30:16 2015 +0530

----------------------------------------------------------------------
 test/integration/component/test_ss_limits.py | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f938a5e1/test/integration/component/test_ss_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_ss_limits.py b/test/integration/component/test_ss_limits.py
index 22ab99c..32201d8 100644
--- a/test/integration/component/test_ss_limits.py
+++ b/test/integration/component/test_ss_limits.py
@@ -127,7 +127,7 @@ class TestSecondaryStorageLimits(cloudstackTestCase):
         except Exception as e:
             return [FAIL, e]
         return [PASS, None]
-
+ 
     @data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
     @attr(tags = ["advanced"], required_hardware="true")
     def test_01_register_template(self, value):
@@ -144,24 +144,28 @@ class TestSecondaryStorageLimits(cloudstackTestCase):
         response = self.setupAccount(value)
         self.assertEqual(response[0], PASS, response[1])
 
+        apiclient = self.testClient.getUserApiClient(
+                                UserName=self.account.name,
+                                DomainName=self.account.domain)
+
         builtin_info = get_builtin_template_info(self.apiclient, self.zone.id)
         self.services["template_2"]["url"] = builtin_info[0]
         self.services["template_2"]["hypervisor"] = builtin_info[1]
         self.services["template_2"]["format"] = builtin_info[2]
 
         try:
-            template = Template.register(self.apiclient,
+            template = Template.register(apiclient,
                                      self.services["template_2"],
                                      zoneid=self.zone.id,
                                      account=self.account.name,
                                      domainid=self.account.domainid,
                                      hypervisor=self.hypervisor)
 
-            template.download(self.apiclient)
+            template.download(apiclient)
         except Exception as e:
             self.fail("Failed to register template: %s" % e)
 
-        templates = Template.list(self.apiclient,
+        templates = Template.list(apiclient,
                                       templatefilter=\
                                       self.services["template_2"]["templatefilter"],
                                       id=template.id)
@@ -171,19 +175,19 @@ class TestSecondaryStorageLimits(cloudstackTestCase):
         templateSize = (templates[0].size / (1024**3))
         expectedCount = templateSize
         response = matchResourceCount(
-                        self.apiclient, expectedCount,
+                        apiclient, expectedCount,
                         RESOURCE_SECONDARY_STORAGE,
                         accountid=self.account.id)
         self.assertEqual(response[0], PASS, response[1])
 
         try:
-            template.delete(self.apiclient)
+            template.delete(apiclient)
         except Exception as e:
             self.fail("Failed to delete template: %s" % e)
 
         expectedCount = 0
         response = matchResourceCount(
-                        self.apiclient, expectedCount,
+                        apiclient, expectedCount,
                         RESOURCE_SECONDARY_STORAGE,
                         accountid=self.account.id)
         self.assertEqual(response[0], PASS, response[1])


[21/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4

Posted by sa...@apache.org.
CID-1261666 added null check


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2c9cc1ec
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2c9cc1ec
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2c9cc1ec

Branch: refs/heads/vmware-disk-controllers
Commit: 2c9cc1ecde74d0ed7d37fe4ee86493d26f1bcc3b
Parents: 5251fb2
Author: Daan Hoogland <da...@onecht.net>
Authored: Mon Jan 5 16:05:57 2015 +0100
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jan 5 16:05:57 2015 +0100

----------------------------------------------------------------------
 .../cloud/hypervisor/xenserver/discoverer/XcpServerDiscoverer.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2c9cc1ec/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/discoverer/XcpServerDiscoverer.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/discoverer/XcpServerDiscoverer.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/discoverer/XcpServerDiscoverer.java
index 45cdaf9..bbd5376 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/discoverer/XcpServerDiscoverer.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/discoverer/XcpServerDiscoverer.java
@@ -161,7 +161,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
                 PoolPatch poolPatch = PoolPatch.getByUuid(conn, hotFixUuid);
                 for(HostPatch patch : patches) {
                     PoolPatch pp = patch.getPoolPatch(conn);
-                    if (pp.equals(poolPatch) && patch.getApplied(conn)) {
+                    if (pp != null && pp.equals(poolPatch) && patch.getApplied(conn)) {
                         s_logger.debug("host " + hostIp + " does have " + hotFixUuid +" Hotfix.");
                         return true;
                     }


[25/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4

Posted by sa...@apache.org.
CID-1114606 use of MAX_VALUE and longValue() on Integer


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e8a54f47
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e8a54f47
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e8a54f47

Branch: refs/heads/vmware-disk-controllers
Commit: e8a54f471c3c2b8c0dc7bc0105646456ad7c317a
Parents: eb9fba4
Author: Daan Hoogland <da...@onecht.net>
Authored: Tue Jan 6 16:24:29 2015 +0100
Committer: Daan Hoogland <da...@onecht.net>
Committed: Tue Jan 6 16:24:29 2015 +0100

----------------------------------------------------------------------
 .../cloud/configuration/ConfigurationManagerImpl.java   | 12 ++++++------
 server/src/com/cloud/vm/UserVmManagerImpl.java          |  6 +++---
 2 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e8a54f47/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index 3d5214d..d1a0887 100644
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -2020,14 +2020,14 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
             }
         }
 
-        if ((cpuNumber != null) && ((cpuNumber.intValue() <= 0) || (cpuNumber.intValue() > 2147483647))) {
-            throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the cpu number value between 1 and 2147483647");
+        if ((cpuNumber != null) && ((cpuNumber.intValue() <= 0) || (cpuNumber.longValue() > Integer.MAX_VALUE))) {
+            throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the cpu number value between 1 and " + Integer.MAX_VALUE);
         }
-        if ((cpuSpeed != null) && ((cpuSpeed.intValue() < 0) || (cpuSpeed.intValue() > 2147483647))) {
-            throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the cpu speed value between 1 and 2147483647");
+        if ((cpuSpeed != null) && ((cpuSpeed.intValue() < 0) || (cpuSpeed.longValue() > Integer.MAX_VALUE))) {
+            throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the cpu speed value between 0 and " + Integer.MAX_VALUE);
         }
-        if ((memory != null) && ((memory.intValue() < 32) || (memory.intValue() > 2147483647))) {
-            throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the memory value between 32 and 2147483647 MB");
+        if ((memory != null) && ((memory.intValue() < 32) || (memory.longValue() > Integer.MAX_VALUE))) {
+            throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the memory value between 32 and " + Integer.MAX_VALUE + " MB");
         }
 
         // check if valid domain

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e8a54f47/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index 605306e..170c612 100644
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -882,7 +882,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
             if (serviceOffering.getCpu() == null) {
                 String cpuNumber = customParameters.get(UsageEventVO.DynamicParameters.cpuNumber.name());
                 if ((cpuNumber == null) || (NumbersUtil.parseInt(cpuNumber, -1) <= 0)) {
-                    throw new InvalidParameterValueException("Invalid cpu cores value, specify a value between 1 and 2147483647");
+                    throw new InvalidParameterValueException("Invalid cpu cores value, specify a value between 1 and " + Integer.MAX_VALUE);
                 }
             } else if (customParameters.containsKey(UsageEventVO.DynamicParameters.cpuNumber.name())) {
                 throw new InvalidParameterValueException("The cpu cores of this offering id:" + serviceOffering.getId()
@@ -892,7 +892,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
             if (serviceOffering.getSpeed() == null) {
                 String cpuSpeed = customParameters.get(UsageEventVO.DynamicParameters.cpuSpeed.name());
                 if ((cpuSpeed == null) || (NumbersUtil.parseInt(cpuSpeed, -1) <= 0)) {
-                    throw new InvalidParameterValueException("Invalid cpu speed value, specify a value between 1 and 2147483647");
+                    throw new InvalidParameterValueException("Invalid cpu speed value, specify a value between 1 and " + Integer.MAX_VALUE);
                 }
             } else if (customParameters.containsKey(UsageEventVO.DynamicParameters.cpuSpeed.name())) {
                 throw new InvalidParameterValueException("The cpu speed of this offering id:" + serviceOffering.getId()
@@ -902,7 +902,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
             if (serviceOffering.getRamSize() == null) {
                 String memory = customParameters.get(UsageEventVO.DynamicParameters.memory.name());
                 if (memory == null || (NumbersUtil.parseInt(memory, -1) < 32)) {
-                    throw new InvalidParameterValueException("Invalid memory value, specify a value between 32 and 2147483647 MB");
+                    throw new InvalidParameterValueException("Invalid memory value, specify a value between 32 and " + Integer.MAX_VALUE + " MB");
                 }
             } else if (customParameters.containsKey(UsageEventVO.DynamicParameters.memory.name())) {
                 throw new InvalidParameterValueException("The memory of this offering id:" + serviceOffering.getId() + " is not customizable. This is predefined in the template.");


[02/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4

Posted by sa...@apache.org.
CLOUDSTACK-8136. [VMware] Create VM snapshot fails if a previous attempt to take the snapshot failed.
While looking for an ongoing VM snapshot task, check the task status to identify if the task is still running.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/25a4f0dc
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/25a4f0dc
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/25a4f0dc

Branch: refs/heads/vmware-disk-controllers
Commit: 25a4f0dc530951e87fe357313dc983cb75aa8972
Parents: 13bdc1c
Author: Likitha Shetty <li...@citrix.com>
Authored: Tue Dec 30 14:16:00 2014 +0530
Committer: Likitha Shetty <li...@citrix.com>
Committed: Tue Dec 30 14:19:48 2014 +0530

----------------------------------------------------------------------
 .../hypervisor/vmware/manager/VmwareStorageManagerImpl.java   | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25a4f0dc/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java
index 1981303..3aec7a4 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java
@@ -37,6 +37,7 @@ import com.vmware.vim25.HostDatastoreBrowserSearchResults;
 import com.vmware.vim25.HostDatastoreBrowserSearchSpec;
 import com.vmware.vim25.ManagedObjectReference;
 import com.vmware.vim25.TaskInfo;
+import com.vmware.vim25.TaskInfoState;
 import com.vmware.vim25.VirtualDisk;
 
 import org.apache.cloudstack.storage.to.TemplateObjectTO;
@@ -1181,8 +1182,10 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
                 TaskInfo info = (TaskInfo)(context.getVimClient().getDynamicProperty(taskMor, "info"));
 
                 if (info.getEntityName().equals(cmd.getVmName()) && info.getName().equalsIgnoreCase("CreateSnapshot_Task")) {
-                    s_logger.debug("There is already a VM snapshot task running, wait for it");
-                    context.getVimClient().waitForTask(taskMor);
+                    if (!(info.getState().equals(TaskInfoState.SUCCESS) || info.getState().equals(TaskInfoState.ERROR))) {
+                        s_logger.debug("There is already a VM snapshot task running, wait for it");
+                        context.getVimClient().waitForTask(taskMor);
+                    }
                 }
             }
 


[08/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4

Posted by sa...@apache.org.
CLOUDSTACK-8124: Skipping snapshot test cases on hyperv

Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7f10e6fe
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7f10e6fe
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7f10e6fe

Branch: refs/heads/vmware-disk-controllers
Commit: 7f10e6fe0b6744dd6d3ce5942baa70dc19a1040a
Parents: 9342944
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Wed Dec 24 14:39:20 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Mon Jan 5 17:02:10 2015 +0530

----------------------------------------------------------------------
 test/integration/component/test_blocker_bugs.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7f10e6fe/test/integration/component/test_blocker_bugs.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_blocker_bugs.py b/test/integration/component/test_blocker_bugs.py
index f9530f0..8ba563f 100644
--- a/test/integration/component/test_blocker_bugs.py
+++ b/test/integration/component/test_blocker_bugs.py
@@ -731,7 +731,7 @@ class TestTemplates(cloudstackTestCase):
 
         cls.testClient = super(TestTemplates, cls).getClsTestClient()
         cls.api_client = cls.testClient.getApiClient()
-
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
         cls.services = Services().services
         # Get Zone, Domain and templates
         cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
@@ -857,6 +857,8 @@ class TestTemplates(cloudstackTestCase):
         # 4. Check the size of snapshot and template
 
         # Create a snapshot from the ROOTDISK
+        if self.hypervisor.lower() in ['hyperv']:
+            self.skipTest("Snapshots feature is not supported on Hyper-V")
         snapshot = Snapshot.create(
                                    self.apiclient,
                                    self.volume.id,
@@ -922,6 +924,8 @@ class TestTemplates(cloudstackTestCase):
         # 5. Template should be created succesfully
 
         # Create a snapshot from the ROOTDISK
+        if self.hypervisor.lower() in ['hyperv']:
+            self.skipTest("Snapshots feature is not supported on Hyper-V")
         snapshot = Snapshot.create(
                                    self.apiclient,
                                    self.volume.id,


[09/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4

Posted by sa...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/214d63ee/test/integration/component/test_templates.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_templates.py b/test/integration/component/test_templates.py
index 753e71a..06b8c5f 100644
--- a/test/integration/component/test_templates.py
+++ b/test/integration/component/test_templates.py
@@ -284,7 +284,7 @@ class TestTemplates(cloudstackTestCase):
 
         cls.testClient = super(TestTemplates, cls).getClsTestClient()
         cls.api_client = cls.testClient.getApiClient()
-
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
         cls.services = Services().services
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client)
@@ -495,6 +495,9 @@ class TestTemplates(cloudstackTestCase):
         # 4. Deploy Virtual machine using this template
         # 5. VM should be in running state
 
+        if self.hypervisor.lower() in ['hyperv']:
+            self.skipTest("Snapshots feature is not supported on Hyper-V")
+
         userapiclient = self.testClient.getUserApiClient(
                                     UserName=self.account.name,
                                     DomainName=self.account.domain)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/214d63ee/test/integration/component/test_usage.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_usage.py b/test/integration/component/test_usage.py
index 58cfbed..262a371 100644
--- a/test/integration/component/test_usage.py
+++ b/test/integration/component/test_usage.py
@@ -16,7 +16,7 @@
 # under the License.
 """ P1 tests for Snapshots
 """
-#Import Local Modules
+# Import Local Modules
 from nose.plugins.attrib import attr
 from marvin.cloudstackTestCase import cloudstackTestCase, unittest
 from marvin.cloudstackAPI import deleteVolume
@@ -39,84 +39,86 @@ from marvin.lib.common import (get_zone,
                                get_domain,
                                get_template)
 
+
 class Services:
+
     """Test Snapshots Services
     """
 
     def __init__(self):
         self.services = {
-                        "account": {
-                                    "email": "test@test.com",
-                                    "firstname": "Test",
-                                    "lastname": "User",
-                                    "username": "test",
-                                    # Random characters are appended for unique
-                                    # username
-                                    "password": "password",
-                         },
-                         "service_offering": {
-                                    "name": "Tiny Instance",
-                                    "displaytext": "Tiny Instance",
-                                    "cpunumber": 1,
-                                    "cpuspeed": 100, # in MHz
-                                    "memory": 128, # In MBs
-                        },
-                        "disk_offering": {
-                                    "displaytext": "Small",
-                                    "name": "Small",
-                                    "disksize": 1
-                        },
-                        "volume": {
-                                   "diskname": "TestDiskServ",
-                                   },
-                        "server": {
-                                    "displayname": "TestVM",
-                                    "username": "root",
-                                    "password": "password",
-                                    "ssh_port": 22,
-                                    "hypervisor": 'XenServer',
-                                    "privateport": 22,
-                                    "publicport": 22,
-                                    "protocol": 'TCP',
-                                },
-                        "templates": {
-                                    "displaytext": 'Template',
-                                    "name": 'Template',
-                                    "ostype": 'CentOS 5.3 (64-bit)',
-                                    "templatefilter": 'self',
-                                    "url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.qcow2.bz2"
-                                },
-                        "iso": {
-                                  "displaytext": "Test ISO",
-                                  "name": "Test ISO",
-                                  "url": "http://people.apache.org/~tsp/dummy.iso",
-                                  # Source URL where ISO is located
-                                  "isextractable": True,
-                                  "isfeatured": True,
-                                  "ispublic": True,
-                                  "ostype": 'CentOS 5.3 (64-bit)',
-                                },
-                        "lbrule": {
-                                   "name": "SSH",
-                                   "alg": "roundrobin",
-                                   # Algorithm used for load balancing
-                                   "privateport": 22,
-                                   "publicport": 2222,
-                                },
-                        "natrule": {
-                                   "privateport": 22,
-                                   "publicport": 22,
-                                   "protocol": "TCP"
-                                },
-                        "vpn_user": {
-                                   "username": "test",
-                                   "password": "test",
-                                },
-                        "ostype": 'CentOS 5.3 (64-bit)',
-                        # Cent OS 5.3 (64 bit)
-                        "sleep": 60,
-                        "timeout": 10,
-                    }
+            "account": {
+                "email": "test@test.com",
+                "firstname": "Test",
+                "lastname": "User",
+                "username": "test",
+                # Random characters are appended for unique
+                # username
+                "password": "password",
+            },
+            "service_offering": {
+                "name": "Tiny Instance",
+                "displaytext": "Tiny Instance",
+                "cpunumber": 1,
+                "cpuspeed": 100,  # in MHz
+                "memory": 128,  # In MBs
+            },
+            "disk_offering": {
+                "displaytext": "Small",
+                "name": "Small",
+                "disksize": 1
+            },
+            "volume": {
+                "diskname": "TestDiskServ",
+            },
+            "server": {
+                "displayname": "TestVM",
+                "username": "root",
+                "password": "password",
+                "ssh_port": 22,
+                "hypervisor": 'XenServer',
+                "privateport": 22,
+                "publicport": 22,
+                "protocol": 'TCP',
+            },
+            "templates": {
+                "displaytext": 'Template',
+                "name": 'Template',
+                "ostype": 'CentOS 5.3 (64-bit)',
+                "templatefilter": 'self',
+                "url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.qcow2.bz2"
+            },
+            "iso": {
+                "displaytext": "Test ISO",
+                "name": "Test ISO",
+                "url": "http://people.apache.org/~tsp/dummy.iso",
+                # Source URL where ISO is located
+                "isextractable": True,
+                "isfeatured": True,
+                "ispublic": True,
+                "ostype": 'CentOS 5.3 (64-bit)',
+            },
+            "lbrule": {
+                "name": "SSH",
+                "alg": "roundrobin",
+                # Algorithm used for load balancing
+                "privateport": 22,
+                "publicport": 2222,
+            },
+            "natrule": {
+                "privateport": 22,
+                "publicport": 22,
+                "protocol": "TCP"
+            },
+            "vpn_user": {
+                "username": "test",
+                "password": "test",
+            },
+            "ostype": 'CentOS 5.3 (64-bit)',
+            # Cent OS 5.3 (64 bit)
+            "sleep": 60,
+            "timeout": 10,
+        }
 
 
 class TestVmUsage(cloudstackTestCase):
@@ -133,45 +135,45 @@ class TestVmUsage(cloudstackTestCase):
         cls.services['mode'] = cls.zone.networktype
 
         template = get_template(
-                            cls.api_client,
-                            cls.zone.id,
-                            cls.services["ostype"]
-                            )
+            cls.api_client,
+            cls.zone.id,
+            cls.services["ostype"]
+        )
         cls.services["server"]["zoneid"] = cls.zone.id
 
         cls.services["template"] = template.id
 
         # Create Account, VMs etc
         cls.account = Account.create(
-                            cls.api_client,
-                            cls.services["account"],
-                            domainid=cls.domain.id
-                            )
+            cls.api_client,
+            cls.services["account"],
+            domainid=cls.domain.id
+        )
 
         cls.services["account"] = cls.account.name
 
         cls.service_offering = ServiceOffering.create(
-                                            cls.api_client,
-                                            cls.services["service_offering"]
-                                            )
+            cls.api_client,
+            cls.services["service_offering"]
+        )
         cls.virtual_machine = VirtualMachine.create(
-                                cls.api_client,
-                                cls.services["server"],
-                                templateid=template.id,
-                                accountid=cls.account.name,
-                                domainid=cls.account.domainid,
-                                serviceofferingid=cls.service_offering.id
-                                )
+            cls.api_client,
+            cls.services["server"],
+            templateid=template.id,
+            accountid=cls.account.name,
+            domainid=cls.account.domainid,
+            serviceofferingid=cls.service_offering.id
+        )
         cls._cleanup = [
-                        cls.service_offering,
-                        cls.account,
-                        ]
+            cls.service_offering,
+            cls.account,
+        ]
         return
 
     @classmethod
     def tearDownClass(cls):
         try:
-            #Cleanup resources used
+            # Cleanup resources used
             cleanup_resources(cls.api_client, cls._cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -185,13 +187,21 @@ class TestVmUsage(cloudstackTestCase):
 
     def tearDown(self):
         try:
-            #Clean up, terminate the created instance, volumes and snapshots
+            # Clean up, terminate the created instance, volumes and snapshots
             cleanup_resources(self.apiclient, self.cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(tags=["advanced", "basic", "sg", "eip", "advancedns", "simulator"], required_hardware="false")
+    @attr(
+        tags=[
+            "advanced",
+            "basic",
+            "sg",
+            "eip",
+            "advancedns",
+            "simulator"],
+        required_hardware="false")
     def test_01_vm_usage(self):
         """Test Create/Destroy VM and verify usage calculation
         """
@@ -219,94 +229,94 @@ class TestVmUsage(cloudstackTestCase):
             self.fail("Failed to destroy VM: %s" % e)
 
         # Fetch account ID from account_uuid
-        self.debug("select id from account where uuid = '%s';" \
-                        % self.account.id)
+        self.debug("select id from account where uuid = '%s';"
+                   % self.account.id)
 
         qresultset = self.dbclient.execute(
-                        "select id from account where uuid = '%s';" \
-                        % self.account.id
-                        )
+            "select id from account where uuid = '%s';"
+            % self.account.id
+        )
         self.assertEqual(
-                         isinstance(qresultset, list),
-                         True,
-                         "Check DB query result set for valid data"
-                         )
+            isinstance(qresultset, list),
+            True,
+            "Check DB query result set for valid data"
+        )
 
         self.assertNotEqual(
-                            len(qresultset),
-                            0,
-                            "Check DB Query result set"
-                            )
+            len(qresultset),
+            0,
+            "Check DB Query result set"
+        )
         qresult = qresultset[0]
 
         account_id = qresult[0]
-        self.debug("select type from usage_event where account_id = '%s';" \
-                        % account_id)
+        self.debug("select type from usage_event where account_id = '%s';"
+                   % account_id)
 
         qresultset = self.dbclient.execute(
-                        "select type from usage_event where account_id = '%s';" \
-                        % account_id
-                        )
+            "select type from usage_event where account_id = '%s';"
+            % account_id
+        )
         self.assertEqual(
-                         isinstance(qresultset, list),
-                         True,
-                         "Check DB query result set for valid data"
-                         )
+            isinstance(qresultset, list),
+            True,
+            "Check DB query result set for valid data"
+        )
 
         self.assertNotEqual(
-                            len(qresultset),
-                            0,
-                            "Check DB Query result set"
-                            )
+            len(qresultset),
+            0,
+            "Check DB Query result set"
+        )
         qresult = str(qresultset)
         self.debug("Query result: %s" % qresult)
         # Check if VM.CREATE, VM.DESTROY events present in usage_event table
         self.assertEqual(
-                            qresult.count('VM.START'),
-                            1,
-                            "Check VM.START event in events table"
-                        )
+            qresult.count('VM.START'),
+            1,
+            "Check VM.START event in events table"
+        )
 
         self.assertEqual(
-                            qresult.count('NETWORK.OFFERING.ASSIGN'),
-                            1,
-                            "Check NETWORK.OFFERING.ASSIGN in events table"
-                        )
+            qresult.count('NETWORK.OFFERING.ASSIGN'),
+            1,
+            "Check NETWORK.OFFERING.ASSIGN in events table"
+        )
         self.assertEqual(
-                            qresult.count('VM.CREATE'),
-                            1,
-                            "Check VM.CREATE in list events"
-                        )
+            qresult.count('VM.CREATE'),
+            1,
+            "Check VM.CREATE in list events"
+        )
 
         self.assertEqual(
-                            qresult.count('VOLUME.CREATE'),
-                            1,
-                            "Check VOLUME.CREATE in events table"
-                        )
+            qresult.count('VOLUME.CREATE'),
+            1,
+            "Check VOLUME.CREATE in events table"
+        )
 
         self.assertEqual(
-                            qresult.count('VM.STOP'),
-                            1,
-                            "Check VM.STOP in events table"
-                        )
+            qresult.count('VM.STOP'),
+            1,
+            "Check VM.STOP in events table"
+        )
 
         self.assertEqual(
-                            qresult.count('NETWORK.OFFERING.REMOVE'),
-                            1,
-                            "Check NETWORK.OFFERING.REMOVE in list events"
-                        )
+            qresult.count('NETWORK.OFFERING.REMOVE'),
+            1,
+            "Check NETWORK.OFFERING.REMOVE in list events"
+        )
 
         self.assertEqual(
-                            qresult.count('VM.DESTROY'),
-                            1,
-                            "Check VM.DESTROY in events table"
-                        )
+            qresult.count('VM.DESTROY'),
+            1,
+            "Check VM.DESTROY in events table"
+        )
 
         self.assertEqual(
-                            qresult.count('VOLUME.DELETE'),
-                            1,
-                            "Check VOLUME.DELETE in events table"
-                        )
+            qresult.count('VOLUME.DELETE'),
+            1,
+            "Check VOLUME.DELETE in events table"
+        )
         return
 
 
@@ -324,53 +334,53 @@ class TestPublicIPUsage(cloudstackTestCase):
         cls.services['mode'] = cls.zone.networktype
 
         template = get_template(
-                            cls.api_client,
-                            cls.zone.id,
-                            cls.services["ostype"]
-                            )
+            cls.api_client,
+            cls.zone.id,
+            cls.services["ostype"]
+        )
         cls.services["server"]["zoneid"] = cls.zone.id
 
         cls.services["template"] = template.id
 
         # Create VMs, Assign Public IP etc
         cls.account = Account.create(
-                            cls.api_client,
-                            cls.services["account"],
-                            domainid=cls.domain.id
-                            )
+            cls.api_client,
+            cls.services["account"],
+            domainid=cls.domain.id
+        )
 
         cls.services["account"] = cls.account.name
 
         cls.service_offering = ServiceOffering.create(
-                                            cls.api_client,
-                                            cls.services["service_offering"]
-                                            )
+            cls.api_client,
+            cls.services["service_offering"]
+        )
         cls.virtual_machine = VirtualMachine.create(
-                                cls.api_client,
-                                cls.services["server"],
-                                templateid=template.id,
-                                accountid=cls.account.name,
-                                domainid=cls.account.domainid,
-                                serviceofferingid=cls.service_offering.id
-                                )
+            cls.api_client,
+            cls.services["server"],
+            templateid=template.id,
+            accountid=cls.account.name,
+            domainid=cls.account.domainid,
+            serviceofferingid=cls.service_offering.id
+        )
 
         cls.public_ip = PublicIPAddress.create(
-                                           cls.api_client,
-                                           accountid=cls.virtual_machine.account,
-                                           zoneid=cls.virtual_machine.zoneid,
-                                           domainid=cls.virtual_machine.domainid,
-                                           services=cls.services["server"]
-                                           )
+            cls.api_client,
+            accountid=cls.virtual_machine.account,
+            zoneid=cls.virtual_machine.zoneid,
+            domainid=cls.virtual_machine.domainid,
+            services=cls.services["server"]
+        )
         cls._cleanup = [
-                        cls.service_offering,
-                        cls.account,
-                        ]
+            cls.service_offering,
+            cls.account,
+        ]
         return
 
     @classmethod
     def tearDownClass(cls):
         try:
-            #Cleanup resources used
+            # Cleanup resources used
             cleanup_resources(cls.api_client, cls._cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -384,13 +394,19 @@ class TestPublicIPUsage(cloudstackTestCase):
 
     def tearDown(self):
         try:
-            #Clean up, terminate the created instance
+            # Clean up, terminate the created instance
             cleanup_resources(self.apiclient, self.cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(tags=["advanced", "eip", "advancedns", "simulator"], required_hardware="false")
+    @attr(
+        tags=[
+            "advanced",
+            "eip",
+            "advancedns",
+            "simulator"],
+        required_hardware="false")
     def test_01_public_ip_usage(self):
         """Test Assign new IP and verify usage calculation
         """
@@ -402,65 +418,65 @@ class TestPublicIPUsage(cloudstackTestCase):
         # 3. Delete the newly created account
 
         self.debug("Deleting public IP: %s" %
-                                self.public_ip.ipaddress)
+                   self.public_ip.ipaddress)
 
         # Release one of the IP
         self.public_ip.delete(self.apiclient)
 
         # Fetch account ID from account_uuid
-        self.debug("select id from account where uuid = '%s';" \
-                        % self.account.id)
+        self.debug("select id from account where uuid = '%s';"
+                   % self.account.id)
 
         qresultset = self.dbclient.execute(
-                        "select id from account where uuid = '%s';" \
-                        % self.account.id
-                        )
+            "select id from account where uuid = '%s';"
+            % self.account.id
+        )
         self.assertEqual(
-                         isinstance(qresultset, list),
-                         True,
-                         "Check DB query result set for valid data"
-                         )
+            isinstance(qresultset, list),
+            True,
+            "Check DB query result set for valid data"
+        )
         self.assertNotEqual(
-                            len(qresultset),
-                            0,
-                            "Check DB Query result set"
-                            )
+            len(qresultset),
+            0,
+            "Check DB Query result set"
+        )
         qresult = qresultset[0]
 
         account_id = qresult[0]
-        self.debug("select type from usage_event where account_id = '%s';" \
-                        % account_id)
+        self.debug("select type from usage_event where account_id = '%s';"
+                   % account_id)
 
         qresultset = self.dbclient.execute(
-                        "select type from usage_event where account_id = '%s';" \
-                        % account_id
-                        )
+            "select type from usage_event where account_id = '%s';"
+            % account_id
+        )
 
         self.assertEqual(
-                         isinstance(qresultset, list),
-                         True,
-                         "Check DB query result set for valid data"
-                         )
+            isinstance(qresultset, list),
+            True,
+            "Check DB query result set for valid data"
+        )
         self.assertNotEqual(
-                            len(qresultset),
-                            0,
-                            "Check DB Query result set"
-                            )
+            len(qresultset),
+            0,
+            "Check DB Query result set"
+        )
 
         qresult = str(qresultset)
         # Check if NET.IPASSIGN, NET.IPRELEASE events present in usage_event
         # table
         self.assertEqual(
-                            qresult.count('NET.IPASSIGN') > 0,
-                            True,
-                            "Check NET.IPASSIGN event in events table"
-                        )
+            qresult.count('NET.IPASSIGN') > 0,
+            True,
+            "Check NET.IPASSIGN event in events table"
+        )
 
         self.assertEqual(
-                            qresult.count('NET.IPRELEASE') > 0,
-                            True,
-                            "Check NET.IPRELEASE in events table"
-                        )
+            qresult.count('NET.IPRELEASE') > 0,
+            True,
+            "Check NET.IPRELEASE in events table"
+        )
         return
 
 
@@ -477,50 +493,50 @@ class TestVolumeUsage(cloudstackTestCase):
         cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
         cls.services['mode'] = cls.zone.networktype
         cls.disk_offering = DiskOffering.create(
-                                    cls.api_client,
-                                    cls.services["disk_offering"]
-                                    )
+            cls.api_client,
+            cls.services["disk_offering"]
+        )
         template = get_template(
-                            cls.api_client,
-                            cls.zone.id,
-                            cls.services["ostype"]
-                            )
+            cls.api_client,
+            cls.zone.id,
+            cls.services["ostype"]
+        )
         cls.services["server"]["zoneid"] = cls.zone.id
         cls.services["server"]["diskoffering"] = cls.disk_offering.id
         cls.services["template"] = template.id
 
         # Create Account, VMs etc
         cls.account = Account.create(
-                            cls.api_client,
-                            cls.services["account"],
-                            domainid=cls.domain.id
-                            )
+            cls.api_client,
+            cls.services["account"],
+            domainid=cls.domain.id
+        )
 
         cls.services["account"] = cls.account.name
 
         cls.service_offering = ServiceOffering.create(
-                                            cls.api_client,
-                                            cls.services["service_offering"]
-                                            )
+            cls.api_client,
+            cls.services["service_offering"]
+        )
         cls.virtual_machine = VirtualMachine.create(
-                                cls.api_client,
-                                cls.services["server"],
-                                templateid=template.id,
-                                accountid=cls.account.name,
-                                domainid=cls.account.domainid,
-                                serviceofferingid=cls.service_offering.id
-                                )
+            cls.api_client,
+            cls.services["server"],
+            templateid=template.id,
+            accountid=cls.account.name,
+            domainid=cls.account.domainid,
+            serviceofferingid=cls.service_offering.id
+        )
         cls._cleanup = [
-                        cls.service_offering,
-                        cls.disk_offering,
-                        cls.account,
-                        ]
+            cls.service_offering,
+            cls.disk_offering,
+            cls.account,
+        ]
         return
 
     @classmethod
     def tearDownClass(cls):
         try:
-            #Cleanup resources used
+            # Cleanup resources used
             cleanup_resources(cls.api_client, cls._cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -534,13 +550,21 @@ class TestVolumeUsage(cloudstackTestCase):
 
     def tearDown(self):
         try:
-            #Clean up, terminate the created instance, volumes
+            # Clean up, terminate the created instance, volumes
             cleanup_resources(self.apiclient, self.cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(tags=["advanced", "basic", "sg", "eip", "advancedns", "simulator"], required_hardware="false")
+    @attr(
+        tags=[
+            "advanced",
+            "basic",
+            "sg",
+            "eip",
+            "advancedns",
+            "simulator"],
+        required_hardware="false")
     def test_01_volume_usage(self):
         """Test Create/delete a volume and verify correct usage is recorded
         """
@@ -560,22 +584,22 @@ class TestVolumeUsage(cloudstackTestCase):
             self.fail("Failed to stop instance: %s" % e)
 
         volume_response = Volume.list(
-                                self.apiclient,
-                                virtualmachineid=self.virtual_machine.id,
-                                type='DATADISK',
-                                listall=True)
+            self.apiclient,
+            virtualmachineid=self.virtual_machine.id,
+            type='DATADISK',
+            listall=True)
         self.assertEqual(
-                         isinstance(volume_response, list),
-                         True,
-                         "Check for valid list volumes response"
-                         )
+            isinstance(volume_response, list),
+            True,
+            "Check for valid list volumes response"
+        )
         data_volume = volume_response[0]
 
         # Detach data Disk
         self.debug("Detaching volume ID: %s VM with ID: %s" % (
-                                                 data_volume.id,
-                                                 self.virtual_machine.id
-                                                 ))
+            data_volume.id,
+            self.virtual_machine.id
+        ))
         self.virtual_machine.detach_volume(self.apiclient, data_volume)
 
         # Delete Data disk
@@ -585,60 +609,60 @@ class TestVolumeUsage(cloudstackTestCase):
         self.apiclient.deleteVolume(cmd)
 
         # Fetch account ID from account_uuid
-        self.debug("select id from account where uuid = '%s';" \
-                        % self.account.id)
+        self.debug("select id from account where uuid = '%s';"
+                   % self.account.id)
 
         qresultset = self.dbclient.execute(
-                        "select id from account where uuid = '%s';" \
-                        % self.account.id
-                        )
+            "select id from account where uuid = '%s';"
+            % self.account.id
+        )
         self.assertEqual(
-                         isinstance(qresultset, list),
-                         True,
-                         "Check DB query result set for valid data"
-                         )
+            isinstance(qresultset, list),
+            True,
+            "Check DB query result set for valid data"
+        )
 
         self.assertNotEqual(
-                            len(qresultset),
-                            0,
-                            "Check DB Query result set"
-                            )
+            len(qresultset),
+            0,
+            "Check DB Query result set"
+        )
         qresult = qresultset[0]
 
         account_id = qresult[0]
-        self.debug("select type from usage_event where account_id = '%s';" \
-                        % account_id)
+        self.debug("select type from usage_event where account_id = '%s';"
+                   % account_id)
 
         qresultset = self.dbclient.execute(
-                        "select type from usage_event where account_id = '%s';" \
-                        % account_id
-                        )
+            "select type from usage_event where account_id = '%s';"
+            % account_id
+        )
 
         self.assertNotEqual(
-                            len(qresultset),
-                            0,
-                            "Check DB Query result set"
-                            )
+            len(qresultset),
+            0,
+            "Check DB Query result set"
+        )
         self.assertEqual(
-                         isinstance(qresultset, list),
-                         True,
-                         "Check DB query result set for valid data"
-                         )
+            isinstance(qresultset, list),
+            True,
+            "Check DB query result set for valid data"
+        )
 
         qresult = str(qresultset)
         self.debug("Query result: %s" % qresult)
         # Check VOLUME.CREATE, VOLUME.DESTROY events in cloud.usage_event table
         self.assertEqual(
-                            qresult.count('VOLUME.CREATE'),
-                            2,
-                            "Check VOLUME.CREATE event in events table"
-                        )
+            qresult.count('VOLUME.CREATE'),
+            2,
+            "Check VOLUME.CREATE event in events table"
+        )
 
         self.assertEqual(
-                            qresult.count('VOLUME.DELETE'),
-                            1,
-                            "Check VOLUME.DELETE in events table"
-                        )
+            qresult.count('VOLUME.DELETE'),
+            1,
+            "Check VOLUME.DELETE in events table"
+        )
         return
 
 
@@ -656,48 +680,48 @@ class TestTemplateUsage(cloudstackTestCase):
         cls.services['mode'] = cls.zone.networktype
         cls.services["server"]["zoneid"] = cls.zone.id
         template = get_template(
-                            cls.api_client,
-                            cls.zone.id,
-                            cls.services["ostype"]
-                            )
+            cls.api_client,
+            cls.zone.id,
+            cls.services["ostype"]
+        )
         cls.services["server"]["zoneid"] = cls.zone.id
         cls._cleanup = []
         try:
             cls.account = Account.create(
-                            cls.api_client,
-                            cls.services["account"],
-                            domainid=cls.domain.id
-                            )
+                cls.api_client,
+                cls.services["account"],
+                domainid=cls.domain.id
+            )
             cls._cleanup.append(cls.account)
             cls.userapiclient = cls.testClient.getUserApiClient(
-                                    UserName=cls.account.name,
-                                    DomainName=cls.account.domain)
+                UserName=cls.account.name,
+                DomainName=cls.account.domain)
             cls.services["account"] = cls.account.name
 
             cls.service_offering = ServiceOffering.create(
-                                            cls.api_client,
-                                            cls.services["service_offering"]
-                                            )
+                cls.api_client,
+                cls.services["service_offering"]
+            )
             cls._cleanup.append(cls.service_offering)
-            #create virtual machine
+            # create virtual machine
             cls.virtual_machine = VirtualMachine.create(
-                                    cls.api_client,
-                                    cls.services["server"],
-                                    templateid=template.id,
-                                    accountid=cls.account.name,
-                                    domainid=cls.account.domainid,
-                                    serviceofferingid=cls.service_offering.id,
-                                    mode=cls.services["mode"]
-                                    )
-
-            #Stop virtual machine
+                cls.api_client,
+                cls.services["server"],
+                templateid=template.id,
+                accountid=cls.account.name,
+                domainid=cls.account.domainid,
+                serviceofferingid=cls.service_offering.id,
+                mode=cls.services["mode"]
+            )
+
+            # Stop virtual machine
             cls.virtual_machine.stop(cls.api_client)
 
             list_volume = Volume.list(
-                            cls.api_client,
-                            virtualmachineid=cls.virtual_machine.id,
-                            type='ROOT',
-                            listall=True)
+                cls.api_client,
+                virtualmachineid=cls.virtual_machine.id,
+                type='ROOT',
+                listall=True)
             if isinstance(list_volume, list):
                 cls.volume = list_volume[0]
             else:
@@ -710,7 +734,7 @@ class TestTemplateUsage(cloudstackTestCase):
     @classmethod
     def tearDownClass(cls):
         try:
-            #Cleanup resources used
+            # Cleanup resources used
             cleanup_resources(cls.api_client, cls._cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -724,13 +748,20 @@ class TestTemplateUsage(cloudstackTestCase):
 
     def tearDown(self):
         try:
-            #Clean up, terminate the created instance, templates
+            # Clean up, terminate the created instance, templates
             cleanup_resources(self.apiclient, self.cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(tags=["advanced", "basic", "sg", "eip", "advancedns"], required_hardware="false")
+    @attr(
+        tags=[
+            "advanced",
+            "basic",
+            "sg",
+            "eip",
+            "advancedns"],
+        required_hardware="false")
     def test_01_template_usage(self):
         """Test Upload/ delete a template and verify correct usage is generated
             for the template uploaded
@@ -743,75 +774,75 @@ class TestTemplateUsage(cloudstackTestCase):
         #    cloud.usage_event tables for this account
         # 4. Destroy the account
 
-        #Create template from Virtual machine and Volume ID
+        # Create template from Virtual machine and Volume ID
         self.template = Template.create(
-                                self.userapiclient,
-                                self.services["templates"],
-                                self.volume.id,
-                                TestTemplateUsage.account.name,
-                                TestTemplateUsage.account.domainid
-                                )
+            self.userapiclient,
+            self.services["templates"],
+            self.volume.id,
+            TestTemplateUsage.account.name,
+            TestTemplateUsage.account.domainid
+        )
         self.debug("Created template with ID: %s" % self.template.id)
         # Delete template
         self.template.delete(self.userapiclient)
         self.debug("Deleted template with ID: %s" % self.template.id)
 
         # Fetch account ID from account_uuid
-        self.debug("select id from account where uuid = '%s';" \
-                        % self.account.id)
+        self.debug("select id from account where uuid = '%s';"
+                   % self.account.id)
 
         qresultset = self.dbclient.execute(
-                        "select id from account where uuid = '%s';" \
-                        % self.account.id
-                        )
+            "select id from account where uuid = '%s';"
+            % self.account.id
+        )
         self.assertEqual(
-                         isinstance(qresultset, list),
-                         True,
-                         "Check DB query result set for valid data"
-                         )
+            isinstance(qresultset, list),
+            True,
+            "Check DB query result set for valid data"
+        )
 
         self.assertNotEqual(
-                            len(qresultset),
-                            0,
-                            "Check DB Query result set"
-                            )
+            len(qresultset),
+            0,
+            "Check DB Query result set"
+        )
         qresult = qresultset[0]
 
         account_id = qresult[0]
-        self.debug("select type from usage_event where account_id = '%s';" \
-                        % account_id)
+        self.debug("select type from usage_event where account_id = '%s';"
+                   % account_id)
 
         qresultset = self.dbclient.execute(
-                        "select type from usage_event where account_id = '%s';" \
-                        % account_id
-                        )
+            "select type from usage_event where account_id = '%s';"
+            % account_id
+        )
 
         self.assertEqual(
-                         isinstance(qresultset, list),
-                         True,
-                         "Check DB query result set for valid data"
-                         )
+            isinstance(qresultset, list),
+            True,
+            "Check DB query result set for valid data"
+        )
         self.assertNotEqual(
-                            len(qresultset),
-                            0,
-                            "Check DB Query result set"
-                            )
+            len(qresultset),
+            0,
+            "Check DB Query result set"
+        )
 
         qresult = str(qresultset)
         self.debug("Query result: %s" % qresult)
 
         # Check for TEMPLATE.CREATE, TEMPLATE.DELETE in cloud.usage_event table
         self.assertEqual(
-                            qresult.count('TEMPLATE.CREATE'),
-                            1,
-                            "Check TEMPLATE.CREATE event in events table"
-                        )
+            qresult.count('TEMPLATE.CREATE'),
+            1,
+            "Check TEMPLATE.CREATE event in events table"
+        )
 
         self.assertEqual(
-                            qresult.count('TEMPLATE.DELETE'),
-                            1,
-                            "Check TEMPLATE.DELETE in events table"
-                        )
+            qresult.count('TEMPLATE.DELETE'),
+            1,
+            "Check TEMPLATE.DELETE in events table"
+        )
         return
 
 
@@ -831,34 +862,34 @@ class TestISOUsage(cloudstackTestCase):
         cls.services["iso"]["zoneid"] = cls.zone.id
         # Create Account, ISO image etc
         cls.account = Account.create(
-                            cls.api_client,
-                            cls.services["account"],
-                            domainid=cls.domain.id
-                            )
+            cls.api_client,
+            cls.services["account"],
+            domainid=cls.domain.id
+        )
         cls.services["account"] = cls.account.name
         cls.iso = Iso.create(
-                                cls.api_client,
-                                cls.services["iso"],
-                                account=cls.account.name,
-                                domainid=cls.account.domainid
-                            )
+            cls.api_client,
+            cls.services["iso"],
+            account=cls.account.name,
+            domainid=cls.account.domainid
+        )
         try:
             # Wait till ISO gets downloaded
             cls.iso.download(cls.api_client)
         except Exception as e:
             raise Exception("%s: Failed to download ISO: %s" % (
-                                                        e,
-                                                        cls.iso.id
-                                                        ))
+                e,
+                cls.iso.id
+            ))
         cls._cleanup = [
-                        cls.account,
-                        ]
+            cls.account,
+        ]
         return
 
     @classmethod
     def tearDownClass(cls):
         try:
-            #Cleanup resources used
+            # Cleanup resources used
             cleanup_resources(cls.api_client, cls._cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -872,13 +903,20 @@ class TestISOUsage(cloudstackTestCase):
 
     def tearDown(self):
         try:
-            #Clean up, terminate the created ISO images
+            # Clean up, terminate the created ISO images
             cleanup_resources(self.apiclient, self.cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(tags=["advanced", "basic", "sg", "eip", "advancedns"], required_hardware="false")
+    @attr(
+        tags=[
+            "advanced",
+            "basic",
+            "sg",
+            "eip",
+            "advancedns"],
+        required_hardware="false")
     def test_01_ISO_usage(self):
         """Test Create/Delete a ISO and verify its usage is generated correctly
         """
@@ -895,62 +933,62 @@ class TestISOUsage(cloudstackTestCase):
         self.iso.delete(self.apiclient)
 
         # Fetch account ID from account_uuid
-        self.debug("select id from account where uuid = '%s';" \
-                        % self.account.id)
+        self.debug("select id from account where uuid = '%s';"
+                   % self.account.id)
 
         qresultset = self.dbclient.execute(
-                        "select id from account where uuid = '%s';" \
-                        % self.account.id
-                        )
+            "select id from account where uuid = '%s';"
+            % self.account.id
+        )
         self.assertEqual(
-                         isinstance(qresultset, list),
-                         True,
-                         "Check DB query result set for valid data"
-                         )
+            isinstance(qresultset, list),
+            True,
+            "Check DB query result set for valid data"
+        )
 
         self.assertNotEqual(
-                            len(qresultset),
-                            0,
-                            "Check DB Query result set"
-                            )
+            len(qresultset),
+            0,
+            "Check DB Query result set"
+        )
         qresult = qresultset[0]
 
         account_id = qresult[0]
-        self.debug("select type from usage_event where account_id = '%s';" \
-                        % account_id)
+        self.debug("select type from usage_event where account_id = '%s';"
+                   % account_id)
 
         qresultset = self.dbclient.execute(
-                        "select type from usage_event where account_id = '%s';" \
-                        % account_id
-                        )
+            "select type from usage_event where account_id = '%s';"
+            % account_id
+        )
 
         self.assertEqual(
-                         isinstance(qresultset, list),
-                         True,
-                         "Check DB query result set for valid data"
-                         )
+            isinstance(qresultset, list),
+            True,
+            "Check DB query result set for valid data"
+        )
 
         self.assertNotEqual(
-                            len(qresultset),
-                            0,
-                            "Check DB Query result set"
-                            )
+            len(qresultset),
+            0,
+            "Check DB Query result set"
+        )
 
         qresult = str(qresultset)
         self.debug("Query result: %s" % qresult)
-        imageStores = ImageStore.list(self.api_client,zoneid=self.zone.id)
+        imageStores = ImageStore.list(self.api_client, zoneid=self.zone.id)
         # Check for ISO.CREATE, ISO.DELETE events in cloud.usage_event table
         self.assertEqual(
-                            qresult.count('ISO.CREATE'),
-                            len(imageStores),
-                            "Check ISO.CREATE event in events table"
-                        )
+            qresult.count('ISO.CREATE'),
+            len(imageStores),
+            "Check ISO.CREATE event in events table"
+        )
 
         self.assertEqual(
-                            qresult.count('ISO.DELETE'),
-                            len(imageStores),
-                            "Check ISO.DELETE in events table"
-                        )
+            qresult.count('ISO.DELETE'),
+            len(imageStores),
+            "Check ISO.DELETE in events table"
+        )
         return
 
 
@@ -967,52 +1005,52 @@ class TestLBRuleUsage(cloudstackTestCase):
         cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
         cls.services['mode'] = cls.zone.networktype
         template = get_template(
-                            cls.api_client,
-                            cls.zone.id,
-                            cls.services["ostype"]
-                            )
+            cls.api_client,
+            cls.zone.id,
+            cls.services["ostype"]
+        )
         cls.services["server"]["zoneid"] = cls.zone.id
 
         cls.services["template"] = template.id
 
         # Create VMs, LB Rules etc
         cls.account = Account.create(
-                            cls.api_client,
-                            cls.services["account"],
-                            domainid=cls.domain.id
-                            )
+            cls.api_client,
+            cls.services["account"],
+            domainid=cls.domain.id
+        )
 
         cls.services["account"] = cls.account.name
 
         cls.service_offering = ServiceOffering.create(
-                                            cls.api_client,
-                                            cls.services["service_offering"]
-                                            )
+            cls.api_client,
+            cls.services["service_offering"]
+        )
         cls.virtual_machine = VirtualMachine.create(
-                                cls.api_client,
-                                cls.services["server"],
-                                templateid=template.id,
-                                accountid=cls.account.name,
-                                domainid=cls.account.domainid,
-                                serviceofferingid=cls.service_offering.id
-                                )
+            cls.api_client,
+            cls.services["server"],
+            templateid=template.id,
+            accountid=cls.account.name,
+            domainid=cls.account.domainid,
+            serviceofferingid=cls.service_offering.id
+        )
         cls.public_ip_1 = PublicIPAddress.create(
-                                           cls.api_client,
-                                           accountid=cls.virtual_machine.account,
-                                           zoneid=cls.virtual_machine.zoneid,
-                                           domainid=cls.virtual_machine.domainid,
-                                           services=cls.services["server"]
-                                           )
+            cls.api_client,
+            accountid=cls.virtual_machine.account,
+            zoneid=cls.virtual_machine.zoneid,
+            domainid=cls.virtual_machine.domainid,
+            services=cls.services["server"]
+        )
         cls._cleanup = [
-                        cls.service_offering,
-                        cls.account,
-                        ]
+            cls.service_offering,
+            cls.account,
+        ]
         return
 
     @classmethod
     def tearDownClass(cls):
         try:
-            #Cleanup resources used
+            # Cleanup resources used
             cleanup_resources(cls.api_client, cls._cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -1026,13 +1064,19 @@ class TestLBRuleUsage(cloudstackTestCase):
 
     def tearDown(self):
         try:
-            #Clean up, terminate the created instance, LB rules
+            # Clean up, terminate the created instance, LB rules
             cleanup_resources(self.apiclient, self.cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(tags=["advanced", "eip", "advancedns", "simulator"], required_hardware="false")
+    @attr(
+        tags=[
+            "advanced",
+            "eip",
+            "advancedns",
+            "simulator"],
+        required_hardware="false")
     def test_01_lb_usage(self):
         """Test Create/Delete a LB rule and verify correct usage is recorded
         """
@@ -1046,75 +1090,75 @@ class TestLBRuleUsage(cloudstackTestCase):
 
         self.debug(
             "Creating load balancer rule for public IP: %s" %
-                                    self.public_ip_1.ipaddress.id)
-        #Create Load Balancer rule and assign VMs to rule
+            self.public_ip_1.ipaddress.id)
+        # Create Load Balancer rule and assign VMs to rule
         lb_rule = LoadBalancerRule.create(
-                                          self.apiclient,
-                                          self.services["lbrule"],
-                                          self.public_ip_1.ipaddress.id,
-                                          accountid=self.account.name
-                                          )
+            self.apiclient,
+            self.services["lbrule"],
+            self.public_ip_1.ipaddress.id,
+            accountid=self.account.name
+        )
         # Delete LB Rule
         self.debug("Deleting LB rule with ID: %s" % lb_rule.id)
         lb_rule.delete(self.apiclient)
 
         # Fetch account ID from account_uuid
-        self.debug("select id from account where uuid = '%s';" \
-                        % self.account.id)
+        self.debug("select id from account where uuid = '%s';"
+                   % self.account.id)
 
         qresultset = self.dbclient.execute(
-                        "select id from account where uuid = '%s';" \
-                        % self.account.id
-                        )
+            "select id from account where uuid = '%s';"
+            % self.account.id
+        )
         self.assertEqual(
-                         isinstance(qresultset, list),
-                         True,
-                         "Check DB query result set for valid data"
-                         )
+            isinstance(qresultset, list),
+            True,
+            "Check DB query result set for valid data"
+        )
 
         self.assertNotEqual(
-                            len(qresultset),
-                            0,
-                            "Check DB Query result set"
-                            )
+            len(qresultset),
+            0,
+            "Check DB Query result set"
+        )
         qresult = qresultset[0]
 
         account_id = qresult[0]
-        self.debug("select type from usage_event where account_id = '%s';" \
-                        % account_id)
+        self.debug("select type from usage_event where account_id = '%s';"
+                   % account_id)
 
         qresultset = self.dbclient.execute(
-                        "select type from usage_event where account_id = '%s';" \
-                        % account_id
-                        )
+            "select type from usage_event where account_id = '%s';"
+            % account_id
+        )
 
         self.assertEqual(
-                         isinstance(qresultset, list),
-                         True,
-                         "Check DB query result set for valid data"
-                         )
+            isinstance(qresultset, list),
+            True,
+            "Check DB query result set for valid data"
+        )
 
         self.assertNotEqual(
-                            len(qresultset),
-                            0,
-                            "Check DB Query result set"
-                            )
+            len(qresultset),
+            0,
+            "Check DB Query result set"
+        )
 
         qresult = str(qresultset)
         self.debug("Query result: %s" % qresult)
 
         # Check for LB.CREATE, LB.DELETE in cloud.usage_event table
         self.assertEqual(
-                            qresult.count('LB.CREATE'),
-                            1,
-                            "Check LB.CREATE event in events table"
-                        )
+            qresult.count('LB.CREATE'),
+            1,
+            "Check LB.CREATE event in events table"
+        )
 
         self.assertEqual(
-                            qresult.count('LB.DELETE'),
-                            1,
-                            "Check LB.DELETE in events table"
-                        )
+            qresult.count('LB.DELETE'),
+            1,
+            "Check LB.DELETE in events table"
+        )
         return
 
 
@@ -1124,7 +1168,7 @@ class TestSnapshotUsage(cloudstackTestCase):
     def setUpClass(cls):
         cls.testClient = super(TestSnapshotUsage, cls).getClsTestClient()
         cls.api_client = cls.testClient.getApiClient()
-
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
         cls.services = Services().services
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client)
@@ -1132,45 +1176,45 @@ class TestSnapshotUsage(cloudstackTestCase):
         cls.services['mode'] = cls.zone.networktype
 
         template = get_template(
-                            cls.api_client,
-                            cls.zone.id,
-                            cls.services["ostype"]
-                            )
+            cls.api_client,
+            cls.zone.id,
+            cls.services["ostype"]
+        )
         cls.services["server"]["zoneid"] = cls.zone.id
 
         cls.services["template"] = template.id
 
         # Create Account, VMs etc
         cls.account = Account.create(
-                            cls.api_client,
-                            cls.services["account"],
-                            domainid=cls.domain.id
-                            )
+            cls.api_client,
+            cls.services["account"],
+            domainid=cls.domain.id
+        )
 
         cls.services["account"] = cls.account.name
 
         cls.service_offering = ServiceOffering.create(
-                                            cls.api_client,
-                                            cls.services["service_offering"]
-                                            )
+            cls.api_client,
+            cls.services["service_offering"]
+        )
         cls.virtual_machine = VirtualMachine.create(
-                                cls.api_client,
-                                cls.services["server"],
-                                templateid=template.id,
-                                accountid=cls.account.name,
-                                domainid=cls.account.domainid,
-                                serviceofferingid=cls.service_offering.id
-                                )
+            cls.api_client,
+            cls.services["server"],
+            templateid=template.id,
+            accountid=cls.account.name,
+            domainid=cls.account.domainid,
+            serviceofferingid=cls.service_offering.id
+        )
         cls._cleanup = [
-                        cls.service_offering,
-                        cls.account,
-                        ]
+            cls.service_offering,
+            cls.account,
+        ]
         return
 
     @classmethod
     def tearDownClass(cls):
         try:
-            #Cleanup resources used
+            # Cleanup resources used
             cleanup_resources(cls.api_client, cls._cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -1184,14 +1228,22 @@ class TestSnapshotUsage(cloudstackTestCase):
 
     def tearDown(self):
         try:
-            #Clean up, terminate the created instance and snapshots
+            # Clean up, terminate the created instance and snapshots
             cleanup_resources(self.apiclient, self.cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(speed = "slow")
-    @attr(tags=["advanced", "basic", "sg", "eip", "advancedns", "simulator"], required_hardware="false")
+    @attr(speed="slow")
+    @attr(
+        tags=[
+            "advanced",
+            "basic",
+            "sg",
+            "eip",
+            "advancedns",
+            "simulator"],
+        required_hardware="false")
     def test_01_snapshot_usage(self):
         """Test Create/Delete a manual snap shot and verify
         correct usage is recorded
@@ -1204,16 +1256,20 @@ class TestSnapshotUsage(cloudstackTestCase):
         # 3. Delete the account
 
         # Get the Root disk of VM
+
+        if self.hypervisor.lower() in ['hyperv']:
+            self.skipTest("Snapshots feature is not supported on Hyper-V")
+
         volumes = Volume.list(
-                    self.apiclient,
-                    virtualmachineid=self.virtual_machine.id,
-                    type='ROOT',
-                    listall=True)
+            self.apiclient,
+            virtualmachineid=self.virtual_machine.id,
+            type='ROOT',
+            listall=True)
         self.assertEqual(
-                         isinstance(volumes, list),
-                         True,
-                         "Check if list volumes return a valid data"
-                        )
+            isinstance(volumes, list),
+            True,
+            "Check if list volumes return a valid data"
+        )
 
         # Create a snapshot from the ROOTDISK
         self.debug("Creating snapshot from volume: %s" % volumes[0].id)
@@ -1224,63 +1280,63 @@ class TestSnapshotUsage(cloudstackTestCase):
         snapshot.delete(self.apiclient)
 
         # Fetch account ID from account_uuid
-        self.debug("select id from account where uuid = '%s';" \
-                        % self.account.id)
+        self.debug("select id from account where uuid = '%s';"
+                   % self.account.id)
 
         qresultset = self.dbclient.execute(
-                        "select id from account where uuid = '%s';" \
-                        % self.account.id
-                        )
+            "select id from account where uuid = '%s';"
+            % self.account.id
+        )
         self.assertEqual(
-                         isinstance(qresultset, list),
-                         True,
-                         "Check DB query result set for valid data"
-                         )
+            isinstance(qresultset, list),
+            True,
+            "Check DB query result set for valid data"
+        )
 
         self.assertNotEqual(
-                            len(qresultset),
-                            0,
-                            "Check DB Query result set"
-                            )
+            len(qresultset),
+            0,
+            "Check DB Query result set"
+        )
         qresult = qresultset[0]
 
         account_id = qresult[0]
-        self.debug("select type from usage_event where account_id = '%s';" \
-                        % account_id)
+        self.debug("select type from usage_event where account_id = '%s';"
+                   % account_id)
 
         qresultset = self.dbclient.execute(
-                        "select type from usage_event where account_id = '%s';" \
-                        % account_id
-                        )
+            "select type from usage_event where account_id = '%s';"
+            % account_id
+        )
 
         self.assertEqual(
-                         isinstance(qresultset, list),
-                         True,
-                         "Check if database query returns a valid data"
-                         )
+            isinstance(qresultset, list),
+            True,
+            "Check if database query returns a valid data"
+        )
 
         self.assertNotEqual(
-                            len(qresultset),
-                            0,
-                            "Check DB Query result set"
-                            )
+            len(qresultset),
+            0,
+            "Check DB Query result set"
+        )
 
         qresult = str(qresultset)
         self.debug("Query Result: %s" % qresult)
 
-        # Check for SNAPSHOT.CREATE, SNAPSHOT.DELETE events in cloud.usage_event
-        # table
+        # Check for SNAPSHOT.CREATE, SNAPSHOT.DELETE events in
+        # cloud.usage_event table
         self.assertEqual(
-                            qresult.count('SNAPSHOT.CREATE'),
-                            1,
-                            "Check SNAPSHOT.CREATE event in events table"
-                        )
+            qresult.count('SNAPSHOT.CREATE'),
+            1,
+            "Check SNAPSHOT.CREATE event in events table"
+        )
 
         self.assertEqual(
-                            qresult.count('SNAPSHOT.DELETE'),
-                            1,
-                            "Check SNAPSHOT.DELETE in events table"
-                        )
+            qresult.count('SNAPSHOT.DELETE'),
+            1,
+            "Check SNAPSHOT.DELETE in events table"
+        )
         return
 
 
@@ -1297,52 +1353,52 @@ class TestNatRuleUsage(cloudstackTestCase):
         cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
         cls.services['mode'] = cls.zone.networktype
         template = get_template(
-                            cls.api_client,
-                            cls.zone.id,
-                            cls.services["ostype"]
-                            )
+            cls.api_client,
+            cls.zone.id,
+            cls.services["ostype"]
+        )
         cls.services["server"]["zoneid"] = cls.zone.id
 
         cls.services["template"] = template.id
 
         # Create VMs, NAT Rules etc
         cls.account = Account.create(
-                            cls.api_client,
-                            cls.services["account"],
-                            domainid=cls.domain.id
-                            )
+            cls.api_client,
+            cls.services["account"],
+            domainid=cls.domain.id
+        )
 
         cls.services["account"] = cls.account.name
 
         cls.service_offering = ServiceOffering.create(
-                                            cls.api_client,
-                                            cls.services["service_offering"]
-                                            )
+            cls.api_client,
+            cls.services["service_offering"]
+        )
         cls.virtual_machine = VirtualMachine.create(
-                                cls.api_client,
-                                cls.services["server"],
-                                templateid=template.id,
-                                accountid=cls.account.name,
-                                domainid=cls.account.domainid,
-                                serviceofferingid=cls.service_offering.id
-                                )
+            cls.api_client,
+            cls.services["server"],
+            templateid=template.id,
+            accountid=cls.account.name,
+            domainid=cls.account.domainid,
+            serviceofferingid=cls.service_offering.id
+        )
         cls.public_ip_1 = PublicIPAddress.create(
-                                           cls.api_client,
-                                           accountid=cls.virtual_machine.account,
-                                           zoneid=cls.virtual_machine.zoneid,
-                                           domainid=cls.virtual_machine.domainid,
-                                           services=cls.services["server"]
-                                           )
+            cls.api_client,
+            accountid=cls.virtual_machine.account,
+            zoneid=cls.virtual_machine.zoneid,
+            domainid=cls.virtual_machine.domainid,
+            services=cls.services["server"]
+        )
         cls._cleanup = [
-                        cls.service_offering,
-                        cls.account,
-                        ]
+            cls.service_offering,
+            cls.account,
+        ]
         return
 
     @classmethod
     def tearDownClass(cls):
         try:
-            #Cleanup resources used
+            # Cleanup resources used
             cleanup_resources(cls.api_client, cls._cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -1356,13 +1412,18 @@ class TestNatRuleUsage(cloudstackTestCase):
 
     def tearDown(self):
         try:
-            #Clean up, terminate the created instance, NAT rules
+            # Clean up, terminate the created instance, NAT rules
             cleanup_resources(self.apiclient, self.cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(tags=["advanced", "advancedns", "simulator"], required_hardware="false")
+    @attr(
+        tags=[
+            "advanced",
+            "advancedns",
+            "simulator"],
+        required_hardware="false")
     def test_01_nat_usage(self):
         """Test Create/Delete a PF rule and verify correct usage is recorded
         """
@@ -1376,75 +1437,75 @@ class TestNatRuleUsage(cloudstackTestCase):
         # 4. Delete this account.
 
         self.debug("Creating NAT rule with public IP: %s" %
-                                    self.public_ip_1.ipaddress.id)
-        #Create NAT rule
+                   self.public_ip_1.ipaddress.id)
+        # Create NAT rule
         nat_rule = NATRule.create(
-                        self.apiclient,
-                        self.virtual_machine,
-                        self.services["natrule"],
-                        self.public_ip_1.ipaddress.id
-                        )
+            self.apiclient,
+            self.virtual_machine,
+            self.services["natrule"],
+            self.public_ip_1.ipaddress.id
+        )
 
         # Delete NAT Rule
         self.debug("Deleting NAT rule: %s" % nat_rule.id)
         nat_rule.delete(self.apiclient)
 
         # Fetch account ID from account_uuid
-        self.debug("select id from account where uuid = '%s';" \
-                        % self.account.id)
+        self.debug("select id from account where uuid = '%s';"
+                   % self.account.id)
 
         qresultset = self.dbclient.execute(
-                        "select id from account where uuid = '%s';" \
-                        % self.account.id
-                        )
+            "select id from account where uuid = '%s';"
+            % self.account.id
+        )
         self.assertEqual(
-                         isinstance(qresultset, list),
-                         True,
-                         "Check DB query result set for valid data"
-                         )
+            isinstance(qresultset, list),
+            True,
+            "Check DB query result set for valid data"
+        )
 
         self.assertNotEqual(
-                            len(qresultset),
-                            0,
-                            "Check DB Query result set"
-                            )
+            len(qresultset),
+            0,
+            "Check DB Query result set"
+        )
         qresult = qresultset[0]
 
         account_id = qresult[0]
-        self.debug("select type from usage_event where account_id = '%s';" \
-                        % account_id)
+        self.debug("select type from usage_event where account_id = '%s';"
+                   % account_id)
 
         qresultset = self.dbclient.execute(
-                        "select type from usage_event where account_id = '%s';" \
-                        % account_id
-                        )
+            "select type from usage_event where account_id = '%s';"
+            % account_id
+        )
 
         self.assertEqual(
-                         isinstance(qresultset, list),
-                         True,
-                         "Check DB query result set for valid data"
-                         )
+            isinstance(qresultset, list),
+            True,
+            "Check DB query result set for valid data"
+        )
         self.assertNotEqual(
-                            len(qresultset),
-                            0,
-                            "Check DB Query result set"
-                            )
+            len(qresultset),
+            0,
+            "Check DB Query result set"
+        )
 
         qresult = str(qresultset)
         self.debug("Query result: %s" % qresult)
 
         # Check for NET.RULEADD, NET.RULEDELETE in cloud.usage_event table
         self.assertEqual(
-                            qresult.count('NET.RULEADD'),
-                            1,
-                            "Check NET.RULEADD event in events table"
-                        )
+            qresult.count('NET.RULEADD'),
+            1,
+            "Check NET.RULEADD event in events table"
+        )
 
         self.assertEqual(
-                            qresult.count('NET.RULEDELETE'),
-                            1,
-                            "Check NET.RULEDELETE in events table"
-                        )
+            qresult.count('NET.RULEDELETE'),
+            1,
+            "Check NET.RULEDELETE in events table"
+        )
         return
 
 
@@ -1461,10 +1522,10 @@ class TestVpnUsage(cloudstackTestCase):
         cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
         cls.services['mode'] = cls.zone.networktype
         template = get_template(
-                            cls.api_client,
-                            cls.zone.id,
-                            cls.services["ostype"]
-                            )
+            cls.api_client,
+            cls.zone.id,
+            cls.services["ostype"]
+        )
         cls.services["server"]["zoneid"] = cls.zone.id
 
         cls.services["template"] = template.id
@@ -1472,41 +1533,41 @@ class TestVpnUsage(cloudstackTestCase):
 
         # Create Service offerings, VMs etc
         cls.account = Account.create(
-                            cls.api_client,
-                            cls.services["account"],
-                            admin=True,
-                            domainid=cls.domain.id
-                            )
+            cls.api_client,
+            cls.services["account"],
+            admin=True,
+            domainid=cls.domain.id
+        )
         cls._cleanup.append(cls.account)
 
         cls.services["account"] = cls.account.name
 
         cls.service_offering = ServiceOffering.create(
-                                            cls.api_client,
-                                            cls.services["service_offering"]
-                                            )
+            cls.api_client,
+            cls.services["service_offering"]
+        )
         cls._cleanup.append(cls.service_offering)
         cls.virtual_machine = VirtualMachine.create(
-                                cls.api_client,
-                                cls.services["server"],
-                                templateid=template.id,
-                                accountid=cls.account.name,
-                                domainid=cls.account.domainid,
-                                serviceofferingid=cls.service_offering.id
-                                )
+            cls.api_client,
+            cls.services["server"],
+            templateid=template.id,
+            accountid=cls.account.name,
+            domainid=cls.account.domainid,
+            serviceofferingid=cls.service_offering.id
+        )
         cls.public_ip = PublicIPAddress.create(
-                                           cls.api_client,
-                                           accountid=cls.virtual_machine.account,
-                                           zoneid=cls.virtual_machine.zoneid,
-                                           domainid=cls.virtual_machine.domainid,
-                                           services=cls.services["server"]
-                                           )
+            cls.api_client,
+            accountid=cls.virtual_machine.account,
+            zoneid=cls.virtual_machine.zoneid,
+            domainid=cls.virtual_machine.domainid,
+            services=cls.services["server"]
+        )
         return
 
     @classmethod
     def tearDownClass(cls):
         try:
-            #Cleanup resources used
+            # Cleanup resources used
             cleanup_resources(cls.api_client, cls._cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -1520,7 +1581,7 @@ class TestVpnUsage(cloudstackTestCase):
 
     def tearDown(self):
         try:
-            #Clean up, terminate the created instance, VPN users
+            # Clean up, terminate the created instance, VPN users
             cleanup_resources(self.apiclient, self.cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -1539,25 +1600,25 @@ class TestVpnUsage(cloudstackTestCase):
         # 4. Delete this account.
 
         self.debug("Created VPN with public IP: %s" %
-                                    self.public_ip.ipaddress.id)
-        #Assign VPN to Public IP
+                   self.public_ip.ipaddress.id)
+        # Assign VPN to Public IP
         vpn = Vpn.create(
-                        self.apiclient,
-                        self.public_ip.ipaddress.id,
-                        account=self.account.name,
-                        domainid=self.account.domainid
-                        )
+            self.apiclient,
+            self.public_ip.ipaddress.id,
+            account=self.account.name,
+            domainid=self.account.domainid
+        )
 
         self.debug("Created VPN user for account: %s" %
-                                    self.account.name)
+                   self.account.name)
 
         vpnuser = VpnUser.create(
-                                 self.apiclient,
-                                 self.services["vpn_user"]["username"],
-                                 self.services["vpn_user"]["password"],
-                                 account=self.account.name,
-                                 domainid=self.account.domainid
-                                 )
+            self.apiclient,
+            self.services["vpn_user"]["username"],
+            self.services["vpn_user"]["password"],
+            account=self.account.name,
+            domainid=self.account.domainid
+        )
 
         # Remove VPN user
         self.debug("Deleting VPN user: %s" % vpnuser.id)
@@ -1568,59 +1629,59 @@ class TestVpnUsage(cloudstackTestCase):
         vpn.delete(self.apiclient)
 
         # Fetch account ID from account_uuid
-        self.debug("select id from account where uuid = '%s';" \
-                        % self.account.id)
+        self.debug("select id from account where uuid = '%s';"
+                   % self.account.id)
 
         qresultset = self.dbclient.execute(
-                        "select id from account where uuid = '%s';" \
-                        % self.account.id
-                        )
+            "select id from account where uuid = '%s';"
+            % self.account.id
+        )
         self.assertEqual(
-                         isinstance(qresultset, list),
-                         True,
-                         "Check DB query result set for valid data"
-                         )
+            isinstance(qresultset, list),
+            True,
+            "Check DB query result set for valid data"
+        )
 
         self.assertNotEqual(
-                            len(qresultset),
-                            0,
-                            "Check DB Query result set"
-                            )
+            len(qresultset),
+            0,
+            "Check DB Query result set"
+        )
         qresult = qresultset[0]
 
         account_id = qresult[0]
-        self.debug("select type from usage_event where account_id = '%s';" \
-                        % account_id)
+        self.debug("select type from usage_event where account_id = '%s';"
+                   % account_id)
 
         qresultset = self.dbclient.execute(
-                        "select type from usage_event where account_id = '%s';" \
-                        % account_id
-                        )
+            "select type from usage_event where account_id = '%s';"
+            % account_id
+        )
 
         self.assertEqual(
-                         isinstance(qresultset, list),
-                         True,
-                         "Check DB query result set for valid data"
-                         )
+            isinstance(qresultset, list),
+            True,
+            "Check DB query result set for valid data"
+        )
         self.assertNotEqual(
-                            len(qresultset),
-                            0,
-                            "Check DB Query result set"
-                            )
+            len(qresultset),
+            0,
+            "Check DB Query result set"
+        )
 
         qresult = str(qresultset)
         self.debug("Query result: %s" % qresult)
 
         # Check for VPN user related events
         self.assertEqual(
-                            qresult.count('VPN.USER.ADD'),
-                            1,
-                            "Check VPN.USER.ADD event in events table"
-                        )
+            qresult.count('VPN.USER.ADD'),
+            1,
+            "Check VPN.USER.ADD event in events table"
+        )
 
         self.assertEqual(
-                            qresult.count('VPN.USER.ADD'),
-                            1,
-                            "Check VPN.USER.ADD in events table"
-                        )
+            qresult.count('VPN.USER.ADD'),
+            1,
+            "Check VPN.USER.ADD in events table"
+        )
         return


[20/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4

Posted by sa...@apache.org.
CID-1261670 added null check


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5251fb2d
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5251fb2d
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5251fb2d

Branch: refs/heads/vmware-disk-controllers
Commit: 5251fb2dc33bc2f5a3e04fe8928ee0e8645b6647
Parents: 251e88c
Author: Daan Hoogland <da...@onecht.net>
Authored: Mon Jan 5 16:01:13 2015 +0100
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jan 5 16:01:13 2015 +0100

----------------------------------------------------------------------
 .../cloudstack/storage/motion/AncientDataMotionStrategy.java       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5251fb2d/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
----------------------------------------------------------------------
diff --git a/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java b/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
index 203cfa4..17ab00e 100644
--- a/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
+++ b/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
@@ -190,7 +190,7 @@ public class AncientDataMotionStrategy implements DataMotionStrategy {
                     // for template, we want to leave it on cache for performance reason
                     if ((answer == null || !answer.getResult()) && srcForCopy.getRefCount() < 2) {
                         // cache object created by this copy, not already there
-                        s_logger.warn("Copy may not be handled correctly by agent(id: " + ep.getId() + ")." +
+                        s_logger.warn("Copy may not be handled correctly by agent(id: " + (ep != null ? ep.getId() : "\"unspecified\"") + ")." +
                                       " Delete " + cacheType + " cache(id: " + cacheId +
                                       ", uuid: " + cacheUuid + ")");
                         cacheMgr.deleteCacheObject(srcForCopy);


[11/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4

Posted by sa...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/214d63ee/test/integration/component/test_snapshots.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_snapshots.py b/test/integration/component/test_snapshots.py
index 4bb2dcf..5b8cdc7 100644
--- a/test/integration/component/test_snapshots.py
+++ b/test/integration/component/test_snapshots.py
@@ -16,142 +16,143 @@
 # under the License.
 """ P1 tests for Snapshots
 """
-#Import Local Modules
-from nose.plugins.attrib import             attr
-from marvin.cloudstackTestCase import       cloudstackTestCase
-
-from marvin.lib.base import     (Snapshot,
-                                             Template,
-                                             VirtualMachine,
-                                             Account,
-                                             ServiceOffering,
-                                             DiskOffering,
-                                             Volume)
-
-from marvin.lib.common import   (get_domain,
-                                             get_zone,
-                                             get_template,
-                                             list_events,
-                                             list_volumes,
-                                             list_snapshots,
-                                             list_templates,
-                                             list_virtual_machines,
-                                             )
-
-from marvin.lib.utils import    (cleanup_resources,
-                                             format_volume_to_ext3,
-                                             random_gen,
-                                             is_snapshot_on_nfs,
-                                             get_hypervisor_type)
-
-from marvin.cloudstackAPI import            detachVolume
-import time
+# Import Local Modules
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import cloudstackTestCase
+
+from marvin.lib.base import (Snapshot,
+                             Template,
+                             VirtualMachine,
+                             Account,
+                             ServiceOffering,
+                             DiskOffering,
+                             Volume)
+
+from marvin.lib.common import (get_domain,
+                               get_zone,
+                               get_template,
+                               list_events,
+                               list_volumes,
+                               list_snapshots,
+                               list_templates,
+                               list_virtual_machines,
+                               )
 
+from marvin.lib.utils import (cleanup_resources,
+                              format_volume_to_ext3,
+                              random_gen,
+                              is_snapshot_on_nfs,
+                              get_hypervisor_type)
+
+from marvin.cloudstackAPI import detachVolume
+import time
 
 
 class Services:
+
     """Test Snapshots Services
     """
 
     def __init__(self):
         self.services = {
-                        "account": {
-                                    "email": "test@test.com",
-                                    "firstname": "Test",
-                                    "lastname": "User",
-                                    "username": "test",
-                                    # Random characters are appended for unique
-                                    # username
-                                    "password": "password",
-                         },
-                         "service_offering": {
-                                    "name": "Tiny Instance",
-                                    "displaytext": "Tiny Instance",
-                                    "cpunumber": 1,
-                                    "cpuspeed": 200,    # in MHz
+            "account": {
+                "email": "test@test.com",
+                "firstname": "Test",
+                "lastname": "User",
+                "username": "test",
+                # Random characters are appended for unique
+                # username
+                "password": "password",
+            },
+            "service_offering": {
+                "name": "Tiny Instance",
+                "displaytext": "Tiny Instance",
+                "cpunumber": 1,
+                "cpuspeed": 200,    # in MHz
                                     "memory": 256,      # In MBs
+            },
+            "disk_offering": {
+                "displaytext": "Small Disk",
+                "name": "Small Disk",
+                "disksize": 1
+            },
+            "server_with_disk":
+            {
+                "displayname": "Test VM -With Disk",
+                "username": "root",
+                "password": "password",
+                "ssh_port": 22,
+                "hypervisor": 'XenServer',
+                "privateport": 22,
+                "publicport": 22,
+                "protocol": 'TCP',
+            },
+
+            "server_without_disk":
+            {
+                "displayname": "Test VM-No Disk",
+                "username": "root",
+                "password": "password",
+                "ssh_port": 22,
+                "hypervisor": 'XenServer',
+                "privateport": 22,
+                # For NAT rule creation
+                "publicport": 22,
+                "protocol": 'TCP',
+            },
+            "server": {
+                "displayname": "TestVM",
+                "username": "root",
+                "password": "password",
+                "ssh_port": 22,
+                "hypervisor": 'XenServer',
+                "privateport": 22,
+                "publicport": 22,
+                "protocol": 'TCP',
+            },
+            "recurring_snapshot": {
+                "intervaltype": 'HOURLY',
+                # Frequency of snapshots
+                "maxsnaps": 1,  # Should be min 2
+                "schedule": 1,
+                "timezone": 'US/Arizona',
+                # Timezone Formats -
+                # http://cloud.mindtouch.us/CloudStack_Documentation/Developer's_Guide%3A_CloudStack
+            },
+            "templates": {
+                "displaytext": 'Template',
+                "name": 'Template',
+                "ostype": "CentOS 5.3 (64-bit)",
+                "templatefilter": 'self',
+            },
+            "volume": {
+                "diskname": "APP Data Volume",
+                "size": 1,   # in GBs
+                "xenserver": {"rootdiskdevice": "/dev/xvda",
+                              "datadiskdevice_1": '/dev/xvdb',
+                              "datadiskdevice_2": '/dev/xvdc',   # Data Disk
+                              },
+                "kvm": {"rootdiskdevice": "/dev/vda",
+                        "datadiskdevice_1": "/dev/vdb",
+                        "datadiskdevice_2": "/dev/vdc"
                         },
-                        "disk_offering": {
-                                    "displaytext": "Small Disk",
-                                    "name": "Small Disk",
-                                    "disksize": 1
-                        },
-                        "server_with_disk":
-                                    {
-                                        "displayname": "Test VM -With Disk",
-                                        "username": "root",
-                                        "password": "password",
-                                        "ssh_port": 22,
-                                        "hypervisor": 'XenServer',
-                                        "privateport": 22,
-                                        "publicport": 22,
-                                        "protocol": 'TCP',
-                                },
-
-                        "server_without_disk":
-                                    {
-                                        "displayname": "Test VM-No Disk",
-                                        "username": "root",
-                                        "password": "password",
-                                        "ssh_port": 22,
-                                        "hypervisor": 'XenServer',
-                                        "privateport": 22,
-                                        # For NAT rule creation
-                                        "publicport": 22,
-                                        "protocol": 'TCP',
-                                },
-                        "server": {
-                                    "displayname": "TestVM",
-                                    "username": "root",
-                                    "password": "password",
-                                    "ssh_port": 22,
-                                    "hypervisor": 'XenServer',
-                                    "privateport": 22,
-                                    "publicport": 22,
-                                    "protocol": 'TCP',
-                                },
-                        "recurring_snapshot": {
-                                    "intervaltype": 'HOURLY',
-                                    # Frequency of snapshots
-                                    "maxsnaps": 1,  # Should be min 2
-                                    "schedule": 1,
-                                    "timezone": 'US/Arizona',
-                                    # Timezone Formats - http://cloud.mindtouch.us/CloudStack_Documentation/Developer's_Guide%3A_CloudStack
-                                },
-                        "templates": {
-                                    "displaytext": 'Template',
-                                    "name": 'Template',
-                                    "ostype": "CentOS 5.3 (64-bit)",
-                                    "templatefilter": 'self',
-                                },
-                        "volume": {
-                                   "diskname": "APP Data Volume",
-                                   "size": 1,   # in GBs
-                                   "xenserver": {"rootdiskdevice":"/dev/xvda",
-                                                 "datadiskdevice_1": '/dev/xvdb',
-                                                 "datadiskdevice_2": '/dev/xvdc',   # Data Disk
-                                                 },
-                                   "kvm":       {"rootdiskdevice": "/dev/vda",
-                                                 "datadiskdevice_1": "/dev/vdb",
-                                                 "datadiskdevice_2": "/dev/vdc"
-                                                 },
-                                   "vmware":    {"rootdiskdevice": "/dev/hda",
-                                                 "datadiskdevice_1": "/dev/hdb",
-                                                 "datadiskdevice_2": "/dev/hdc"
-                                                 }
-                        },
-                        "paths": {
-                                    "mount_dir": "/mnt/tmp",
-                                    "sub_dir": "test",
-                                    "sub_lvl_dir1": "test1",
-                                    "sub_lvl_dir2": "test2",
-                                    "random_data": "random.data",
-                        },
-                        "ostype": "CentOS 5.3 (64-bit)",
-                        # Cent OS 5.3 (64 bit)
-                        "sleep": 60,
-                        "timeout": 10,
-                    }
+                "vmware": {"rootdiskdevice": "/dev/hda",
+                           "datadiskdevice_1": "/dev/hdb",
+                           "datadiskdevice_2": "/dev/hdc"
+                           }
+            },
+            "paths": {
+                "mount_dir": "/mnt/tmp",
+                "sub_dir": "test",
+                "sub_lvl_dir1": "test1",
+                "sub_lvl_dir2": "test2",
+                "random_data": "random.data",
+            },
+            "ostype": "CentOS 5.3 (64-bit)",
+            # Cent OS 5.3 (64 bit)
+            "sleep": 60,
+            "timeout": 10,
+        }
 
 
 class TestSnapshots(cloudstackTestCase):
@@ -167,17 +168,18 @@ class TestSnapshots(cloudstackTestCase):
         cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
         cls.services['mode'] = cls.zone.networktype
         cls.disk_offering = DiskOffering.create(
-                                    cls.api_client,
-                                    cls.services["disk_offering"]
-                                    )
+            cls.api_client,
+            cls.services["disk_offering"]
+        )
         cls.template = get_template(
-                            cls.api_client,
-                            cls.zone.id,
-                            cls.services["ostype"]
-                            )
+            cls.api_client,
+            cls.zone.id,
+            cls.services["ostype"]
+        )
 
         cls.services["domainid"] = cls.domain.id
-        cls.services["volume"]["zoneid"] = cls.services["server_with_disk"]["zoneid"] = cls.zone.id
+        cls.services["volume"]["zoneid"] = cls.services[
+            "server_with_disk"]["zoneid"] = cls.zone.id
         cls.services["server_with_disk"]["diskoffering"] = cls.disk_offering.id
 
         cls.services["server_without_disk"]["zoneid"] = cls.zone.id
@@ -187,23 +189,23 @@ class TestSnapshots(cloudstackTestCase):
         cls.services["diskoffering"] = cls.disk_offering.id
 
         cls.service_offering = ServiceOffering.create(
-                                            cls.api_client,
-                                            cls.services["service_offering"]
-                                            )
+            cls.api_client,
+            cls.services["service_offering"]
+        )
 
         # Get Hypervisor Type
         cls.hypervisor = (get_hypervisor_type(cls.api_client)).lower()
 
         cls._cleanup = [
-                        cls.service_offering,
-                        cls.disk_offering
-                        ]
+            cls.service_offering,
+            cls.disk_offering
+        ]
         return
 
     @classmethod
     def tearDownClass(cls):
         try:
-            #Cleanup resources used
+            # Cleanup resources used
             cleanup_resources(cls.api_client, cls._cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -216,92 +218,105 @@ class TestSnapshots(cloudstackTestCase):
 
         # Create VMs, NAT Rules etc
         self.account = Account.create(
-                            self.apiclient,
-                            self.services["account"],
-                            domainid=self.domain.id
-                            )
+            self.apiclient,
+            self.services["account"],
+            domainid=self.domain.id
+        )
 
         self.virtual_machine = self.virtual_machine_with_disk = \
-                    VirtualMachine.create(
-                                self.api_client,
-                                self.services["server_with_disk"],
-                                templateid=self.template.id,
-                                accountid=self.account.name,
-                                domainid=self.account.domainid,
-                                serviceofferingid=self.service_offering.id,
-                                mode=self.services["mode"]
-                                )
+            VirtualMachine.create(
+                self.api_client,
+                self.services["server_with_disk"],
+                templateid=self.template.id,
+                accountid=self.account.name,
+                domainid=self.account.domainid,
+                serviceofferingid=self.service_offering.id,
+                mode=self.services["mode"]
+            )
         self.cleanup = [self.account, ]
         return
 
     def tearDown(self):
         try:
-            #Clean up, terminate the created instance, volumes and snapshots
+            # Clean up, terminate the created instance, volumes and snapshots
             cleanup_resources(self.apiclient, self.cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(speed = "slow")
+    @attr(speed="slow")
     @attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true")
     def test_02_snapshot_data_disk(self):
         """Test Snapshot Data Disk
         """
 
         volume = list_volumes(
-                            self.apiclient,
-                            virtualmachineid=self.virtual_machine_with_disk.id,
-                            type='DATADISK',
-                            listall=True
-                            )
+            self.apiclient,
+            virtualmachineid=self.virtual_machine_with_disk.id,
+            type='DATADISK',
+            listall=True
+        )
         self.assertEqual(
-                            isinstance(volume, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
+            isinstance(volume, list),
+            True,
+            "Check list response returns a valid list"
+        )
 
         self.debug("Creating a Snapshot from data volume: %s" % volume[0].id)
         snapshot = Snapshot.create(
-                                   self.apiclient,
-                                   volume[0].id,
-                                   account=self.account.name,
-                                   domainid=self.account.domainid
-                                   )
+            self.apiclient,
+            volume[0].id,
+            account=self.account.name,
+            domainid=self.account.domainid
+        )
         snapshots = list_snapshots(
-                                  self.apiclient,
-                                  id=snapshot.id
-                                  )
+            self.apiclient,
+            id=snapshot.id
+        )
         self.assertEqual(
-                            isinstance(snapshots, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
+            isinstance(snapshots, list),
+            True,
+            "Check list response returns a valid list"
+        )
         self.assertNotEqual(
-                            snapshots,
-                            None,
-                            "Check if result exists in list item call"
-                            )
+            snapshots,
+            None,
+            "Check if result exists in list item call"
+        )
         self.assertEqual(
-                            snapshots[0].id,
-                            snapshot.id,
-                            "Check resource id in list resources call"
-                        )
-        self.assertTrue(is_snapshot_on_nfs(self.apiclient, self.dbclient, self.config, self.zone.id, snapshot.id))
+            snapshots[0].id,
+            snapshot.id,
+            "Check resource id in list resources call"
+        )
+        self.assertTrue(
+            is_snapshot_on_nfs(
+                self.apiclient,
+                self.dbclient,
+                self.config,
+                self.zone.id,
+                snapshot.id))
         return
 
-    @attr(speed = "slow")
-    @attr(tags=["advanced", "advancedns", "basic", "sg"], required_hardware="true")
+    @attr(speed="slow")
+    @attr(
+        tags=[
+            "advanced",
+            "advancedns",
+            "basic",
+            "sg"],
+        required_hardware="true")
     def test_01_volume_from_snapshot(self):
         """Test Creating snapshot from volume having spaces in name(KVM)
         """
         # Validate the following
-        #1. Create a virtual machine and data volume
-        #2. Attach data volume to VM
-        #3. Login to machine; create temp/test directories on data volume and write some random data
-        #4. Snapshot the Volume
-        #5. Create another Volume from snapshot
-        #6. Mount/Attach volume to another virtual machine
-        #7. Compare data, data should match
+        # 1. Create a virtual machine and data volume
+        # 2. Attach data volume to VM
+        # 3. Login to machine; create temp/test directories on data volume
+        #    and write some random data
+        # 4. Snapshot the Volume
+        # 5. Create another Volume from snapshot
+        # 6. Mount/Attach volume to another virtual machine
+        # 7. Compare data, data should match
 
         random_data_0 = random_gen(size=100)
         random_data_1 = random_gen(size=100)
@@ -316,63 +331,60 @@ class TestSnapshots(cloudstackTestCase):
                       self.virtual_machine.ipaddress)
 
         volume = Volume.create(
-                               self.apiclient,
-                               self.services["volume"],
-                               zoneid=self.zone.id,
-                               account=self.account.name,
-                               domainid=self.account.domainid,
-                               diskofferingid=self.disk_offering.id
-                               )
+            self.apiclient,
+            self.services["volume"],
+            zoneid=self.zone.id,
+            account=self.account.name,
+            domainid=self.account.domainid,
+            diskofferingid=self.disk_offering.id
+        )
         self.debug("Created volume with ID: %s" % volume.id)
         self.virtual_machine.attach_volume(
-                                           self.apiclient,
-                                           volume
-                                           )
+            self.apiclient,
+            volume
+        )
         self.debug("Attach volume: %s to VM: %s" %
-                                (volume.id, self.virtual_machine.id))
-
+                   (volume.id, self.virtual_machine.id))
 
         self.debug("Formatting volume: %s to ext3" % volume.id)
-        #Format partition using ext3
-        # Note that this is the second data disk partition of virtual machine as it was already containing
-        # data disk before attaching the new volume, Hence datadiskdevice_2
+        # Format partition using ext3
+        # Note that this is the second data disk partition of virtual machine
+        # as it was already containing data disk before attaching the new
+        # volume, Hence datadiskdevice_2
         format_volume_to_ext3(
-                              ssh_client,
-                              self.services["volume"][self.hypervisor]["datadiskdevice_2"]
-                              )
-        cmds = [    "fdisk -l",
-                    "mkdir -p %s" % self.services["paths"]["mount_dir"],
-                    "mount -t ext3 %s1 %s" % (
-                                      self.services["volume"][self.hypervisor]["datadiskdevice_2"],
-                                      self.services["paths"]["mount_dir"]
-                                      ),
-                    "mkdir -p %s/%s/{%s,%s} " % (
-                                    self.services["paths"]["mount_dir"],
-                                    self.services["paths"]["sub_dir"],
-                                    self.services["paths"]["sub_lvl_dir1"],
-                                    self.services["paths"]["sub_lvl_dir2"]
-                                    ),
-                    "echo %s > %s/%s/%s/%s" % (
-                                    random_data_0,
-                                    self.services["paths"]["mount_dir"],
-                                    self.services["paths"]["sub_dir"],
-                                    self.services["paths"]["sub_lvl_dir1"],
-                                    self.services["paths"]["random_data"]
-                                    ),
-                    "echo %s > %s/%s/%s/%s" % (
-                                    random_data_1,
-                                    self.services["paths"]["mount_dir"],
-                                    self.services["paths"]["sub_dir"],
-                                    self.services["paths"]["sub_lvl_dir2"],
-                                    self.services["paths"]["random_data"]
-                                    ),
-                    "cat %s/%s/%s/%s" % (
-                                    self.services["paths"]["mount_dir"],
-                                    self.services["paths"]["sub_dir"],
-                                    self.services["paths"]["sub_lvl_dir1"],
-                                    self.services["paths"]["random_data"]
-                                    )
-                ]
+            ssh_client,
+            self.services["volume"][self.hypervisor]["datadiskdevice_2"]
+        )
+        cmds = [
+            "fdisk -l",
+            "mkdir -p %s" %
+            self.services["paths"]["mount_dir"],
+            "mount -t ext3 %s1 %s" %
+            (self.services["volume"][
+                self.hypervisor]["datadiskdevice_2"],
+                self.services["paths"]["mount_dir"]),
+            "mkdir -p %s/%s/{%s,%s} " %
+            (self.services["paths"]["mount_dir"],
+                self.services["paths"]["sub_dir"],
+                self.services["paths"]["sub_lvl_dir1"],
+                self.services["paths"]["sub_lvl_dir2"]),
+            "echo %s > %s/%s/%s/%s" %
+            (random_data_0,
+                self.services["paths"]["mount_dir"],
+                self.services["paths"]["sub_dir"],
+                self.services["paths"]["sub_lvl_dir1"],
+                self.services["paths"]["random_data"]),
+            "echo %s > %s/%s/%s/%s" %
+            (random_data_1,
+                self.services["paths"]["mount_dir"],
+                self.services["paths"]["sub_dir"],
+                self.services["paths"]["sub_lvl_dir2"],
+                self.services["paths"]["random_data"]),
+            "cat %s/%s/%s/%s" %
+            (self.services["paths"]["mount_dir"],
+                self.services["paths"]["sub_dir"],
+                self.services["paths"]["sub_lvl_dir1"],
+                self.services["paths"]["random_data"])]
         for c in cmds:
             self.debug("Command: %s" % c)
             result = ssh_client.execute(c)
@@ -380,95 +392,95 @@ class TestSnapshots(cloudstackTestCase):
 
         # Unmount the Sec Storage
         cmds = [
-                    "umount %s" % (self.services["paths"]["mount_dir"]),
-                ]
+            "umount %s" % (self.services["paths"]["mount_dir"]),
+        ]
         for c in cmds:
             self.debug("Command: %s" % c)
             ssh_client.execute(c)
 
         list_volume_response = Volume.list(
-                                    self.apiclient,
-                                    virtualmachineid=self.virtual_machine.id,
-                                    type='DATADISK',
-                                    id=volume.id
-                                    )
+            self.apiclient,
+            virtualmachineid=self.virtual_machine.id,
+            type='DATADISK',
+            id=volume.id
+        )
 
         self.assertEqual(
-                         isinstance(list_volume_response, list),
-                         True,
-                         "Check list volume response for valid data"
-                         )
+            isinstance(list_volume_response, list),
+            True,
+            "Check list volume response for valid data"
+        )
         volume_response = list_volume_response[0]
-        #Create snapshot from attached volume
+        # Create snapshot from attached volume
         snapshot = Snapshot.create(
-                                   self.apiclient,
-                                   volume_response.id,
-                                   account=self.account.name,
-                                   domainid=self.account.domainid
-                                   )
+            self.apiclient,
+            volume_response.id,
+            account=self.account.name,
+            domainid=self.account.domainid
+        )
         self.debug("Created snapshot: %s" % snapshot.id)
-        #Create volume from snapshot
+        # Create volume from snapshot
         volume_from_snapshot = Volume.create_from_snapshot(
-                                        self.apiclient,
-                                        snapshot.id,
-                                        self.services["volume"],
-                                        account=self.account.name,
-                                        domainid=self.account.domainid
-                                        )
+            self.apiclient,
+            snapshot.id,
+            self.services["volume"],
+            account=self.account.name,
+            domainid=self.account.domainid
+        )
 
         # Detach the volume from virtual machine
         self.virtual_machine.detach_volume(
-                                           self.apiclient,
-                                           volume
-                                           )
+            self.apiclient,
+            volume
+        )
         self.debug("Detached volume: %s from VM: %s" %
-                                (volume.id, self.virtual_machine.id))
+                   (volume.id, self.virtual_machine.id))
 
         self.debug("Created Volume: %s from Snapshot: %s" % (
-                                            volume_from_snapshot.id,
-                                            snapshot.id))
+            volume_from_snapshot.id,
+            snapshot.id))
         volumes = Volume.list(
-                                self.apiclient,
-                                id=volume_from_snapshot.id
-                                )
+            self.apiclient,
+            id=volume_from_snapshot.id
+        )
         self.assertEqual(
-                            isinstance(volumes, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
+            isinstance(volumes, list),
+            True,
+            "Check list response returns a valid list"
+        )
 
         self.assertNotEqual(
-                            len(volumes),
-                            None,
-                            "Check Volume list Length"
-                      )
+            len(volumes),
+            None,
+            "Check Volume list Length"
+        )
         self.assertEqual(
-                        volumes[0].id,
-                        volume_from_snapshot.id,
-                        "Check Volume in the List Volumes"
-                    )
-        #Attaching volume to new VM
+            volumes[0].id,
+            volume_from_snapshot.id,
+            "Check Volume in the List Volumes"
+        )
+        # Attaching volume to new VM
         new_virtual_machine = VirtualMachine.create(
-                                    self.apiclient,
-                                    self.services["server_without_disk"],
-                                    templateid=self.template.id,
-                                    accountid=self.account.name,
-                                    domainid=self.account.domainid,
-                                    serviceofferingid=self.service_offering.id,
-                                    mode=self.services["mode"]
-                                )
+            self.apiclient,
+            self.services["server_without_disk"],
+            templateid=self.template.id,
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering.id,
+            mode=self.services["mode"]
+        )
         self.debug("Deployed new VM for account: %s" % self.account.name)
-        #self.cleanup.append(new_virtual_machine)
+        # self.cleanup.append(new_virtual_machine)
 
         self.debug("Attaching volume: %s to VM: %s" % (
-                                            volume_from_snapshot.id,
-                                            new_virtual_machine.id
-                                            ))
+            volume_from_snapshot.id,
+            new_virtual_machine.id
+        ))
 
         new_virtual_machine.attach_volume(
-                                           self.apiclient,
-                                           volume_from_snapshot
-                                           )
+            self.apiclient,
+            volume_from_snapshot
+        )
 
         # Rebooting is required so that newly attached disks are detected
         self.debug("Rebooting : %s" % new_virtual_machine.id)
@@ -476,17 +488,20 @@ class TestSnapshots(cloudstackTestCase):
         new_virtual_machine.reboot(self.apiclient)
 
         try:
-            #Login to VM to verify test directories and files
+            # Login to VM to verify test directories and files
             ssh = new_virtual_machine.get_ssh_client()
 
-            # Mount datadiskdevice_1 because this is the first data disk of the new virtual machine
-            cmds = ["fdisk -l",
-                    "mkdir -p %s" % self.services["paths"]["mount_dir"],
-                    "mount -t ext3 %s1 %s" % (
-                                      self.services["volume"][self.hypervisor]["datadiskdevice_1"],
-                                      self.services["paths"]["mount_dir"]
-                                      ),
-               ]
+            # Mount datadiskdevice_1 because this is the first data disk of the
+            # new virtual machine
+            cmds = [
+                "fdisk -l",
+                "mkdir -p %s" %
+                self.services["paths"]["mount_dir"],
+                "mount -t ext3 %s1 %s" %
+                (self.services["volume"][
+                    self.hypervisor]["datadiskdevice_1"],
+                    self.services["paths"]["mount_dir"]),
+            ]
 
             for c in cmds:
                 self.debug("Command: %s" % c)
@@ -494,107 +509,119 @@ class TestSnapshots(cloudstackTestCase):
                 self.debug(result)
 
             returned_data_0 = ssh.execute(
-                            "cat %s/%s/%s/%s" % (
-                                    self.services["paths"]["mount_dir"],
-                                    self.services["paths"]["sub_dir"],
-                                    self.services["paths"]["sub_lvl_dir1"],
-                                    self.services["paths"]["random_data"]
-                            ))
+                "cat %s/%s/%s/%s" % (
+                    self.services["paths"]["mount_dir"],
+                    self.services["paths"]["sub_dir"],
+                    self.services["paths"]["sub_lvl_dir1"],
+                    self.services["paths"]["random_data"]
+                ))
             returned_data_1 = ssh.execute(
-                            "cat %s/%s/%s/%s" % (
-                                    self.services["paths"]["mount_dir"],
-                                    self.services["paths"]["sub_dir"],
-                                    self.services["paths"]["sub_lvl_dir2"],
-                                    self.services["paths"]["random_data"]
-                            ))
+                "cat %s/%s/%s/%s" % (
+                    self.services["paths"]["mount_dir"],
+                    self.services["paths"]["sub_dir"],
+                    self.services["paths"]["sub_lvl_dir2"],
+                    self.services["paths"]["random_data"]
+                ))
         except Exception as e:
             self.fail("SSH access failed for VM: %s, Exception: %s" %
-                                (new_virtual_machine.ipaddress, e))
+                      (new_virtual_machine.ipaddress, e))
 
         self.debug("returned_data_0: %s" % returned_data_0[0])
         self.debug("returned_data_1: %s" % returned_data_1[0])
 
-        #Verify returned data
+        # Verify returned data
         self.assertEqual(
-                random_data_0,
-                returned_data_0[0],
-                "Verify newly attached volume contents with existing one"
-                )
+            random_data_0,
+            returned_data_0[0],
+            "Verify newly attached volume contents with existing one"
+        )
         self.assertEqual(
-                random_data_1,
-                returned_data_1[0],
-                "Verify newly attached volume contents with existing one"
-                )
+            random_data_1,
+            returned_data_1[0],
+            "Verify newly attached volume contents with existing one"
+        )
         # Unmount the Sec Storage
         cmds = [
-                    "umount %s" % (self.services["paths"]["mount_dir"]),
-                ]
+            "umount %s" % (self.services["paths"]["mount_dir"]),
+        ]
         for c in cmds:
             self.debug("Command: %s" % c)
             ssh_client.execute(c)
         return
 
-    @attr(speed = "slow")
+    @attr(speed="slow")
     @attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true")
     def test_04_delete_snapshot(self):
         """Test Delete Snapshot
         """
 
-        #1. Snapshot the Volume
-        #2. Delete the snapshot
-        #3. Verify snapshot is removed by calling List Snapshots API
-        #4. Verify snapshot was removed from image store
+        # 1. Snapshot the Volume
+        # 2. Delete the snapshot
+        # 3. Verify snapshot is removed by calling List Snapshots API
+        # 4. Verify snapshot was removed from image store
 
         self.debug("Creating volume under account: %s" % self.account.name)
         volume = Volume.create(
-                               self.apiclient,
-                               self.services["volume"],
-                               zoneid=self.zone.id,
-                               account=self.account.name,
-                               domainid=self.account.domainid,
-                               diskofferingid=self.disk_offering.id
-                               )
+            self.apiclient,
+            self.services["volume"],
+            zoneid=self.zone.id,
+            account=self.account.name,
+            domainid=self.account.domainid,
+            diskofferingid=self.disk_offering.id
+        )
         self.debug("Created volume: %s" % volume.id)
         self.debug("Attaching volume to vm: %s" % self.virtual_machine.id)
 
         self.virtual_machine.attach_volume(
-                                           self.apiclient,
-                                           volume
-                                           )
+            self.apiclient,
+            volume
+        )
         self.debug("Volume attached to vm")
 
         volumes = list_volumes(
-                               self.apiclient,
-                               virtualmachineid=self.virtual_machine.id,
-                               type='DATADISK',
-                               id=volume.id
-                               )
+            self.apiclient,
+            virtualmachineid=self.virtual_machine.id,
+            type='DATADISK',
+            id=volume.id
+        )
         self.assertEqual(
-                            isinstance(volumes, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
+            isinstance(volumes, list),
+            True,
+            "Check list response returns a valid list"
+        )
         snapshot = Snapshot.create(
-                                   self.apiclient,
-                                   volumes[0].id,
-                                   account=self.account.name,
-                                   domainid=self.account.domainid
-                                   )
+            self.apiclient,
+            volumes[0].id,
+            account=self.account.name,
+            domainid=self.account.domainid
+        )
         snapshot.delete(self.apiclient)
         snapshots = list_snapshots(
-                                   self.apiclient,
-                                   id=snapshot.id
-                                   )
+            self.apiclient,
+            id=snapshot.id
+        )
         self.assertEqual(
-                         snapshots,
-                         None,
-                         "Check if result exists in list item call"
-                         )
-        self.assertFalse(is_snapshot_on_nfs(self.apiclient, self.dbclient, self.config, self.zone.id, snapshot.id))
+            snapshots,
+            None,
+            "Check if result exists in list item call"
+        )
+        self.assertFalse(
+            is_snapshot_on_nfs(
+                self.apiclient,
+                self.dbclient,
+                self.config,
+                self.zone.id,
+                snapshot.id))
         return
 
-    @attr(speed = "slow")
-    @attr(tags=["advanced", "advancedns", "basic", "sg"], required_hardware="true")
+    @attr(speed="slow")
+    @attr(
+        tags=[
+            "advanced",
+            "advancedns",
+            "basic",
+            "sg"],
+        required_hardware="true")
     def test_03_snapshot_detachedDisk(self):
         """Test snapshot from detached disk
         """
@@ -609,167 +636,174 @@ class TestSnapshots(cloudstackTestCase):
         # 6. verify backup_snap_id was non null in the `snapshots` table
 
         volumes = list_volumes(
-                               self.apiclient,
-                               virtualmachineid=self.virtual_machine.id,
-                               type='DATADISK',
-                               listall=True
-                               )
+            self.apiclient,
+            virtualmachineid=self.virtual_machine.id,
+            type='DATADISK',
+            listall=True
+        )
         self.assertEqual(
-                            isinstance(volumes, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
+            isinstance(volumes, list),
+            True,
+            "Check list response returns a valid list"
+        )
         volume = volumes[0]
         random_data_0 = random_gen(size=100)
         random_data_1 = random_gen(size=100)
         try:
             ssh_client = self.virtual_machine.get_ssh_client()
 
-            #Format partition using ext3
+            # Format partition using ext3
             format_volume_to_ext3(
-                              ssh_client,
-                              self.services["volume"][self.hypervisor]["datadiskdevice_1"]
-                              )
+                ssh_client,
+                self.services["volume"][self.hypervisor]["datadiskdevice_1"]
+            )
             cmds = [
-                    "mkdir -p %s" % self.services["paths"]["mount_dir"],
-                    "mount %s1 %s" % (
-                                      self.services["volume"][self.hypervisor]["datadiskdevice_1"],
-                                      self.services["paths"]["mount_dir"]
-                                      ),
-                    "pushd %s" % self.services["paths"]["mount_dir"],
-                    "mkdir -p %s/{%s,%s} " % (
-                                                self.services["paths"]["sub_dir"],
-                                                self.services["paths"]["sub_lvl_dir1"],
-                                                self.services["paths"]["sub_lvl_dir2"]
-                                            ),
-                    "echo %s > %s/%s/%s" % (
-                                               random_data_0,
-                                                self.services["paths"]["sub_dir"],
-                                                self.services["paths"]["sub_lvl_dir1"],
-                                                self.services["paths"]["random_data"]
-                                            ),
-                    "echo %s > %s/%s/%s" % (
-                                                random_data_1,
-                                                self.services["paths"]["sub_dir"],
-                                                self.services["paths"]["sub_lvl_dir2"],
-                                                self.services["paths"]["random_data"]
-                                            ),
-                    "sync",
-                    "umount %s" % (self.services["paths"]["mount_dir"]),
-                ]
+                "mkdir -p %s" %
+                self.services["paths"]["mount_dir"],
+                "mount %s1 %s" %
+                (self.services["volume"][
+                    self.hypervisor]["datadiskdevice_1"],
+                    self.services["paths"]["mount_dir"]),
+                "pushd %s" %
+                self.services["paths"]["mount_dir"],
+                "mkdir -p %s/{%s,%s} " %
+                (self.services["paths"]["sub_dir"],
+                    self.services["paths"]["sub_lvl_dir1"],
+                    self.services["paths"]["sub_lvl_dir2"]),
+                "echo %s > %s/%s/%s" %
+                (random_data_0,
+                    self.services["paths"]["sub_dir"],
+                    self.services["paths"]["sub_lvl_dir1"],
+                    self.services["paths"]["random_data"]),
+                "echo %s > %s/%s/%s" %
+                (random_data_1,
+                    self.services["paths"]["sub_dir"],
+                    self.services["paths"]["sub_lvl_dir2"],
+                    self.services["paths"]["random_data"]),
+                "sync",
+                "umount %s" %
+                (self.services["paths"]["mount_dir"]),
+            ]
             for c in cmds:
                 self.debug(ssh_client.execute(c))
 
-            #detach volume from VM
+            # detach volume from VM
             cmd = detachVolume.detachVolumeCmd()
             cmd.id = volume.id
             self.apiclient.detachVolume(cmd)
 
-            #Create snapshot from detached volume
+            # Create snapshot from detached volume
             snapshot = Snapshot.create(self.apiclient, volume.id)
 
             volumes = list_volumes(
-                               self.apiclient,
-                               virtualmachineid=self.virtual_machine.id,
-                               type='DATADISK',
-                               listall=True
-                               )
+                self.apiclient,
+                virtualmachineid=self.virtual_machine.id,
+                type='DATADISK',
+                listall=True
+            )
 
             self.assertEqual(
-                            volumes,
-                            None,
-                            "Check Volume is detached"
-                      )
+                volumes,
+                None,
+                "Check Volume is detached"
+            )
 
             # Verify the snapshot was created or not
             snapshots = list_snapshots(
-                                   self.apiclient,
-                                   id=snapshot.id
-                                   )
+                self.apiclient,
+                id=snapshot.id
+            )
             self.assertNotEqual(
-                            snapshots,
-                            None,
-                            "Check if result exists in list snapshots call"
-                            )
+                snapshots,
+                None,
+                "Check if result exists in list snapshots call"
+            )
             self.assertEqual(
-                            snapshots[0].id,
-                            snapshot.id,
-                            "Check snapshot id in list resources call"
-                        )
+                snapshots[0].id,
+                snapshot.id,
+                "Check snapshot id in list resources call"
+            )
         except Exception as e:
             self.fail("SSH failed for VM with IP: %s - %s" %
-                                (self.virtual_machine.ssh_ip, e))
+                      (self.virtual_machine.ssh_ip, e))
 
         qresultset = self.dbclient.execute(
-                        "select id from snapshots where uuid = '%s';" \
-                        % snapshot.id
-                        )
+            "select id from snapshots where uuid = '%s';"
+            % snapshot.id
+        )
         self.assertNotEqual(
-                            len(qresultset),
-                            0,
-                            "Check DB Query result set"
-                            )
+            len(qresultset),
+            0,
+            "Check DB Query result set"
+        )
 
         qresult = qresultset[0]
         self.assertNotEqual(
-                            str(qresult[0]),
-                            'NULL',
-                            "Check if backup_snap_id is not null"
-                        )
+            str(qresult[0]),
+            'NULL',
+            "Check if backup_snap_id is not null"
+        )
         return
 
-    @attr(speed = "slow")
-    @attr(tags=["advanced", "advancedns", "smoke", "xen"], required_hardware="true")
+    @attr(speed="slow")
+    @attr(
+        tags=[
+            "advanced",
+            "advancedns",
+            "smoke",
+            "xen"],
+        required_hardware="true")
     def test_07_template_from_snapshot(self):
         """Create Template from snapshot
         """
 
-        #1. Login to machine; create temp/test directories on data volume
-        #2. Snapshot the Volume
-        #3. Create Template from snapshot
-        #4. Deploy Virtual machine using this template
-        #5. Login to newly created virtual machine
-        #6. Compare data in the root disk with the one that was written on the volume, it should match
+        # 1. Login to machine; create temp/test directories on data volume
+        # 2. Snapshot the Volume
+        # 3. Create Template from snapshot
+        # 4. Deploy Virtual machine using this template
+        # 5. Login to newly created virtual machine
+        # 6. Compare data in the root disk with the one that was written on the
+        # volume, it should match
 
         userapiclient = self.testClient.getUserApiClient(
-                                    UserName=self.account.name,
-                                    DomainName=self.account.domain)
+            UserName=self.account.name,
+            DomainName=self.account.domain)
 
         random_data_0 = random_gen(size=100)
         random_data_1 = random_gen(size=100)
 
         try:
-            #Login to virtual machine
+            # Login to virtual machine
             ssh_client = self.virtual_machine.get_ssh_client()
 
             cmds = [
-                    "mkdir -p %s" % self.services["paths"]["mount_dir"],
-                    "mount %s1 %s" % (
-                                      self.services["volume"][self.hypervisor]["rootdiskdevice"],
-                                      self.services["paths"]["mount_dir"]
-                                      ),
-                    "mkdir -p %s/%s/{%s,%s} " % (
-                                                self.services["paths"]["mount_dir"],
-                                                self.services["paths"]["sub_dir"],
-                                                self.services["paths"]["sub_lvl_dir1"],
-                                                self.services["paths"]["sub_lvl_dir2"]
-                                            ),
-                    "echo %s > %s/%s/%s/%s" % (
-                                                random_data_0,
-                                                self.services["paths"]["mount_dir"],
-                                                self.services["paths"]["sub_dir"],
-                                                self.services["paths"]["sub_lvl_dir1"],
-                                                self.services["paths"]["random_data"]
-                                            ),
-                    "echo %s > %s/%s/%s/%s" % (
-                                                random_data_1,
-                                                self.services["paths"]["mount_dir"],
-                                                self.services["paths"]["sub_dir"],
-                                                self.services["paths"]["sub_lvl_dir2"],
-                                                self.services["paths"]["random_data"]
-                                        ),
-		             "sync",
-                ]
+                "mkdir -p %s" % self.services["paths"]["mount_dir"],
+                "mount %s1 %s" % (
+                    self.services["volume"][self.hypervisor]["rootdiskdevice"],
+                    self.services["paths"]["mount_dir"]
+                ),
+                "mkdir -p %s/%s/{%s,%s} " % (
+                    self.services["paths"]["mount_dir"],
+                    self.services["paths"]["sub_dir"],
+                    self.services["paths"]["sub_lvl_dir1"],
+                    self.services["paths"]["sub_lvl_dir2"]
+                ),
+                "echo %s > %s/%s/%s/%s" % (
+                    random_data_0,
+                    self.services["paths"]["mount_dir"],
+                    self.services["paths"]["sub_dir"],
+                    self.services["paths"]["sub_lvl_dir1"],
+                    self.services["paths"]["random_data"]
+                ),
+                "echo %s > %s/%s/%s/%s" % (
+                    random_data_1,
+                    self.services["paths"]["mount_dir"],
+                    self.services["paths"]["sub_dir"],
+                    self.services["paths"]["sub_lvl_dir2"],
+                    self.services["paths"]["random_data"]
+                ),
+                "sync",
+            ]
 
             for c in cmds:
                 self.debug(c)
@@ -778,125 +812,124 @@ class TestSnapshots(cloudstackTestCase):
 
         except Exception as e:
             self.fail("SSH failed for VM with IP address: %s" %
-                                    self.virtual_machine.ipaddress)
+                      self.virtual_machine.ipaddress)
 
         # Unmount the Volume
         cmds = [
-                    "umount %s" % (self.services["paths"]["mount_dir"]),
-                ]
+            "umount %s" % (self.services["paths"]["mount_dir"]),
+        ]
         for c in cmds:
             self.debug(c)
             ssh_client.execute(c)
 
         volumes = list_volumes(
-                        userapiclient,
-                        virtualmachineid=self.virtual_machine.id,
-                        type='ROOT',
-                        listall=True
-                        )
+            userapiclient,
+            virtualmachineid=self.virtual_machine.id,
+            type='ROOT',
+            listall=True
+        )
         self.assertEqual(
-                            isinstance(volumes, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
+            isinstance(volumes, list),
+            True,
+            "Check list response returns a valid list"
+        )
 
         volume = volumes[0]
 
-        #Create a snapshot of volume
+        # Create a snapshot of volume
         snapshot = Snapshot.create(
-                                   userapiclient,
-                                   volume.id,
-                                   account=self.account.name,
-                                   domainid=self.account.domainid
-                                   )
+            userapiclient,
+            volume.id,
+            account=self.account.name,
+            domainid=self.account.domainid
+        )
 
         self.debug("Snapshot created from volume ID: %s" % volume.id)
         # Generate template from the snapshot
         template = Template.create_from_snapshot(
-                                    userapiclient,
-                                    snapshot,
-                                    self.services["templates"]
-                                    )
+            userapiclient,
+            snapshot,
+            self.services["templates"]
+        )
         self.cleanup.append(template)
         self.debug("Template created from snapshot ID: %s" % snapshot.id)
 
         # Verify created template
         templates = list_templates(
-                                userapiclient,
-                                templatefilter=\
-                                self.services["templates"]["templatefilter"],
-                                id=template.id
-                                )
+            userapiclient,
+            templatefilter=self.services["templates"]["templatefilter"],
+            id=template.id
+        )
         self.assertNotEqual(
-                            templates,
-                            None,
-                            "Check if result exists in list item call"
-                            )
+            templates,
+            None,
+            "Check if result exists in list item call"
+        )
 
         self.assertEqual(
-                            templates[0].id,
-                            template.id,
-                            "Check new template id in list resources call"
-                        )
+            templates[0].id,
+            template.id,
+            "Check new template id in list resources call"
+        )
         self.debug("Deploying new VM from template: %s" % template.id)
 
         # Deploy new virtual machine using template
         new_virtual_machine = VirtualMachine.create(
-                                    userapiclient,
-                                    self.services["server_without_disk"],
-                                    templateid=template.id,
-                                    accountid=self.account.name,
-                                    domainid=self.account.domainid,
-                                    serviceofferingid=self.service_offering.id,
-                                    mode=self.services["mode"]
-                                    )
+            userapiclient,
+            self.services["server_without_disk"],
+            templateid=template.id,
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering.id,
+            mode=self.services["mode"]
+        )
         try:
-            #Login to VM & mount directory
+            # Login to VM & mount directory
             ssh = new_virtual_machine.get_ssh_client()
 
             cmds = [
-                    "mkdir -p %s" % self.services["paths"]["mount_dir"],
-                    "mount %s1 %s" % (
-                                      self.services["volume"][self.hypervisor]["rootdiskdevice"],
-                                      self.services["paths"]["mount_dir"]
-                                      )
-               ]
+                "mkdir -p %s" % self.services["paths"]["mount_dir"],
+                "mount %s1 %s" % (
+                    self.services["volume"][self.hypervisor]["rootdiskdevice"],
+                    self.services["paths"]["mount_dir"]
+                )
+            ]
 
             for c in cmds:
                 ssh.execute(c)
 
             returned_data_0 = ssh.execute("cat %s/%s/%s/%s" % (
-                                                self.services["paths"]["mount_dir"],
-                                                self.services["paths"]["sub_dir"],
-                                                self.services["paths"]["sub_lvl_dir1"],
-                                                self.services["paths"]["random_data"]
-                                    ))
+                self.services["paths"]["mount_dir"],
+                self.services["paths"]["sub_dir"],
+                self.services["paths"]["sub_lvl_dir1"],
+                self.services["paths"]["random_data"]
+            ))
             self.debug(returned_data_0)
             returned_data_1 = ssh.execute("cat %s/%s/%s/%s" % (
-                                                self.services["paths"]["mount_dir"],
-                                                self.services["paths"]["sub_dir"],
-                                                self.services["paths"]["sub_lvl_dir2"],
-                                                self.services["paths"]["random_data"]
-                                    ))
+                self.services["paths"]["mount_dir"],
+                self.services["paths"]["sub_dir"],
+                self.services["paths"]["sub_lvl_dir2"],
+                self.services["paths"]["random_data"]
+            ))
             self.debug(returned_data_1)
         except Exception as e:
             self.fail("SSH failed for VM with IP address: %s" %
-                                    new_virtual_machine.ipaddress)
-        #Verify returned data
+                      new_virtual_machine.ipaddress)
+        # Verify returned data
         self.assertEqual(
-                random_data_0,
-                returned_data_0[0],
-                "Verify newly attached volume contents with existing one"
-                )
+            random_data_0,
+            returned_data_0[0],
+            "Verify newly attached volume contents with existing one"
+        )
         self.assertEqual(
-                random_data_1,
-                returned_data_1[0],
-                "Verify newly attached volume contents with existing one"
-                )
+            random_data_1,
+            returned_data_1[0],
+            "Verify newly attached volume contents with existing one"
+        )
         # Unmount the volume
         cmds = [
-                    "umount %s" % (self.services["paths"]["mount_dir"]),
-                ]
+            "umount %s" % (self.services["paths"]["mount_dir"]),
+        ]
         try:
             for c in cmds:
                 self.debug(c)
@@ -904,7 +937,7 @@ class TestSnapshots(cloudstackTestCase):
 
         except Exception as e:
             self.fail("SSH failed for VM with IP address: %s, Exception: %s" %
-                                    (new_virtual_machine.ipaddress, e))
+                      (new_virtual_machine.ipaddress, e))
         return
 
 
@@ -912,9 +945,11 @@ class TestCreateVMSnapshotTemplate(cloudstackTestCase):
 
     @classmethod
     def setUpClass(cls):
-        cls.testClient = super(TestCreateVMSnapshotTemplate, cls).getClsTestClient()
+        cls.testClient = super(
+            TestCreateVMSnapshotTemplate,
+            cls).getClsTestClient()
         cls.api_client = cls.testClient.getApiClient()
-
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
         cls.services = Services().services
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client)
@@ -922,35 +957,34 @@ class TestCreateVMSnapshotTemplate(cloudstackTestCase):
         cls.services['mode'] = cls.zone.networktype
 
         cls.template = get_template(
-                            cls.api_client,
-                            cls.zone.id,
-                            cls.services["ostype"]
-                            )
+            cls.api_client,
+            cls.zone.id,
+            cls.services["ostype"]
+        )
         cls.services["domainid"] = cls.domain.id
         cls.services["server"]["zoneid"] = cls.zone.id
 
-
         # Create VMs, NAT Rules etc
         cls.account = Account.create(
-                            cls.api_client,
-                            cls.services["account"],
-                            domainid=cls.domain.id
-                            )
+            cls.api_client,
+            cls.services["account"],
+            domainid=cls.domain.id
+        )
 
         cls.service_offering = ServiceOffering.create(
-                                            cls.api_client,
-                                            cls.services["service_offering"]
-                                            )
+            cls.api_client,
+            cls.services["service_offering"]
+        )
         cls._cleanup = [
-                        cls.service_offering,
-                        cls.account,
-                        ]
+            cls.service_offering,
+            cls.account,
+        ]
         return
 
     @classmethod
     def tearDownClass(cls):
         try:
-            #Cleanup resources used
+            # Cleanup resources used
             cleanup_resources(cls.api_client, cls._cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -965,13 +999,13 @@ class TestCreateVMSnapshotTemplate(cloudstackTestCase):
 
     def tearDown(self):
         try:
-            #Clean up, terminate the created instance, volumes and snapshots
+            # Clean up, terminate the created instance, volumes and snapshots
             cleanup_resources(self.apiclient, self.cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(speed = "slow")
+    @attr(speed="slow")
     @attr(tags=["advanced", "advancedns"], required_hardware="true")
     def test_01_createVM_snapshotTemplate(self):
         """Test create VM, Snapshot and Template
@@ -984,35 +1018,39 @@ class TestCreateVMSnapshotTemplate(cloudstackTestCase):
         # 4. Create a instance from above created template.
         # 5. listSnapshots should list the snapshot that was created.
         # 6. verify that secondary storage NFS share contains the reqd
-        #  volume under /secondary/snapshots/$accountid/$volumeid/$snapshot_uuid
+        #    volume under /secondary/snapshots/$accountid/
+        #    $volumeid/$snapshot_uuid
         # 7. verify backup_snap_id was non null in the `snapshots` table
         # 8. listTemplates() should return the newly created Template,
         #    and check for template state as READY"
         # 9. listVirtualMachines() command should return the deployed VM.
         #    State of this VM should be Running.
 
-        #Create Virtual Machine
+        # Create Virtual Machine
+
+        if self.hypervisor.lower() in ['hyperv']:
+            self.skipTest("Snapshots feature is not supported on Hyper-V")
 
         userapiclient = self.testClient.getUserApiClient(
-                                    UserName=self.account.name,
-                                    DomainName=self.account.domain)
+            UserName=self.account.name,
+            DomainName=self.account.domain)
 
         self.virtual_machine = VirtualMachine.create(
-                                userapiclient,
-                                self.services["server"],
-                                templateid=self.template.id,
-                                accountid=self.account.name,
-                                domainid=self.account.domainid,
-                                serviceofferingid=self.service_offering.id
-                                )
+            userapiclient,
+            self.services["server"],
+            templateid=self.template.id,
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering.id
+        )
         self.debug("Created VM with ID: %s" % self.virtual_machine.id)
         # Get the Root disk of VM
         volumes = list_volumes(
-                            userapiclient,
-                            virtualmachineid=self.virtual_machine.id,
-                            type='ROOT',
-                            listall=True
-                            )
+            userapiclient,
+            virtualmachineid=self.virtual_machine.id,
+            type='ROOT',
+            listall=True
+        )
         volume = volumes[0]
 
         # Create a snapshot from the ROOTDISK
@@ -1021,105 +1059,111 @@ class TestCreateVMSnapshotTemplate(cloudstackTestCase):
         self.cleanup.append(snapshot)
 
         snapshots = list_snapshots(
-                                   userapiclient,
-                                   id=snapshot.id
-                                   )
+            userapiclient,
+            id=snapshot.id
+        )
         self.assertEqual(
-                            isinstance(snapshots, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
+            isinstance(snapshots, list),
+            True,
+            "Check list response returns a valid list"
+        )
         self.assertNotEqual(
-                            snapshots,
-                            None,
-                            "Check if result exists in list snapshots call"
-                            )
+            snapshots,
+            None,
+            "Check if result exists in list snapshots call"
+        )
         self.assertEqual(
-                            snapshots[0].id,
-                            snapshot.id,
-                            "Check snapshot id in list resources call"
-                        )
-        self.debug("select backup_snap_id, account_id, volume_id from snapshots where uuid = '%s';" \
-                        % snapshot.id)
+            snapshots[0].id,
+            snapshot.id,
+            "Check snapshot id in list resources call"
+        )
+        self.debug(
+            "select backup_snap_id, account_id, volume_id from snapshots where uuid = '%s';" %
+            snapshot.id)
         snapshot_uuid = snapshot.id
 
         # Generate template from the snapshot
         template = Template.create_from_snapshot(
-                                    userapiclient,
-                                    snapshot,
-                                    self.services["templates"]
-                                    )
+            userapiclient,
+            snapshot,
+            self.services["templates"]
+        )
         self.debug("Created template from snapshot: %s" % template.id)
         self.cleanup.append(template)
 
         templates = list_templates(
-                                userapiclient,
-                                templatefilter=\
-                                self.services["templates"]["templatefilter"],
-                                id=template.id
-                                )
+            userapiclient,
+            templatefilter=self.services["templates"]["templatefilter"],
+            id=template.id
+        )
 
         self.assertNotEqual(
-                            templates,
-                            None,
-                            "Check if result exists in list item call"
-                            )
+            templates,
+            None,
+            "Check if result exists in list item call"
+        )
 
         self.assertEqual(
-                            templates[0].isready,
-                            True,
-                            "Check new template state in list templates call"
-                        )
+            templates[0].isready,
+            True,
+            "Check new template state in list templates call"
+        )
 
         # Deploy new virtual machine using template
         new_virtual_machine = VirtualMachine.create(
-                                    userapiclient,
-                                    self.services["server"],
-                                    templateid=template.id,
-                                    accountid=self.account.name,
-                                    domainid=self.account.domainid,
-                                    serviceofferingid=self.service_offering.id
-                                    )
+            userapiclient,
+            self.services["server"],
+            templateid=template.id,
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering.id
+        )
         self.debug("Created VM with ID: %s from template: %s" % (
-                                                        new_virtual_machine.id,
-                                                        template.id
-                                                        ))
+            new_virtual_machine.id,
+            template.id
+        ))
         self.cleanup.append(new_virtual_machine)
 
         # Newly deployed VM should be 'Running'
         virtual_machines = list_virtual_machines(
-                                userapiclient,
-                                id=new_virtual_machine.id,
-                                account=self.account.name,
-                                domainid=self.account.domainid
-                                )
+            userapiclient,
+            id=new_virtual_machine.id,
+            account=self.account.name,
+            domainid=self.account.domainid
+        )
         self.assertEqual(
-                            isinstance(virtual_machines, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
+            isinstance(virtual_machines, list),
+            True,
+            "Check list response returns a valid list"
+        )
         self.assertNotEqual(
-                             len(virtual_machines),
-                             0,
-                             "Check list virtual machines response"
-                             )
+            len(virtual_machines),
+            0,
+            "Check list virtual machines response"
+        )
         for virtual_machine in virtual_machines:
             self.assertEqual(
-                        virtual_machine.state,
-                        'Running',
-                        "Check list VM response for Running state"
-                    )
-        self.assertTrue(is_snapshot_on_nfs(self.apiclient, self.dbclient, self.config, self.zone.id, snapshot_uuid))
+                virtual_machine.state,
+                'Running',
+                "Check list VM response for Running state"
+            )
+        self.assertTrue(
+            is_snapshot_on_nfs(
+                self.apiclient,
+                self.dbclient,
+                self.config,
+                self.zone.id,
+                snapshot_uuid))
         return
 
+
 class TestSnapshotEvents(cloudstackTestCase):
 
     @classmethod
     def setUpClass(cls):
         cls.testClient = super(TestSnapshotEvents, cls).getClsTestClient()
         cls.api_client = cls.testClient.getApiClient()
-
-
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
         cls.services = Services().services
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client)
@@ -1127,46 +1171,46 @@ class TestSnapshotEvents(cloudstackTestCase):
         cls.services['mode'] = cls.zone.networktype
 
         template = get_template(
-                            cls.api_client,
-                            cls.zone.id,
-                            cls.services["ostype"]
-                            )
+            cls.api_client,
+            cls.zone.id,
+            cls.services["ostype"]
+        )
         cls.services["server"]["zoneid"] = cls.zone.id
 
         cls.services["template"] = template.id
 
         # Create VMs, NAT Rules etc
         cls.account = Account.create(
-                            cls.api_client,
-                            cls.services["account"],
-                            domainid=cls.domain.id
-                            )
+            cls.api_client,
+            cls.services["account"],
+            domainid=cls.domain.id
+        )
 
         cls.services["account"] = cls.account.name
 
         cls.service_offering = ServiceOffering.create(
-                                            cls.api_client,
-                                            cls.services["service_offering"]
-                                            )
+            cls.api_client,
+            cls.services["service_offering"]
+        )
         cls.virtual_machine = VirtualMachine.create(
-                                cls.api_client,
-                                cls.services["server"],
-                                templateid=template.id,
-                                accountid=cls.account.name,
-                                domainid=cls.account.domainid,
-                                serviceofferingid=cls.service_offering.id
-                                )
+            cls.api_client,
+            cls.services["server"],
+            templateid=template.id,
+            accountid=cls.account.name,
+            domainid=cls.account.domainid,
+            serviceofferingid=cls.service_offering.id
+        )
 
         cls._cleanup = [
-                        cls.service_offering,
-                        cls.account,
-                        ]
+            cls.service_offering,
+            cls.account,
+        ]
         return
 
     @classmethod
     def tearDownClass(cls):
         try:
-            #Cleanup resources used
+            # Cleanup resources used
             cleanup_resources(cls.api_client, cls._cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -1181,34 +1225,38 @@ class TestSnapshotEvents(cloudstackTestCase):
 
     def tearDown(self):
         try:
-            #Clean up, terminate the created instance, volumes and snapshots
+            # Clean up, terminate the created instance, volumes and snapshots
             cleanup_resources(self.apiclient, self.cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(speed = "slow")
+    @attr(speed="slow")
     @attr(tags=["advanced", "advancedns"], required_hardware="false")
     def test_05_snapshot_events(self):
         """Test snapshot events
         """
         # Validate the following
-        # 1. Perform snapshot on the root disk of this VM and check the events/alerts.
+        # 1. Perform snapshot on the root disk of this VM and
+        #    check the events/alerts.
         # 2. delete the snapshots and check the events/alerts
         # 3. listEvents() shows created/deleted snapshot events
 
+        if self.hypervisor.lower() in ['hyperv']:
+            self.skipTest("Snapshots feature is not supported on Hyper-V")
+
         # Get the Root disk of VM
         volumes = list_volumes(
-                            self.apiclient,
-                            virtualmachineid=self.virtual_machine.id,
-                            type='ROOT',
-                            listall=True
-                            )
+            self.apiclient,
+            virtualmachineid=self.virtual_machine.id,
+            type='ROOT',
+            listall=True
+        )
         self.assertEqual(
-                            isinstance(volumes, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
+            isinstance(volumes, list),
+            True,
+            "Check list response returns a valid list"
+        )
         volume = volumes[0]
 
         # Create a snapshot from the ROOTDISK
@@ -1216,47 +1264,47 @@ class TestSnapshotEvents(cloudstackTestCase):
         self.debug("Snapshot created with ID: %s" % snapshot.id)
 
         snapshots = list_snapshots(
-                                   self.apiclient,
-                                   id=snapshot.id
-                                   )
+            self.apiclient,
+            id=snapshot.id
+        )
         self.assertEqual(
-                            isinstance(snapshots, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
+            isinstance(snapshots, list),
+            True,
+            "Check list response returns a valid list"
+        )
         self.assertNotEqual(
-                            snapshots,
-                            None,
-                            "Check if result exists in list snapshots call"
-                            )
+            snapshots,
+            None,
+            "Check if result exists in list snapshots call"
+        )
         self.assertEqual(
-                            snapshots[0].id,
-                            snapshot.id,
-                            "Check snapshot id in list resources call"
-                        )
+            snapshots[0].id,
+            snapshot.id,
+            "Check snapshot id in list resources call"
+        )
         snapshot.delete(self.apiclient)
 
         # Sleep to ensure that snapshot is deleted properly
         time.sleep(self.services["sleep"])
         events = list_events(
-                             self.apiclient,
-                             account=self.account.name,
-                             domainid=self.account.domainid,
-                             type='SNAPSHOT.DELETE'
-                             )
+            self.apiclient,
+            account=self.account.name,
+            domainid=self.account.domainid,
+            type='SNAPSHOT.DELETE'
+        )
         self.assertEqual(
-                            isinstance(events, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
+            isinstance(events, list),
+            True,
+            "Check list response returns a valid list"
+        )
         self.assertNotEqual(
-                            events,
-                            None,
-                            "Check if event exists in list events call"
-                            )
+            events,
+            None,
+            "Check if event exists in list events call"
+        )
         self.assertIn(
-                            events[0].state,
-                            ['Completed', 'Scheduled'],
-                            "Check events state in list events call"
-                        )
+            events[0].state,
+            ['Completed', 'Scheduled'],
+            "Check events state in list events call"
+        )
         return

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/214d63ee/test/integration/component/test_ss_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_ss_limits.py b/test/integration/component/test_ss_limits.py
index c498302..22ab99c 100644
--- a/test/integration/component/test_ss_limits.py
+++ b/test/integration/component/test_ss_limits.py
@@ -58,6 +58,7 @@ class TestSecondaryStorageLimits(cloudstackTestCase):
         cloudstackTestClient = super(TestSecondaryStorageLimits,
                                cls).getClsTestClient()
         cls.api_client = cloudstackTestClient.getApiClient()
+        cls.hypervisor = cloudstackTestClient.getHypervisorInfo()
         # Fill services from the external config file
         cls.services = cloudstackTestClient.getParsedTestDataConfig()
         # Get Zone, Domain and templates
@@ -201,6 +202,9 @@ class TestSecondaryStorageLimits(cloudstackTestCase):
         5. Verify that the secondary storage count of the account equals
            the size of the template"""
 
+        if self.hypervisor.lower() in ['hyperv']:
+            self.skipTest("Snapshots feature is not supported on Hyper-V")
+
         response = self.setupAccount(value)
         self.assertEqual(response[0], PASS, response[1])
 


[07/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4

Posted by sa...@apache.org.
CLOUDSTACK-8063: list secondary Ips information on non-default nics in VM response


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/93429443
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/93429443
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/93429443

Branch: refs/heads/vmware-disk-controllers
Commit: 93429443d50eabd5c6e73a412b8935120e13c42d
Parents: 48aa7e1
Author: Wei Zhou <w....@tech.leaseweb.com>
Authored: Mon Jan 5 11:22:14 2015 +0100
Committer: Wei Zhou <w....@tech.leaseweb.com>
Committed: Mon Jan 5 11:22:14 2015 +0100

----------------------------------------------------------------------
 .../src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java  | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93429443/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java
index 8ea142a..890b4bc 100644
--- a/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java
+++ b/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java
@@ -358,6 +358,18 @@ public class UserVmJoinDaoImpl extends GenericDaoBase<UserVmJoinVO, Long> implem
                 nicResponse.setType(uvo.getGuestType().toString());
             }
             nicResponse.setIsDefault(uvo.isDefaultNic());
+            List<NicSecondaryIpVO> secondaryIps = ApiDBUtils.findNicSecondaryIps(uvo.getNicId());
+            if (secondaryIps != null) {
+                List<NicSecondaryIpResponse> ipList = new ArrayList<NicSecondaryIpResponse>();
+                for (NicSecondaryIpVO ip : secondaryIps) {
+                    NicSecondaryIpResponse ipRes = new NicSecondaryIpResponse();
+                    ipRes.setId(ip.getUuid());
+                    ipRes.setIpAddr(ip.getIp4Address());
+                    ipList.add(ipRes);
+                }
+                nicResponse.setSecondaryIps(ipList);
+            }
+
             nicResponse.setObjectName("nic");
             userVmData.addNic(nicResponse);
         }


[19/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4

Posted by sa...@apache.org.
CID-1261671 added null check


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/251e88c4
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/251e88c4
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/251e88c4

Branch: refs/heads/vmware-disk-controllers
Commit: 251e88c4015093fad723c13b496065d6434871cc
Parents: 54e5f28
Author: Daan Hoogland <da...@onecht.net>
Authored: Mon Jan 5 15:55:33 2015 +0100
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jan 5 15:55:33 2015 +0100

----------------------------------------------------------------------
 engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/251e88c4/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java b/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java
index 4c4fe86..223172e 100644
--- a/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java
+++ b/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java
@@ -150,6 +150,11 @@ public class DomainDaoImpl extends GenericDaoBase<DomainVO, Long> implements Dom
         if (id != null && id.longValue() == Domain.ROOT_DOMAIN) {
             s_logger.error("Can not remove domain " + id + " as it is ROOT domain");
             return false;
+        } else {
+            if(id == null) {
+                s_logger.error("Can not remove domain without id.");
+                return false;
+            }
         }
 
         DomainVO domain = findById(id);


[05/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4

Posted by sa...@apache.org.
CLOUDSTACK-7383: UI > Instances menu > detail view > TakeSnapshot action should be hidden when VM's hypervisor is LXC.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7fe1ed9d
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7fe1ed9d
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7fe1ed9d

Branch: refs/heads/vmware-disk-controllers
Commit: 7fe1ed9dc81a92312cb273dc464d5f6d4259af05
Parents: b64fa34
Author: Jessica Wang <je...@apache.org>
Authored: Fri Jan 2 14:06:28 2015 -0800
Committer: Jessica Wang <je...@apache.org>
Committed: Fri Jan 2 14:12:15 2015 -0800

----------------------------------------------------------------------
 ui/scripts/instances.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7fe1ed9d/ui/scripts/instances.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js
index d439c66..9ed0e16 100644
--- a/ui/scripts/instances.js
+++ b/ui/scripts/instances.js
@@ -2435,7 +2435,7 @@
             allowedActions.push("restart");
             
             if ((jsonObj.hypervisor != 'KVM' || g_kvmsnapshotenabled == true) 
-            		|| (jsonObj.hypervisor != 'LXC')) {
+            		&& (jsonObj.hypervisor != 'LXC')) {
                 allowedActions.push("snapshot");
             }
             
@@ -2469,7 +2469,7 @@
             allowedActions.push("reinstall");
             
             if ((jsonObj.hypervisor != 'KVM' || g_kvmsnapshotenabled == true) 
-            		|| (jsonObj.hypervisor != 'LXC')) {
+            		&& (jsonObj.hypervisor != 'LXC')) {
                 allowedActions.push("snapshot");
             }
             


[06/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4

Posted by sa...@apache.org.
README: back to work

Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/48aa7e18
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/48aa7e18
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/48aa7e18

Branch: refs/heads/vmware-disk-controllers
Commit: 48aa7e1854eb3d747acd04257ede67ee813dac4e
Parents: 7fe1ed9
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Sun Jan 4 15:28:02 2015 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Sun Jan 4 15:28:02 2015 +0530

----------------------------------------------------------------------
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/48aa7e18/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 71fdb8a..4ea9224 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
 # Apache CloudStack [![Build Status](https://travis-ci.org/apache/cloudstack.svg?branch=master)](https://travis-ci.org/apache/cloudstack) [![Coverity Scan Build Status](https://scan.coverity.com/projects/943/badge.svg)](https://scan.coverity.com/projects/943)
 
-![Apache CloudStack](tools/logo/acslogo.jpg)
+![Apache CloudStack](tools/logo/apache_cloudstack.png)
 
 Apache CloudStack is open source software designed to deploy and manage large
 networks of virtual machines, as a highly available, highly scalable


[24/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4

Posted by sa...@apache.org.
Seems we are hitting bug MCHECKSTYLE-250


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/eb9fba4f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/eb9fba4f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/eb9fba4f

Branch: refs/heads/vmware-disk-controllers
Commit: eb9fba4feaded3cb18e64e44f7d601e82653f39b
Parents: ec32ea3
Author: Hugo Trippaers <ht...@schubergphilis.com>
Authored: Tue Jan 6 14:03:34 2015 +0100
Committer: Hugo Trippaers <ht...@schubergphilis.com>
Committed: Tue Jan 6 14:03:34 2015 +0100

----------------------------------------------------------------------
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eb9fba4f/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index d3694bc..66fe7f7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -96,7 +96,7 @@
     <cs.target.dir>target</cs.target.dir>
     <cs.daemon.version>1.0.15</cs.daemon.version>
     <cs.jna.version>4.0.0</cs.jna.version>
-    <cs.checkstyle.version>2.13</cs.checkstyle.version>
+    <cs.checkstyle.version>2.11</cs.checkstyle.version>
     <cs.mycila.license.version>2.7</cs.mycila.license.version>
     <cs.findbugs.version>3.0.0</cs.findbugs.version>
     <cs.javadoc.version>2.10.1</cs.javadoc.version>


[10/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4

Posted by sa...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/214d63ee/test/integration/component/test_tags.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_tags.py b/test/integration/component/test_tags.py
index 2b05fbb..e323578 100644
--- a/test/integration/component/test_tags.py
+++ b/test/integration/component/test_tags.py
@@ -16,7 +16,7 @@
 # under the License.
 """ P1 tests for tags
 """
-#Import Local Modules
+# Import Local Modules
 from nose.plugins.attrib import attr
 from marvin.cloudstackTestCase import cloudstackTestCase
 from marvin.lib.utils import cleanup_resources
@@ -43,147 +43,149 @@ from marvin.lib.common import (get_zone,
 from marvin.codes import FAILED
 import time
 
+
 class Services:
+
     """Test tags Services
     """
 
     def __init__(self):
         self.services = {
-                        "domain": {
-                                   "name": "Domain",
-                        },
-                        "project": {
-                                    "name": "Project",
-                                    "displaytext": "Test project",
-                        },
-                        "account": {
-                                    "email": "administrator@clogeny.com",
-                                    "firstname": "Test",
-                                    "lastname": "User",
-                                    "username": "test",
-                                    # Random characters are appended for unique
-                                    # username
-                                    "password": "password",
-                         },
-                         "user": {
-                                    "email": "user@clogeny.com",
-                                    "firstname": "User",
-                                    "lastname": "User",
-                                    "username": "User",
-                                    # Random characters are appended for unique
-                                    # username
-                                    "password": "password",
-                         },
-                        "other_user": {
-                                    "email": "otheruser@clogeny.com",
-                                    "firstname": "Other",
-                                    "lastname": "User",
-                                    "username": "User",
-                                    # Random characters are appended for unique
-                                    # username
-                                    "password": "password",
-                         },
-                         "service_offering": {
-                                    "name": "Tiny Instance",
-                                    "displaytext": "Tiny Instance",
-                                    "cpunumber": 1,
-                                    "cpuspeed": 100,
-                                    # in MHz
-                                    "memory": 128,
-                                    # In MBs
-                        },
-                        "disk_offering": {
-                                    "displaytext": "Tiny Disk Offering",
-                                    "name": "Tiny Disk Offering",
-                                    "disksize": 1
-                        },
-                        "volume": {
-                                   "diskname": "Test Volume",
-                        },
-                        "virtual_machine": {
-                                    "displayname": "TestVM",
-                                    "username": "root",
-                                    "password": "password",
-                                    "ssh_port": 22,
-                                    "hypervisor": 'XenServer',
-                                    "privateport": 22,
-                                    "publicport": 22,
-                                    "protocol": 'TCP',
-                        },
-                        "template": {
-                                    "displaytext": "Cent OS Template",
-                                    "name": "Cent OS Template",
-                                    "ostype": 'CentOS 5.3 (64-bit)',
-                                    "templatefilter": 'self',
-                        },
-                        "iso":
-                        {
-                            "displaytext": "Dummy ISO",
-                            "name": "Dummy ISO",
-                            "url": "http://people.apache.org/~tsp/dummy.iso",
-                            # Source URL where ISO is located
-                            "isextractable": True,
-                            "isfeatured": True,
-                            "ispublic": False,
-                            "ostype": 'CentOS 5.3 (64-bit)',
-                            "mode": 'HTTP_DOWNLOAD',
-                            # Used in Extract template, value must be HTTP_DOWNLOAD
-                        },
-                        "network_offering": {
-                                    "name": 'Network offering-VR services',
-                                    "displaytext": 'Network offering-VR services',
-                                    "guestiptype": 'Isolated',
-                                    "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat',
-                                    "traffictype": 'GUEST',
-                                    "availability": 'Optional',
-                                    "serviceProviderList": {
-                                            "Dhcp": 'VirtualRouter',
-                                            "Dns": 'VirtualRouter',
-                                            "SourceNat": 'VirtualRouter',
-                                            "PortForwarding": 'VirtualRouter',
-                                            "Vpn": 'VirtualRouter',
-                                            "Firewall": 'VirtualRouter',
-                                            "Lb": 'VirtualRouter',
-                                            "UserData": 'VirtualRouter',
-                                            "StaticNat": 'VirtualRouter',
-                                        },
-                                    },
-                         "network": {
-                                  "name": "Test Network",
-                                  "displaytext": "Test Network",
-                                },
-                         "lbrule": {
-                                    "name": "SSH",
-                                    "alg": "leastconn",
-                                    # Algorithm used for load balancing
-                                    "privateport": 22,
-                                    "publicport": 22,
-                                    "openfirewall": False,
-                         },
-                         "natrule": {
-                                    "privateport": 22,
-                                    "publicport": 22,
-                                    "protocol": "TCP"
-                                },
-                         "fw_rule": {
-                                    "startport": 1,
-                                    "endport": 6000,
-                                    "cidr": '55.55.0.0/11',
-                                    # Any network (For creating FW rule)
-                                },
-                         "security_group": {
-                                    "name": 'SSH',
-                                    "protocol": 'TCP',
-                                    "startport": 22,
-                                    "endport": 22,
-                                    "cidrlist": '0.0.0.0/0',
-                        },
-                        # Cent OS 5.3 (64 bit)
-                        "sleep": 60,
-                        "ostype": 'CentOS 5.3 (64-bit)',
-                        "timeout": 10,
-                        "mode": 'advanced',
-                    }
+            "domain": {
+                "name": "Domain",
+            },
+            "project": {
+                "name": "Project",
+                "displaytext": "Test project",
+            },
+            "account": {
+                "email": "administrator@clogeny.com",
+                "firstname": "Test",
+                "lastname": "User",
+                "username": "test",
+                # Random characters are appended for unique
+                # username
+                "password": "password",
+            },
+            "user": {
+                "email": "user@clogeny.com",
+                "firstname": "User",
+                "lastname": "User",
+                "username": "User",
+                # Random characters are appended for unique
+                # username
+                "password": "password",
+            },
+            "other_user": {
+                "email": "otheruser@clogeny.com",
+                "firstname": "Other",
+                "lastname": "User",
+                "username": "User",
+                # Random characters are appended for unique
+                # username
+                "password": "password",
+            },
+            "service_offering": {
+                "name": "Tiny Instance",
+                "displaytext": "Tiny Instance",
+                "cpunumber": 1,
+                "cpuspeed": 100,
+                # in MHz
+                "memory": 128,
+                # In MBs
+            },
+            "disk_offering": {
+                "displaytext": "Tiny Disk Offering",
+                "name": "Tiny Disk Offering",
+                "disksize": 1
+            },
+            "volume": {
+                "diskname": "Test Volume",
+            },
+            "virtual_machine": {
+                "displayname": "TestVM",
+                "username": "root",
+                "password": "password",
+                "ssh_port": 22,
+                "hypervisor": 'XenServer',
+                "privateport": 22,
+                "publicport": 22,
+                "protocol": 'TCP',
+            },
+            "template": {
+                "displaytext": "Cent OS Template",
+                "name": "Cent OS Template",
+                "ostype": 'CentOS 5.3 (64-bit)',
+                "templatefilter": 'self',
+            },
+            "iso":
+            {
+                "displaytext": "Dummy ISO",
+                "name": "Dummy ISO",
+                "url": "http://people.apache.org/~tsp/dummy.iso",
+                # Source URL where ISO is located
+                "isextractable": True,
+                "isfeatured": True,
+                "ispublic": False,
+                "ostype": 'CentOS 5.3 (64-bit)',
+                "mode": 'HTTP_DOWNLOAD',
+                # Used in Extract template, value must be HTTP_DOWNLOAD
+            },
+            "network_offering": {
+                "name": 'Network offering-VR services',
+                "displaytext": 'Network offering-VR services',
+                "guestiptype": 'Isolated',
+                "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat',
+                "traffictype": 'GUEST',
+                "availability": 'Optional',
+                "serviceProviderList": {
+                    "Dhcp": 'VirtualRouter',
+                    "Dns": 'VirtualRouter',
+                    "SourceNat": 'VirtualRouter',
+                    "PortForwarding": 'VirtualRouter',
+                    "Vpn": 'VirtualRouter',
+                    "Firewall": 'VirtualRouter',
+                    "Lb": 'VirtualRouter',
+                    "UserData": 'VirtualRouter',
+                    "StaticNat": 'VirtualRouter',
+                },
+            },
+            "network": {
+                "name": "Test Network",
+                "displaytext": "Test Network",
+            },
+            "lbrule": {
+                "name": "SSH",
+                "alg": "leastconn",
+                # Algorithm used for load balancing
+                "privateport": 22,
+                "publicport": 22,
+                "openfirewall": False,
+            },
+            "natrule": {
+                "privateport": 22,
+                "publicport": 22,
+                "protocol": "TCP"
+            },
+            "fw_rule": {
+                "startport": 1,
+                "endport": 6000,
+                "cidr": '55.55.0.0/11',
+                # Any network (For creating FW rule)
+            },
+            "security_group": {
+                "name": 'SSH',
+                "protocol": 'TCP',
+                "startport": 22,
+                "endport": 22,
+                "cidrlist": '0.0.0.0/0',
+            },
+            # Cent OS 5.3 (64 bit)
+            "sleep": 60,
+            "ostype": 'CentOS 5.3 (64-bit)',
+            "timeout": 10,
+            "mode": 'advanced',
+        }
 
 
 class TestResourceTags(cloudstackTestCase):
@@ -192,7 +194,7 @@ class TestResourceTags(cloudstackTestCase):
     def setUpClass(cls):
         cls.testClient = super(TestResourceTags, cls).getClsTestClient()
         cls.api_client = cls.testClient.getApiClient()
-
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
         cls.services = Services().services
 
         # Get Zone, Domain and templates
@@ -200,65 +202,66 @@ class TestResourceTags(cloudstackTestCase):
         cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
         cls.domain = get_domain(cls.api_client)
         cls.template = get_template(
-                            cls.api_client,
-                            cls.zone.id,
-                            cls.services["ostype"]
-                            )
+            cls.api_client,
+            cls.zone.id,
+            cls.services["ostype"]
+        )
         if cls.template == FAILED:
-            assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
+            assert False, "get_template() failed to return template\
+                    with description %s" % cls.services["ostype"]
 
         cls.account = Account.create(
-                            cls.api_client,
-                            cls.services["account"],
-                            admin=True,
-                            )
-        
+            cls.api_client,
+            cls.services["account"],
+            admin=True,
+        )
+
         cls.user_api_client = cls.testClient.getUserApiClient(
-                UserName=cls.account.name,
-                DomainName=cls.account.domain
-            )
-        
+            UserName=cls.account.name,
+            DomainName=cls.account.domain
+        )
+
         # Create service offerings, disk offerings etc
         cls.service_offering = ServiceOffering.create(
-                                    cls.api_client,
-                                    cls.services["service_offering"]
-                                    )
+            cls.api_client,
+            cls.services["service_offering"]
+        )
 
         cls.disk_offering = DiskOffering.create(
-                                    cls.api_client,
-                                    cls.services["disk_offering"]
-                                    )
-        
+            cls.api_client,
+            cls.services["disk_offering"]
+        )
+
         cls.services["iso"]["zoneid"] = cls.zone.id
         cls.services["virtual_machine"]["zoneid"] = cls.zone.id
         cls.services["virtual_machine"]["template"] = cls.template.id
         cls.vm_1 = VirtualMachine.create(
-                                    cls.api_client,
-                                    cls.services["virtual_machine"],
-                                    accountid=cls.account.name,
-                                    domainid=cls.account.domainid,
-                                    serviceofferingid=cls.service_offering.id,
-                                    mode=cls.zone.networktype
-                                )
+            cls.api_client,
+            cls.services["virtual_machine"],
+            accountid=cls.account.name,
+            domainid=cls.account.domainid,
+            serviceofferingid=cls.service_offering.id,
+            mode=cls.zone.networktype
+        )
         cls.vm_2 = VirtualMachine.create(
-                                    cls.api_client,
-                                    cls.services["virtual_machine"],
-                                    accountid=cls.account.name,
-                                    domainid=cls.account.domainid,
-                                    serviceofferingid=cls.service_offering.id,
-                                    mode=cls.zone.networktype
-                                )
+            cls.api_client,
+            cls.services["virtual_machine"],
+            accountid=cls.account.name,
+            domainid=cls.account.domainid,
+            serviceofferingid=cls.service_offering.id,
+            mode=cls.zone.networktype
+        )
         cls._cleanup = [
-                        cls.account,
-                        cls.service_offering,
-                        cls.disk_offering
-                        ]
+            cls.account,
+            cls.service_offering,
+            cls.disk_offering
+        ]
         return
 
     @classmethod
     def tearDownClass(cls):
         try:
-            #Cleanup resources used
+            # Cleanup resources used
             print("Cleanup resources used")
             cleanup_resources(cls.api_client, cls._cleanup)
         except Exception as e:
@@ -274,18 +277,18 @@ class TestResourceTags(cloudstackTestCase):
 
     def tearDown(self):
         try:
-            #Clean up, terminate the created accounts, domains etc
+            # Clean up, terminate the created accounts, domains etc
             cleanup_resources(self.apiclient, self.cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
-         
+
         for tag in self.rm_tags:
             tag['tag_obj'].delete(self.apiclient, tag['resid'],
-                  tag['restype'],
-                  {tag['key']: tag['value']})
+                                  tag['restype'],
+                                  {tag['key']: tag['value']})
 
         return
-    
+
     @attr(tags=["advanced"], required_hardware="false")
     def test_01_lbrule_tag(self):
         """ Test Create tag on LB rule and remove the LB rule
@@ -296,131 +299,131 @@ class TestResourceTags(cloudstackTestCase):
         # 3. Delete the LB rule
 
         self.debug("Fetching the network details for account: %s" %
-                                                self.account.name)
+                   self.account.name)
         networks = Network.list(
-                                self.apiclient,
-                                account=self.account.name,
-                                domainid=self.account.domainid,
-                                listall=True
-                                )
-        self.assertEqual(
-                         isinstance(networks, list),
-                         True,
-                         "List networks should not return an empty response"
-                         )
+            self.apiclient,
+            account=self.account.name,
+            domainid=self.account.domainid,
+            listall=True
+        )
+        self.assertEqual(
+            isinstance(networks, list),
+            True,
+            "List networks should not return an empty response"
+        )
         network = networks[0]
         self.debug("Network for the account: %s is %s" %
-                                    (self.account.name, network.name))
+                   (self.account.name, network.name))
 
         self.debug("Associating public IP for network: %s" % network.id)
         public_ip = PublicIPAddress.create(
-                                    self.apiclient,
-                                    accountid=self.account.name,
-                                    zoneid=self.zone.id,
-                                    domainid=self.account.domainid,
-                                    networkid=network.id
-                                    )
+            self.apiclient,
+            accountid=self.account.name,
+            zoneid=self.zone.id,
+            domainid=self.account.domainid,
+            networkid=network.id
+        )
         self.cleanup.append(public_ip)
 
         self.debug("Trying to create LB rule on IP: %s" %
-                                    public_ip.ipaddress.ipaddress)
+                   public_ip.ipaddress.ipaddress)
 
         # Create Load Balancer rule on the public ip
         lb_rule = LoadBalancerRule.create(
-                                    self.apiclient,
-                                    self.services["lbrule"],
-                                    ipaddressid=public_ip.ipaddress.id,
-                                    accountid=self.account.name
-                                    )
+            self.apiclient,
+            self.services["lbrule"],
+            ipaddressid=public_ip.ipaddress.id,
+            accountid=self.account.name
+        )
 
         # Check if the LB rule created successfully
         lb_rules = LoadBalancerRule.list(
-                                         self.apiclient,
-                                         id=lb_rule.id
-                                         )
+            self.apiclient,
+            id=lb_rule.id
+        )
 
         self.assertEqual(
-                         isinstance(lb_rules, list),
-                         True,
-                         "List LB rules should return valid list"
-                         )
+            isinstance(lb_rules, list),
+            True,
+            "List LB rules should return valid list"
+        )
 
         self.debug("Assigning the virtual machines (%s, %s) to lb rule: %s" %
-                                                        (self.vm_1.name,
-                                                         self.vm_2.name,
-                                                         lb_rule.name))
+                   (self.vm_1.name,
+                    self.vm_2.name,
+                    lb_rule.name))
 
         lb_rule.assign(self.apiclient, [self.vm_1, self.vm_2])
         self.debug("Creating a tag for load balancer rule")
         tag = Tag.create(
-                         self.apiclient,
-                         resourceIds=lb_rule.id,
-                         resourceType='LoadBalancer',
-                         tags={'LB': 40}
-                         )
+            self.apiclient,
+            resourceIds=lb_rule.id,
+            resourceType='LoadBalancer',
+            tags={'LB': 40}
+        )
         self.debug("Tag created: %s" % tag.__dict__)
 
         tags = Tag.list(
-                        self.apiclient,
-                        listall=True,
-                        resourceType='LoadBalancer',
-                        key='LB',
-                        account=self.account.name,
-                        domainid=self.account.domainid,
-                        value=40
-                        )
+            self.apiclient,
+            listall=True,
+            resourceType='LoadBalancer',
+            key='LB',
+            account=self.account.name,
+            domainid=self.account.domainid,
+            value=40
+        )
 
         self.debug("Tag created: %s" % str(tags))
         self.assertEqual(
-                         isinstance(tags, list),
-                         True,
-                         "List tags should not return empty response"
-                         )
+            isinstance(tags, list),
+            True,
+            "List tags should not return empty response"
+        )
         self.assertEqual(
-                         int(tags[0].value),
-                         40,
-                         "The tag value should match with the original value"
-                         )
-    
+            int(tags[0].value),
+            40,
+            "The tag value should match with the original value"
+        )
+
         lb_rules = LoadBalancerRule.list(
-                                         self.apiclient,
-                                         listall=True,
-                                         key='FW',
-                                         value=40
-                                         )
+            self.apiclient,
+            listall=True,
+            key='FW',
+            value=40
+        )
 
         self.assertEqual(
-                         isinstance(lb_rules, list),
-                         True,
-                         "List LB rules should return valid list"
-                         )
+            isinstance(lb_rules, list),
+            True,
+            "List LB rules should return valid list"
+        )
 
         self.debug("Deleting the created tag..")
         try:
             tag.delete(
-                       self.apiclient,
-                       resourceIds=lb_rule.id,
-                       resourceType='LoadBalancer',
-                       tags={'LB': 40}
-                       )
+                self.apiclient,
+                resourceIds=lb_rule.id,
+                resourceType='LoadBalancer',
+                tags={'LB': 40}
+            )
         except Exception as e:
             self.fail("Failed to delete the tag - %s" % e)
 
         self.debug("Verifying if tag is actually deleted!")
         tags = Tag.list(
-                        self.apiclient,
-                        listall=True,
-                        resourceType='LoadBalancer',
-                        key='LB',
-                        account=self.account.name,
-                        domainid=self.account.domainid
-                        )
-
-        self.assertEqual(
-                         tags,
-                         None,
-                         "List tags should return empty response"
-                         )
+            self.apiclient,
+            listall=True,
+            resourceType='LoadBalancer',
+            key='LB',
+            account=self.account.name,
+            domainid=self.account.domainid
+        )
+
+        self.assertEqual(
+            tags,
+            None,
+            "List tags should return empty response"
+        )
 
         self.debug("Deleting the Load balancer rule")
         try:
@@ -439,126 +442,126 @@ class TestResourceTags(cloudstackTestCase):
         # 3. Delete the PF rule
 
         self.debug("Fetching the network details for account: %s" %
-                                                self.account.name)
+                   self.account.name)
         networks = Network.list(
-                                self.apiclient,
-                                account=self.account.name,
-                                domainid=self.account.domainid,
-                                listall=True
-                                )
-        self.assertEqual(
-                         isinstance(networks, list),
-                         True,
-                         "List networks should not return an empty response"
-                         )
+            self.apiclient,
+            account=self.account.name,
+            domainid=self.account.domainid,
+            listall=True
+        )
+        self.assertEqual(
+            isinstance(networks, list),
+            True,
+            "List networks should not return an empty response"
+        )
         network = networks[0]
         self.debug("Network for the account: %s is %s" %
-                                    (self.account.name, network.name))
+                   (self.account.name, network.name))
 
         self.debug("Associating public IP for network: %s" % network.id)
         public_ip = PublicIPAddress.create(
-                                    self.apiclient,
-                                    accountid=self.account.name,
-                                    zoneid=self.zone.id,
-                                    domainid=self.account.domainid,
-                                    networkid=network.id
-                                    )
+            self.apiclient,
+            accountid=self.account.name,
+            zoneid=self.zone.id,
+            domainid=self.account.domainid,
+            networkid=network.id
+        )
         self.cleanup.append(public_ip)
 
         self.debug("Trying to create LB rule on IP: %s" %
-                                    public_ip.ipaddress.ipaddress)
+                   public_ip.ipaddress.ipaddress)
 
         self.debug("Creating PF rule for vm: %s on Ip: %s" %
-                            (self.vm_1.name, public_ip.ipaddress.ipaddress))
+                   (self.vm_1.name, public_ip.ipaddress.ipaddress))
 
         nat_rule = NATRule.create(
-                         self.apiclient,
-                         self.vm_1,
-                         self.services["natrule"],
-                         ipaddressid=public_ip.ipaddress.id
-                      )
+            self.apiclient,
+            self.vm_1,
+            self.services["natrule"],
+            ipaddressid=public_ip.ipaddress.id
+        )
 
         # Check if NAT rule created successfully
         nat_rules = NATRule.list(
-                                 self.apiclient,
-                                 id=nat_rule.id
-                                 )
+            self.apiclient,
+            id=nat_rule.id
+        )
 
         self.assertEqual(
-                         isinstance(nat_rules, list),
-                         True,
-                         "List NAT rules should return valid list"
-                         )
+            isinstance(nat_rules, list),
+            True,
+            "List NAT rules should return valid list"
+        )
 
         self.debug("Creating a tag for port forwarding rule")
         tag = Tag.create(
-                         self.apiclient,
-                         resourceIds=nat_rule.id,
-                         resourceType='portForwardingRule',
-                         tags={'PF': 40}
-                         )
+            self.apiclient,
+            resourceIds=nat_rule.id,
+            resourceType='portForwardingRule',
+            tags={'PF': 40}
+        )
         self.debug("Tag created: %s" % tag.__dict__)
 
         tags = Tag.list(
-                        self.apiclient,
-                        listall=True,
-                        resourceType='portForwardingRule',
-                        account=self.account.name,
-                        domainid=self.account.domainid,
-                        key='PF',
-                        value=40
-                        )
-        self.assertEqual(
-                         isinstance(tags, list),
-                         True,
-                         "List tags should not return empty response"
-                         )
+            self.apiclient,
+            listall=True,
+            resourceType='portForwardingRule',
+            account=self.account.name,
+            domainid=self.account.domainid,
+            key='PF',
+            value=40
+        )
         self.assertEqual(
-                         int(tags[0].value),
-                         40,
-                         "The tag value should match with the original value"
-                         )
-        
+            isinstance(tags, list),
+            True,
+            "List tags should not return empty response"
+        )
+        self.assertEqual(
+            int(tags[0].value),
+            40,
+            "The tag value should match with the original value"
+        )
+
         nat_rules = NATRule.list(
-                                 self.apiclient,
-                                 listall=True,
-                                 key='FW',
-                                 value=40
-                                )
+            self.apiclient,
+            listall=True,
+            key='FW',
+            value=40
+        )
 
         self.assertEqual(
-                         isinstance(nat_rules, list),
-                         True,
-                         "List NAT rules should return valid list"
-                         )
-    
+            isinstance(nat_rules, list),
+            True,
+            "List NAT rules should return valid list"
+        )
+
         self.debug("Deleting the created tag..")
         try:
             tag.delete(
-                       self.apiclient,
-                       resourceIds=nat_rule.id,
-                       resourceType='portForwardingRule',
-                       tags={'PF': 40}
-                       )
+                self.apiclient,
+                resourceIds=nat_rule.id,
+                resourceType='portForwardingRule',
+                tags={'PF': 40}
+            )
         except Exception as e:
             self.fail("Failed to delete the tag - %s" % e)
 
         self.debug("Verifying if tag is actually deleted!")
         tags = Tag.list(
-                        self.apiclient,
-                        listall=True,
-                        resourceType='portForwardingRule',
-                        account=self.account.name,
-                        domainid=self.account.domainid,
-                        key='PF',
-                        value=40
-                        )
-
-        self.assertEqual(
-                         tags,
-                         None,
-                         "List tags should return empty response"
-                         )
+            self.apiclient,
+            listall=True,
+            resourceType='portForwardingRule',
+            account=self.account.name,
+            domainid=self.account.domainid,
+            key='PF',
+            value=40
+        )
+
+        self.assertEqual(
+            tags,
+            None,
+            "List tags should return empty response"
+        )
         self.debug("Deleting the port forwarding rule")
         try:
             nat_rule.delete(self.apiclient)
@@ -576,131 +579,131 @@ class TestResourceTags(cloudstackTestCase):
         # 3. Delete the firewall rule
 
         self.debug("Fetching the network details for account: %s" %
-                                                self.account.name)
+                   self.account.name)
         networks = Network.list(
-                                self.apiclient,
-                                account=self.account.name,
-                                domainid=self.account.domainid,
-                                listall=True
-                                )
-        self.assertEqual(
-                         isinstance(networks, list),
-                         True,
-                         "List networks should not return an empty response"
-                         )
+            self.apiclient,
+            account=self.account.name,
+            domainid=self.account.domainid,
+            listall=True
+        )
+        self.assertEqual(
+            isinstance(networks, list),
+            True,
+            "List networks should not return an empty response"
+        )
         network = networks[0]
         self.debug("Network for the account: %s is %s" %
-                                    (self.account.name, network.name))
+                   (self.account.name, network.name))
 
         self.debug("Associating public IP for network: %s" % network.id)
         public_ip = PublicIPAddress.create(
-                                    self.apiclient,
-                                    accountid=self.account.name,
-                                    zoneid=self.zone.id,
-                                    domainid=self.account.domainid,
-                                    networkid=network.id
-                                    )
+            self.apiclient,
+            accountid=self.account.name,
+            zoneid=self.zone.id,
+            domainid=self.account.domainid,
+            networkid=network.id
+        )
         self.cleanup.append(public_ip)
 
         self.debug("Creating firewall rule on public IP: %s" %
-                                                public_ip.ipaddress.ipaddress)
+                   public_ip.ipaddress.ipaddress)
         # Create Firewall rule on public IP
         fw_rule = FireWallRule.create(
-                            self.apiclient,
-                            ipaddressid=public_ip.ipaddress.id,
-                            protocol='TCP',
-                            cidrlist=[self.services["fw_rule"]["cidr"]],
-                            startport=self.services["fw_rule"]["startport"],
-                            endport=self.services["fw_rule"]["endport"]
-                            )
+            self.apiclient,
+            ipaddressid=public_ip.ipaddress.id,
+            protocol='TCP',
+            cidrlist=[self.services["fw_rule"]["cidr"]],
+            startport=self.services["fw_rule"]["startport"],
+            endport=self.services["fw_rule"]["endport"]
+        )
 
         self.debug("Created firewall rule: %s" % fw_rule.id)
 
         fw_rules = FireWallRule.list(
-                                     self.apiclient,
-                                     id=fw_rule.id
-                                    )
+            self.apiclient,
+            id=fw_rule.id
+        )
         self.assertEqual(
-                         isinstance(fw_rules, list),
-                         True,
-                         "List fw rules should return a valid firewall rules"
-                         )
+            isinstance(fw_rules, list),
+            True,
+            "List fw rules should return a valid firewall rules"
+        )
 
         self.assertNotEqual(
-                            len(fw_rules),
-                            0,
-                            "Length of fw rules response should not be zero"
-                            )
+            len(fw_rules),
+            0,
+            "Length of fw rules response should not be zero"
+        )
 
         self.debug("Creating a tag for firewall rule")
         tag = Tag.create(
-                         self.apiclient,
-                         resourceIds=fw_rule.id,
-                         resourceType='FirewallRule',
-                         tags={'FW': '40'}
-                         )
+            self.apiclient,
+            resourceIds=fw_rule.id,
+            resourceType='FirewallRule',
+            tags={'FW': '40'}
+        )
         self.debug("Tag created: %s" % tag.__dict__)
 
         tags = Tag.list(
-                        self.apiclient,
-                        listall=True,
-                        resourceType='FirewallRule',
-                        account=self.account.name,
-                        domainid=self.account.domainid,
-                        key='FW',
-                        value='40'
-                        )
-        self.assertEqual(
-                         isinstance(tags, list),
-                         True,
-                         "List tags should not return empty response"
-                         )
-        
+            self.apiclient,
+            listall=True,
+            resourceType='FirewallRule',
+            account=self.account.name,
+            domainid=self.account.domainid,
+            key='FW',
+            value='40'
+        )
         self.assertEqual(
-                         tags[0].value,
-                         '40',
-                         "The tag value should match with the original value"
-                         )
+            isinstance(tags, list),
+            True,
+            "List tags should not return empty response"
+        )
+
+        self.assertEqual(
+            tags[0].value,
+            '40',
+            "The tag value should match with the original value"
+        )
 
         fw_rules = FireWallRule.list(
-                                     self.apiclient,
-                                     listall=True,
-                                     key='FW',
-                                     value='40'
-                                    )
-        self.assertEqual(
-                         isinstance(fw_rules, list),
-                         True,
-                         "List fw rules should return a valid firewall rules"
-                         )
+            self.apiclient,
+            listall=True,
+            key='FW',
+            value='40'
+        )
+        self.assertEqual(
+            isinstance(fw_rules, list),
+            True,
+            "List fw rules should return a valid firewall rules"
+        )
 
         self.debug("Deleting the created tag..")
         try:
             tag.delete(
-                       self.apiclient,
-                       resourceIds=fw_rule.id,
-                       resourceType='FirewallRule',
-                       tags={'FW': '40'}
-                       )
+                self.apiclient,
+                resourceIds=fw_rule.id,
+                resourceType='FirewallRule',
+                tags={'FW': '40'}
+            )
         except Exception as e:
             self.fail("Failed to delete the tag - %s" % e)
 
         self.debug("Verifying if tag is actually deleted!")
         tags = Tag.list(
-                        self.apiclient,
-                        listall=True,
-                        resourceType='FirewallRule',
-                        account=self.account.name,
-                        domainid=self.account.domainid,
-                        key='FW',
-                        value='40'
-                        )
-
-        self.assertEqual(
-                         tags,
-                         None,
-                         "List tags should return empty response"
-                         )
+            self.apiclient,
+            listall=True,
+            resourceType='FirewallRule',
+            account=self.account.name,
+            domainid=self.account.domainid,
+            key='FW',
+            value='40'
+        )
+
+        self.assertEqual(
+            tags,
+            None,
+            "List tags should return empty response"
+        )
 
         self.debug("Deleting the firewall rule")
         try:
@@ -720,139 +723,139 @@ class TestResourceTags(cloudstackTestCase):
         self.skipTest("VPN resource tags are unsupported in 4.0")
 
         self.debug("Fetching the network details for account: %s" %
-                                                self.account.name)
+                   self.account.name)
         networks = Network.list(
-                                self.apiclient,
-                                account=self.account.name,
-                                domainid=self.account.domainid,
-                                listall=True
-                                )
-        self.assertEqual(
-                         isinstance(networks, list),
-                         True,
-                         "List networks should not return an empty response"
-                         )
+            self.apiclient,
+            account=self.account.name,
+            domainid=self.account.domainid,
+            listall=True
+        )
+        self.assertEqual(
+            isinstance(networks, list),
+            True,
+            "List networks should not return an empty response"
+        )
         network = networks[0]
         self.debug("Network for the account: %s is %s" %
-                                    (self.account.name, network.name))
+                   (self.account.name, network.name))
 
         self.debug("Associating public IP for network: %s" % network.id)
         public_ip = PublicIPAddress.create(
-                                    self.apiclient,
-                                    accountid=self.account.name,
-                                    zoneid=self.zone.id,
-                                    domainid=self.account.domainid,
-                                    networkid=network.id
-                                    )
+            self.apiclient,
+            accountid=self.account.name,
+            zoneid=self.zone.id,
+            domainid=self.account.domainid,
+            networkid=network.id
+        )
         self.cleanup.append(public_ip)
 
         nat_rule = NATRule.create(
-                         self.apiclient,
-                         self.vm_1,
-                         self.services["natrule"],
-                         ipaddressid=public_ip.ipaddress.id
-                      )
+            self.apiclient,
+            self.vm_1,
+            self.services["natrule"],
+            ipaddressid=public_ip.ipaddress.id
+        )
 
         # Check if NAT rule created successfully
         nat_rules = NATRule.list(
-                                 self.apiclient,
-                                 id=nat_rule.id
-                                 )
+            self.apiclient,
+            id=nat_rule.id
+        )
 
         self.assertEqual(
-                         isinstance(nat_rules, list),
-                         True,
-                         "List NAT rules should return valid list"
-                         )
+            isinstance(nat_rules, list),
+            True,
+            "List NAT rules should return valid list"
+        )
 
         # User should be able to enable VPN on source NAT
         self.debug("Creating VPN with public NAT IP: %s" %
-                                            public_ip.ipaddress.ipaddress)
+                   public_ip.ipaddress.ipaddress)
         # Assign VPN to source NAT
         try:
             vpn = Vpn.create(
-                        self.apiclient,
-                        public_ip.ipaddress.id,
-                        account=self.account.name,
-                        domainid=self.account.domainid
-                        )
+                self.apiclient,
+                public_ip.ipaddress.id,
+                account=self.account.name,
+                domainid=self.account.domainid
+            )
 
         except Exception as e:
             print e
 
         vpns = Vpn.list(
-                        self.apiclient,
-                        publicipid=public_ip.ipaddress.id,
-                        listall=True,
-                        )
+            self.apiclient,
+            publicipid=public_ip.ipaddress.id,
+            listall=True,
+        )
 
         self.assertEqual(
-                         isinstance(vpns, list),
-                         True,
-                         "List VPNs should return a valid VPN list"
-                         )
+            isinstance(vpns, list),
+            True,
+            "List VPNs should return a valid VPN list"
+        )
 
         self.assertNotEqual(
-                            len(vpns),
-                            0,
-                            "Length of list VPN response should not be zero"
-                            )
+            len(vpns),
+            0,
+            "Length of list VPN response should not be zero"
+        )
 
         self.debug("Creating a tag for VPN rule")
         tag = Tag.create(
-                         self.apiclient,
-                         resourceIds=nat_rule.id,
-                         resourceType='VPN',
-                         tags={'protocol': 'L2TP'}
-                         )
+            self.apiclient,
+            resourceIds=nat_rule.id,
+            resourceType='VPN',
+            tags={'protocol': 'L2TP'}
+        )
         self.debug("Tag created: %s" % tag.__dict__)
 
         tags = Tag.list(
-                        self.apiclient,
-                        listall=True,
-                        resourceType='VPN',
-                        account=self.account.name,
-                        domainid=self.account.domainid,
-                        key='protocol',
-                        value='L2TP'
-                        )
-        self.assertEqual(
-                         isinstance(tags, list),
-                         True,
-                         "List tags should not return empty response"
-                         )
+            self.apiclient,
+            listall=True,
+            resourceType='VPN',
+            account=self.account.name,
+            domainid=self.account.domainid,
+            key='protocol',
+            value='L2TP'
+        )
         self.assertEqual(
-                         tags[0].value,
-                         'L2TP',
-                         "The tag value should match with the original value"
-                         )
+            isinstance(tags, list),
+            True,
+            "List tags should not return empty response"
+        )
+        self.assertEqual(
+            tags[0].value,
+            'L2TP',
+            "The tag value should match with the original value"
+        )
         self.debug("Deleting the created tag..")
         try:
             tag.delete(
-                       self.apiclient,
-                       resourceIds=vpn.id,
-                       resourceType='VPN',
-                       tags={'protocol': 'L2TP'}
-                       )
+                self.apiclient,
+                resourceIds=vpn.id,
+                resourceType='VPN',
+                tags={'protocol': 'L2TP'}
+            )
         except Exception as e:
             self.fail("Failed to delete the tag - %s" % e)
 
         self.debug("Verifying if tag is actually deleted!")
         tags = Tag.list(
-                        self.apiclient,
-                        listall=True,
-                        resourceType='VPN',
-                        account=self.account.name,
-                        domainid=self.account.domainid,
-                        key='protocol',
-                        value='L2TP'
-                        )
-
-        self.assertEqual(
-                         tags,
-                         None,
-                         "List tags should return empty response"
-                         )
+            self.apiclient,
+            listall=True,
+            resourceType='VPN',
+            account=self.account.name,
+            domainid=self.account.domainid,
+            key='protocol',
+            value='L2TP'
+        )
+
+        self.assertEqual(
+            tags,
+            None,
+            "List tags should return empty response"
+        )
 
         self.debug("Disabling the VPN")
         try:
@@ -871,71 +874,71 @@ class TestResourceTags(cloudstackTestCase):
 
         self.debug("Creating a tag for user VM")
         tag = Tag.create(
-                         self.apiclient,
-                         resourceIds=self.vm_1.id,
-                         resourceType='userVM',
-                         tags={'region': 'India'}
-                         )
+            self.apiclient,
+            resourceIds=self.vm_1.id,
+            resourceType='userVM',
+            tags={'region': 'India'}
+        )
         self.debug("Tag created: %s" % tag.__dict__)
 
         tags = Tag.list(
-                        self.apiclient,
-                        listall=True,
-                        resourceType='userVM',
-                        account=self.account.name,
-                        domainid=self.account.domainid,
-                        key='region',
-                        value='India'
-                        )
-        self.assertEqual(
-                         isinstance(tags, list),
-                         True,
-                         "List tags should not return empty response"
-                         )
+            self.apiclient,
+            listall=True,
+            resourceType='userVM',
+            account=self.account.name,
+            domainid=self.account.domainid,
+            key='region',
+            value='India'
+        )
         self.assertEqual(
-                         tags[0].value,
-                         'India',
-                         "The tag value should match with the original value"
-                         )
-        
+            isinstance(tags, list),
+            True,
+            "List tags should not return empty response"
+        )
+        self.assertEqual(
+            tags[0].value,
+            'India',
+            "The tag value should match with the original value"
+        )
+
         vms = VirtualMachine.list(
-                                    self.apiclient,
-                                    listall=True,
-                                    key='region',
-                                    value='India'
-                                  )
-    
+            self.apiclient,
+            listall=True,
+            key='region',
+            value='India'
+        )
+
         self.assertEqual(
-                         isinstance(vms, list),
-                         True,
-                         "Tag based VMs listing failed")
-    
+            isinstance(vms, list),
+            True,
+            "Tag based VMs listing failed")
+
         self.debug("Deleting the created tag..")
         try:
             tag.delete(
-                       self.apiclient,
-                       resourceIds=self.vm_1.id,
-                       resourceType='userVM',
-                       tags={'region': 'India'}
-                       )
+                self.apiclient,
+                resourceIds=self.vm_1.id,
+                resourceType='userVM',
+                tags={'region': 'India'}
+            )
         except Exception as e:
             self.fail("Failed to delete the tag - %s" % e)
 
         self.debug("Verifying if tag is actually deleted!")
         tags = Tag.list(
-                        self.apiclient,
-                        listall=True,
-                        resourceType='userVM',
-                        account=self.account.name,
-                        domainid=self.account.domainid,
-                        key='region',
-                        value='India'
-                        )
-        self.assertEqual(
-                         tags,
-                         None,
-                         "List tags should return empty response"
-                         )
+            self.apiclient,
+            listall=True,
+            resourceType='userVM',
+            account=self.account.name,
+            domainid=self.account.domainid,
+            key='region',
+            value='India'
+        )
+        self.assertEqual(
+            tags,
+            None,
+            "List tags should return empty response"
+        )
         return
 
     @attr(tags=["advanced", "basic"], required_hardware="false")
@@ -948,7 +951,7 @@ class TestResourceTags(cloudstackTestCase):
 
         try:
             self.debug("Stopping the virtual machine: %s" % self.vm_1.name)
-            #Stop virtual machine
+            # Stop virtual machine
             self.vm_1.stop(self.user_api_client)
         except Exception as e:
             self.fail("Failed to stop VM: %s" % e)
@@ -956,11 +959,11 @@ class TestResourceTags(cloudstackTestCase):
         timeout = self.services["timeout"]
         while True:
             list_volume = Volume.list(
-                                   self.user_api_client,
-                                   virtualmachineid=self.vm_1.id,
-                                   type='ROOT',
-                                   listall=True
-                                   )
+                self.user_api_client,
+                virtualmachineid=self.vm_1.id,
+                type='ROOT',
+                listall=True
+            )
             if isinstance(list_volume, list):
                 break
             elif timeout == 0:
@@ -972,78 +975,77 @@ class TestResourceTags(cloudstackTestCase):
         self.volume = list_volume[0]
 
         self.debug("Creating template from ROOT disk of virtual machine: %s" %
-                                                            self.vm_1.name)
-        #Create template from volume
+                   self.vm_1.name)
+        # Create template from volume
         template = Template.create(
-                                    self.user_api_client,
-                                    self.services["template"],
-                                    self.volume.id
-                                )
+            self.user_api_client,
+            self.services["template"],
+            self.volume.id
+        )
         self.cleanup.append(template)
         self.debug("Created the template(%s). Now restarting the userVm: %s" %
-                                            (template.name, self.vm_1.name))
+                   (template.name, self.vm_1.name))
         self.vm_1.start(self.user_api_client)
 
         self.debug("Creating a tag for the template")
         tag = Tag.create(
-                         self.user_api_client,
-                         resourceIds=template.id,
-                         resourceType='Template',
-                         tags={'OS': 'CentOS'}
-                         )
+            self.user_api_client,
+            resourceIds=template.id,
+            resourceType='Template',
+            tags={'OS': 'CentOS'}
+        )
         self.debug("Tag created: %s" % tag.__dict__)
 
         tags = Tag.list(
-                        self.user_api_client,
-                        listall=True,
-                        resourceType='Template',
-                        key='OS',
-                        value='CentOS'
-                        )
-        self.assertEqual(
-                         isinstance(tags, list),
-                         True,
-                         "List tags should not return empty response"
-                         )
+            self.user_api_client,
+            listall=True,
+            resourceType='Template',
+            key='OS',
+            value='CentOS'
+        )
         self.assertEqual(
-                         tags[0].value,
-                         'CentOS',
-                         'The tag should have original value'
-                         )
+            isinstance(tags, list),
+            True,
+            "List tags should not return empty response"
+        )
+        self.assertEqual(
+            tags[0].value,
+            'CentOS',
+            'The tag should have original value'
+        )
 
         Template.list(
-                  self.user_api_client,
-                  templatefilter=\
-                  self.services["template"]["templatefilter"],
-                  listall=True,
-                  key='OS',
-                  value='CentOS'
-                  )
+            self.user_api_client,
+            templatefilter=self.services["template"]["templatefilter"],
+            listall=True,
+            key='OS',
+            value='CentOS'
+        )
 
         self.debug("Deleting the created tag..")
         try:
             tag.delete(
-                       self.user_api_client,
-                       resourceIds=template.id,
-                       resourceType='Template',
-                       tags={'OS': 'CentOS'}
-                       )
+                self.user_api_client,
+                resourceIds=template.id,
+                resourceType='Template',
+                tags={'OS': 'CentOS'}
+            )
         except Exception as e:
             self.fail("Failed to delete the tag - %s" % e)
 
         self.debug("Verifying if tag is actually deleted!")
         tags = Tag.list(
-                        self.user_api_client,
-                        listall=True,
-                        resourceType='Template',
-                        key='OS',
-                        value='CentOS'
-                        )
-        self.assertEqual(
-                         tags,
-                         None,
-                         "List tags should return empty response"
-                         )
+            self.user_api_client,
+            listall=True,
+            resourceType='Template',
+            key='OS',
+            value='CentOS'
+        )
+        self.assertEqual(
+            tags,
+            None,
+            "List tags should return empty response"
+        )
         return
 
     @attr(tags=["advanced", "basic"], required_hardware="false")
@@ -1055,90 +1057,90 @@ class TestResourceTags(cloudstackTestCase):
         # 2. Delete above created tag using deleteTags API
 
         iso = Iso.create(
-                         self.apiclient,
-                         self.services["iso"],
-                         account=self.account.name,
-                         domainid=self.account.domainid
-                         )
+            self.apiclient,
+            self.services["iso"],
+            account=self.account.name,
+            domainid=self.account.domainid
+        )
         self.debug("ISO created with ID: %s" % iso.id)
 
         list_iso_response = Iso.list(self.apiclient,
                                      id=iso.id)
         self.assertEqual(
-                         isinstance(list_iso_response, list),
-                         True,
-                         "Check list response returns a valid list"
-                         )
+            isinstance(list_iso_response, list),
+            True,
+            "Check list response returns a valid list"
+        )
 
         self.debug("Creating a tag for the ISO")
         tag = Tag.create(
-                         self.apiclient,
-                         resourceIds=iso.id,
-                         resourceType='ISO',
-                         tags={'OS': 'CentOS'}
-                         )
+            self.apiclient,
+            resourceIds=iso.id,
+            resourceType='ISO',
+            tags={'OS': 'CentOS'}
+        )
         self.debug("Tag created: %s" % tag.__dict__)
 
         tags = Tag.list(
-                        self.apiclient,
-                        listall=True,
-                        resourceType='ISO',
-                        account=self.account.name,
-                        domainid=self.account.domainid,
-                        key='OS',
-                        value='CentOS'
-                        )
-        self.assertEqual(
-                         isinstance(tags, list),
-                         True,
-                         "List tags should not return empty response"
-                         )
+            self.apiclient,
+            listall=True,
+            resourceType='ISO',
+            account=self.account.name,
+            domainid=self.account.domainid,
+            key='OS',
+            value='CentOS'
+        )
         self.assertEqual(
-                         tags[0].value,
-                         'CentOS',
-                         'The tag should have original value'
-                         )
+            isinstance(tags, list),
+            True,
+            "List tags should not return empty response"
+        )
+        self.assertEqual(
+            tags[0].value,
+            'CentOS',
+            'The tag should have original value'
+        )
         isos = Iso.list(
-                        self.apiclient,
-                        key='OS',
-                        value='CentOS',
-                        account=self.account.name,
-                        domainid=self.account.domainid,
-                        isofilter='all'
-                    )
-
-        self.assertEqual(
-                         isinstance(isos, list),
-                         True,
-                         "List isos should not return an empty response"
-                         )
+            self.apiclient,
+            key='OS',
+            value='CentOS',
+            account=self.account.name,
+            domainid=self.account.domainid,
+            isofilter='all'
+        )
+
+        self.assertEqual(
+            isinstance(isos, list),
+            True,
+            "List isos should not return an empty response"
+        )
 
         self.debug("Deleting the created tag..")
         try:
             tag.delete(
-                       self.apiclient,
-                       resourceIds=iso.id,
-                       resourceType='ISO',
-                       tags={'OS': 'CentOS'}
-                       )
+                self.apiclient,
+                resourceIds=iso.id,
+                resourceType='ISO',
+                tags={'OS': 'CentOS'}
+            )
         except Exception as e:
             self.fail("Failed to delete the tag - %s" % e)
 
         self.debug("Verifying if tag is actually deleted!")
         tags = Tag.list(
-                        self.apiclient,
-                        listall=True,
-                        resourceType='ISO',
-                        account=self.account.name,
-                        domainid=self.account.domainid,
-                        key='OS',
-                        value='CentOS'
-                        )
-        self.assertEqual(
-                         tags,
-                         None,
-                         "List tags should return empty response"
-                         )
+            self.apiclient,
+            listall=True,
+            resourceType='ISO',
+            account=self.account.name,
+            domainid=self.account.domainid,
+            key='OS',
+            value='CentOS'
+        )
+        self.assertEqual(
+            tags,
+            None,
+            "List tags should return empty response"
+        )
         return
 
     @attr(tags=["advanced", "basic"], required_hardware="false")
@@ -1150,84 +1152,84 @@ class TestResourceTags(cloudstackTestCase):
         # 2. Delete above created tag using deleteTags API
 
         self.debug("Creating volume for account: %s " %
-                                                self.account.name)
+                   self.account.name)
         volume = Volume.create(
-                               self.apiclient,
-                               self.services["volume"],
-                               zoneid=self.zone.id,
-                               account=self.account.name,
-                               domainid=self.account.domainid,
-                               diskofferingid=self.disk_offering.id
-                               )
+            self.apiclient,
+            self.services["volume"],
+            zoneid=self.zone.id,
+            account=self.account.name,
+            domainid=self.account.domainid,
+            diskofferingid=self.disk_offering.id
+        )
         self.cleanup.append(volume)
 
         self.debug("Volume created in account: %s" % volume.name)
 
         self.debug("Creating a tag for the volume")
         tag = Tag.create(
-                         self.apiclient,
-                         resourceIds=volume.id,
-                         resourceType='volume',
-                         tags={'region': 'India'}
-                         )
+            self.apiclient,
+            resourceIds=volume.id,
+            resourceType='volume',
+            tags={'region': 'India'}
+        )
         self.debug("Tag created: %s" % tag.__dict__)
 
         tags = Tag.list(
-                        self.apiclient,
-                        listall=True,
-                        resourceType='volume',
-                        account=self.account.name,
-                        domainid=self.account.domainid,
-                        key='region',
-                        value='India'
-                        )
-        self.assertEqual(
-                         isinstance(tags, list),
-                         True,
-                         "List tags should not return empty response"
-                         )
+            self.apiclient,
+            listall=True,
+            resourceType='volume',
+            account=self.account.name,
+            domainid=self.account.domainid,
+            key='region',
+            value='India'
+        )
         self.assertEqual(
-                         tags[0].value,
-                         'India',
-                         'The tag should have original value'
-                         )
-        
+            isinstance(tags, list),
+            True,
+            "List tags should not return empty response"
+        )
+        self.assertEqual(
+            tags[0].value,
+            'India',
+            'The tag should have original value'
+        )
+
         vols = Volume.list(self.apiclient,
-                  listall=True,
-                  key='region',
-                  value='India'
-                 )
-        self.assertEqual(
-                         isinstance(vols, list),
-                         True,
-                         "List volumes should not return empty response"
-                        )
-    
+                           listall=True,
+                           key='region',
+                           value='India'
+                           )
+        self.assertEqual(
+            isinstance(vols, list),
+            True,
+            "List volumes should not return empty response"
+        )
+
         self.debug("Deleting the created tag..")
         try:
             tag.delete(
-                       self.apiclient,
-                       resourceIds=volume.id,
-                       resourceType='volume',
-                       tags={'region': 'India'}
-                       )
+                self.apiclient,
+                resourceIds=volume.id,
+                resourceType='volume',
+                tags={'region': 'India'}
+            )
         except Exception as e:
             self.fail("Failed to delete the tag - %s" % e)
 
         self.debug("Verifying if tag is actually deleted!")
         tags = Tag.list(
-                        self.apiclient,
-                        listall=True,
-                        resourceType='volume',
-                        account=self.account.name,
-                        domainid=self.account.domainid,
-                        key='region'
-                        )
-        self.assertEqual(
-                         tags,
-                         None,
-                         "List tags should return empty response"
-                         )
+            self.apiclient,
+            listall=True,
+            resourceType='volume',
+            account=self.account.name,
+            domainid=self.account.domainid,
+            key='region'
+        )
+        self.assertEqual(
+            tags,
+            None,
+            "List tags should return empty response"
+        )
         return
 
     @attr(tags=["advanced", "basic"], required_hardware="false")
@@ -1238,8 +1240,11 @@ class TestResourceTags(cloudstackTestCase):
         # 1. Create a tag on snapshot using createTags API
         # 2. Delete above created tag using deleteTags API
 
+        if self.hypervisor.lower() in ['hyperv']:
+            self.skipTest("Snapshots feature is not supported on Hyper-V")
+
         self.debug("Creating snapshot on ROOT volume for VM: %s " %
-                                                            self.vm_1.name)
+                   self.vm_1.name)
         # Get the Root disk of VM
         volumes = Volume.list(self.apiclient,
                               virtualmachineid=self.vm_1.id,
@@ -1255,80 +1260,80 @@ class TestResourceTags(cloudstackTestCase):
         snapshots = Snapshot.list(self.apiclient,
                                   id=snapshot.id)
         self.assertEqual(
-                         isinstance(snapshots, list),
-                         True,
-                         "Tag based snapshot listing failed")
+            isinstance(snapshots, list),
+            True,
+            "Tag based snapshot listing failed")
 
         self.debug("Creating a tag for the snapshot")
         tag = Tag.create(
-                         self.apiclient,
-                         resourceIds=snapshot.id,
-                         resourceType='snapshot',
-                         tags={'type': 'manual'}
-                         )
+            self.apiclient,
+            resourceIds=snapshot.id,
+            resourceType='snapshot',
+            tags={'type': 'manual'}
+        )
         self.debug("Tag created: %s" % tag.__dict__)
 
         tags = Tag.list(
-                        self.apiclient,
-                        listall=True,
-                        resourceType='snapshot',
-                        account=self.account.name,
-                        domainid=self.account.domainid,
-                        key='type',
-                        value='manual'
-                        )
-        self.assertEqual(
-                         isinstance(tags, list),
-                         True,
-                         "List tags should not return empty response"
-                         )
+            self.apiclient,
+            listall=True,
+            resourceType='snapshot',
+            account=self.account.name,
+            domainid=self.account.domainid,
+            key='type',
+            value='manual'
+        )
         self.assertEqual(
-                         tags[0].value,
-                         'manual',
-                         'The tag should have original value'
-                         )
+            isinstance(tags, list),
+            True,
+            "List tags should not return empty response"
+        )
+        self.assertEqual(
+            tags[0].value,
+            'manual',
+            'The tag should have original value'
+        )
         snapshots = Snapshot.list(self.apiclient,
                                   listall=True,
                                   key='type',
                                   value='manual')
         self.assertEqual(
-                         isinstance(snapshots, list),
-                         True,
-                         "Check list response returns a valid list"
-                         )
+            isinstance(snapshots, list),
+            True,
+            "Check list response returns a valid list"
+        )
         self.assertNotEqual(
-                            snapshots,
-                            None,
-                            "Check if result exists in list snapshots call"
-                            )
+            snapshots,
+            None,
+            "Check if result exists in list snapshots call"
+        )
         self.debug("Listing snapshots by tag was successful")
 
         self.debug("Deleting the created tag..")
         try:
             tag.delete(
-                       self.apiclient,
-                       resourceIds=snapshot.id,
-                       resourceType='snapshot',
-                       tags={'type': 'manual'}
-                       )
+                self.apiclient,
+                resourceIds=snapshot.id,
+                resourceType='snapshot',
+                tags={'type': 'manual'}
+            )
         except Exception as e:
             self.fail("Failed to delete the tag - %s" % e)
 
         self.debug("Verifying if tag is actually deleted!")
         tags = Tag.list(
-                        self.apiclient,
-                        listall=True,
-                        resourceType='snapshot',
-                        account=self.account.name,
-                        domainid=self.account.domainid,
-                        key='type',
-                        value='manual'
-                        )
-        self.assertEqual(
-                         tags,
-                         None,
-                         "List tags should return empty response"
-                         )
+            self.apiclient,
+            listall=True,
+            resourceType='snapshot',
+            account=self.account.name,
+            domainid=self.account.domainid,
+            key='type',
+            value='manual'
+        )
+        self.assertEqual(
+            tags,
+            None,
+            "List tags should return empty response"
+        )
 
         return
 
@@ -1341,91 +1346,91 @@ class TestResourceTags(cloudstackTestCase):
         # 2. Delete above created tag using deleteTags API
 
         self.debug("Fetching the network details for account: %s" %
-                                                self.account.name)
+                   self.account.name)
         networks = Network.list(
-                                self.apiclient,
-                                account=self.account.name,
-                                domainid=self.account.domainid,
-                                listall=True
-                                )
-        self.assertEqual(
-                         isinstance(networks, list),
-                         True,
-                         "List networks should not return an empty response"
-                         )
+            self.apiclient,
+            account=self.account.name,
+            domainid=self.account.domainid,
+            listall=True
+        )
+        self.assertEqual(
+            isinstance(networks, list),
+            True,
+            "List networks should not return an empty response"
+        )
         network = networks[0]
         self.debug("Network for the account: %s is %s" %
-                                    (self.account.name, network.name))
+                   (self.account.name, network.name))
 
         self.debug("Creating a tag for load balancer rule")
         tag = Tag.create(
-                         self.apiclient,
-                         resourceIds=network.id,
-                         resourceType='Network',
-                         tags={'region': 'India'}
-                         )
+            self.apiclient,
+            resourceIds=network.id,
+            resourceType='Network',
+            tags={'region': 'India'}
+        )
         self.debug("Tag created: %s" % tag.__dict__)
 
         tags = Tag.list(
-                        self.apiclient,
-                        listall=True,
-                        resourceType='Network',
-                        account=self.account.name,
-                        domainid=self.account.domainid,
-                        key='region',
-                        value='India'
-                        )
-        self.assertEqual(
-                         isinstance(tags, list),
-                         True,
-                         "List tags should not return empty response"
-                         )
+            self.apiclient,
+            listall=True,
+            resourceType='Network',
+            account=self.account.name,
+            domainid=self.account.domainid,
+            key='region',
+            value='India'
+        )
         self.assertEqual(
-                         tags[0].value,
-                         'India',
-                         'The tag should have original value'
-                         )
-        
+            isinstance(tags, list),
+            True,
+            "List tags should not return empty response"
+        )
+        self.assertEqual(
+            tags[0].value,
+            'India',
+            'The tag should have original value'
+        )
+
         networks = Network.list(
-                                self.apiclient,
-                                account=self.account.name,
-                                domainid=self.account.domainid,
-                                listall=True,
-                                key='region',
-                                value='India'       
-                                )
-        self.assertEqual(
-                         isinstance(networks, list),
-                         True,
-                         "List networks should not return an empty response"
-                         )
+            self.apiclient,
+            account=self.account.name,
+            domainid=self.account.domainid,
+            listall=True,
+            key='region',
+            value='India'
+        )
+        self.assertEqual(
+            isinstance(networks, list),
+            True,
+            "List networks should not return an empty response"
+        )
 
         self.debug("Deleting the created tag..")
         try:
             tag.delete(
-                       self.apiclient,
-                       resourceIds=network.id,
-                       resourceType='Network',
-                       tags={'region': 'India'}
-                       )
+                self.apiclient,
+                resourceIds=network.id,
+                resourceType='Network',
+                tags={'region': 'India'}
+            )
         except Exception as e:
             self.fail("Failed to delete the tag - %s" % e)
 
         self.debug("Verifying if tag is actually deleted!")
         tags = Tag.list(
-                        self.apiclient,
-                        listall=True,
-                        resourceType='Network',
-                        account=self.account.name,
-                        domainid=self.account.domainid,
-                        key='region',
-                        value='India'
-                        )
-        self.assertEqual(
-                         tags,
-                         None,
-                         "List tags should return empty response"
-                         )
+            self.apiclient,
+            listall=True,
+            resourceType='Network',
+            account=self.account.name,
+            domainid=self.account.domainid,
+            key='region',
+            value='India'
+        )
+        self.assertEqual(
+            tags,
+            None,
+            "List tags should return empty response"
+        )
         return
 
     @attr(tags=["basic", "sg"])
@@ -1437,29 +1442,29 @@ class TestResourceTags(cloudstackTestCase):
         # 2. Delete above created tag using deleteTags API
 
         vms = VirtualMachine.list(
-                                  self.apiclient,
-                                  id=self.vm_1.id,
-                                  listall=True
-                                  )
+            self.apiclient,
+            id=self.vm_1.id,
+            listall=True
+        )
 
         self.assertEqual(
-                         isinstance(vms, list),
-                         True,
-                         "List vms should not return empty response"
-                         )
+            isinstance(vms, list),
+            True,
+            "List vms should not return empty response"
+        )
         source_host = vms[0].hostid
-    
+
         hosts = Host.list(
-                          self.apiclient,
-                          zoneid=self.zone.id,
-                          resourcestate='Enabled',
-                          type='Routing'
-                          )
-        self.assertEqual(
-                         isinstance(hosts, list),
-                         True,
-                         "List hosts should return valid host response"
-                         )
+            self.apiclient,
+            zoneid=self.zone.id,
+            resourcestate='Enabled',
+            type='Routing'
+        )
+        self.assertEqual(
+            isinstance(hosts, list),
+            True,
+            "List hosts should return valid host response"
+        )
 
         self.debug("Available hosts: ")
         for host in hosts:
@@ -1474,64 +1479,64 @@ class TestResourceTags(cloudstackTestCase):
 
         self.debug("Creating a tag for user VM")
         tag = Tag.create(
-                         self.apiclient,
-                         resourceIds=self.vm_1.id,
-                         resourceType='userVM',
-                         tags={'region': 'India'}
-                         )
+            self.apiclient,
+            resourceIds=self.vm_1.id,
+            resourceType='userVM',
+            tags={'region': 'India'}
+        )
         self.debug("Tag created: %s" % tag.__dict__)
 
         tags = Tag.list(
-                        self.apiclient,
-                        listall=True,
-                        resourceType='userVM',
-                        account=self.account.name,
-                        domainid=self.account.domainid,
-                        key='region',
-                        value='India'
-                        )
-        self.assertEqual(
-                         isinstance(tags, list),
-                         True,
-                         "List tags should not return empty response"
-                         )
+            self.apiclient,
+            listall=True,
+            resourceType='userVM',
+            account=self.account.name,
+            domainid=self.account.domainid,
+            key='region',
+            value='India'
+        )
+        self.assertEqual(
+            isinstance(tags, list),
+            True,
+            "List tags should not return empty response"
+        )
 
         self.assertEqual(
-                         tags[0].value,
-                         'India',
-                         'The tag should have original value'
-                         )
+            tags[0].value,
+            'India',
+            'The tag should have original value'
+        )
 
         self.debug("Migrating the instance from: %s to %s" %
-                                                (source_host, dest_host.id))
+                   (source_host, dest_host.id))
         self.vm_1.migrate(self.apiclient, hostid=dest_host.id)
 
         self.debug("Deleting the created tag..")
         try:
             tag.delete(
-                       self.apiclient,
-                       resourceIds=self.vm_1.id,
-                       resourceType='userVM',
-                       tags={'region': 'India'}
-                       )
+                self.apiclient,
+                resourceIds=self.vm_1.id,
+                resourceType='userVM',
+                tags={'region': 'India'}
+            )
         except Exception as e:
             self.fail("Failed to delete the tag - %s" % e)
 
         self.debug("Verifying if tag is actually deleted!")
         tags = Tag.list(
-                        self.apiclient,
-                        listall=True,
-                        resourceType='userVM',
-                        account=self.account.name,
-                        domainid=self.account.domainid,
-                        key='region',
-                        value='India'
-                        )
-        self.assertEqual(
-                         tags,
-                         None,
-                         "List tags should return empty response"
-                         )
+            self.apiclient,
+            listall=True,
+            resourceType='userVM',
+            account=self.account.name,
+            domainid=self.account.domainid,
+            key='region',
+            value='India'
+        )
+        self.assertEqual(
+            tags,
+            None,
+            "List tags should return empty response"
+        )
         return
 
     @attr(tags=["advanced", "basic"], required_hardware="false")
@@ -1545,33 +1550,33 @@ class TestResourceTags(cloudstackTestCase):
 
         self.debug("Creating a tag for user VM")
         tag_1 = Tag.create(
-                         self.apiclient,
-                         resourceIds=self.vm_1.id,
-                         resourceType='userVM',
-                         tags={'region': 'India'}
-                         )
+            self.apiclient,
+            resourceIds=self.vm_1.id,
+            resourceType='userVM',
+            tags={'region': 'India'}
+        )
         self.debug("Tag created: %s" % tag_1.__dict__)
 
         tags = Tag.list(
-                        self.apiclient,
-                        listall=True,
-                        resourceType='userVM',
-                        account=self.account.name,
-                        domainid=self.account.domainid,
-                        key='region',
-                        value='India'
-                        )
-        self.assertEqual(
-                         isinstance(tags, list),
-                         True,
-                         "List tags should not return empty response"
-                         )
+            self.apiclient,
+            listall=True,
+            resourceType='userVM',
+            account=self.account.name,
+            domainid=self.account.domainid,
+            key='region',
+            value='India'
+        )
+        self.assertEqual(
+            isinstance(tags, list),
+            True,
+            "List tags should not return empty response"
+        )
 
         self.assertEqual(
-                         tags[0].value,
-                      

<TRUNCATED>

[17/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4

Posted by sa...@apache.org.
CLOUDSATCK-8138: Fixed VmSnapshot revert issue in test_escalations_instances.py

Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/22d65654
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/22d65654
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/22d65654

Branch: refs/heads/vmware-disk-controllers
Commit: 22d6565434e31a8c65953a9eb1b8bfeea1c0f1d0
Parents: eae9f0f
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Wed Dec 31 15:19:22 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Mon Jan 5 18:42:07 2015 +0530

----------------------------------------------------------------------
 test/integration/component/test_escalations_instances.py | 3 ---
 1 file changed, 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/22d65654/test/integration/component/test_escalations_instances.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_instances.py b/test/integration/component/test_escalations_instances.py
index 15eb6f1..ddae154 100644
--- a/test/integration/component/test_escalations_instances.py
+++ b/test/integration/component/test_escalations_instances.py
@@ -2622,9 +2622,6 @@ class TestInstances(cloudstackTestCase):
             "Latest snapshot taken is not marked as current"
         )
 
-        # Stop Virtual machine befor reverting VM to a snapshot taken without memory
-        vm_created.stop(self.userapiclient)
-
         # Reverting the VM to Snapshot 1
         VmSnapshot.revertToSnapshot(
             self.userapiclient,


[18/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4

Posted by sa...@apache.org.
CID-1261669 added comment to clarify false positive


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/54e5f28a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/54e5f28a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/54e5f28a

Branch: refs/heads/vmware-disk-controllers
Commit: 54e5f28acec2e665a56b2c60a98d6eb8b045f5f1
Parents: 22d6565
Author: Daan Hoogland <da...@onecht.net>
Authored: Mon Jan 5 15:43:51 2015 +0100
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jan 5 15:43:51 2015 +0100

----------------------------------------------------------------------
 .../com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54e5f28a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
index f01153f..ccf4626 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
@@ -4244,6 +4244,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
             if (cpuInfo.get("socket_count") != null) {
                 _host.cpuSockets = Integer.parseInt(cpuInfo.get("socket_count"));
             }
+            // would hcs be null we would have thrown an exception on condition (_host.cpus <= 0) by now
             for (final HostCpu hc : hcs) {
                 _host.speed = hc.getSpeed(conn).intValue();
                 break;


[12/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4

Posted by sa...@apache.org.
CLOUDSTACK-8124: Skipping snapshot tests on hyperv hypervisor

Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/214d63ee
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/214d63ee
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/214d63ee

Branch: refs/heads/vmware-disk-controllers
Commit: 214d63ee1eb393168c2f91a646a775cdaeb5cae8
Parents: 7f10e6f
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Wed Dec 24 16:30:28 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Mon Jan 5 18:04:37 2015 +0530

----------------------------------------------------------------------
 .../component/test_project_limits.py            |    6 +-
 .../component/test_ps_domain_limits.py          |  480 +--
 test/integration/component/test_ps_limits.py    |    4 +-
 .../component/test_resource_limits.py           |   11 +-
 test/integration/component/test_snapshots.py    | 1504 +++++-----
 test/integration/component/test_ss_limits.py    |    4 +
 test/integration/component/test_tags.py         | 2774 +++++++++---------
 test/integration/component/test_templates.py    |    5 +-
 test/integration/component/test_usage.py        | 1469 +++++-----
 9 files changed, 3240 insertions(+), 3017 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/214d63ee/test/integration/component/test_project_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_project_limits.py b/test/integration/component/test_project_limits.py
index d4fb92d..adae047 100644
--- a/test/integration/component/test_project_limits.py
+++ b/test/integration/component/test_project_limits.py
@@ -18,7 +18,7 @@
 """
 #Import Local Modules
 from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.cloudstackTestCase import cloudstackTestCase,unittest
 #from marvin.cloudstackAPI import *
 from marvin.lib.utils import (cleanup_resources,
                               validateList)
@@ -522,7 +522,7 @@ class TestResourceLimitsProject(cloudstackTestCase):
     def setUpClass(cls):
         cls.testClient = super(TestResourceLimitsProject, cls).getClsTestClient()
         cls.api_client = cls.testClient.getApiClient()
-
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
         cls.services = Services().services
         cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
         cls.services['mode'] = cls.zone.networktype
@@ -758,6 +758,8 @@ class TestResourceLimitsProject(cloudstackTestCase):
         # 5. Try to create another snapshot in this project. It should give
         #    user an appropriate error and an alert should be generated.
 
+        if self.hypervisor.lower() in ['hyperv']:
+            raise self.skipTest("Snapshots feature is not supported on Hyper-V")
         self.debug(
             "Updating snapshot resource limits for project: %s" %
                                         self.project.id)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/214d63ee/test/integration/component/test_ps_domain_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_ps_domain_limits.py b/test/integration/component/test_ps_domain_limits.py
index 268174f..f9aa023 100644
--- a/test/integration/component/test_ps_domain_limits.py
+++ b/test/integration/component/test_ps_domain_limits.py
@@ -46,25 +46,29 @@ from marvin.codes import (PASS,
                           FAILED,
                           RESOURCE_PRIMARY_STORAGE)
 
+
 class TestMultipleChildDomain(cloudstackTestCase):
 
     @classmethod
     def setUpClass(cls):
         cloudstackTestClient = super(TestMultipleChildDomain,
-                               cls).getClsTestClient()
+                                     cls).getClsTestClient()
         cls.api_client = cloudstackTestClient.getApiClient()
+        cls.hypervisor = cloudstackTestClient.getHypervisorInfo()
         # Fill services from the external config file
         cls.services = cloudstackTestClient.getParsedTestDataConfig()
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client)
-        cls.zone = get_zone(cls.api_client, cloudstackTestClient.getZoneForTests())
+        cls.zone = get_zone(
+            cls.api_client,
+            cloudstackTestClient.getZoneForTests())
         cls.services["mode"] = cls.zone.networktype
 
         cls.template = get_template(
-                            cls.api_client,
-                            cls.zone.id,
-                            cls.services["ostype"]
-                            )
+            cls.api_client,
+            cls.zone.id,
+            cls.services["ostype"]
+        )
 
         cls.services["virtual_machine"]["zoneid"] = cls.zone.id
         cls.services["virtual_machine"]["template"] = cls.template.id
@@ -72,8 +76,9 @@ class TestMultipleChildDomain(cloudstackTestCase):
 
         cls._cleanup = []
         try:
-            cls.service_offering = ServiceOffering.create(cls.api_client,
-                    cls.services["service_offering"])
+            cls.service_offering = ServiceOffering.create(
+                cls.api_client,
+                cls.services["service_offering"])
             cls._cleanup.append(cls.service_offering)
         except Exception as e:
             cls.tearDownClass()
@@ -96,11 +101,11 @@ class TestMultipleChildDomain(cloudstackTestCase):
         self.services["disk_offering"]["disksize"] = 5
         try:
             self.disk_offering = DiskOffering.create(
-                                    self.apiclient,
-                                    self.services["disk_offering"]
-                                    )
-            self.assertNotEqual(self.disk_offering, None, \
-                    "Disk offering is None")
+                self.apiclient,
+                self.services["disk_offering"]
+            )
+            self.assertNotEqual(self.disk_offering, None,
+                                "Disk offering is None")
             self.cleanup.append(self.disk_offering)
         except Exception as e:
             self.tearDown()
@@ -121,44 +126,56 @@ class TestMultipleChildDomain(cloudstackTestCase):
         child domains"""
 
         try:
-            #Update resource limit for domain
+            # Update resource limit for domain
             Resources.updateLimit(self.apiclient, resourcetype=10,
-                              max=parentdomainlimit,
-                              domainid=self.parent_domain.id)
+                                  max=parentdomainlimit,
+                                  domainid=self.parent_domain.id)
 
             # Update Resource limit for sub-domains
             Resources.updateLimit(self.apiclient, resourcetype=10,
-                              max=subdomainlimit,
-                              domainid=self.cadmin_1.domainid)
+                                  max=subdomainlimit,
+                                  domainid=self.cadmin_1.domainid)
 
             Resources.updateLimit(self.apiclient, resourcetype=10,
-                              max=subdomainlimit,
-                              domainid=self.cadmin_2.domainid)
+                                  max=subdomainlimit,
+                                  domainid=self.cadmin_2.domainid)
         except Exception as e:
             return [FAIL, e]
         return [PASS, None]
 
     def setupAccounts(self):
         try:
-            self.parent_domain = Domain.create(self.apiclient,
-                                        services=self.services["domain"],
-                                        parentdomainid=self.domain.id)
-            self.parentd_admin = Account.create(self.apiclient, self.services["account"],
-                                            admin=True, domainid=self.parent_domain.id)
+            self.parent_domain = Domain.create(
+                self.apiclient,
+                services=self.services["domain"],
+                parentdomainid=self.domain.id)
+            self.parentd_admin = Account.create(
+                self.apiclient,
+                self.services["account"],
+                admin=True,
+                domainid=self.parent_domain.id)
 
             # Create sub-domains and their admin accounts
-            self.cdomain_1 = Domain.create(self.apiclient,
-                                       services=self.services["domain"],
-                                       parentdomainid=self.parent_domain.id)
-            self.cdomain_2 = Domain.create(self.apiclient,
-                                        services=self.services["domain"],
-                                        parentdomainid=self.parent_domain.id)
-
-            self.cadmin_1 = Account.create(self.apiclient, self.services["account"],
-                                       admin=True, domainid=self.cdomain_1.id)
-
-            self.cadmin_2 = Account.create(self.apiclient, self.services["account"],
-                                       admin=True, domainid=self.cdomain_2.id)
+            self.cdomain_1 = Domain.create(
+                self.apiclient,
+                services=self.services["domain"],
+                parentdomainid=self.parent_domain.id)
+            self.cdomain_2 = Domain.create(
+                self.apiclient,
+                services=self.services["domain"],
+                parentdomainid=self.parent_domain.id)
+
+            self.cadmin_1 = Account.create(
+                self.apiclient,
+                self.services["account"],
+                admin=True,
+                domainid=self.cdomain_1.id)
+
+            self.cadmin_2 = Account.create(
+                self.apiclient,
+                self.services["account"],
+                admin=True,
+                domainid=self.cdomain_2.id)
 
             # Cleanup the resources created at end of test
             self.cleanup.append(self.cadmin_1)
@@ -169,14 +186,14 @@ class TestMultipleChildDomain(cloudstackTestCase):
             self.cleanup.append(self.parent_domain)
 
             users = {
-                 self.cdomain_1: self.cadmin_1,
-                 self.cdomain_2: self.cadmin_2
-                 }
+                self.cdomain_1: self.cadmin_1,
+                self.cdomain_2: self.cadmin_2
+            }
         except Exception as e:
             return [FAIL, e, None]
         return [PASS, None, users]
 
-    @attr(tags=["advanced","selfservice"])
+    @attr(tags=["advanced", "selfservice"])
     def test_01_multiple_domains_primary_storage_limits(self):
         """Test primary storage limit of domain and its sub-domains
 
@@ -204,73 +221,97 @@ class TestMultipleChildDomain(cloudstackTestCase):
 
         # Setting up account and domain hierarchy
         result = self.setupAccounts()
-        self.assertEqual(result[0], PASS,\
-            "Failure while setting up accounts and domains: %s" % result[1])
+        self.assertEqual(
+            result[0],
+            PASS,
+            "Failure while setting up accounts and domains: %s" %
+            result[1])
 
-        templatesize = (self.template.size / (1024**3))
+        templatesize = (self.template.size / (1024 ** 3))
         disksize = 10
         subdomainlimit = (templatesize + disksize)
 
-        result = self.updateDomainResourceLimits(((subdomainlimit*3)- 1), subdomainlimit)
-        self.assertEqual(result[0], PASS,\
-            "Failure while updating resource limits: %s" % result[1])
+        result = self.updateDomainResourceLimits(
+            ((subdomainlimit * 3) - 1),
+            subdomainlimit)
+        self.assertEqual(
+            result[0],
+            PASS,
+            "Failure while updating resource limits: %s" %
+            result[1])
 
         try:
             self.services["disk_offering"]["disksize"] = disksize
-            disk_offering_custom = DiskOffering.create(self.apiclient,
-                                    services=self.services["disk_offering"])
+            disk_offering_custom = DiskOffering.create(
+                self.apiclient,
+                services=self.services["disk_offering"])
             self.cleanup.append(disk_offering_custom)
         except Exception as e:
             self.fail("Failed to create disk offering")
 
         # Get API clients of parent and child domain admin accounts
         api_client_admin = self.testClient.getUserApiClient(
-                        UserName=self.parentd_admin.name,
-                        DomainName=self.parentd_admin.domain)
-        self.assertNotEqual(api_client_admin, FAILED,\
-            "Failed to create api client for account: %s" % self.parentd_admin.name)
+            UserName=self.parentd_admin.name,
+            DomainName=self.parentd_admin.domain)
+        self.assertNotEqual(
+            api_client_admin,
+            FAILED,
+            "Failed to create api client for account: %s" %
+            self.parentd_admin.name)
 
         api_client_cadmin_1 = self.testClient.getUserApiClient(
-                                UserName=self.cadmin_1.name,
-                                DomainName=self.cadmin_1.domain)
-        self.assertNotEqual(api_client_cadmin_1, FAILED,\
-            "Failed to create api client for account: %s" % self.cadmin_1.name)
+            UserName=self.cadmin_1.name,
+            DomainName=self.cadmin_1.domain)
+        self.assertNotEqual(
+            api_client_cadmin_1,
+            FAILED,
+            "Failed to create api client for account: %s" %
+            self.cadmin_1.name)
 
         api_client_cadmin_2 = self.testClient.getUserApiClient(
-                                UserName=self.cadmin_2.name,
-                                DomainName=self.cadmin_2.domain)
-        self.assertNotEqual(api_client_cadmin_2, FAILED,\
-            "Failed to create api client for account: %s" % self.cadmin_2.name)
+            UserName=self.cadmin_2.name,
+            DomainName=self.cadmin_2.domain)
+        self.assertNotEqual(
+            api_client_cadmin_2,
+            FAILED,
+            "Failed to create api client for account: %s" %
+            self.cadmin_2.name)
 
         VirtualMachine.create(
-                api_client_cadmin_1, self.services["virtual_machine"],
-                accountid=self.cadmin_1.name, domainid=self.cadmin_1.domainid,
-                diskofferingid=disk_offering_custom.id, serviceofferingid=self.service_offering.id
-                )
+            api_client_cadmin_1,
+            self.services["virtual_machine"],
+            accountid=self.cadmin_1.name,
+            domainid=self.cadmin_1.domainid,
+            diskofferingid=disk_offering_custom.id,
+            serviceofferingid=self.service_offering.id)
 
         self.initialResourceCount = (templatesize + disksize)
         result = isDomainResourceCountEqualToExpectedCount(
-                        self.apiclient, self.parent_domain.id,
-                        self.initialResourceCount, RESOURCE_PRIMARY_STORAGE)
+            self.apiclient, self.parent_domain.id,
+            self.initialResourceCount, RESOURCE_PRIMARY_STORAGE)
         self.assertFalse(result[0], result[1])
         self.assertTrue(result[2], "Resource count does not match")
 
         # Create VM in second child domain
         vm_2 = VirtualMachine.create(
-                api_client_cadmin_2, self.services["virtual_machine"],
-                accountid=self.cadmin_2.name, domainid=self.cadmin_2.domainid,
-                diskofferingid=disk_offering_custom.id, serviceofferingid=self.service_offering.id
-                )
+            api_client_cadmin_2,
+            self.services["virtual_machine"],
+            accountid=self.cadmin_2.name,
+            domainid=self.cadmin_2.domainid,
+            diskofferingid=disk_offering_custom.id,
+            serviceofferingid=self.service_offering.id)
 
         # Now the VMs in two child domains have exhausted the primary storage limit
         # of parent domain, hence VM creation in parent domain with custom disk offering
         # should fail
         with self.assertRaises(Exception):
             VirtualMachine.create(
-                    api_client_admin, self.services["virtual_machine"],
-                    accountid=self.parentd_admin.name, domainid=self.parentd_admin.domainid,
-                    diskofferingid=disk_offering_custom.id, serviceofferingid=self.service_offering.id
-                    )
+                api_client_admin,
+                self.services["virtual_machine"],
+                accountid=self.parentd_admin.name,
+                domainid=self.parentd_admin.domainid,
+                diskofferingid=disk_offering_custom.id,
+                serviceofferingid=self.service_offering.id)
 
         # Deleting user account
         self.cadmin_1.delete(self.apiclient)
@@ -278,8 +319,8 @@ class TestMultipleChildDomain(cloudstackTestCase):
 
         expectedCount = self.initialResourceCount
         result = isDomainResourceCountEqualToExpectedCount(
-                        self.apiclient, self.parent_domain.id,
-                        expectedCount, RESOURCE_PRIMARY_STORAGE)
+            self.apiclient, self.parent_domain.id,
+            expectedCount, RESOURCE_PRIMARY_STORAGE)
         self.assertFalse(result[0], result[1])
         self.assertTrue(result[2], "Resource count does not match")
 
@@ -293,8 +334,8 @@ class TestMultipleChildDomain(cloudstackTestCase):
 
         expectedCount = 0
         result = isDomainResourceCountEqualToExpectedCount(
-                    self.apiclient, self.parent_domain.id,
-                    expectedCount, RESOURCE_PRIMARY_STORAGE)
+            self.apiclient, self.parent_domain.id,
+            expectedCount, RESOURCE_PRIMARY_STORAGE)
         self.assertFalse(result[0], result[1])
         self.assertTrue(result[2], "Resource count does not match")
         return
@@ -315,68 +356,79 @@ class TestMultipleChildDomain(cloudstackTestCase):
 
         # Setting up account and domain hierarchy
         result = self.setupAccounts()
-        self.assertEqual(result[0], PASS,\
-            "Failure while setting up accounts and domains: %s" % result[1])
+        self.assertEqual(
+            result[0],
+            PASS,
+            "Failure while setting up accounts and domains: %s" %
+            result[1])
         users = result[2]
 
-        templatesize = (self.template.size / (1024**3))
+        templatesize = (self.template.size / (1024 ** 3))
 
         for domain, admin in users.items():
             self.account = admin
             self.domain = domain
 
             apiclient = self.testClient.getUserApiClient(
-                                UserName=self.account.name,
-                                DomainName=self.account.domain)
-            self.assertNotEqual(apiclient, FAILED,\
-            "Failed to create api client for account: %s" % self.account.name)
+                UserName=self.account.name,
+                DomainName=self.account.domain)
+            self.assertNotEqual(
+                apiclient,
+                FAILED,
+                "Failed to create api client for account: %s" %
+                self.account.name)
             try:
                 vm = VirtualMachine.create(
-                        apiclient, self.services["virtual_machine"],
-                        accountid=self.account.name, domainid=self.account.domainid,
-                        diskofferingid=self.disk_offering.id, serviceofferingid=self.service_offering.id
-                        )
+                    apiclient,
+                    self.services["virtual_machine"],
+                    accountid=self.account.name,
+                    domainid=self.account.domainid,
+                    diskofferingid=self.disk_offering.id,
+                    serviceofferingid=self.service_offering.id)
 
                 expectedCount = templatesize + self.disk_offering.disksize
                 result = isDomainResourceCountEqualToExpectedCount(
-                            self.apiclient, self.domain.id,
-                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+                    self.apiclient, self.domain.id,
+                    expectedCount, RESOURCE_PRIMARY_STORAGE)
                 self.assertFalse(result[0], result[1])
                 self.assertTrue(result[2], "Resource count does not match")
 
                 # Creating service offering with 10 GB volume
                 self.services["disk_offering"]["disksize"] = 10
-                disk_offering_10_GB = DiskOffering.create(self.apiclient,
-                                    services=self.services["disk_offering"])
+                disk_offering_10_GB = DiskOffering.create(
+                    self.apiclient,
+                    services=self.services["disk_offering"])
 
                 self.cleanup.append(disk_offering_10_GB)
 
                 volume = Volume.create(
-                            apiclient, self.services["volume"],
-                            zoneid=self.zone.id, account=self.account.name,
-                            domainid=self.account.domainid, diskofferingid=disk_offering_10_GB.id
-                            )
-
-                volumeSize = (volume.size / (1024**3))
+                    apiclient,
+                    self.services["volume"],
+                    zoneid=self.zone.id,
+                    account=self.account.name,
+                    domainid=self.account.domainid,
+                    diskofferingid=disk_offering_10_GB.id)
+
+                volumeSize = (volume.size / (1024 ** 3))
                 expectedCount += volumeSize
 
-       	        vm.attach_volume(apiclient, volume=volume)
+                vm.attach_volume(apiclient, volume=volume)
                 result = isDomainResourceCountEqualToExpectedCount(
-                            self.apiclient, self.domain.id,
-                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+                    self.apiclient, self.domain.id,
+                    expectedCount, RESOURCE_PRIMARY_STORAGE)
                 self.assertFalse(result[0], result[1])
                 self.assertTrue(result[2], "Resource count does not match")
 
                 expectedCount -= volumeSize
                 vm.detach_volume(apiclient, volume=volume)
                 result = isDomainResourceCountEqualToExpectedCount(
-                            self.apiclient, self.domain.id,
-                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+                    self.apiclient, self.domain.id,
+                    expectedCount, RESOURCE_PRIMARY_STORAGE)
                 self.assertFalse(result[0], result[1])
                 self.assertTrue(result[2], "Resource count does not match")
             except Exception as e:
                 self.fail("Failure: %s" % e)
-	    return
+            return
 
     @attr(tags=["advanced"], required_hardware="false")
     def test_03_multiple_domains_multiple_volumes(self):
@@ -397,67 +449,80 @@ class TestMultipleChildDomain(cloudstackTestCase):
         # Setting up account and domain hierarchy
         result = self.setupAccounts()
         if result[0] == FAIL:
-            self.fail("Failure while setting up accounts and domains: %s" % result[1])
+            self.fail(
+                "Failure while setting up accounts and domains: %s" %
+                result[1])
         else:
             users = result[2]
 
-        templatesize = (self.template.size / (1024**3))
+        templatesize = (self.template.size / (1024 ** 3))
 
         for domain, admin in users.items():
             self.account = admin
             self.domain = domain
 
             apiclient = self.testClient.getUserApiClient(
-                                UserName=self.account.name,
-                                DomainName=self.account.domain)
-            self.assertNotEqual(apiclient, FAILED,\
-            "Failed to create api client for account: %s" % self.account.name)
+                UserName=self.account.name,
+                DomainName=self.account.domain)
+            self.assertNotEqual(
+                apiclient,
+                FAILED,
+                "Failed to create api client for account: %s" %
+                self.account.name)
 
             try:
                 vm = VirtualMachine.create(
-                        apiclient, self.services["virtual_machine"],
-                        accountid=self.account.name, domainid=self.account.domainid,
-                        diskofferingid=self.disk_offering.id, serviceofferingid=self.service_offering.id
-                        )
+                    apiclient,
+                    self.services["virtual_machine"],
+                    accountid=self.account.name,
+                    domainid=self.account.domainid,
+                    diskofferingid=self.disk_offering.id,
+                    serviceofferingid=self.service_offering.id)
 
                 expectedCount = templatesize + self.disk_offering.disksize
                 result = isDomainResourceCountEqualToExpectedCount(
-                            self.apiclient, self.domain.id,
-                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+                    self.apiclient, self.domain.id,
+                    expectedCount, RESOURCE_PRIMARY_STORAGE)
                 self.assertFalse(result[0], result[1])
                 self.assertTrue(result[2], "Resource count does not match")
 
                 volume1size = self.services["disk_offering"]["disksize"] = 15
-                disk_offering_15_GB = DiskOffering.create(self.apiclient,
-                                    services=self.services["disk_offering"])
+                disk_offering_15_GB = DiskOffering.create(
+                    self.apiclient,
+                    services=self.services["disk_offering"])
 
                 self.cleanup.append(disk_offering_15_GB)
 
                 volume2size = self.services["disk_offering"]["disksize"] = 20
-                disk_offering_20_GB = DiskOffering.create(self.apiclient,
-                                    services=self.services["disk_offering"])
+                disk_offering_20_GB = DiskOffering.create(
+                    self.apiclient,
+                    services=self.services["disk_offering"])
 
                 self.cleanup.append(disk_offering_20_GB)
 
                 volume_1 = Volume.create(
-                            apiclient, self.services["volume"],
-                            zoneid=self.zone.id, account=self.account.name,
-                            domainid=self.account.domainid, diskofferingid=disk_offering_15_GB.id
-                            )
+                    apiclient,
+                    self.services["volume"],
+                    zoneid=self.zone.id,
+                    account=self.account.name,
+                    domainid=self.account.domainid,
+                    diskofferingid=disk_offering_15_GB.id)
 
                 volume_2 = Volume.create(
-                            apiclient, self.services["volume"],
-                            zoneid=self.zone.id, account=self.account.name,
-                            domainid=self.account.domainid, diskofferingid=disk_offering_20_GB.id
-                            )
+                    apiclient,
+                    self.services["volume"],
+                    zoneid=self.zone.id,
+                    account=self.account.name,
+                    domainid=self.account.domainid,
+                    diskofferingid=disk_offering_20_GB.id)
 
                 vm.attach_volume(apiclient, volume=volume_1)
                 vm.attach_volume(apiclient, volume=volume_2)
 
                 expectedCount += volume1size + volume2size
                 result = isDomainResourceCountEqualToExpectedCount(
-                            self.apiclient, self.domain.id,
-                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+                    self.apiclient, self.domain.id,
+                    expectedCount, RESOURCE_PRIMARY_STORAGE)
                 self.assertFalse(result[0], result[1])
                 self.assertTrue(result[2], "Resource count does not match")
 
@@ -466,16 +531,16 @@ class TestMultipleChildDomain(cloudstackTestCase):
 
                 expectedCount -= volume1size
                 result = isDomainResourceCountEqualToExpectedCount(
-                            self.apiclient, self.domain.id,
-                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+                    self.apiclient, self.domain.id,
+                    expectedCount, RESOURCE_PRIMARY_STORAGE)
                 self.assertFalse(result[0], result[1])
                 self.assertTrue(result[2], "Resource count does not match")
 
                 expectedCount -= volume2size
                 vm.detach_volume(apiclient, volume=volume_2)
                 result = isDomainResourceCountEqualToExpectedCount(
-                            self.apiclient, self.domain.id,
-                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+                    self.apiclient, self.domain.id,
+                    expectedCount, RESOURCE_PRIMARY_STORAGE)
                 self.assertFalse(result[0], result[1])
                 self.assertTrue(result[2], "Resource count does not match")
             except Exception as e:
@@ -498,9 +563,14 @@ class TestMultipleChildDomain(cloudstackTestCase):
         # 5. Delete volume which was created from snapshot and verify primary storage
              resource count"""
 
+        if self.hypervisor.lower() in ['hyperv']:
+            self.skipTest("Snapshots feature is not supported on Hyper-V")
+
         result = self.setupAccounts()
         if result[0] == FAIL:
-            self.fail("Failure while setting up accounts and domains: %s" % result[1])
+            self.fail(
+                "Failure while setting up accounts and domains: %s" %
+                result[1])
         users = result[2]
 
         for domain, admin in users.items():
@@ -509,62 +579,75 @@ class TestMultipleChildDomain(cloudstackTestCase):
 
             try:
                 apiclient = self.testClient.getUserApiClient(
-                                UserName=self.account.name,
-                                DomainName=self.account.domain)
-                self.assertNotEqual(apiclient, FAILED,\
-                 "Failed to create api client for account: %s" % self.account.name)
+                    UserName=self.account.name,
+                    DomainName=self.account.domain)
+                self.assertNotEqual(
+                    apiclient,
+                    FAILED,
+                    "Failed to create api client for account: %s" %
+                    self.account.name)
 
                 vm = VirtualMachine.create(
-                            apiclient, self.services["virtual_machine"],
-                            accountid=self.account.name, domainid=self.account.domainid,
-                            diskofferingid=self.disk_offering.id, serviceofferingid=self.service_offering.id
-                            )
+                    apiclient,
+                    self.services["virtual_machine"],
+                    accountid=self.account.name,
+                    domainid=self.account.domainid,
+                    diskofferingid=self.disk_offering.id,
+                    serviceofferingid=self.service_offering.id)
 
-                templatesize = (self.template.size / (1024**3))
+                templatesize = (self.template.size / (1024 ** 3))
 
-                initialResourceCount = expectedCount = templatesize + self.disk_offering.disksize
+                initialResourceCount = expectedCount = templatesize + \
+                    self.disk_offering.disksize
                 result = isDomainResourceCountEqualToExpectedCount(
-                            self.apiclient, self.domain.id,
-                            initialResourceCount, RESOURCE_PRIMARY_STORAGE)
+                    self.apiclient, self.domain.id,
+                    initialResourceCount, RESOURCE_PRIMARY_STORAGE)
                 self.assertFalse(result[0], result[1])
                 self.assertTrue(result[2], "Resource count does not match")
 
                 vm.stop(self.apiclient)
 
-                response = createSnapshotFromVirtualMachineVolume(apiclient, self.account, vm.id)
+                response = createSnapshotFromVirtualMachineVolume(
+                    apiclient,
+                    self.account,
+                    vm.id)
                 self.assertEqual(response[0], PASS, response[1])
                 snapshot = response[1]
 
-                response = snapshot.validateState(apiclient, Snapshot.BACKED_UP)
+                response = snapshot.validateState(
+                    apiclient,
+                    Snapshot.BACKED_UP)
                 self.assertEqual(response[0], PASS, response[1])
 
-                self.services["volume"]["size"] = self.services["disk_offering"]["disksize"]
-                volume = Volume.create_from_snapshot(apiclient,
-                                        snapshot_id=snapshot.id,
-                                        services=self.services["volume"],
-                                        account=self.account.name,
-                                        domainid=self.account.domainid)
-                volumeSize = (volume.size / (1024**3))
+                self.services["volume"]["size"] = self.services[
+                    "disk_offering"]["disksize"]
+                volume = Volume.create_from_snapshot(
+                    apiclient,
+                    snapshot_id=snapshot.id,
+                    services=self.services["volume"],
+                    account=self.account.name,
+                    domainid=self.account.domainid)
+                volumeSize = (volume.size / (1024 ** 3))
                 vm.attach_volume(apiclient, volume)
                 expectedCount = initialResourceCount + (volumeSize)
                 result = isDomainResourceCountEqualToExpectedCount(
-                            self.apiclient, self.domain.id,
-                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+                    self.apiclient, self.domain.id,
+                    expectedCount, RESOURCE_PRIMARY_STORAGE)
                 self.assertFalse(result[0], result[1])
                 self.assertTrue(result[2], "Resource count does not match")
 
                 expectedCount -= volumeSize
                 vm.detach_volume(apiclient, volume)
                 result = isDomainResourceCountEqualToExpectedCount(
-                            self.apiclient, self.domain.id,
-                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+                    self.apiclient, self.domain.id,
+                    expectedCount, RESOURCE_PRIMARY_STORAGE)
                 self.assertFalse(result[0], result[1])
                 self.assertTrue(result[2], "Resource count does not match")
 
                 volume.delete(apiclient)
                 result = isDomainResourceCountEqualToExpectedCount(
-                            self.apiclient, self.domain.id,
-                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+                    self.apiclient, self.domain.id,
+                    expectedCount, RESOURCE_PRIMARY_STORAGE)
                 self.assertFalse(result[0], result[1])
                 self.assertTrue(result[2], "Resource count does not match")
             except Exception as e:
@@ -573,7 +656,7 @@ class TestMultipleChildDomain(cloudstackTestCase):
 
     @attr(tags=["advanced"], required_hardware="false")
     def test_05_assign_virtual_machine_different_domain(self):
-	"""Test assign virtual machine to account belonging to different domain
+        """Test assign virtual machine to account belonging to different domain
 
         # Steps
         1. Create a parent domain and two sub-domains in it (also admin accounts
@@ -590,41 +673,48 @@ class TestMultipleChildDomain(cloudstackTestCase):
         self.assertEqual(result[0], PASS, result[1])
 
         apiclient = self.testClient.getUserApiClient(
-                                UserName=self.cadmin_1.name,
-                                DomainName=self.cadmin_1.domain)
-        self.assertNotEqual(apiclient, FAILED,\
-                 "Failed to create api client for account: %s" % self.cadmin_1.name)
+            UserName=self.cadmin_1.name,
+            DomainName=self.cadmin_1.domain)
+        self.assertNotEqual(
+            apiclient,
+            FAILED,
+            "Failed to create api client for account: %s" %
+            self.cadmin_1.name)
 
         try:
             vm_1 = VirtualMachine.create(
-                    apiclient, self.services["virtual_machine"],
-                    accountid=self.cadmin_1.name, domainid=self.cadmin_1.domainid,
-                    diskofferingid=self.disk_offering.id, serviceofferingid=self.service_offering.id
-                    )
+                apiclient,
+                self.services["virtual_machine"],
+                accountid=self.cadmin_1.name,
+                domainid=self.cadmin_1.domainid,
+                diskofferingid=self.disk_offering.id,
+                serviceofferingid=self.service_offering.id)
 
-            templatesize = (self.template.size / (1024**3))
+            templatesize = (self.template.size / (1024 ** 3))
 
             expectedCount = templatesize + self.disk_offering.disksize
             result = isDomainResourceCountEqualToExpectedCount(
-                            self.apiclient, self.cadmin_1.domainid,
-                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+                self.apiclient, self.cadmin_1.domainid,
+                expectedCount, RESOURCE_PRIMARY_STORAGE)
             self.assertFalse(result[0], result[1])
             self.assertTrue(result[2], "Resource count does not match")
 
             vm_1.stop(apiclient)
-            vm_1.assign_virtual_machine(self.apiclient, account=self.cadmin_2.name,
-				    domainid=self.cadmin_2.domainid)
+            vm_1.assign_virtual_machine(
+                self.apiclient,
+                account=self.cadmin_2.name,
+                domainid=self.cadmin_2.domainid)
 
             result = isDomainResourceCountEqualToExpectedCount(
-                            self.apiclient, self.cadmin_2.domainid,
-                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+                self.apiclient, self.cadmin_2.domainid,
+                expectedCount, RESOURCE_PRIMARY_STORAGE)
             self.assertFalse(result[0], result[1])
             self.assertTrue(result[2], "Resource count does not match")
 
             expectedCount = 0
             result = isDomainResourceCountEqualToExpectedCount(
-                            self.apiclient, self.cadmin_1.domainid,
-                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+                self.apiclient, self.cadmin_1.domainid,
+                expectedCount, RESOURCE_PRIMARY_STORAGE)
             self.assertFalse(result[0], result[1])
             self.assertTrue(result[2], "Resource count does not match")
         except Exception as e:
@@ -633,7 +723,7 @@ class TestMultipleChildDomain(cloudstackTestCase):
 
     @attr(tags=["advanced"], required_hardware="false")
     def test_06_destroy_recover_vm(self):
-	"""Test primary storage counts while destroying and recovering VM
+        """Test primary storage counts while destroying and recovering VM
         # Steps
         1. Create a parent domain and two sub-domains in it (also admin accounts
            of each domain)
@@ -656,33 +746,35 @@ class TestMultipleChildDomain(cloudstackTestCase):
             self.domain = domain
             try:
                 vm_1 = VirtualMachine.create(
-                    self.apiclient, self.services["virtual_machine"],
-                    accountid=self.account.name, domainid=self.account.domainid,
-                    diskofferingid=self.disk_offering.id, serviceofferingid=self.service_offering.id
-                    )
+                    self.apiclient,
+                    self.services["virtual_machine"],
+                    accountid=self.account.name,
+                    domainid=self.account.domainid,
+                    diskofferingid=self.disk_offering.id,
+                    serviceofferingid=self.service_offering.id)
 
-                templatesize = (self.template.size / (1024**3))
+                templatesize = (self.template.size / (1024 ** 3))
 
                 expectedCount = templatesize + self.disk_offering.disksize
                 result = isDomainResourceCountEqualToExpectedCount(
-                            self.apiclient, self.account.domainid,
-                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+                    self.apiclient, self.account.domainid,
+                    expectedCount, RESOURCE_PRIMARY_STORAGE)
                 self.assertFalse(result[0], result[1])
                 self.assertTrue(result[2], "Resource count does not match")
 
                 vm_1.delete(self.apiclient, expunge=False)
 
                 result = isDomainResourceCountEqualToExpectedCount(
-                            self.apiclient, self.account.domainid,
-                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+                    self.apiclient, self.account.domainid,
+                    expectedCount, RESOURCE_PRIMARY_STORAGE)
                 self.assertFalse(result[0], result[1])
                 self.assertTrue(result[2], "Resource count does not match")
 
                 vm_1.recover(self.apiclient)
 
                 result = isDomainResourceCountEqualToExpectedCount(
-                            self.apiclient, self.account.domainid,
-                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+                    self.apiclient, self.account.domainid,
+                    expectedCount, RESOURCE_PRIMARY_STORAGE)
                 self.assertFalse(result[0], result[1])
                 self.assertTrue(result[2], "Resource count does not match")
             except Exception as e:

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/214d63ee/test/integration/component/test_ps_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_ps_limits.py b/test/integration/component/test_ps_limits.py
index e557249..c9a754b 100644
--- a/test/integration/component/test_ps_limits.py
+++ b/test/integration/component/test_ps_limits.py
@@ -56,6 +56,7 @@ class TestVolumeLimits(cloudstackTestCase):
         cloudstackTestClient = super(TestVolumeLimits,
                                cls).getClsTestClient()
         cls.api_client = cloudstackTestClient.getApiClient()
+        cls.hypervisor = cloudstackTestClient.getHypervisorInfo()
         # Fill services from the external config file
         cls.services = cloudstackTestClient.getParsedTestDataConfig()
         # Get Zone, Domain and templates
@@ -505,7 +506,8 @@ class TestVolumeLimits(cloudstackTestCase):
         # 3. Create volume againt from this snapshto and attach to VM
         # 4. Verify that primary storage count increases by the volume size
         # 5. Detach and delete volume, verify primary storage count decreaes by volume size"""
-
+        if self.hypervisor.lower() in ['hyperv']:
+            self.skipTest("Snapshots feature is not supported on Hyper-V")
         response = self.setupAccount(value)
         self.debug(response[0])
         self.debug(response[1])

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/214d63ee/test/integration/component/test_resource_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_resource_limits.py b/test/integration/component/test_resource_limits.py
index f7fecb0..5f29d70 100644
--- a/test/integration/component/test_resource_limits.py
+++ b/test/integration/component/test_resource_limits.py
@@ -18,7 +18,7 @@
 """
 #Import Local Modules
 from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.cloudstackTestCase import cloudstackTestCase,unittest
 from marvin.lib.base import (VirtualMachine,
                                          Snapshot,
                                          Template,
@@ -129,7 +129,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
     def setUpClass(cls):
         cls.testClient = super(TestResourceLimitsAccount, cls).getClsTestClient()
         cls.api_client = cls.testClient.getApiClient()
-
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
         cls.services = Services().services
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client)
@@ -448,6 +448,8 @@ class TestResourceLimitsAccount(cloudstackTestCase):
         # 5. Create 2 snapshot in account 2. Verify account 2 should be able to
         #    create snapshots without any warning
 
+        if self.hypervisor.lower() in ['hyperv']:
+            self.skipTest("Snapshots feature is not supported on Hyper-V")
         self.debug(
             "Updating public IP resource limit for account: %s" %
                                                 self.account_1.name)
@@ -914,7 +916,7 @@ class TestResourceLimitsDomain(cloudstackTestCase):
     def setUpClass(cls):
         cls.testClient = super(TestResourceLimitsDomain, cls).getClsTestClient()
         cls.api_client = cls.testClient.getApiClient()
-
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
         cls.services = Services().services
         cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
         cls.services['mode'] = cls.zone.networktype
@@ -1132,7 +1134,8 @@ class TestResourceLimitsDomain(cloudstackTestCase):
         #    created
         # 5. Try to create another snapshot in this domain. It should give the
         #    user an appropriate error and an alert should be generated.
-
+        if self.hypervisor.lower() in ['hyperv']:
+            self.skipTest("Snapshots feature is not supported on Hyper-V")
         self.debug(
             "Updating snapshot resource limits for domain: %s" %
                                         self.account.domainid)


[15/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4

Posted by sa...@apache.org.
CLOUDSTACK-8135: Fixed cleanup issue in test_escalations_instances.py

Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1ee41888
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1ee41888
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1ee41888

Branch: refs/heads/vmware-disk-controllers
Commit: 1ee41888353d87f4972e6ccb492817133805a88e
Parents: f938a5e
Author: Ashutosh K <as...@clogeny.com>
Authored: Tue Dec 30 12:55:06 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Mon Jan 5 18:31:52 2015 +0530

----------------------------------------------------------------------
 test/integration/component/test_escalations_instances.py | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1ee41888/test/integration/component/test_escalations_instances.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_instances.py b/test/integration/component/test_escalations_instances.py
index 1e5ec53..b089ed5 100644
--- a/test/integration/component/test_escalations_instances.py
+++ b/test/integration/component/test_escalations_instances.py
@@ -2238,7 +2238,6 @@ class TestInstances(cloudstackTestCase):
             vm_created,
             "VM creation failed"
         )
-        self.cleanup.append(vm_created)
         # Listing all the VMs for a user again for matching zone
         list_vms_after = VirtualMachine.list(
             self.userapiclient,


[22/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4

Posted by sa...@apache.org.
CLOUDSTACK-8140: CS fails to start after secstorage/consoleproxy.service.offering is set to uuid


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/84c44b63
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/84c44b63
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/84c44b63

Branch: refs/heads/vmware-disk-controllers
Commit: 84c44b63140e8acf2336549040bda9c0a8f2ff66
Parents: 2c9cc1e
Author: Wei Zhou <w....@tech.leaseweb.com>
Authored: Tue Jan 6 10:23:44 2015 +0100
Committer: Wei Zhou <w....@tech.leaseweb.com>
Committed: Tue Jan 6 10:23:44 2015 +0100

----------------------------------------------------------------------
 server/src/com/cloud/configuration/Config.java  |  6 +++---
 .../consoleproxy/ConsoleProxyManagerImpl.java   | 18 ++++++++----------
 .../SecondaryStorageManagerImpl.java            | 20 +++++++++++++-------
 setup/db/db/schema-442to450.sql                 |  2 ++
 4 files changed, 26 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/84c44b63/server/src/com/cloud/configuration/Config.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java
index af4da6a..f9e9bdd 100644
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -1804,7 +1804,7 @@ public enum Config {
     ConsoleProxyServiceOffering(
             "Advanced",
             ManagementServer.class,
-            Long.class,
+            String.class,
             "consoleproxy.service.offering",
             null,
             "Uuid of the service offering used by console proxy; if NULL - system offering will be used",
@@ -1812,10 +1812,10 @@ public enum Config {
     SecondaryStorageServiceOffering(
             "Advanced",
             ManagementServer.class,
-            Long.class,
+            String.class,
             "secstorage.service.offering",
             null,
-            "Service offering used by secondary storage; if NULL - system offering will be used",
+            "Uuid of the service offering used by secondary storage; if NULL - system offering will be used",
             null),
     HaTag("Advanced", ManagementServer.class, String.class, "ha.tag", null, "HA tag defining that the host marked with this tag can be used for HA purposes only", null),
     ImplicitHostTags(

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/84c44b63/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
index 65930aa..bb64fa3 100644
--- a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
+++ b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
@@ -91,7 +91,6 @@ import com.cloud.network.dao.IPAddressVO;
 import com.cloud.network.dao.NetworkDao;
 import com.cloud.network.dao.NetworkVO;
 import com.cloud.network.rules.RulesManager;
-import com.cloud.offering.DiskOffering;
 import com.cloud.offering.NetworkOffering;
 import com.cloud.offering.ServiceOffering;
 import com.cloud.offerings.dao.NetworkOfferingDao;
@@ -105,7 +104,6 @@ import com.cloud.storage.Storage;
 import com.cloud.storage.StoragePoolStatus;
 import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
 import com.cloud.storage.VMTemplateVO;
-import com.cloud.storage.dao.DiskOfferingDao;
 import com.cloud.storage.dao.VMTemplateDao;
 import com.cloud.user.Account;
 import com.cloud.user.AccountManager;
@@ -196,8 +194,6 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
     @Inject
     private ServiceOfferingDao _offeringDao;
     @Inject
-    private DiskOfferingDao _diskOfferingDao;
-    @Inject
     private NetworkOfferingDao _networkOfferingDao;
     @Inject
     private PrimaryDataStoreDao _storagePoolDao;
@@ -1267,13 +1263,15 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
         //check if there is a default service offering configured
         String cpvmSrvcOffIdStr = configs.get(Config.ConsoleProxyServiceOffering.key());
         if (cpvmSrvcOffIdStr != null) {
-            DiskOffering diskOffering = _diskOfferingDao.findByUuid(cpvmSrvcOffIdStr);
-            if (diskOffering == null) {
-                diskOffering = _diskOfferingDao.findById(Long.parseLong(cpvmSrvcOffIdStr));
+            _serviceOffering = _offeringDao.findByUuid(cpvmSrvcOffIdStr);
+            if (_serviceOffering == null) {
+                try {
+                    _serviceOffering = _offeringDao.findById(Long.parseLong(cpvmSrvcOffIdStr));
+                } catch (NumberFormatException ex) {
+                    s_logger.debug("The system service offering specified by global config is not id, but uuid=" + cpvmSrvcOffIdStr + " for console proxy vm");
+                }
             }
-            if (diskOffering != null) {
-                _serviceOffering = _offeringDao.findById(diskOffering.getId());
-            } else {
+            if (_serviceOffering == null) {
                 s_logger.warn("Can't find system service offering specified by global config, uuid=" + cpvmSrvcOffIdStr + " for console proxy vm");
             }
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/84c44b63/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java b/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
index 3ba4242..ccf3dcd 100644
--- a/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
+++ b/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
@@ -853,14 +853,20 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
         //check if there is a default service offering configured
         String ssvmSrvcOffIdStr = configs.get(Config.SecondaryStorageServiceOffering.key());
         if (ssvmSrvcOffIdStr != null) {
-            Long ssvmSrvcOffId = Long.parseLong(ssvmSrvcOffIdStr);
-            _serviceOffering = _offeringDao.findById(ssvmSrvcOffId);
-            if (_serviceOffering == null || !_serviceOffering.getSystemUse()) {
-                String msg = "Can't find system service offering id=" + ssvmSrvcOffId + " for secondary storage vm";
-                s_logger.error(msg);
-                throw new ConfigurationException(msg);
+            _serviceOffering = _offeringDao.findByUuid(ssvmSrvcOffIdStr);
+            if (_serviceOffering == null) {
+                try {
+                    _serviceOffering = _offeringDao.findById(Long.parseLong(ssvmSrvcOffIdStr));
+                } catch (NumberFormatException ex) {
+                    s_logger.debug("The system service offering specified by global config is not id, but uuid=" + ssvmSrvcOffIdStr + " for secondary storage vm");
+                }
             }
-        } else {
+            if (_serviceOffering == null) {
+                s_logger.warn("Can't find system service offering specified by global config, uuid=" + ssvmSrvcOffIdStr + " for secondary storage vm");
+            }
+        }
+
+        if(_serviceOffering == null || !_serviceOffering.getSystemUse()){
             int ramSize = NumbersUtil.parseInt(_configDao.getValue("ssvm.ram.size"), DEFAULT_SS_VM_RAMSIZE);
             int cpuFreq = NumbersUtil.parseInt(_configDao.getValue("ssvm.cpu.mhz"), DEFAULT_SS_VM_CPUMHZ);
             _useLocalStorage = Boolean.parseBoolean(configs.get(Config.SystemVMUseLocalStorage.key()));

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/84c44b63/setup/db/db/schema-442to450.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-442to450.sql b/setup/db/db/schema-442to450.sql
index b5006c2..9498481 100644
--- a/setup/db/db/schema-442to450.sql
+++ b/setup/db/db/schema-442to450.sql
@@ -1005,3 +1005,5 @@ INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervis
 
 INSERT IGNORE INTO `cloud`.`configuration` (`category`, `instance`, `component`, `name`, `value`, `default_value`, `description`) VALUES ('Advanced', 'DEFAULT', 'ManagementServer', 'xen.heartbeat.timeout' , '180', '120', 'Timeout value to send to the xenheartbeat script for guarding the self fencing functionality');
 
+UPDATE `cloud`.`configuration` SET description='Uuid of the service offering used by secondary storage; if NULL - system offering will be used' where name='secstorage.service.offering';
+


[04/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4

Posted by sa...@apache.org.
CLOUDSTACK-8141: UI > use Project view > Infrastructure > zone > physical network > Public traffic type > do not pass projectId to listNetworks API.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b64fa34c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b64fa34c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b64fa34c

Branch: refs/heads/vmware-disk-controllers
Commit: b64fa34ce901f88a944f9f104310a8f53a827f0f
Parents: 61154b9
Author: Jessica Wang <je...@apache.org>
Authored: Fri Jan 2 11:33:57 2015 -0800
Committer: Jessica Wang <je...@apache.org>
Committed: Fri Jan 2 11:35:31 2015 -0800

----------------------------------------------------------------------
 ui/scripts/system.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b64fa34c/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index ad40ec1..88d0a78 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -601,7 +601,9 @@
                                 
                                 dataProvider: function (args) {
                                     $.ajax({
-                                        url: createURL("listNetworks&listAll=true&trafficType=Public&isSystem=true&zoneId=" + selectedZoneObj.id),
+                                        url: createURL("listNetworks&listAll=true&trafficType=Public&isSystem=true&zoneId=" + selectedZoneObj.id, {
+                                            ignoreProject: true
+                                        }),
                                         dataType: "json",
                                         async: false,
                                         success: function (json) {