You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ra...@apache.org on 2014/11/13 10:42:46 UTC

[01/28] git commit: updated refs/heads/master to 8c9093b

Repository: cloudstack
Updated Branches:
  refs/heads/master b8fdda0a3 -> 8c9093b1d


CLOUDSTACK-7830: Usage Job fails with "Data too long for column 'user_name'"


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

Branch: refs/heads/master
Commit: 36fd780482dbd65ef9328f630d0af0793d0fed2e
Parents: cdabb24
Author: Damodar <da...@citrix.com>
Authored: Mon Nov 10 14:40:36 2014 +0530
Committer: Kishan Kavala <ki...@apache.org>
Committed: Mon Nov 10 15:07:13 2014 +0530

----------------------------------------------------------------------
 setup/db/db/schema-441to450.sql | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/36fd7804/setup/db/db/schema-441to450.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-441to450.sql b/setup/db/db/schema-441to450.sql
index 1d2bbb6..0aa95e8 100644
--- a/setup/db/db/schema-441to450.sql
+++ b/setup/db/db/schema-441to450.sql
@@ -754,3 +754,5 @@ DELETE t1 FROM guest_os_hypervisor t1, guest_os_hypervisor t2 WHERE (t1.hypervis
 
 -- Set as removed built-in CentOS 5.3 template (if any) for XenServer, since CentOS 5.6 template already exists
 UPDATE `cloud`.`vm_template` SET removed=NOW() WHERE unique_name="centos53-x86_64" AND hypervisor_type="XenServer";
+
+ALTER TABLE `cloud_usage`.`usage_vpn_user` CHANGE `user_name` `user_name` VARCHAR(255);


[15/28] git commit: updated refs/heads/master to 8c9093b

Posted by ra...@apache.org.
CLOUDSTACK-7828.Avoid marking IPs already in Allocated as Allocated again. Use row lock to ensure that prev state is either Allocating or Free. This will inturn avoid logging duplicate events


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

Branch: refs/heads/master
Commit: c916f30574ebd3e909be3dc0e8ca74ae9ef7c5ce
Parents: c401dbc
Author: Santhosh Edukulla <sa...@gmail.com>
Authored: Mon Nov 3 12:40:13 2014 +0530
Committer: Santhosh Edukulla <sa...@gmail.com>
Committed: Mon Nov 10 21:22:47 2014 +0530

----------------------------------------------------------------------
 .../com/cloud/network/IpAddressManagerImpl.java | 44 ++++++++++----------
 1 file changed, 21 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c916f305/server/src/com/cloud/network/IpAddressManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/IpAddressManagerImpl.java b/server/src/com/cloud/network/IpAddressManagerImpl.java
index 016d297..4335349 100644
--- a/server/src/com/cloud/network/IpAddressManagerImpl.java
+++ b/server/src/com/cloud/network/IpAddressManagerImpl.java
@@ -807,32 +807,32 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
     @Override
     public void markPublicIpAsAllocated(final IPAddressVO addr) {
 
-        assert (addr.getState() == IpAddress.State.Allocating || addr.getState() == IpAddress.State.Free) : "Unable to transition from state " + addr.getState() + " to "
-                + IpAddress.State.Allocated;
         Transaction.execute(new TransactionCallbackNoReturn() {
             @Override
             public void doInTransactionWithoutResult(TransactionStatus status) {
-        Account owner = _accountMgr.getAccount(addr.getAllocatedToAccountId());
-
-        addr.setState(IpAddress.State.Allocated);
-        _ipAddressDao.update(addr.getId(), addr);
-
-        // Save usage event
-        if (owner.getAccountId() != Account.ACCOUNT_ID_SYSTEM) {
-            VlanVO vlan = _vlanDao.findById(addr.getVlanId());
-
-            String guestType = vlan.getVlanType().toString();
-
-            if (!isIpDedicated(addr)) {
-                        UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NET_IP_ASSIGN, owner.getId(), addr.getDataCenterId(), addr.getId(), addr.getAddress().toString(),
-                                addr.isSourceNat(), guestType, addr.getSystem(), addr.getClass().getName(), addr.getUuid());
-            }
-
-                    if (updateIpResourceCount(addr)) {
-                _resourceLimitMgr.incrementResourceCount(owner.getId(), ResourceType.public_ip);
+            Account owner = _accountMgr.getAccount(addr.getAllocatedToAccountId());
+            synchronized (this) {
+                if (_ipAddressDao.lockRow(addr.getId(),true) != null) {
+                    IPAddressVO userIp = _ipAddressDao.findById(addr.getId());
+                    if (userIp.getState() == IpAddress.State.Allocating || addr.getState() == IpAddress.State.Free) {
+                        addr.setState(IpAddress.State.Allocated);
+                        _ipAddressDao.update(addr.getId(), addr);
+                        // Save usage event
+                        if (owner.getAccountId() != Account.ACCOUNT_ID_SYSTEM) {
+                            VlanVO vlan = _vlanDao.findById(addr.getVlanId());
+                            String guestType = vlan.getVlanType().toString();
+                            if (!isIpDedicated(addr)) {
+                                UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NET_IP_ASSIGN, owner.getId(), addr.getDataCenterId(), addr.getId(), addr.getAddress().toString(),
+                                        addr.isSourceNat(), guestType, addr.getSystem(), addr.getClass().getName(), addr.getUuid());
+                            }
+                            if (updateIpResourceCount(addr)) {
+                                _resourceLimitMgr.incrementResourceCount(owner.getId(), ResourceType.public_ip);
+                            }
+                        }
+                    }
+                }
             }
         }
-            }
         });
     }
 
@@ -922,7 +922,6 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
     public boolean applyIpAssociations(Network network, boolean continueOnError) throws ResourceUnavailableException {
         List<IPAddressVO> userIps = _ipAddressDao.listByAssociatedNetwork(network.getId(), null);
         boolean success = true;
-
         // CloudStack will take a lazy approach to associate an acquired public IP to a network service provider as
         // it will not know what service an acquired IP will be used for. An IP is actually associated with a provider when first
         // rule is applied. Similarly when last rule on the acquired IP is revoked, IP is not associated with any provider
@@ -941,7 +940,6 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
                 }
             }
         }
-
         return success;
     }
 


[22/28] git commit: updated refs/heads/master to 8c9093b

Posted by ra...@apache.org.
CLOUDSTACK-7645: [UI] Fixed incorrect label issues caused the dictionary split

In some cases the UI does not display the correct text, displaying 'label.xyz' instead of the localized string.
This appears to be due to the dictionary split: entries in dictionary2.jsp are not found because the dictionary has not been extended with dictionary2 as expected.

In this fix:
- Instead of extending the dictionary, we leave it as it is and change the localization function to look in the dictionary first and, if the item is not found there, then look in dictionary2.
- This way we are not depending on the extent() function to be called at the 'right' time; In turn, the localization function will be aware of both dictionaries.
- In the future, when we add another dictionary, we will have to modify this function only.


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

Branch: refs/heads/master
Commit: d82e556dcd980bac50f27eaca284983808e04b1c
Parents: f136179
Author: Mihaela Stoica <mi...@citrix.com>
Authored: Tue Nov 11 17:34:50 2014 +0000
Committer: Brian Federle <br...@citrix.com>
Committed: Wed Nov 12 08:21:42 2014 -0800

----------------------------------------------------------------------
 ui/scripts/cloudStack.js      | 9 +++------
 ui/scripts/sharedFunctions.js | 4 +---
 2 files changed, 4 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d82e556d/ui/scripts/cloudStack.js
----------------------------------------------------------------------
diff --git a/ui/scripts/cloudStack.js b/ui/scripts/cloudStack.js
index c5aa89c..a76e101 100644
--- a/ui/scripts/cloudStack.js
+++ b/ui/scripts/cloudStack.js
@@ -407,14 +407,11 @@
         // Localization
         if (!$.isFunction(cloudStack.localizationFn)) { // i.e., localize is overridden by a plugin/module
             cloudStack.localizationFn = function(str) {
-                return dictionary[str];
+                // look in dictionary first; if not found, try dictionary2
+                var localized = dictionary[str];
+                return localized ? localized : dictionary2[str]; 
             };
         }
-        
-        //added for dictionary split up
-        if (dictionary != undefined && dictionary2 != undefined) {
-            $.extend(dictionary,dictionary2);
-        }
 
         // Localize validation messages
         cloudStack.localizeValidatorMessages();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d82e556d/ui/scripts/sharedFunctions.js
----------------------------------------------------------------------
diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js
index cba6fc6..6bcc50e 100644
--- a/ui/scripts/sharedFunctions.js
+++ b/ui/scripts/sharedFunctions.js
@@ -1454,9 +1454,7 @@ var processPropertiesInImagestoreObject = function(jsonObj) {
         }
         return vmName;
     }
-
-var dictionary = {}, dictionary2 = {}; //for globalization
-    
+  
 var timezoneMap = new Object();
 timezoneMap["Etc/GMT+12"] = "Etc/GMT+12 [GMT-12:00]";
 timezoneMap["Etc/GMT+11"] = "Etc/GMT+11 [GMT-11:00]";


[20/28] git commit: updated refs/heads/master to 8c9093b

Posted by ra...@apache.org.
CLOUDSTACK-7864: CPVM continues to be in Stopped state after a failure to start because of a management server restart. Added optimization to purge queue items for cancelled jobs.


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

Branch: refs/heads/master
Commit: 0c45c96ec718edf29ba55fea7dbfda04cc3495e5
Parents: f2cedda
Author: Min Chen <mi...@citrix.com>
Authored: Tue Nov 11 10:38:46 2014 -0800
Committer: Min Chen <mi...@citrix.com>
Committed: Tue Nov 11 11:11:18 2014 -0800

----------------------------------------------------------------------
 .../framework/jobs/impl/AsyncJobManagerImpl.java   | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0c45c96e/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
----------------------------------------------------------------------
diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
index 0e00a88..2ba5d1e 100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
@@ -981,13 +981,20 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
                     // purge sync queue item running on this ms node
                     _queueMgr.cleanupActiveQueueItems(msid, true);
                     // reset job status for all jobs running on this ms node
-                    _jobDao.resetJobProcess(msid, ApiErrorCode.INTERNAL_ERROR.getHttpCode(), "job cancelled because of management server restart or shutdown");
-                    // purge those queue items for those cancelled jobs above, which may not be picked up by any MS node yet
-                    List<AsyncJobVO> cancelJobs = _jobDao.getResetJobs(msid);
-                    for (AsyncJobVO job : cancelJobs){
+                    List<AsyncJobVO> jobs = _jobDao.getResetJobs(msid);
+                    for (AsyncJobVO job : jobs) {
+                        if (s_logger.isDebugEnabled()) {
+                            s_logger.debug("Cancel left-over job-" + job.getId());
+                        }
+                        job.setStatus(JobInfo.Status.FAILED);
+                        job.setResultCode(ApiErrorCode.INTERNAL_ERROR.getHttpCode());
+                        job.setResult("job cancelled because of management server restart or shutdown");
+                        _jobDao.update(job.getId(), job);
+                        if (s_logger.isDebugEnabled()) {
+                            s_logger.debug("Purge queue item for cancelled job-" + job.getId());
+                        }
                         _queueMgr.purgeAsyncJobQueueItemId(job.getId());
                     }
-
                 }
             });
         } catch (Throwable e) {


[19/28] git commit: updated refs/heads/master to 8c9093b

Posted by ra...@apache.org.
CLOUDSTACK-7884: Cloudstack MS is not responding (happening randomly) after some restart.


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

Branch: refs/heads/master
Commit: f2cedda9efece05ef702170d5b6d3858a44de3f9
Parents: 7efc4c3
Author: Min Chen <mi...@citrix.com>
Authored: Fri Oct 31 17:20:16 2014 -0700
Committer: Min Chen <mi...@citrix.com>
Committed: Tue Nov 11 09:19:21 2014 -0800

----------------------------------------------------------------------
 .../cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java     | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f2cedda9/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
----------------------------------------------------------------------
diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
index d5f7f9d..0e00a88 100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
@@ -61,6 +61,7 @@ import com.cloud.cluster.ManagementServerHost;
 import com.cloud.utils.DateUtil;
 import com.cloud.utils.Pair;
 import com.cloud.utils.Predicate;
+import com.cloud.utils.component.ComponentLifecycle;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.concurrency.NamedThreadFactory;
 import com.cloud.utils.db.DB;
@@ -1035,7 +1036,9 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
     private GenericSearchBuilder<AsyncJobJoinMapVO, Long> JoinJobTimeSearch;
 
     protected AsyncJobManagerImpl() {
-
+        // override default run level for manager components to start this early, otherwise, VirtualMachineManagerImpl will
+        // get stuck in non-initializing job queue
+        setRunLevel(ComponentLifecycle.RUN_LEVEL_FRAMEWORK);
     }
 
     private void publishOnEventBus(AsyncJob job, String jobEvent) {


[27/28] git commit: updated refs/heads/master to 8c9093b

Posted by ra...@apache.org.
CLOUDSTACK-7898: Add properties file in same folder as template

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

Branch: refs/heads/master
Commit: 8b7c1d7c5e1d7b4396c57d4cf20b24217335bc8e
Parents: 9809164
Author: Mike Tutkowski <mi...@solidfire.com>
Authored: Wed Nov 12 21:03:03 2014 -0700
Committer: Mike Tutkowski <mi...@solidfire.com>
Committed: Wed Nov 12 21:03:03 2014 -0700

----------------------------------------------------------------------
 .../resource/Xenserver625StorageProcessor.java  | 25 +++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8b7c1d7c/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java
index 20baffd..eec01db 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java
@@ -904,10 +904,29 @@ public class Xenserver625StorageProcessor extends XenServerStorageProcessor {
             }
 
             destVdi = VDI.getByUuid(conn, destVdiUuid);
-            String templatePath = destDir + "/" + destVdiUuid + ".vhd";
-            templatePath = templatePath.replaceAll("//","/");
+
+            // scan makes XenServer pick up VDI physicalSize
+            destSr.scan(conn);
+
+            String templateUuid = destVdi.getUuid(conn);
+            String templateFilename = templateUuid + ".vhd";
+            long virtualSize = destVdi.getVirtualSize(conn);
+            long physicalSize = destVdi.getPhysicalUtilisation(conn);
+
+            String templatePath = destNfsPath + "/" + destDir;
+
+            templatePath = templatePath.replaceAll("//", "/");
+
+            result = hypervisorResource.postCreatePrivateTemplate(conn, templatePath, templateFilename, templateUuid, nameLabel, null,
+                    physicalSize, virtualSize, destObj.getId());
+
+            if (!result) {
+                throw new CloudRuntimeException("Could not create the template.properties file on secondary storage dir");
+            }
+
             TemplateObjectTO newTemplate = new TemplateObjectTO();
-            newTemplate.setPath(templatePath);
+
+            newTemplate.setPath(destDir + "/" + templateFilename);
             newTemplate.setFormat(Storage.ImageFormat.VHD);
             newTemplate.setSize(destVdi.getVirtualSize(conn));
             newTemplate.setPhysicalSize(destVdi.getPhysicalUtilisation(conn));


[11/28] git commit: updated refs/heads/master to 8c9093b

Posted by ra...@apache.org.
CLOUDSTACK-7823: test_snapshots.py - remove 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/53694133
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/53694133
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/53694133

Branch: refs/heads/master
Commit: 53694133d8848d56cdf10bf756022b3f2e9cf8d0
Parents: 23df5f2
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Fri Oct 31 11:52:44 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Mon Nov 10 17:17:32 2014 +0530

----------------------------------------------------------------------
 test/integration/component/test_snapshots.py | 46 ++++++++++-------------
 1 file changed, 20 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/53694133/test/integration/component/test_snapshots.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_snapshots.py b/test/integration/component/test_snapshots.py
index 0811eb1..62f2f06 100644
--- a/test/integration/component/test_snapshots.py
+++ b/test/integration/component/test_snapshots.py
@@ -186,37 +186,17 @@ class TestSnapshots(cloudstackTestCase):
         cls.services["zoneid"] = cls.zone.id
         cls.services["diskoffering"] = cls.disk_offering.id
 
-        # Create VMs, NAT Rules etc
-        cls.account = Account.create(
-                            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.virtual_machine = cls.virtual_machine_with_disk = \
-                    VirtualMachine.create(
-                                cls.api_client,
-                                cls.services["server_with_disk"],
-                                templateid=cls.template.id,
-                                accountid=cls.account.name,
-                                domainid=cls.account.domainid,
-                                serviceofferingid=cls.service_offering.id,
-                                mode=cls.services["mode"]
-                                )
 
         # Get Hypervisor Type
         cls.hypervisor = (get_hypervisor_type(cls.api_client)).lower()
 
         cls._cleanup = [
                         cls.service_offering,
-                        cls.disk_offering,
-                        cls.account,
+                        cls.disk_offering
                         ]
         return
 
@@ -233,7 +213,25 @@ class TestSnapshots(cloudstackTestCase):
         self.apiclient = self.testClient.getApiClient()
         self.hypervisor = str(self.testClient.getHypervisorInfo()).lower()
         self.dbclient = self.testClient.getDbConnection()
-        self.cleanup = []
+
+        # Create VMs, NAT Rules etc
+        self.account = Account.create(
+                            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"]
+                                )
+        self.cleanup = [self.account, ]
         return
 
     def tearDown(self):
@@ -853,8 +851,6 @@ class TestSnapshots(cloudstackTestCase):
                                     serviceofferingid=self.service_offering.id,
                                     mode=self.services["mode"]
                                     )
-        self.cleanup.append(new_virtual_machine)
-
         try:
             #Login to VM & mount directory
             ssh = new_virtual_machine.get_ssh_client()
@@ -942,8 +938,6 @@ class TestCreateVMSnapshotTemplate(cloudstackTestCase):
                             domainid=cls.domain.id
                             )
 
-        cls.services["account"] = cls.account.name
-
         cls.service_offering = ServiceOffering.create(
                                             cls.api_client,
                                             cls.services["service_offering"]


[25/28] git commit: updated refs/heads/master to 8c9093b

Posted by ra...@apache.org.
CLOUDSTACK-7887: change int to str into swiftxen


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

Branch: refs/heads/master
Commit: 6c955a3a472da1308a5336a48b29514b78c543e4
Parents: a4b92e9
Author: Pierre-Luc Dion <pd...@apache.org>
Authored: Wed Nov 12 19:18:37 2014 -0500
Committer: Pierre-Luc Dion <pd...@apache.org>
Committed: Wed Nov 12 19:22:13 2014 -0500

----------------------------------------------------------------------
 scripts/vm/hypervisor/xenserver/swiftxen | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6c955a3a/scripts/vm/hypervisor/xenserver/swiftxen
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/swiftxen b/scripts/vm/hypervisor/xenserver/swiftxen
index 8342238..f56d5ad 100644
--- a/scripts/vm/hypervisor/xenserver/swiftxen
+++ b/scripts/vm/hypervisor/xenserver/swiftxen
@@ -69,7 +69,7 @@ def upload(args):
             if size > MAX_SEG_SIZE :        
                 segment = 1
         if segment :             
-            cmd = [SWIFT, "-A", url, "-U", account + ":" + username, "-K", key, "upload", "-S", MAX_SEG_SIZE, container, lfilename]
+            cmd = [SWIFT, "-A", url, "-U", account + ":" + username, "-K", key, "upload", "-S", str(MAX_SEG_SIZE), container, lfilename]
         else :
             cmd = [SWIFT, "-A", url ,"-U", account + ":" + username, "-K", key, "upload", container, lfilename]
         util.pread2(cmd)


[10/28] git commit: updated refs/heads/master to 8c9093b

Posted by ra...@apache.org.
CLOUDSTACK-7856: test_vpc_network_pf_rules.py - Check if httpd service is running or not, if not, start it

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/23df5f22
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/23df5f22
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/23df5f22

Branch: refs/heads/master
Commit: 23df5f22ac96bf8032d10a5b65c6016534d67fcb
Parents: 2f7959d
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Thu Nov 6 18:23:08 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Mon Nov 10 17:07:46 2014 +0530

----------------------------------------------------------------------
 .../component/test_vpc_network_pfrules.py       | 51 ++++++++++++++------
 1 file changed, 36 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/23df5f22/test/integration/component/test_vpc_network_pfrules.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_network_pfrules.py b/test/integration/component/test_vpc_network_pfrules.py
index c3a8161..e49642b 100644
--- a/test/integration/component/test_vpc_network_pfrules.py
+++ b/test/integration/component/test_vpc_network_pfrules.py
@@ -18,7 +18,7 @@
 """ Component tests for VPC network functionality - Port Forwarding Rules.
 """
 from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
 from marvin.lib.base import (stopRouter,
                                          startRouter,
                                          Account,
@@ -327,20 +327,31 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
                 else:
                     self.debug("Failed to SSH into VM - %s" % (public_ip.ipaddress.ipaddress))
 
-    def check_wget_from_vm(self, vm, public_ip, testnegative=False):
+    def check_wget_from_vm(self, vm, public_ip, network=None, testnegative=False, isVmAccessible=True):
         import urllib
         self.debug("Checking if we can wget from a VM=%s http server on public_ip=%s"  % (vm.name, public_ip.ipaddress.ipaddress))
         try:
+                if not isVmAccessible:
+                    self.create_natrule(vm, public_ip, network)
+                # Start httpd service on VM first
+                sshClient = vm.get_ssh_client()
+                sshClient.execute("service httpd start")
+                time.sleep(5)
+                ssh_response = str(sshClient.execute("service httpd status")).lower()
+                self.debug("httpd service status is: %s" % ssh_response)
+                if not "running" in ssh_response:
+                    raise Exception("Failed to start httpd service")
+
                 urllib.urlretrieve("http://%s/test.html" % public_ip.ipaddress.ipaddress, filename="test.html")
                 if not testnegative:
                     self.debug("Successesfull to wget from VM=%s http server on public_ip=%s" % (vm.name, public_ip.ipaddress.ipaddress))
                 else:
                     self.fail("Successesfull to wget from VM=%s http server on public_ip=%s" % (vm.name, public_ip.ipaddress.ipaddress))
-        except:
+        except Exception as e:
                 if not testnegative:
-                    self.fail("Failed to wget from VM=%s http server on public_ip=%s" % (vm.name, public_ip.ipaddress.ipaddress))
+                    self.fail("Failed to wget from VM=%s http server on public_ip=%s: %s" % (vm.name, public_ip.ipaddress.ipaddress, e))
                 else:
-                    self.debug("Failed to wget from VM=%s http server on public_ip=%s" % (vm.name, public_ip.ipaddress.ipaddress))
+                    self.debug("Failed to wget from VM=%s http server on public_ip=%s: %s" % (vm.name, public_ip.ipaddress.ipaddress, e))
 
     def create_natrule(self, vm, public_ip, network, services=None):
         self.debug("Creating NAT rule in network for vm with public IP")
@@ -687,7 +698,8 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
         nat_rule.delete(self.apiclient)
         self.start_vpcrouter(router)
         self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=True)
-        self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True)
+        self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True,
+                isVmAccessible=False, network=network_1)
         return
 
     @attr(tags=["advanced", "intervlan"], required_hardware="true")
@@ -717,7 +729,8 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
         http_rule.delete(self.apiclient)
         nat_rule.delete(self.apiclient)
         self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=True)
-        self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True)
+        self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True,
+                isVmAccessible=False, network=network_1)
         return
 
     @attr(tags=["advanced", "intervlan"], required_hardware="true")
@@ -781,10 +794,14 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
         self.check_ssh_into_vm(vm_2, public_ip_2, testnegative=True)
         self.check_ssh_into_vm(vm_3, public_ip_3, testnegative=True)
         self.check_ssh_into_vm(vm_4, public_ip_4, testnegative=True)
-        self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True)
-        self.check_wget_from_vm(vm_2, public_ip_2, testnegative=True)
-        self.check_wget_from_vm(vm_3, public_ip_3, testnegative=True)
-        self.check_wget_from_vm(vm_4, public_ip_4, testnegative=True)
+        self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True,
+                isVmAccessible=False, network=network_1)
+        self.check_wget_from_vm(vm_2, public_ip_2, testnegative=True,
+                isVmAccessible=False, network=network_1)
+        self.check_wget_from_vm(vm_3, public_ip_3, testnegative=True,
+                isVmAccessible=False, network=network_2)
+        self.check_wget_from_vm(vm_4, public_ip_4, testnegative=True,
+                isVmAccessible=False, network=network_2)
         return
 
     @attr(tags=["advanced", "intervlan"], required_hardware="true")
@@ -843,8 +860,12 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
         self.check_ssh_into_vm(vm_2, public_ip_2, testnegative=True)
         self.check_ssh_into_vm(vm_3, public_ip_3, testnegative=True)
         self.check_ssh_into_vm(vm_4, public_ip_4, testnegative=True)
-        self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True)
-        self.check_wget_from_vm(vm_2, public_ip_2, testnegative=True)
-        self.check_wget_from_vm(vm_3, public_ip_3, testnegative=True)
-        self.check_wget_from_vm(vm_4, public_ip_4, testnegative=True)
+        self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True,
+                isVmAccessible=False, network=network_1)
+        self.check_wget_from_vm(vm_2, public_ip_2, testnegative=True,
+                isVmAccessible=False, network=network_1)
+        self.check_wget_from_vm(vm_3, public_ip_3, testnegative=True,
+                isVmAccessible=False, network=network_2)
+        self.check_wget_from_vm(vm_4, public_ip_4, testnegative=True,
+                isVmAccessible=False, network=network_2)
         return


[05/28] git commit: updated refs/heads/master to 8c9093b

Posted by ra...@apache.org.
CLOUDSTACK-7763 Reservations for VMware VMs remain after dynamic scaling


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

Branch: refs/heads/master
Commit: 0e7f1ea9b819de197e70a088e92d7ffb7016d063
Parents: de3eb88
Author: Bharat Kumar <bh...@citrix.com>
Authored: Wed Oct 22 11:29:22 2014 +0530
Committer: Kishan Kavala <ki...@apache.org>
Committed: Mon Nov 10 15:07:13 2014 +0530

----------------------------------------------------------------------
 .../src/com/cloud/hypervisor/vmware/resource/VmwareResource.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0e7f1ea9/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index 085b6bb..fa66769 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -1281,7 +1281,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
             VmwareHypervisorHost hyperHost = getHyperHost(context);
             VirtualMachineMO vmMo = hyperHost.findVmOnHyperHost(cmd.getVmName());
             VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec();
-            int ramMb = (int)(vmSpec.getMinRam() / (1024 * 1024));
+            int ramMb = getReservedMemoryMb(vmSpec);
             long hotaddIncrementSizeInMb;
             long hotaddMemoryLimitInMb;
             long requestedMaxMemoryInMb = vmSpec.getMaxRam() / (1024 * 1024);


[06/28] git commit: updated refs/heads/master to 8c9093b

Posted by ra...@apache.org.
CLOUDSTACK-7872: network getting shutdown inspite of running VM's in the network


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

Branch: refs/heads/master
Commit: 0bd34d389f93b56e74a6bb04054c8e419bf8571e
Parents: 36fd780
Author: Jayapal <ja...@apache.org>
Authored: Fri Nov 7 09:37:32 2014 +0530
Committer: Jayapal <ja...@apache.org>
Committed: Mon Nov 10 15:26:48 2014 +0530

----------------------------------------------------------------------
 .../com/cloud/network/dao/NetworkDaoImpl.java   |  2 --
 engine/schema/src/com/cloud/vm/dao/NicDao.java  |  2 ++
 .../schema/src/com/cloud/vm/dao/NicDaoImpl.java | 22 ++++++++++++++++++++
 .../src/com/cloud/network/NetworkModelImpl.java |  7 +++++++
 4 files changed, 31 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0bd34d38/engine/schema/src/com/cloud/network/dao/NetworkDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/NetworkDaoImpl.java b/engine/schema/src/com/cloud/network/dao/NetworkDaoImpl.java
index 0c556c8..4a07455 100644
--- a/engine/schema/src/com/cloud/network/dao/NetworkDaoImpl.java
+++ b/engine/schema/src/com/cloud/network/dao/NetworkDaoImpl.java
@@ -244,7 +244,6 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
         GarbageCollectedSearch = createSearchBuilder(Long.class);
         GarbageCollectedSearch.selectFields(GarbageCollectedSearch.entity().getId());
         SearchBuilder<NetworkOpVO> join7 = _ntwkOpDao.createSearchBuilder();
-        join7.and("activenics", join7.entity().getActiveNicsCount(), Op.EQ);
         join7.and("gc", join7.entity().isGarbageCollected(), Op.EQ);
         join7.and("check", join7.entity().isCheckForGc(), Op.EQ);
         GarbageCollectedSearch.join("ntwkOpGC", join7, GarbageCollectedSearch.entity().getId(), join7.entity().getId(), JoinBuilder.JoinType.INNER);
@@ -438,7 +437,6 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
     public List<Long> findNetworksToGarbageCollect() {
         SearchCriteria<Long> sc = GarbageCollectedSearch.create();
         sc.setJoinParameters("ntwkOffGC", "isPersistent", false);
-        sc.setJoinParameters("ntwkOpGC", "activenics", 0);
         sc.setJoinParameters("ntwkOpGC", "gc", true);
         sc.setJoinParameters("ntwkOpGC", "check", true);
         return customSearch(sc, null);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0bd34d38/engine/schema/src/com/cloud/vm/dao/NicDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/dao/NicDao.java b/engine/schema/src/com/cloud/vm/dao/NicDao.java
index a7ad016..9f153f8 100644
--- a/engine/schema/src/com/cloud/vm/dao/NicDao.java
+++ b/engine/schema/src/com/cloud/vm/dao/NicDao.java
@@ -74,4 +74,6 @@ public interface NicDao extends GenericDao<NicVO, Long> {
     List<NicVO> listByNetworkIdTypeAndGatewayAndBroadcastUri(long networkId, VirtualMachine.Type vmType, String gateway, URI broadcastUri);
 
     int countNicsForStartingVms(long networkId);
+
+    int countNicsForRunningVms(long networkId);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0bd34d38/engine/schema/src/com/cloud/vm/dao/NicDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/dao/NicDaoImpl.java b/engine/schema/src/com/cloud/vm/dao/NicDaoImpl.java
index 2a9a602..ca44b63 100644
--- a/engine/schema/src/com/cloud/vm/dao/NicDaoImpl.java
+++ b/engine/schema/src/com/cloud/vm/dao/NicDaoImpl.java
@@ -46,6 +46,7 @@ public class NicDaoImpl extends GenericDaoBase<NicVO, Long> implements NicDao {
     private SearchBuilder<NicVO> NonReleasedSearch;
     private GenericSearchBuilder<NicVO, Integer> CountBy;
     private GenericSearchBuilder<NicVO, Integer> CountByForStartingVms;
+    private GenericSearchBuilder<NicVO, Integer> CountByForRunningVms;
 
     @Inject
     VMInstanceDao _vmDao;
@@ -95,6 +96,17 @@ public class NicDaoImpl extends GenericDaoBase<NicVO, Long> implements NicDao {
         join1.and("state", join1.entity().getState(), Op.EQ);
         CountByForStartingVms.join("vm", join1, CountByForStartingVms.entity().getInstanceId(), join1.entity().getId(), JoinBuilder.JoinType.INNER);
         CountByForStartingVms.done();
+
+        CountByForRunningVms = createSearchBuilder(Integer.class);
+        CountByForRunningVms.select(null, Func.COUNT, CountByForRunningVms.entity().getId());
+        CountByForRunningVms.and("networkId", CountByForRunningVms.entity().getNetworkId(), Op.EQ);
+        CountByForRunningVms.and("removed", CountByForRunningVms.entity().getRemoved(), Op.NULL);
+        SearchBuilder<VMInstanceVO> join2 = _vmDao.createSearchBuilder();
+        join2.and("state", join2.entity().getState(), Op.EQ);
+        join2.and("type", join2.entity().getType(), Op.EQ);
+        CountByForRunningVms.join("vm", join2, CountByForRunningVms.entity().getInstanceId(), join2.entity().getId(), JoinBuilder.JoinType.INNER);
+        CountByForRunningVms.done();
+
     }
 
     @Override
@@ -291,4 +303,14 @@ public class NicDaoImpl extends GenericDaoBase<NicVO, Long> implements NicDao {
         List<Integer> results = customSearch(sc, null);
         return results.get(0);
     }
+
+    @Override
+    public int countNicsForRunningVms(long networkId) {
+        SearchCriteria<Integer> sc = CountByForRunningVms.create();
+        sc.setParameters("networkId", networkId);
+        sc.setJoinParameters("vm", "state", VirtualMachine.State.Running);
+        sc.setJoinParameters("vm", "type", VirtualMachine.Type.User);
+        List<Integer> results = customSearch(sc, null);
+        return results.get(0);
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0bd34d38/server/src/com/cloud/network/NetworkModelImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkModelImpl.java b/server/src/com/cloud/network/NetworkModelImpl.java
index 1dc81bd..2edf970 100755
--- a/server/src/com/cloud/network/NetworkModelImpl.java
+++ b/server/src/com/cloud/network/NetworkModelImpl.java
@@ -2232,6 +2232,13 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel {
             return false;
         }
 
+        // Due to VMSync issue, there can be cases where nic count is zero, but there can be VM's running in the network
+        // so add extra guard to check if network GC is actially required.
+        if (_nicDao.countNicsForRunningVms(networkId) > 0) {
+            s_logger.debug("Network id=" + networkId + " is not ready for GC as it has vms that are Running at the moment");
+            return false;
+        }
+
         return true;
     }
 


[28/28] git commit: updated refs/heads/master to 8c9093b

Posted by ra...@apache.org.
Merge branch '4.5'

Conflicts:
	framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
	plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java
	setup/db/db/schema-441to450.sql
	test/integration/component/test_escalations_instances.py
	ui/dictionary2.jsp
	ui/scripts/cloudStack.js

This closes #38


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

Branch: refs/heads/master
Commit: 8c9093b1dff811803e48561b86a90731f2d4e8cb
Parents: b8fdda0 8b7c1d7
Author: Rajani Karuturi <ra...@gmail.com>
Authored: Thu Nov 13 14:45:59 2014 +0530
Committer: Rajani Karuturi <ra...@gmail.com>
Committed: Thu Nov 13 14:53:05 2014 +0530

----------------------------------------------------------------------
 ui/dictionary2.jsp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8c9093b1/ui/dictionary2.jsp
----------------------------------------------------------------------
diff --cc ui/dictionary2.jsp
index a755ebc,28b4f05..a76ba3b
--- a/ui/dictionary2.jsp
+++ b/ui/dictionary2.jsp
@@@ -1012,6 -1012,6 +1012,6 @@@ $.extend(dictionary, 
  'state.detached': '<fmt:message key="state.detached" />',
  'label.na': '<fmt:message key="label.na" />',
  'label.added.network.offering': '<fmt:message key="label.added.network.offering" />',
- 'label.no': '<fmt:message key="label.no" />',
+ 'label.no': '<fmt:message key="label.no" />'
 -};
 +});
  </script>


[14/28] git commit: updated refs/heads/master to 8c9093b

Posted by ra...@apache.org.
CLOUDSTACK-7871: allow VM and template details update using update APIs

Allows updating details (key/value) pair which updatse entries
invm_template_details and user_vm_details tables using updateVM and updateTemplate
APIs. This allows sys admins to update nics, controllers etc without DB hacking.

Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
(cherry picked from commit 97fa4a023e2346b3b9f56bf213ed4125c371ca6d)
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/c401dbc8
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c401dbc8
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c401dbc8

Branch: refs/heads/master
Commit: c401dbc8f986563159f49f5c419ad31437ef9d04
Parents: 85ac979
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Mon Nov 10 17:51:25 2014 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Nov 10 17:53:26 2014 +0530

----------------------------------------------------------------------
 .../cloudstack/api/BaseUpdateTemplateOrIsoCmd.java | 17 ++++++++++++++++-
 .../api/command/user/vm/UpdateVMCmd.java           | 16 ++++++++++++++++
 .../com/cloud/template/TemplateManagerImpl.java    |  8 +++++++-
 server/src/com/cloud/vm/UserVmManagerImpl.java     |  6 ++++++
 4 files changed, 45 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c401dbc8/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java b/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java
index 2350f6b..2754b25 100644
--- a/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java
@@ -22,6 +22,9 @@ import org.apache.cloudstack.api.command.user.iso.UpdateIsoCmd;
 import org.apache.cloudstack.api.response.GuestOSResponse;
 import org.apache.cloudstack.api.response.TemplateResponse;
 
+import java.util.Collection;
+import java.util.Map;
+
 public abstract class BaseUpdateTemplateOrIsoCmd extends BaseCmd {
     public static final Logger s_logger = Logger.getLogger(UpdateIsoCmd.class.getName());
 
@@ -64,6 +67,9 @@ public abstract class BaseUpdateTemplateOrIsoCmd extends BaseCmd {
     @Parameter(name = ApiConstants.ROUTING, type = CommandType.BOOLEAN, description = "true if the template type is routing i.e., if template is used to deploy router")
     protected Boolean isRoutingType;
 
+    @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "Details in key/value pairs.")
+    protected Map details;
+
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
@@ -107,4 +113,13 @@ public abstract class BaseUpdateTemplateOrIsoCmd extends BaseCmd {
     public Boolean isRoutingType() {
         return isRoutingType;
     }
-}
+
+    public Map getDetails() {
+        if (this.details == null || this.details.isEmpty()) {
+            return null;
+        }
+
+        Collection paramsCollection = this.details.values();
+        return (Map) (paramsCollection.toArray())[0];
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c401dbc8/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java
index d185b91..6954832 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java
@@ -38,6 +38,9 @@ import com.cloud.user.Account;
 import com.cloud.uservm.UserVm;
 import com.cloud.vm.VirtualMachine;
 
+import java.util.Collection;
+import java.util.Map;
+
 @APICommand(name = "updateVirtualMachine", description="Updates properties of a virtual machine. The VM has to be stopped and restarted for the " +
         "new properties to take effect. UpdateVirtualMachine does not first check whether the VM is stopped. " +
         "Therefore, stop the VM manually before issuing this call.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class},
@@ -90,6 +93,9 @@ public class UpdateVMCmd extends BaseCustomIdCmd {
     @Parameter(name = ApiConstants.INSTANCE_NAME, type = CommandType.STRING, description = "instance name of the user vm", since = "4.4", authorized = {RoleType.Admin})
     private String instanceName;
 
+    @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "Details in key/value pairs.")
+    protected Map details;
+
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
@@ -129,6 +135,16 @@ public class UpdateVMCmd extends BaseCustomIdCmd {
     public String getInstanceName() {
         return instanceName;
     }
+
+    public Map getDetails() {
+        if (this.details == null || this.details.isEmpty()) {
+            return null;
+        }
+
+        Collection paramsCollection = this.details.values();
+        return (Map) (paramsCollection.toArray())[0];
+    }
+
 /////////////////////////////////////////////////////
     /////////////// API Implementation///////////////////
     /////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c401dbc8/server/src/com/cloud/template/TemplateManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/template/TemplateManagerImpl.java b/server/src/com/cloud/template/TemplateManagerImpl.java
index c7d2283..5641f57 100755
--- a/server/src/com/cloud/template/TemplateManagerImpl.java
+++ b/server/src/com/cloud/template/TemplateManagerImpl.java
@@ -1776,6 +1776,7 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
         Boolean isRoutingTemplate = cmd.isRoutingType();
         Boolean bootable = cmd.isBootable();
         Integer sortKey = cmd.getSortKey();
+        Map details = cmd.getDetails();
         Account account = CallContext.current().getCallingAccount();
 
         // verify that template exists
@@ -1798,7 +1799,7 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
 
         boolean updateNeeded =
                 !(name == null && displayText == null && format == null && guestOSId == null && passwordEnabled == null && bootable == null && sortKey == null &&
-                        isDynamicallyScalable == null && isRoutingTemplate == null);
+                        isDynamicallyScalable == null && isRoutingTemplate == null && details == null);
         if (!updateNeeded) {
             return template;
         }
@@ -1858,6 +1859,11 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
             }
         }
 
+        if (details != null && !details.isEmpty()) {
+            template.setDetails(details);
+            _tmpltDao.saveDetails(template);
+        }
+
         _tmpltDao.update(id, template);
 
         return _tmpltDao.findById(id);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c401dbc8/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 28ec6ec..77ace7a 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -1899,6 +1899,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
         String userData = cmd.getUserData();
         Boolean isDynamicallyScalable = cmd.isDynamicallyScalable();
         String hostName = cmd.getHostName();
+        Map details = cmd.getDetails();
         Account caller = CallContext.current().getCallingAccount();
 
         // Input validation and permission checks
@@ -1938,6 +1939,11 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
 
         }
 
+        if (details != null && !details.isEmpty()) {
+            vmInstance.setDetails(details);
+            _vmDao.saveDetails(vmInstance);
+        }
+
         return updateVirtualMachine(id, displayName, group, ha, isDisplayVm, osTypeId, userData, isDynamicallyScalable,
                 cmd.getHttpMethod(), cmd.getCustomId(), hostName, cmd.getInstanceName());
     }


[17/28] git commit: updated refs/heads/master to 8c9093b

Posted by ra...@apache.org.
CLOUDSTACK-7880: Creating shared network results in exception
This is due to event publish being wrapped in a transaction, moved it outside of transaction scope.


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

Branch: refs/heads/master
Commit: 6d268db217a0c9dd0701a85f4d0244461c9ebd0b
Parents: 32dc524
Author: Koushik Das <ko...@apache.org>
Authored: Tue Nov 11 16:32:20 2014 +0530
Committer: Koushik Das <ko...@apache.org>
Committed: Tue Nov 11 16:32:20 2014 +0530

----------------------------------------------------------------------
 .../orchestration/NetworkOrchestrator.java      |  9 --
 .../com/cloud/network/NetworkServiceImpl.java   | 92 ++++++++++++--------
 2 files changed, 55 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6d268db2/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
index 553bca1..17a2a9b 100755
--- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
@@ -39,7 +39,6 @@ import javax.naming.ConfigurationException;
 
 import org.apache.log4j.Logger;
 import org.apache.cloudstack.acl.ControlledEntity.ACLType;
-import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.context.CallContext;
 import org.apache.cloudstack.engine.cloud.entity.api.db.VMNetworkMapVO;
 import org.apache.cloudstack.engine.cloud.entity.api.db.dao.VMNetworkMapDao;
@@ -676,14 +675,6 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
 
                         if (domainId != null && aclType == ACLType.Domain) {
                             _networksDao.addDomainToNetwork(id, domainId, subdomainAccess == null ? true : subdomainAccess);
-                            //send event for storing the domain wide resource access
-                            Map<String, Object> params = new HashMap<String, Object>();
-                            params.put(ApiConstants.ENTITY_TYPE, Network.class);
-                            params.put(ApiConstants.ENTITY_ID, id);
-                            params.put(ApiConstants.DOMAIN_ID, domainId);
-                            params.put(ApiConstants.SUBDOMAIN_ACCESS, subdomainAccess == null ? true : subdomainAccess);
-                            _messageBus.publish(_name, EntityManager.MESSAGE_ADD_DOMAIN_WIDE_ENTITY_EVENT,
-                                    PublishScope.LOCAL, params);
                         }
                     }
                 });

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6d268db2/server/src/com/cloud/network/NetworkServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkServiceImpl.java b/server/src/com/cloud/network/NetworkServiceImpl.java
index 9f34d1f..1b243d0 100755
--- a/server/src/com/cloud/network/NetworkServiceImpl.java
+++ b/server/src/com/cloud/network/NetworkServiceImpl.java
@@ -150,8 +150,10 @@ import com.cloud.vm.dao.NicSecondaryIpDao;
 import com.cloud.vm.dao.NicSecondaryIpVO;
 import com.cloud.vm.dao.UserVmDao;
 import com.cloud.vm.dao.VMInstanceDao;
+
 import org.apache.cloudstack.acl.ControlledEntity.ACLType;
 import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.command.admin.network.CreateNetworkCmdByAdmin;
 import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd;
 import org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd;
@@ -163,12 +165,15 @@ import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
 import org.apache.cloudstack.context.CallContext;
 import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.cloudstack.framework.messagebus.MessageBus;
+import org.apache.cloudstack.framework.messagebus.PublishScope;
 import org.apache.cloudstack.network.element.InternalLoadBalancerElementService;
 import org.apache.log4j.Logger;
 
 import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
+
 import java.net.Inet6Address;
 import java.net.InetAddress;
 import java.net.URI;
@@ -318,6 +323,9 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
     @Inject
     public SecurityGroupService _securityGroupService;
 
+    @Inject
+    MessageBus _messageBus;
+
     int _cidrLimit;
     boolean _allowSubdomainNetworkAccess;
 
@@ -1328,70 +1336,80 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
             final String ip6Cidr, final Boolean displayNetwork, final Long aclId, final String isolatedPvlan, final NetworkOfferingVO ntwkOff, final PhysicalNetwork pNtwk,
             final ACLType aclType, final Account ownerFinal, final String cidr, final boolean createVlan) throws InsufficientCapacityException, ResourceAllocationException {
         try {
-            return Transaction.execute(new TransactionCallbackWithException<Network, Exception>() {
+            Network network = Transaction.execute(new TransactionCallbackWithException<Network, Exception>() {
                 @Override
                 public Network doInTransaction(TransactionStatus status) throws InsufficientCapacityException, ResourceAllocationException {
                     Account owner = ownerFinal;
                     Boolean subdomainAccess = subdomainAccessFinal;
 
-        Long sharedDomainId = null;
-        if (isDomainSpecific) {
-            if (domainId != null) {
-                sharedDomainId = domainId;
-            } else {
-                sharedDomainId = _domainMgr.getDomain(Domain.ROOT_DOMAIN).getId();
-                subdomainAccess = true;
-            }
-        }
+                    Long sharedDomainId = null;
+                    if (isDomainSpecific) {
+                        if (domainId != null) {
+                            sharedDomainId = domainId;
+                        } else {
+                            sharedDomainId = _domainMgr.getDomain(Domain.ROOT_DOMAIN).getId();
+                            subdomainAccess = true;
+                        }
+                    }
 
-        // default owner to system if network has aclType=Domain
-        if (aclType == ACLType.Domain) {
-            owner = _accountMgr.getAccount(Account.ACCOUNT_ID_SYSTEM);
-        }
+                    // default owner to system if network has aclType=Domain
+                    if (aclType == ACLType.Domain) {
+                        owner = _accountMgr.getAccount(Account.ACCOUNT_ID_SYSTEM);
+                    }
 
-        //Create guest network
-        Network network = null;
-        if (vpcId != null) {
+                    // Create guest network
+                    Network network = null;
+                    if (vpcId != null) {
                         if (!_configMgr.isOfferingForVpc(ntwkOff)) {
-                throw new InvalidParameterValueException("Network offering can't be used for VPC networks");
-            }
+                            throw new InvalidParameterValueException("Network offering can't be used for VPC networks");
+                        }
 
                         if (aclId != null) {
-                NetworkACL acl = _networkACLDao.findById(aclId);
+                            NetworkACL acl = _networkACLDao.findById(aclId);
                             if (acl == null) {
-                    throw new InvalidParameterValueException("Unable to find specified NetworkACL");
-                }
+                                throw new InvalidParameterValueException("Unable to find specified NetworkACL");
+                            }
 
                             if (aclId != NetworkACL.DEFAULT_DENY && aclId != NetworkACL.DEFAULT_ALLOW) {
-                    //ACL is not default DENY/ALLOW
-                    // ACL should be associated with a VPC
+                                // ACL is not default DENY/ALLOW
+                                // ACL should be associated with a VPC
                                 if (!vpcId.equals(acl.getVpcId())) {
                                     throw new InvalidParameterValueException("ACL: " + aclId + " do not belong to the VPC");
-                    }
-                }
-            }
+                                }
+                            }
+                        }
                         network = _vpcMgr.createVpcGuestNetwork(networkOfferingId, name, displayText, gateway, cidr, vlanId, networkDomain, owner, sharedDomainId, pNtwk, zoneId,
                                 aclType, subdomainAccess, vpcId, aclId, caller, displayNetwork);
-        } else {
+                    } else {
                         if (_configMgr.isOfferingForVpc(ntwkOff)) {
-                throw new InvalidParameterValueException("Network offering can be used for VPC networks only");
-            }
-            if (ntwkOff.getInternalLb()) {
-                throw new InvalidParameterValueException("Internal Lb can be enabled on vpc networks only");
-            }
+                            throw new InvalidParameterValueException("Network offering can be used for VPC networks only");
+                        }
+                        if (ntwkOff.getInternalLb()) {
+                            throw new InvalidParameterValueException("Internal Lb can be enabled on vpc networks only");
+                        }
 
                         network = _networkMgr.createGuestNetwork(networkOfferingId, name, displayText, gateway, cidr, vlanId, networkDomain, owner, sharedDomainId, pNtwk, zoneId,
                                 aclType, subdomainAccess, vpcId, ip6Gateway, ip6Cidr, displayNetwork, isolatedPvlan);
-        }
+                    }
 
-        if (_accountMgr.isRootAdmin(caller.getId()) && createVlan && network != null) {
-            // Create vlan ip range
+                    if (_accountMgr.isRootAdmin(caller.getId()) && createVlan && network != null) {
+                        // Create vlan ip range
                         _configMgr.createVlanAndPublicIpRange(pNtwk.getDataCenterId(), network.getId(), physicalNetworkId, false, null, startIP, endIP, gateway, netmask, vlanId,
                                 null, startIPv6, endIPv6, ip6Gateway, ip6Cidr);
-        }
+                    }
                     return network;
                 }
             });
+            if (domainId != null && aclType == ACLType.Domain) {
+                // send event for storing the domain wide resource access
+                Map<String, Object> params = new HashMap<String, Object>();
+                params.put(ApiConstants.ENTITY_TYPE, Network.class);
+                params.put(ApiConstants.ENTITY_ID, network.getId());
+                params.put(ApiConstants.DOMAIN_ID, domainId);
+                params.put(ApiConstants.SUBDOMAIN_ACCESS, subdomainAccessFinal == null ? true : subdomainAccessFinal);
+                _messageBus.publish(_name, EntityManager.MESSAGE_ADD_DOMAIN_WIDE_ENTITY_EVENT, PublishScope.LOCAL, params);
+            }
+            return network;
         } catch (Exception e) {
             ExceptionUtil.rethrowRuntime(e);
             ExceptionUtil.rethrow(e, InsufficientCapacityException.class);


[21/28] git commit: updated refs/heads/master to 8c9093b

Posted by ra...@apache.org.
CLOUDSTACK-7886: cloudstackoperations like deployvm,deleteNW are failing if CS fail to contact rabbit mq server. This is happening in case of Async API calls.

Signed-off-by: Koushik Das <ko...@apache.org>


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

Branch: refs/heads/master
Commit: f1361796bf1fc73a65c47583dd0a5d6ef2dc3c27
Parents: 0c45c96
Author: Damodar <da...@citrix.com>
Authored: Tue Nov 11 18:16:06 2014 +0530
Committer: Koushik Das <ko...@apache.org>
Committed: Wed Nov 12 10:24:56 2014 +0530

----------------------------------------------------------------------
 server/src/com/cloud/api/ApiServer.java | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f1361796/server/src/com/cloud/api/ApiServer.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiServer.java b/server/src/com/cloud/api/ApiServer.java
index e29ddd3..2156d60 100755
--- a/server/src/com/cloud/api/ApiServer.java
+++ b/server/src/com/cloud/api/ApiServer.java
@@ -304,11 +304,8 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
         try {
             eventBus.publish(event);
         } catch (EventBusException evx) {
-            String errMsg = "F" +
-                    "" +
-                    "ailed to publish async job event on the the event bus.";
+            String errMsg = "Failed to publish async job event on the the event bus.";
             s_logger.warn(errMsg, evx);
-            throw new CloudRuntimeException(errMsg);
         }
     }
 


[12/28] git commit: updated refs/heads/master to 8c9093b

Posted by ra...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/85ac979f/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 1aaa688..7e4cfe6 100644
--- a/test/integration/component/test_escalations_instances.py
+++ b/test/integration/component/test_escalations_instances.py
@@ -16,17 +16,28 @@
 # under the License.
 
 # Import Local Modules
-from marvin.cloudstackTestCase import *
-from marvin.cloudstackException import *
-from marvin.cloudstackAPI import *
-from marvin.sshClient import SshClient
-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,
+                             ServiceOffering,
+                             NetworkOffering,
+                             Network,
+                             VirtualMachine,
+                             SecurityGroup,
+                             DiskOffering,
+                             Resources,
+                             Iso,
+                             Configurations,
+                             SSHKeyPair,
+                             Volume,
+                             VmSnapshot,
+                             Zone)
+from marvin.lib.common import (get_zone,
+                               get_template,
+                               get_domain)
 from marvin.codes import PASS
 from nose.plugins.attrib import attr
-from time import sleep
-# from ctypes.wintypes import BOOLEAN
+
 
 class TestListInstances(cloudstackTestCase):
 
@@ -40,19 +51,23 @@ class TestListInstances(cloudstackTestCase):
             cls.hypervisor = cls.testClient.getHypervisorInfo()
             # 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"]
+            )
             if cls.zone.localstorageenabled:
                 cls.storagetype = 'local'
-                cls.services["service_offerings"]["tiny"]["storagetype"] = 'local'
+                cls.services["service_offerings"][
+                    "tiny"]["storagetype"] = 'local'
                 cls.services["disk_offering"]["storagetype"] = 'local'
             else:
                 cls.storagetype = 'shared'
-                cls.services["service_offerings"]["tiny"]["storagetype"] = 'shared'
+                cls.services["service_offerings"][
+                    "tiny"]["storagetype"] = 'shared'
                 cls.services["disk_offering"]["storagetype"] = 'shared'
 
             cls.services['mode'] = cls.zone.networktype
@@ -62,32 +77,13 @@ class TestListInstances(cloudstackTestCase):
             cls.services["custom_volume"]["zoneid"] = cls.zone.id
             # Creating Disk offering, Service Offering and Account
             cls.disk_offering = DiskOffering.create(
-                                                    cls.api_client,
-                                                    cls.services["disk_offering"]
-                                                    )
+                cls.api_client,
+                cls.services["disk_offering"]
+            )
             cls.service_offering = ServiceOffering.create(
-                                                          cls.api_client,
-                                                          cls.services["service_offerings"]["tiny"]
-                                                          )
-            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)
-            # Updating resource Limits
-            for i in range(0, 12):
-                Resources.updateLimit(
-                                      cls.api_client,
-                                      account=cls.account.name,
-                                      domainid=cls.domain.id,
-                                      max=-1,
-                                      resourcetype=i
-                                      )
-
-            cls._cleanup.append(cls.account)
+                cls.api_client,
+                cls.services["service_offerings"]["tiny"]
+            )
             cls._cleanup.append(cls.service_offering)
             cls._cleanup.append(cls.disk_offering)
         except Exception as e:
@@ -98,7 +94,27 @@ class TestListInstances(cloudstackTestCase):
     def setUp(self):
 
         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)
+        # Updating resource Limits
+        for i in range(0, 12):
+            Resources.updateLimit(
+                self.api_client,
+                account=self.account.name,
+                domainid=self.domain.id,
+                max=-1,
+                resourcetype=i
+            )
+
+        self.cleanup = [self.account, ]
 
     def tearDown(self):
         # Clean up, terminate the created resources
@@ -115,14 +131,15 @@ class TestListInstances(cloudstackTestCase):
         return
 
     def __verify_values(self, expected_vals, actual_vals):
-        """  
+        """
         @Desc: Function to verify expected and actual values
         @Steps:
         Step1: Initializing return flag to True
-        Step1: Verifying length of expected and actual dictionaries is matching.
+        Step1: Verifying length of expected and actual dictionaries is matching
                If not matching returning false
         Step2: Listing all the keys from expected dictionary
-        Step3: Looping through each key from step2 and verifying expected and actual dictionaries have same value
+        Step3: Looping through each key from step2 and verifying expected and
+               actual dictionaries have same value
                If not making return flag to False
         Step4: returning the return flag after all the values are verified
         """
@@ -139,24 +156,26 @@ class TestListInstances(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="false")
     def test_01_list_instances_pagination(self):
-        """  
+        """
         @Desc: Test List Instances pagination
         @Steps:
         Step1: Listing all the Instances for a user
         Step2: Verifying listed Instances for account created at class level
-        Step3: If number of volumes is less than (page size + 1), then creating them
+        Step3: If number of volumes is less than
+                (page size + 1), then creating them
         Step4: Listing all the volumes again after creation of volumes
         Step5: Verifying the length of the volumes is (page size + 1)
         Step6: Listing all the volumes in page1
-        Step7: Verifying that the length of the volumes in page 1 is (page size)
+        Step7: Verifying that the length of the volumes in page 1 is
+               (page size)
         Step8: Listing all the volumes in page2
         Step9: Verifying that the length of the volumes in page 2 is 1
         Step10: Deleting the volume present in page 2
@@ -164,124 +183,128 @@ class TestListInstances(cloudstackTestCase):
         Step12: Verifying that there are no volumes present in page 2
         """
         # Listing all the instances for a user
-        list_instances_before = VirtualMachine.list(self.userapiclient, listall=self.services["listall"])
+        list_instances_before = VirtualMachine.list(
+            self.userapiclient,
+            listall=self.services["listall"])
 
         # Verifying listed instances for account created at class level
         self.assertIsNone(
-                          list_instances_before,
-                          "Virtual Machine already exists for newly created user"
-                          )
-        # If number of instances are less than (pagesize + 1), then creating them
+            list_instances_before,
+            "Virtual Machine already exists for newly created user"
+        )
+        # If number of instances are less than (pagesize + 1), then creating
+        # them
         for i in range(0, (self.services["pagesize"] + 1)):
             vm_created = VirtualMachine.create(
-                                               self.userapiclient,
-                                               self.services["virtual_machine"],
-                                               accountid=self.account.name,
-                                               domainid=self.account.domainid,
-                                               serviceofferingid=self.service_offering.id,
-                                               )
+                self.userapiclient,
+                self.services["virtual_machine"],
+                accountid=self.account.name,
+                domainid=self.account.domainid,
+                serviceofferingid=self.service_offering.id,
+            )
             self.assertIsNotNone(
-                                 vm_created,
-                                 "VM creation failed"
-                                 )
-            if(i < (self.services["pagesize"])):
-                self.cleanup.append(vm_created)
+                vm_created,
+                "VM creation failed"
+            )
 
             self.assertEqual(
-                             self.services["virtual_machine"]["displayname"],
-                             vm_created.displayname,
-                             "Newly created VM name and the test data VM name are not matching"
-                             )
+                self.services["virtual_machine"]["displayname"],
+                vm_created.displayname,
+                "Newly created VM name and the test data VM name\
+                        are not matching")
 
         # Listing all the instances again after creating VM's
-        list_instances_after = VirtualMachine.list(self.userapiclient, listall=self.services["listall"])
+        list_instances_after = VirtualMachine.list(
+            self.userapiclient,
+            listall=self.services["listall"])
         status = validateList(list_instances_after)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Listing of instances after creation failed"
-                          )
+            PASS,
+            status[0],
+            "Listing of instances after creation failed"
+        )
         # Verifying the length of the instances is (page size + 1)
         self.assertEqual(
-                         len(list_instances_after),
-                         (self.services["pagesize"] + 1),
-                         "Number of instances created is not matching as expected"
-                         )
+            len(list_instances_after),
+            (self.services["pagesize"] + 1),
+            "Number of instances created is not matching as expected"
+        )
 
         # Listing all the volumes in page1
         list_instances_page1 = VirtualMachine.list(
-                                                   self.userapiclient,
-                                                   listall=self.services["listall"],
-                                                   page=1,
-                                                   pagesize=self.services["pagesize"],
-                                                   domainid=self.account.domainid
-                                                   )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid
+        )
         status = validateList(list_instances_page1)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Listing of instances in page1 failed"
-                          )
+            PASS,
+            status[0],
+            "Listing of instances in page1 failed"
+        )
         # Verifying that the length of the instances in page 1 is (page size)
         self.assertEqual(
-                         self.services["pagesize"],
-                         len(list_instances_page1),
-                         "List VM response is not matching with the page size length for page 1"
-                         )
+            self.services["pagesize"],
+            len(list_instances_page1),
+            "List VM response is not matching with the page size\
+                    length for page 1")
 
         # Listing all the VM's in page2
         list_instances_page2 = VirtualMachine.list(
-                                                   self.userapiclient,
-                                                   listall=self.services["listall"],
-                                                   page=2,
-                                                   pagesize=self.services["pagesize"],
-                                                   domainid=self.account.domainid
-                                                   )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=2,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid
+        )
         status = validateList(list_instances_page2)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Listing of instances in page2 failed"
-                          )
+            PASS,
+            status[0],
+            "Listing of instances in page2 failed"
+        )
         # Verifying that the length of the VM's in page 2 is 1
         self.assertEqual(
-                         1,
-                         len(list_instances_page2),
-                         "List VM response is not matching with the page size length for page 2"
-                         )
+            1,
+            len(list_instances_page2),
+            "List VM response is not matching with the\
+                    page size length for page 2"
+        )
         instance_page2 = list_instances_page2[0]
 
         # Verifying that the VM on page 2 is not present in page1
         for i in range(0, len(list_instances_page1)):
             instance_page1 = list_instances_page1[i]
             self.assertNotEquals(
-                                 instance_page2.id,
-                                 instance_page1.id,
-                                 "VM listed in page 2 is also listed in page 1"
-                                 )
+                instance_page2.id,
+                instance_page1.id,
+                "VM listed in page 2 is also listed in page 1"
+            )
 
         # Deleting a single VM
-        VirtualMachine.delete(vm_created, self.userapiclient, expunge=True)
+        VirtualMachine.delete(vm_created, self.apiClient, expunge=True)
 
         # Listing the VM's in page 2
         list_instance_response = VirtualMachine.list(
-                                                     self.userapiclient,
-                                                     listall=self.services["listall"],
-                                                     page=2,
-                                                     pagesize=self.services["pagesize"],
-                                                     domainid=self.account.domainid
-                                                     )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=2,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid
+        )
         # verifying that VM does not exists on page 2
         self.assertEqual(
-                        list_instance_response,
-                        None,
-                        "VM was not deleted"
-                        )
+            list_instance_response,
+            None,
+            "VM was not deleted"
+        )
         return
 
     @attr(tags=["advanced", "basic"], required_hardware="false")
     def test_02_list_Running_vm(self):
-        """  
+        """
         @Desc: Test List Running VM's
         @Steps:
         Step1: Listing all the Running VMs for a user
@@ -289,90 +312,90 @@ class TestListInstances(cloudstackTestCase):
         Step3: Deploying a VM
         Step4: Listing all the Running VMs for a user again
         Step5: Verifying that the size of the list is increased by 1
-        Step6: Verifying that the details of the Running VM listed are same as the VM deployed in Step3
+        Step6: Verifying that the details of the Running VM listed are
+               same as the VM deployed in Step3
         """
         # Listing all the Running VM's for a User
         list_running_vms_before = VirtualMachine.list(
-                                                      self.userapiclient,
-                                                      listall=self.services["listall"],
-                                                      page=1,
-                                                      pagesize=self.services["pagesize"],
-                                                      domainid=self.account.domainid,
-                                                      state="Running"
-                                                      )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+            state="Running"
+        )
         self.assertIsNone(
-                          list_running_vms_before,
-                          "Virtual Machine already exists for newly created user"
-                          )
+            list_running_vms_before,
+            "Virtual Machine already exists for newly created user"
+        )
         # Deploying a VM
         vm_created = VirtualMachine.create(
-                                           self.userapiclient,
-                                           self.services["virtual_machine"],
-                                           accountid=self.account.name,
-                                           domainid=self.account.domainid,
-                                           serviceofferingid=self.service_offering.id,
-                                           )
+            self.userapiclient,
+            self.services["virtual_machine"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering.id,
+        )
         self.assertIsNotNone(
-                             vm_created,
-                             "VM creation failed"
-                             )
-        self.cleanup.append(vm_created)
+            vm_created,
+            "VM creation failed"
+        )
         # Listing all the Running VM's for a User
         list_running_vms_after = VirtualMachine.list(
-                                                      self.userapiclient,
-                                                      listall=self.services["listall"],
-                                                      page=1,
-                                                      pagesize=self.services["pagesize"],
-                                                      domainid=self.account.domainid,
-                                                      state="Running"
-                                                      )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+            state="Running"
+        )
         status = validateList(list_running_vms_after)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Newly created VM is not in Running state"
-                          )
+            PASS,
+            status[0],
+            "Newly created VM is not in Running state"
+        )
         # Verifying list size is 1
         self.assertEquals(
-                          1,
-                          len(list_running_vms_after),
-                          "Running VM list count is not matching"
-                          )
+            1,
+            len(list_running_vms_after),
+            "Running VM list count is not matching"
+        )
         running_vm = list_running_vms_after[0]
 
         # Creating expected and actual values dictionaries
         expected_dict = {
-                         "id":vm_created.id,
-                         "name":vm_created.name,
-                         "displayname":vm_created.displayname,
-                         "state":"Running",
-                         "zoneid":vm_created.zoneid,
-                         "account":vm_created.account,
-                         "template":vm_created.templateid
-                         }
+            "id": vm_created.id,
+            "name": vm_created.name,
+            "displayname": vm_created.displayname,
+            "state": "Running",
+            "zoneid": vm_created.zoneid,
+            "account": vm_created.account,
+            "template": vm_created.templateid
+        }
         actual_dict = {
-                       "id":running_vm.id,
-                       "name":running_vm.name,
-                       "displayname":running_vm.displayname,
-                       "state":running_vm.state,
-                       "zoneid":running_vm.zoneid,
-                       "account":running_vm.account,
-                       "template":running_vm.templateid
-                       }
+            "id": running_vm.id,
+            "name": running_vm.name,
+            "displayname": running_vm.displayname,
+            "state": running_vm.state,
+            "zoneid": running_vm.zoneid,
+            "account": running_vm.account,
+            "template": running_vm.templateid
+        }
         running_vm_status = self.__verify_values(
-                                                  expected_dict,
-                                                  actual_dict
-                                                  )
+            expected_dict,
+            actual_dict
+        )
         self.assertEqual(
-                         True,
-                         running_vm_status,
-                         "Listed Running VM details are not as expected"
-                         )
+            True,
+            running_vm_status,
+            "Listed Running VM details are not as expected"
+        )
         return
 
     @attr(tags=["advanced", "basic"], required_hardware="false")
     def test_03_list_Stopped_vm(self):
-        """  
+        """
         @Desc: Test List Stopped VM's
         @Steps:
         Step1: Listing all the Stopped VMs for a user
@@ -381,86 +404,86 @@ class TestListInstances(cloudstackTestCase):
         Step4: Stopping the VM deployed in step3
         Step5: Listing all the Stopped VMs for a user again
         Step6: Verifying that the size of the list is increased by 1
-        Step7: Verifying that the details of the Stopped VM listed are same as the VM stopped in Step4
+        Step7: Verifying that the details of the Stopped VM listed are
+               same as the VM stopped in Step4
         """
         # Listing all the Stopped VM's for a User
         list_stopped_vms_before = VirtualMachine.list(
-                                                      self.userapiclient,
-                                                      listall=self.services["listall"],
-                                                      page=1,
-                                                      pagesize=self.services["pagesize"],
-                                                      domainid=self.account.domainid,
-                                                      state="Stopped"
-                                                      )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+            state="Stopped"
+        )
         self.assertIsNone(
-                           list_stopped_vms_before,
-                           "Virtual Machine already exists for newly created user"
-                           )
+            list_stopped_vms_before,
+            "Virtual Machine already exists for newly created user"
+        )
         # Deploying a VM
         vm_created = VirtualMachine.create(
-                                           self.userapiclient,
-                                           self.services["virtual_machine"],
-                                           accountid=self.account.name,
-                                           domainid=self.account.domainid,
-                                           serviceofferingid=self.service_offering.id,
-                                           )
+            self.userapiclient,
+            self.services["virtual_machine"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering.id,
+        )
         self.assertIsNotNone(
-                             vm_created,
-                             "VM creation failed"
-                             )
-        self.cleanup.append(vm_created)
+            vm_created,
+            "VM creation failed"
+        )
         # Stopping the VM
         VirtualMachine.stop(vm_created, self.userapiclient)
         # Listing all the Stopped VM's for a User
         list_stopped_vms_after = VirtualMachine.list(
-                                                      self.userapiclient,
-                                                      listall=self.services["listall"],
-                                                      page=1,
-                                                      pagesize=self.services["pagesize"],
-                                                      domainid=self.account.domainid,
-                                                      state="Stopped"
-                                                      )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+            state="Stopped"
+        )
         status = validateList(list_stopped_vms_after)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Stopped VM is not in Stopped state"
-                          )
+            PASS,
+            status[0],
+            "Stopped VM is not in Stopped state"
+        )
         # Verifying list size is 1
         self.assertEquals(
-                          1,
-                          len(list_stopped_vms_after),
-                          "Stopped VM list count is not matching"
-                          )
+            1,
+            len(list_stopped_vms_after),
+            "Stopped VM list count is not matching"
+        )
         stopped_vm = list_stopped_vms_after[0]
         # Creating expected and actual values dictionaries
         expected_dict = {
-                         "id":vm_created.id,
-                         "name":vm_created.name,
-                         "displayname":vm_created.displayname,
-                         "state":"Stopped",
-                         "zoneid":vm_created.zoneid,
-                         "account":vm_created.account,
-                         "template":vm_created.templateid
-                         }
+            "id": vm_created.id,
+            "name": vm_created.name,
+            "displayname": vm_created.displayname,
+            "state": "Stopped",
+            "zoneid": vm_created.zoneid,
+            "account": vm_created.account,
+            "template": vm_created.templateid
+        }
         actual_dict = {
-                       "id":stopped_vm.id,
-                       "name":stopped_vm.name,
-                       "displayname":stopped_vm.displayname,
-                       "state":stopped_vm.state,
-                       "zoneid":stopped_vm.zoneid,
-                       "account":stopped_vm.account,
-                       "template":stopped_vm.templateid
-                       }
+            "id": stopped_vm.id,
+            "name": stopped_vm.name,
+            "displayname": stopped_vm.displayname,
+            "state": stopped_vm.state,
+            "zoneid": stopped_vm.zoneid,
+            "account": stopped_vm.account,
+            "template": stopped_vm.templateid
+        }
         stopped_vm_status = self.__verify_values(
-                                                  expected_dict,
-                                                  actual_dict
-                                                  )
+            expected_dict,
+            actual_dict
+        )
         self.assertEqual(
-                         True,
-                         stopped_vm_status,
-                         "Listed Stopped VM details are not as expected"
-                         )
+            True,
+            stopped_vm_status,
+            "Listed Stopped VM details are not as expected"
+        )
         return
 
     @attr(tags=["advanced", "basic"], required_hardware="false")
@@ -476,99 +499,100 @@ class TestListInstances(cloudstackTestCase):
         Step6: Verifying that destroyed VM is not listed for User
         Step7: Listing all the destroyed VMs as admin
         Step8: Verifying that the size of the list is 1
-        Step9: Verifying that the details of the Destroyed VM listed are same as the VM destroyed in Step4
+        Step9: Verifying that the details of the Destroyed VM listed
+                are same as the VM destroyed in Step4
         """
         # Listing all the Destroyed VM's for a User
         list_destroyed_vms_before = VirtualMachine.list(
-                                                      self.userapiclient,
-                                                      listall=self.services["listall"],
-                                                      page=1,
-                                                      pagesize=self.services["pagesize"],
-                                                      domainid=self.account.domainid,
-                                                      state="Destroyed"
-                                                      )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+            state="Destroyed"
+        )
         self.assertIsNone(
-                           list_destroyed_vms_before,
-                           "Virtual Machine in Destroyed state already exists for newly created user"
-                           )
+            list_destroyed_vms_before,
+            "Virtual Machine in Destroyed state already exists\
+                    for newly created user")
         # Deploying a VM
         vm_created = VirtualMachine.create(
-                                           self.userapiclient,
-                                           self.services["virtual_machine"],
-                                           accountid=self.account.name,
-                                           domainid=self.account.domainid,
-                                           serviceofferingid=self.service_offering.id,
-                                           )
+            self.userapiclient,
+            self.services["virtual_machine"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering.id,
+        )
         self.assertIsNotNone(
-                             vm_created,
-                             "VM creation failed"
-                             )
+            vm_created,
+            "VM creation failed"
+        )
         # Destroying the VM
         VirtualMachine.delete(vm_created, self.userapiclient, expunge=False)
         # Listing all the Destroyed VM's for a User
         list_destroyed_vms_after = VirtualMachine.list(
-                                                      self.userapiclient,
-                                                      listall=self.services["listall"],
-                                                      page=1,
-                                                      pagesize=self.services["pagesize"],
-                                                      domainid=self.account.domainid,
-                                                      state="Destroyed"
-                                                      )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+            state="Destroyed"
+        )
         self.assertIsNone(
-                          list_destroyed_vms_after,
-                          "Destroyed VM is not in destroyed state"
-                          )
+            list_destroyed_vms_after,
+            "Destroyed VM is not in destroyed state"
+        )
         # Listing destroyed VMs as admin user
         list_destroyed_vms_admin = VirtualMachine.list(
-                                                       self.apiClient,
-                                                       listall=self.services["listall"],
-                                                       page=1,
-                                                       pagesize=self.services["pagesize"],
-                                                       domainid=self.account.domainid,
-                                                       state="Destroyed",
-                                                       id=vm_created.id
-                                                       )
+            self.apiClient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+            state="Destroyed",
+            id=vm_created.id
+        )
         status = validateList(list_destroyed_vms_admin)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Destroyed VM is not in Destroyed state"
-                          )
+            PASS,
+            status[0],
+            "Destroyed VM is not in Destroyed state"
+        )
         # Verifying that the length of the destroyed VMs list should be 1
         self.assertEquals(
-                          1,
-                          len(list_destroyed_vms_admin),
-                          "Destroyed VM list count is not matching"
-                          )
+            1,
+            len(list_destroyed_vms_admin),
+            "Destroyed VM list count is not matching"
+        )
         destroyed_vm = list_destroyed_vms_admin[0]
         # Creating expected and actual values dictionaries
         expected_dict = {
-                         "id":vm_created.id,
-                         "name":vm_created.name,
-                         "displayname":vm_created.displayname,
-                         "state":"Destroyed",
-                         "zoneid":vm_created.zoneid,
-                         "account":vm_created.account,
-                         "template":vm_created.templateid
-                         }
+            "id": vm_created.id,
+            "name": vm_created.name,
+            "displayname": vm_created.displayname,
+            "state": "Destroyed",
+            "zoneid": vm_created.zoneid,
+            "account": vm_created.account,
+            "template": vm_created.templateid
+        }
         actual_dict = {
-                       "id":destroyed_vm.id,
-                       "name":destroyed_vm.name,
-                       "displayname":destroyed_vm.displayname,
-                       "state":destroyed_vm.state,
-                       "zoneid":destroyed_vm.zoneid,
-                       "account":destroyed_vm.account,
-                       "template":destroyed_vm.templateid
-                       }
+            "id": destroyed_vm.id,
+            "name": destroyed_vm.name,
+            "displayname": destroyed_vm.displayname,
+            "state": destroyed_vm.state,
+            "zoneid": destroyed_vm.zoneid,
+            "account": destroyed_vm.account,
+            "template": destroyed_vm.templateid
+        }
         destroyed_vm_status = self.__verify_values(
-                                                  expected_dict,
-                                                  actual_dict
-                                                  )
+            expected_dict,
+            actual_dict
+        )
         self.assertEqual(
-                         True,
-                         destroyed_vm_status,
-                         "Listed Destroyed VM details are not as expected"
-                         )
+            True,
+            destroyed_vm_status,
+            "Listed Destroyed VM details are not as expected"
+        )
         return
 
     @attr(tags=["advanced", "basic"], required_hardware="false")
@@ -582,95 +606,95 @@ class TestListInstances(cloudstackTestCase):
         Step4: Listing all the VMs for a user again
         Step5: Verifying that the size of the list is increased by 1
         Step6: List a VM by specifying the Id if the VM deployed in Step3
-        Step7: Verifying that the details of the Listed VM are same as the VM deployed in Step3
+        Step7: Verifying that the details of the Listed VM are same as
+               the VM deployed in Step3
         """
         # Listing all the VM's for a User
         list_vms_before = VirtualMachine.list(
-                                              self.userapiclient,
-                                              listall=self.services["listall"],
-                                              page=1,
-                                              pagesize=self.services["pagesize"],
-                                              domainid=self.account.domainid,
-                                              account=self.account.name
-                                              )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+            account=self.account.name
+        )
         self.assertIsNone(
-                           list_vms_before,
-                           "Virtual Machine already exists for newly created user"
-                           )
+            list_vms_before,
+            "Virtual Machine already exists for newly created user"
+        )
         # Deploying a VM
         vm_created = VirtualMachine.create(
-                                           self.userapiclient,
-                                           self.services["virtual_machine"],
-                                           accountid=self.account.name,
-                                           domainid=self.account.domainid,
-                                           serviceofferingid=self.service_offering.id,
-                                           )
+            self.userapiclient,
+            self.services["virtual_machine"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering.id,
+        )
         self.assertIsNotNone(
-                             vm_created,
-                             "VM creation failed"
-                             )
-        self.cleanup.append(vm_created)
+            vm_created,
+            "VM creation failed"
+        )
         # Listing all the VM's for a User
         list_vms_after = VirtualMachine.list(
-                                             self.userapiclient,
-                                             listall=self.services["listall"],
-                                             page=1,
-                                             pagesize=self.services["pagesize"],
-                                             domainid=self.account.domainid,
-                                             account=self.account.name
-                                             )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+            account=self.account.name
+        )
         status = validateList(list_vms_after)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Listing of VM after creation failed"
-                          )
+            PASS,
+            status[0],
+            "Listing of VM after creation failed"
+        )
         self.assertEquals(
-                          1,
-                          len(list_vms_after),
-                          "VM list count is not matching"
-                          )
+            1,
+            len(list_vms_after),
+            "VM list count is not matching"
+        )
         # Listing a VM by Id
         list_vm_byid = VirtualMachine.list(
-                                           self.userapiclient,
-                                           listall=self.services["listall"],
-                                           id=vm_created.id
-                                           )
+            self.userapiclient,
+            listall=self.services["listall"],
+            id=vm_created.id
+        )
         status = validateList(list_vm_byid)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Listing of VM by Id failed"
-                          )
+            PASS,
+            status[0],
+            "Listing of VM by Id failed"
+        )
         listed_vm = list_vm_byid[0]
         # Creating expected and actual values dictionaries
         expected_dict = {
-                         "id":vm_created.id,
-                         "name":vm_created.name,
-                         "displayname":vm_created.displayname,
-                         "state":vm_created.state,
-                         "zoneid":vm_created.zoneid,
-                         "account":vm_created.account,
-                         "template":vm_created.templateid
-                         }
+            "id": vm_created.id,
+            "name": vm_created.name,
+            "displayname": vm_created.displayname,
+            "state": vm_created.state,
+            "zoneid": vm_created.zoneid,
+            "account": vm_created.account,
+            "template": vm_created.templateid
+        }
         actual_dict = {
-                       "id":listed_vm.id,
-                       "name":listed_vm.name,
-                       "displayname":listed_vm.displayname,
-                       "state":listed_vm.state,
-                       "zoneid":listed_vm.zoneid,
-                       "account":listed_vm.account,
-                       "template":listed_vm.templateid
-                       }
+            "id": listed_vm.id,
+            "name": listed_vm.name,
+            "displayname": listed_vm.displayname,
+            "state": listed_vm.state,
+            "zoneid": listed_vm.zoneid,
+            "account": listed_vm.account,
+            "template": listed_vm.templateid
+        }
         list_vm_status = self.__verify_values(
-                                              expected_dict,
-                                              actual_dict
-                                              )
+            expected_dict,
+            actual_dict
+        )
         self.assertEqual(
-                         True,
-                         list_vm_status,
-                         "Listed VM by Id details are not as expected"
-                         )
+            True,
+            list_vm_status,
+            "Listed VM by Id details are not as expected"
+        )
         return
 
     @attr(tags=["advanced", "basic"], required_hardware="false")
@@ -683,134 +707,136 @@ class TestListInstances(cloudstackTestCase):
         Step3: Deploying a 2 VM's
         Step4: Listing all the VMs for a user again
         Step5: Verifying that list size is increased by 2
-        Step6: Listing the VM by specifying complete name of VM-1 created in step3
+        Step6: Listing the VM by specifying complete name of
+               VM-1 created in step3
         Step7: Verifying that the size of the list is 1
-        Step8: Verifying that the details of the listed VM are same as the VM-1 created in step3
+        Step8: Verifying that the details of the listed VM are same as the
+               VM-1 created in step3
         Step9: Listing the VM by specifying the partial name of VM
         Step10: Verifying that the size of the list is 2
         """
         # Listing all the VM's for a User
         list_vms_before = VirtualMachine.list(
-                                              self.userapiclient,
-                                              listall=self.services["listall"],
-                                              page=1,
-                                              pagesize=self.services["pagesize"],
-                                              domainid=self.account.domainid,
-                                              )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+        )
         self.assertIsNone(
-                           list_vms_before,
-                           "Virtual Machine already exists for newly created user"
-                           )
+            list_vms_before,
+            "Virtual Machine already exists for newly created user"
+        )
         vms = {}
         for i in range(0, 2):
             # Deploying a VM
             vm_created = VirtualMachine.create(
-                                               self.userapiclient,
-                                               self.services["virtual_machine"],
-                                               accountid=self.account.name,
-                                               domainid=self.account.domainid,
-                                               serviceofferingid=self.service_offering.id,
-                                               )
+                self.userapiclient,
+                self.services["virtual_machine"],
+                accountid=self.account.name,
+                domainid=self.account.domainid,
+                serviceofferingid=self.service_offering.id,
+            )
             self.assertIsNotNone(
-                                 vm_created,
-                                 "VM creation failed"
-                                 )
-            self.cleanup.append(vm_created)
+                vm_created,
+                "VM creation failed"
+            )
             vms.update({i: vm_created})
 
         # Listing all the VM's for a User
         list_vms_after = VirtualMachine.list(
-                                             self.userapiclient,
-                                             listall=self.services["listall"],
-                                             page=1,
-                                             pagesize=self.services["pagesize"],
-                                             domainid=self.account.domainid,
-                                             )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+        )
         status = validateList(list_vms_after)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "VM's creation failed"
-                          )
+            PASS,
+            status[0],
+            "VM's creation failed"
+        )
         self.assertEquals(
-                          2,
-                          len(list_vms_after),
-                          "VM's list count is not matching"
-                          )
+            2,
+            len(list_vms_after),
+            "VM's list count is not matching"
+        )
         # Listing the VM by complete name
         list_vm_byfullname = VirtualMachine.list(
-                                                 self.userapiclient,
-                                                 listall=self.services["listall"],
-                                                 page=1,
-                                                 pagesize=self.services["pagesize"],
-                                                 domainid=self.account.domainid,
-                                                 name=vms[0].name
-                                                 )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+            name=vms[0].name
+        )
         status = validateList(list_vm_byfullname)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Failed to list VM by Name"
-                          )
+            PASS,
+            status[0],
+            "Failed to list VM by Name"
+        )
         # Verifying that the size of the list is 1
         self.assertEquals(
-                          1,
-                          len(list_vm_byfullname),
-                          "VM list by full name count is not matching"
-                          )
-        # Verifying that the details of the listed VM are same as the VM created above
+            1,
+            len(list_vm_byfullname),
+            "VM list by full name count is not matching"
+        )
+        # Verifying that the details of the listed VM are same
+        # as the VM created above
         # Creating expected and actual values dictionaries
         expected_dict = {
-                         "id":vms[0].id,
-                         "name":vms[0].name,
-                         "displayname":vms[0].displayname,
-                         "state":vms[0].state,
-                         "zoneid":vms[0].zoneid,
-                         "account":vms[0].account,
-                         "template":vms[0].templateid
-                         }
+            "id": vms[0].id,
+            "name": vms[0].name,
+            "displayname": vms[0].displayname,
+            "state": vms[0].state,
+            "zoneid": vms[0].zoneid,
+            "account": vms[0].account,
+            "template": vms[0].templateid
+        }
         actual_dict = {
-                       "id":list_vm_byfullname[0].id,
-                       "name":list_vm_byfullname[0].name,
-                       "displayname":list_vm_byfullname[0].displayname,
-                       "state":list_vm_byfullname[0].state,
-                       "zoneid":list_vm_byfullname[0].zoneid,
-                       "account":list_vm_byfullname[0].account,
-                       "template":list_vm_byfullname[0].templateid
-                       }
+            "id": list_vm_byfullname[0].id,
+            "name": list_vm_byfullname[0].name,
+            "displayname": list_vm_byfullname[0].displayname,
+            "state": list_vm_byfullname[0].state,
+            "zoneid": list_vm_byfullname[0].zoneid,
+            "account": list_vm_byfullname[0].account,
+            "template": list_vm_byfullname[0].templateid
+        }
         list_vm_status = self.__verify_values(
-                                              expected_dict,
-                                              actual_dict
-                                              )
+            expected_dict,
+            actual_dict
+        )
         self.assertEqual(
-                         True,
-                         list_vm_status,
-                         "Listed VM details are not as expected"
-                         )
+            True,
+            list_vm_status,
+            "Listed VM details are not as expected"
+        )
         # Listing the VM by partial name
         list_vm_bypartialname = VirtualMachine.list(
-                                                 self.userapiclient,
-                                                 listall=self.services["listall"],
-                                                 domainid=self.account.domainid,
-                                                 name=vms[0].name[:1]
-                                                 )
+            self.userapiclient,
+            listall=self.services["listall"],
+            domainid=self.account.domainid,
+            name=vms[0].name[:1]
+        )
         status = validateList(list_vm_bypartialname)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Failed to list VM by Name"
-                          )
+            PASS,
+            status[0],
+            "Failed to list VM by Name"
+        )
         # Verifying that the size of the list is 2
         self.assertEquals(
-                          2,
-                          len(list_vm_bypartialname),
-                          "VM list by full name count is not matching"
-                          )
+            2,
+            len(list_vm_bypartialname),
+            "VM list by full name count is not matching"
+        )
         return
 
     @attr(tags=["advanced", "basic"], required_hardware="false")
     def test_07_list_vm_by_name_state(self):
-        """  
+        """
         @Desc: Test List VM's by Name and State
         @Steps:
         Step1: Listing all the VMs for a user
@@ -818,143 +844,147 @@ class TestListInstances(cloudstackTestCase):
         Step3: Deploying a VM
         Step4: Listing all the VMs for a user again
         Step5: Verifying that list size is increased by 1
-        Step6: Listing the VM by specifying name of VM created in step3 and state as Running (matching name and state)
+        Step6: Listing the VM by specifying name of VM created in step3 and
+               state as Running (matching name and state)
         Step7: Verifying that the size of the list is 1
-        Step8: Verifying that the details of the listed VM are same as the VM created in step3
-        Step9: Listing the VM by specifying name of VM created in step3 and state as Stopped (non matching state)
+        Step8: Verifying that the details of the listed VM are same as
+               the VM created in step3
+        Step9: Listing the VM by specifying name of VM created in step3
+               and state as Stopped (non matching state)
         Step10: Verifying that the size of the list is 0
-        Step11: Listing the VM by specifying non matching name and state as Running (non matching name)
+        Step11: Listing the VM by specifying non matching name and
+                state as Running (non matching name)
         Step12: Verifying that the size of the list is 0
         """
         # Listing all the VM's for a User
         list_vms_before = VirtualMachine.list(
-                                              self.userapiclient,
-                                              listall=self.services["listall"],
-                                              page=1,
-                                              pagesize=self.services["pagesize"],
-                                              domainid=self.account.domainid,
-                                              )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+        )
         self.assertIsNone(
-                           list_vms_before,
-                           "Virtual Machine already exists for newly created user"
-                           )
+            list_vms_before,
+            "Virtual Machine already exists for newly created user"
+        )
         # Deploying a VM
         vm_created = VirtualMachine.create(
-                                           self.userapiclient,
-                                           self.services["virtual_machine"],
-                                           accountid=self.account.name,
-                                           domainid=self.account.domainid,
-                                           serviceofferingid=self.service_offering.id,
-                                           )
+            self.userapiclient,
+            self.services["virtual_machine"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering.id,
+        )
         self.assertIsNotNone(
-                             vm_created,
-                             "VM creation failed"
-                             )
-        self.cleanup.append(vm_created)
+            vm_created,
+            "VM creation failed"
+        )
         # Listing all the VM's for a User
         list_vms_after = VirtualMachine.list(
-                                             self.userapiclient,
-                                             listall=self.services["listall"],
-                                             page=1,
-                                             pagesize=self.services["pagesize"],
-                                             domainid=self.account.domainid,
-                                             )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+        )
         status = validateList(list_vms_after)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "VM's creation failed"
-                          )
+            PASS,
+            status[0],
+            "VM's creation failed"
+        )
         self.assertEquals(
-                          1,
-                          len(list_vms_after),
-                          "VM's list count is not matching"
-                          )
+            1,
+            len(list_vms_after),
+            "VM's list count is not matching"
+        )
         # Listing the VM by matching Name and State
         list_running_vm = VirtualMachine.list(
-                                              self.userapiclient,
-                                              listall=self.services["listall"],
-                                              page=1,
-                                              pagesize=self.services["pagesize"],
-                                              domainid=self.account.domainid,
-                                              name=vm_created.name,
-                                              state="Running"
-                                              )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+            name=vm_created.name,
+            state="Running"
+        )
         status = validateList(list_running_vm)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "List VM by name and state failed"
-                          )
+            PASS,
+            status[0],
+            "List VM by name and state failed"
+        )
         # Verifying that the size of the list is 1
         self.assertEquals(
-                          1,
-                          len(list_running_vm),
-                          "Count of VM list by name and state is not matching"
-                          )
-        # Verifying that the details of the listed VM are same as the VM created above
+            1,
+            len(list_running_vm),
+            "Count of VM list by name and state is not matching"
+        )
+        # Verifying that the details of the listed VM are same
+        # as the VM created above
         # Creating expected and actual values dictionaries
         expected_dict = {
-                         "id":vm_created.id,
-                         "name":vm_created.name,
-                         "displayname":vm_created.displayname,
-                         "state":"Running",
-                         "zoneid":vm_created.zoneid,
-                         "account":vm_created.account,
-                         "template":vm_created.templateid
-                         }
+            "id": vm_created.id,
+            "name": vm_created.name,
+            "displayname": vm_created.displayname,
+            "state": "Running",
+            "zoneid": vm_created.zoneid,
+            "account": vm_created.account,
+            "template": vm_created.templateid
+        }
         actual_dict = {
-                       "id":list_running_vm[0].id,
-                       "name":list_running_vm[0].name,
-                       "displayname":list_running_vm[0].displayname,
-                       "state":list_running_vm[0].state,
-                       "zoneid":list_running_vm[0].zoneid,
-                       "account":list_running_vm[0].account,
-                       "template":list_running_vm[0].templateid
-                       }
+            "id": list_running_vm[0].id,
+            "name": list_running_vm[0].name,
+            "displayname": list_running_vm[0].displayname,
+            "state": list_running_vm[0].state,
+            "zoneid": list_running_vm[0].zoneid,
+            "account": list_running_vm[0].account,
+            "template": list_running_vm[0].templateid
+        }
         list_vm_status = self.__verify_values(
-                                              expected_dict,
-                                              actual_dict
-                                              )
+            expected_dict,
+            actual_dict
+        )
         self.assertEqual(
-                         True,
-                         list_vm_status,
-                         "Listed VM details are not as expected"
-                         )
+            True,
+            list_vm_status,
+            "Listed VM details are not as expected"
+        )
         # Listing the VM by matching name and non matching state
         list_running_vm = VirtualMachine.list(
-                                              self.userapiclient,
-                                              listall=self.services["listall"],
-                                              page=1,
-                                              pagesize=self.services["pagesize"],
-                                              domainid=self.account.domainid,
-                                              name=vm_created.name,
-                                              state="Stopped"
-                                              )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+            name=vm_created.name,
+            state="Stopped"
+        )
         self.assertIsNone(
-                          list_running_vm,
-                          "Listed VM with non matching state"
-                          )
+            list_running_vm,
+            "Listed VM with non matching state"
+        )
         # Listing the VM by non matching name and matching state
         list_running_vm = VirtualMachine.list(
-                                              self.userapiclient,
-                                              listall=self.services["listall"],
-                                              page=1,
-                                              pagesize=self.services["pagesize"],
-                                              domainid=self.account.domainid,
-                                              name="name",
-                                              state="Running"
-                                              )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            domainid=self.account.domainid,
+            name="name",
+            state="Running"
+        )
         self.assertIsNone(
-                          list_running_vm,
-                          "Listed VM with non matching name"
-                          )
+            list_running_vm,
+            "Listed VM with non matching name"
+        )
         return
 
     @attr(tags=["advanced", "basic"], required_hardware="false")
     def test_08_list_vm_by_zone(self):
-        """  
-        @Desc: Test List VM by Zone. 
+        """
+        @Desc: Test List VM by Zone.
         This test case is applicable for a setup having multiple zones.
         @Steps:
         Step1: Listing all the zones
@@ -966,7 +996,8 @@ class TestListInstances(cloudstackTestCase):
         Step6: Deploying a VM
         Step7: Listing all the VMs for a user again for matching zone
         Step8: Verifying that the size of the list is 1
-        Step9: Verifying that the details of the Listed VM are same as the VM deployed in Step6
+        Step9: Verifying that the details of the Listed VM are same
+               as the VM deployed in Step6
         Step10: Listing all the VMs for a user again for non-matching zone
         Step11: Verifying that the size of the list is 0
         """
@@ -974,10 +1005,10 @@ class TestListInstances(cloudstackTestCase):
         zones_list = Zone.list(self.apiClient)
         status = validateList(zones_list)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "zones not available in the given setup"
-                          )
+            PASS,
+            status[0],
+            "zones not available in the given setup"
+        )
         current_zone = self.services["virtual_machine"]["zoneid"]
         current_template = self.services["virtual_machine"]["template"]
         # Checking if there are multiple zones in the setup.
@@ -986,114 +1017,114 @@ class TestListInstances(cloudstackTestCase):
         else:
             # Getting the template available under the zone
             template = get_template(
-                                    self.apiClient,
-                                    zones_list[0].id,
-                                    self.services["ostype"]
-                                    )
+                self.apiClient,
+                zones_list[0].id,
+                self.services["ostype"]
+            )
             self.assertIsNotNone(
-                                 template,
-                                 "Template not found for zone"
-                                 )
+                template,
+                "Template not found for zone"
+            )
             self.services["virtual_machine"]["zoneid"] = zones_list[0].id
             self.services["virtual_machine"]["template"] = template.id
             # Listing all the VM's for a User
             list_vms_before = VirtualMachine.list(
-                                                  self.userapiclient,
-                                                  listall=self.services["listall"],
-                                                  page=1,
-                                                  pagesize=self.services["pagesize"],
-                                                  domainid=self.account.domainid,
-                                                  zoneid=zones_list[0].id
-                                                  )
+                self.userapiclient,
+                listall=self.services["listall"],
+                page=1,
+                pagesize=self.services["pagesize"],
+                domainid=self.account.domainid,
+                zoneid=zones_list[0].id
+            )
             self.assertIsNone(
-                               list_vms_before,
-                               "Virtual Machine already exists for newly created user"
-                               )
+                list_vms_before,
+                "Virtual Machine already exists for newly created user"
+            )
             # Deploying a VM
             vm_created = VirtualMachine.create(
-                                               self.userapiclient,
-                                               self.services["virtual_machine"],
-                                               accountid=self.account.name,
-                                               domainid=self.account.domainid,
-                                               serviceofferingid=self.service_offering.id,
-                                               )
+                self.userapiclient,
+                self.services["virtual_machine"],
+                accountid=self.account.name,
+                domainid=self.account.domainid,
+                serviceofferingid=self.service_offering.id,
+            )
             self.assertIsNotNone(
-                                 vm_created,
-                                 "VM creation failed"
-                                 )
-            self.cleanup.append(vm_created)
+                vm_created,
+                "VM creation failed"
+            )
             # Listing all the VMs for a user again for matching zone
             list_vms_after = VirtualMachine.list(
-                                                 self.userapiclient,
-                                                 listall=self.services["listall"],
-                                                 page=1,
-                                                 pagesize=self.services["pagesize"],
-                                                 domainid=self.account.domainid,
-                                                 zoneid=zones_list[0].id
-                                                 )
+                self.userapiclient,
+                listall=self.services["listall"],
+                page=1,
+                pagesize=self.services["pagesize"],
+                domainid=self.account.domainid,
+                zoneid=zones_list[0].id
+            )
             status = validateList(list_vms_after)
             self.assertEquals(
-                              PASS,
-                              status[0],
-                              "VM creation failed"
-                              )
+                PASS,
+                status[0],
+                "VM creation failed"
+            )
             # Verifying that the size of the list is 1
             self.assertEquals(
-                              1,
-                              len(list_vms_after),
-                              "VM list count is not matching"
-                              )
+                1,
+                len(list_vms_after),
+                "VM list count is not matching"
+            )
             listed_vm = list_vms_after[0]
-            # Verifying that the details of the Listed VM are same as the VM deployed above
+            # Verifying that the details of the Listed VM are
+            # same as the VM deployed above
             # Creating expected and actual values dictionaries
             expected_dict = {
-                               "id":vm_created.id,
-                               "name":vm_created.name,
-                               "displayname":vm_created.displayname,
-                               "state":vm_created.state,
-                               "zoneid":vm_created.zoneid,
-                               "account":vm_created.account,
-                               "template":vm_created.templateid
-                               }
+                "id": vm_created.id,
+                "name": vm_created.name,
+                "displayname": vm_created.displayname,
+                "state": vm_created.state,
+                "zoneid": vm_created.zoneid,
+                "account": vm_created.account,
+                "template": vm_created.templateid
+            }
             actual_dict = {
-                               "id":listed_vm.id,
-                               "name":listed_vm.name,
-                               "displayname":listed_vm.displayname,
-                               "state":listed_vm.state,
-                               "zoneid":listed_vm.zoneid,
-                               "account":listed_vm.account,
-                               "template":listed_vm.templateid
-                               }
+                "id": listed_vm.id,
+                "name": listed_vm.name,
+                "displayname": listed_vm.displayname,
+                "state": listed_vm.state,
+                "zoneid": listed_vm.zoneid,
+                "account": listed_vm.account,
+                "template": listed_vm.templateid
+            }
             list_vm_status = self.__verify_values(
-                                                  expected_dict,
-                                                  actual_dict
-                                                  )
+                expected_dict,
+                actual_dict
+            )
             self.assertEqual(
-                             True,
-                             list_vm_status,
-                             "Listed VM by Id details are not as expected"
-                             )
+                True,
+                list_vm_status,
+                "Listed VM by Id details are not as expected"
+            )
             # Listing all the VMs for a user again for non-matching zone
             list_vms = VirtualMachine.list(
-                                           self.userapiclient,
-                                           listall=self.services["listall"],
-                                           page=1,
-                                           pagesize=self.services["pagesize"],
-                                           domainid=self.account.domainid,
-                                           zoneid=zones_list[1].id
-                                           )
+                self.userapiclient,
+                listall=self.services["listall"],
+                page=1,
+                pagesize=self.services["pagesize"],
+                domainid=self.account.domainid,
+                zoneid=zones_list[1].id
+            )
             self.assertIsNone(
-                              list_vms,
-                              "VM's listed for non matching zone"
-                              )
+                list_vms,
+                "VM's listed for non matching zone"
+            )
             self.services["virtual_machine"]["zoneid"] = current_zone
             self.services["virtual_machine"]["template"] = current_template
         return
 
     @attr(tags=["advanced", "basic"], required_hardware="false")
     def test_09_list_vm_by_zone_name(self):
-        """  
-        @Desc: Test List VM by Zone. 
+        """
+        @Desc: Test List VM by Zone.
         This test case is applicable for a setup having multiple zones.
         @Steps:
         Step1: Listing all the zones
@@ -1105,22 +1136,26 @@ class TestListInstances(cloudstackTestCase):
         Step6: Deploying a VM
         Step7: Listing all the VMs for a user again
         Step8: Verifying that list size is increased by 1
-        Step9: Listing the VM by specifying name of VM created in step6 and matching zone (matching name and zone)
+        Step9: Listing the VM by specifying name of VM created in step6
+               and matching zone (matching name and zone)
         Step10: Verifying that the size of the list is 1
-        Step11: Verifying that the details of the listed VM are same as the VM created in step3
-        Step12: Listing the VM by specifying name of VM created in step6 and non matching zone (non matching zone)
+        Step11: Verifying that the details of the listed VM are same
+                as the VM created in step3
+        Step12: Listing the VM by specifying name of VM created in step6
+                and non matching zone (non matching zone)
         Step13: Verifying that the size of the list is 0
-        Step14: Listing the VM by specifying non matching name and matching zone (non matching name)
+        Step14: Listing the VM by specifying non matching name and
+                matching zone (non matching name)
         Step15: Verifying that the size of the list is 0
         """
         # Listing all the zones available
         zones_list = Zone.list(self.apiClient)
         status = validateList(zones_list)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "zones not available in the given setup"
-                          )
+            PASS,
+            status[0],
+            "zones not available in the given setup"
+        )
         current_zone = self.services["virtual_machine"]["zoneid"]
         current_template = self.services["virtual_machine"]["template"]
         # Checking if there are multiple zones in the setup.
@@ -1129,343 +1164,353 @@ class TestListInstances(cloudstackTestCase):
         else:
             # Getting the template available under the zone
             template = get_template(
-                                    self.apiClient,
-                                    zones_list[0].id,
-                                    self.services["ostype"]
-                                    )
+                self.apiClient,
+                zones_list[0].id,
+                self.services["ostype"]
+            )
             self.assertIsNotNone(
-                                 template,
-                                 "Template not found for zone"
-                                 )
+                template,
+                "Template not found for zone"
+            )
             self.services["virtual_machine"]["zoneid"] = zones_list[0].id
             self.services["virtual_machine"]["template"] = template.id
             # Listing all the VM's for a User
             list_vms_before = VirtualMachine.list(
-                                                  self.userapiclient,
-                                                  listall=self.services["listall"],
-                                                  page=1,
-                                                  pagesize=self.services["pagesize"],
-                                                  domainid=self.account.domainid,
-                                                  zoneid=zones_list[0].id,
-                                                  account=self.account.name
-                                                  )
+                self.userapiclient,
+                listall=self.services["listall"],
+                page=1,
+                pagesize=self.services["pagesize"],
+                domainid=self.account.domainid,
+                zoneid=zones_list[0].id,
+                account=self.account.name
+            )
             self.assertIsNone(
-                               list_vms_before,
-                               "Virtual Machine already exists for newly created user"
-                               )
+                list_vms_before,
+                "Virtual Machine already exists for newly created user"
+            )
             # Deploying a VM
             vm_created = VirtualMachine.create(
-                                               self.userapiclient,
-                                               self.services["virtual_machine"],
-                                               accountid=self.account.name,
-                                               domainid=self.account.domainid,
-                                               serviceofferingid=self.service_offering.id,
-                                               )
+                self.userapiclient,
+                self.services["virtual_machine"],
+                accountid=self.account.name,
+                domainid=self.account.domainid,
+                serviceofferingid=self.service_offering.id,
+            )
             self.assertIsNotNone(
-                                 vm_created,
-                                 "VM creation failed"
-                                 )
-            self.cleanup.append(vm_created)
+                vm_created,
+                "VM creation failed"
+            )
             # Listing all the VMs for a user again for matching zone
             list_vms_after = VirtualMachine.list(
-                                                 self.userapiclient,
-                                                 listall=self.services["listall"],
-                                                 page=1,
-                                                 pagesize=self.services["pagesize"],
-                                                 domainid=self.account.domainid,
-                                                 zoneid=zones_list[0].id,
-                                                 account=self.account.name
-                                                 )
+                self.userapiclient,
+                listall=self.services["listall"],
+                page=1,
+                pagesize=self.services["pagesize"],
+                domainid=self.account.domainid,
+                zoneid=zones_list[0].id,
+                account=self.account.name
+            )
             status = validateList(list_vms_after)
             self.assertEquals(
-                              PASS,
-                              status[0],
-                              "VM creation failed"
-                              )
+                PASS,
+                status[0],
+                "VM creation failed"
+            )
             # Verifying that the size of the list is 1
             self.assertEquals(
-                              1,
-                              len(list_vms_after),
-                              "VM list count is not matching"
-                              )
-            # Listing the VM by specifying name of VM created in above and matching zone
+                1,
+                len(list_vms_after),
+                "VM list count is not matching"
+            )
+            # Listing the VM by specifying name of VM created in above and
+            # matching zone
             list_vms = VirtualMachine.list(
-                                           self.userapiclient,
-                                           listall=self.services["listall"],
-                                           page=1,
-                                           pagesize=self.services["pagesize"],
-                                           domainid=self.account.domainid,
-                                           zoneid=zones_list[0].id,
-                                           name=vm_created.name
-                                           )
+                self.userapiclient,
+                listall=self.services["listall"],
+                page=1,
+                pagesize=self.services["pagesize"],
+                domainid=self.account.domainid,
+                zoneid=zones_list[0].id,
+                name=vm_created.name
+            )
             status = validateList(list_vms)
             self.assertEquals(
-                              PASS,
-                              status[0],
-                              "Listing VM's by name and zone failed"
-                              )
+                PASS,
+                status[0],
+                "Listing VM's by name and zone failed"
+            )
             # Verifying Verifying that the size of the list is 1
             self.assertEquals(
-                              1,
-                              len(list_vms),
-                              "Count of listed VM's by name and zone is not as expected"
-                              )
+                1,
+                len(list_vms),
+                "Count of listed VM's by name and zone is not as expected"
+            )
             listed_vm = list_vms[0]
-            # Verifying that the details of the Listed VM are same as the VM deployed above
+            # Verifying that the details of the Listed VM are same
+            # as the VM deployed above
             # Creating expected and actual values dictionaries
             expected_dict = {
-                             "id":vm_created.id,
-                             "name":vm_created.name,
-                             "displayname":vm_created.displayname,
-                             "state":vm_created.state,
-                             "zoneid":vm_created.zoneid,
-                             "account":vm_created.account,
-                             "template":vm_created.templateid
-                               }
+                "id": vm_created.id,
+                "name": vm_created.name,
+                "displayname": vm_created.displayname,
+                "state": vm_created.state,
+                "zoneid": vm_created.zoneid,
+                "account": vm_created.account,
+                "template": vm_created.templateid
+            }
             actual_dict = {
-                               "id":listed_vm.id,
-                               "name":listed_vm.name,
-                               "displayname":listed_vm.displayname,
-                               "state":listed_vm.state,
-                               "zoneid":listed_vm.zoneid,
-                               "account":listed_vm.account,
-                               "template":listed_vm.templateid
-                               }
+                "id": listed_vm.id,
+                "name": listed_vm.name,
+                "displayname": listed_vm.displayname,
+                "state": listed_vm.state,
+                "zoneid": listed_vm.zoneid,
+                "account": listed_vm.account,
+                "template": listed_vm

<TRUNCATED>

[13/28] git commit: updated refs/heads/master to 8c9093b

Posted by ra...@apache.org.
CLOUDSTACK-7818: Fixing test_escalations_instances.py, Removing dependency of test cases 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/85ac979f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/85ac979f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/85ac979f

Branch: refs/heads/master
Commit: 85ac979f72e7ea4b65f466429e786fe468a03646
Parents: 5369413
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Thu Oct 30 18:05:41 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Mon Nov 10 17:20:35 2014 +0530

----------------------------------------------------------------------
 .../component/test_escalations_instances.py     | 4434 +++++++++---------
 1 file changed, 2273 insertions(+), 2161 deletions(-)
----------------------------------------------------------------------



[07/28] git commit: updated refs/heads/master to 8c9093b

Posted by ra...@apache.org.
CLOUDSTACK-7866: Passing type value to list_hosts method so as to avoid listing SSVM and CPVM

Correcting hostid attribute

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/3e00f99c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3e00f99c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3e00f99c

Branch: refs/heads/master
Commit: 3e00f99c535e318faab4c09ac943fd8540f81d17
Parents: 0bd34d3
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Mon Nov 10 11:58:18 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Mon Nov 10 16:29:39 2014 +0530

----------------------------------------------------------------------
 .../maint/test_host_high_availability.py        | 22 ++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3e00f99c/test/integration/component/maint/test_host_high_availability.py
----------------------------------------------------------------------
diff --git a/test/integration/component/maint/test_host_high_availability.py b/test/integration/component/maint/test_host_high_availability.py
index ecc23f7..0d76f81 100644
--- a/test/integration/component/maint/test_host_high_availability.py
+++ b/test/integration/component/maint/test_host_high_availability.py
@@ -19,11 +19,20 @@
 """
 #Import Local Modules
 from nose.plugins.attrib import attr
-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
+from marvin.cloudstackAPI import (migrateVirtualMachine,
+                                  prepareHostForMaintenance,
+                                  cancelHostMaintenance)
+from marvin.lib.utils import cleanup_resources
+from marvin.lib.base import (Account,
+                             VirtualMachine,
+                             ServiceOffering)
+from marvin.lib.common import (get_zone,
+                               get_domain,
+                               get_template,
+                               list_hosts,
+                               list_virtual_machines,
+                               list_service_offering)
 import time
 
 
@@ -490,6 +499,7 @@ class TestHostHighAvailability(cloudstackTestCase):
         #Find out Non-Suitable host for VM migration
         list_hosts_response = list_hosts(
             self.apiclient,
+            type="Routing"
         )
         self.assertEqual(
             isinstance(list_hosts_response, list),
@@ -505,7 +515,7 @@ class TestHostHighAvailability(cloudstackTestCase):
 
         notSuitableHost = None
         for host in list_hosts_response:
-            if not host.suitableformigration and host.hostid != vm.hostid:
+            if not host.suitableformigration and host.id != vm.hostid:
                 notSuitableHost = host
                 break
 


[04/28] git commit: updated refs/heads/master to 8c9093b

Posted by ra...@apache.org.
CLOUDSTACK-7760 Data disk size is not considering for primary storage resource limit check


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

Branch: refs/heads/master
Commit: 310bb255acd74b6347bd778590e15543eef7333b
Parents: 0e7f1ea
Author: Bharat Kumar <bh...@citrix.com>
Authored: Fri Oct 17 11:24:40 2014 +0530
Committer: Kishan Kavala <ki...@apache.org>
Committed: Mon Nov 10 15:07:13 2014 +0530

----------------------------------------------------------------------
 server/src/com/cloud/vm/UserVmManagerImpl.java | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/310bb255/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 1a024a3..28ec6ec 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -2682,6 +2682,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
                     throw new InvalidParameterValueException("VM Creation failed. Volume size: " + diskSize + "GB is out of allowed range. Max: " + customDiskOfferingMaxSize
                             + " Min:" + customDiskOfferingMinSize);
                 }
+                size=size+diskSize*(1024*1024*1024);
             }
             size += _diskOfferingDao.findById(diskOfferingId).getDiskSize();
         }


[16/28] git commit: updated refs/heads/master to 8c9093b

Posted by ra...@apache.org.
CLOUDSTACK-7873 Fixed the user vm details length issue for higher key lengths


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

Branch: refs/heads/master
Commit: 32dc5243b6bfa0f51ffb3eeaf49e4b7fef5edf55
Parents: c916f30
Author: Santhosh Edukulla <sa...@gmail.com>
Authored: Mon Nov 10 20:05:32 2014 +0530
Committer: Santhosh Edukulla <sa...@gmail.com>
Committed: Mon Nov 10 21:24:28 2014 +0530

----------------------------------------------------------------------
 engine/schema/src/com/cloud/vm/UserVmDetailVO.java | 2 +-
 setup/db/create-schema.sql                         | 2 +-
 setup/db/db/schema-441to450.sql                    | 4 ++++
 3 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/32dc5243/engine/schema/src/com/cloud/vm/UserVmDetailVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/UserVmDetailVO.java b/engine/schema/src/com/cloud/vm/UserVmDetailVO.java
index d1a6e63..2b169a3 100644
--- a/engine/schema/src/com/cloud/vm/UserVmDetailVO.java
+++ b/engine/schema/src/com/cloud/vm/UserVmDetailVO.java
@@ -39,7 +39,7 @@ public class UserVmDetailVO implements ResourceDetail {
     @Column(name = "name")
     private String name;
 
-    @Column(name = "value", length = 1024)
+    @Column(name = "value", length = 5120)
     private String value;
 
     @Column(name = "display")

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/32dc5243/setup/db/create-schema.sql
----------------------------------------------------------------------
diff --git a/setup/db/create-schema.sql b/setup/db/create-schema.sql
index f95b02f..b4786c0 100755
--- a/setup/db/create-schema.sql
+++ b/setup/db/create-schema.sql
@@ -1140,7 +1140,7 @@ CREATE TABLE `cloud`.`user_vm_details` (
   `id` bigint unsigned NOT NULL auto_increment,
   `vm_id` bigint unsigned NOT NULL COMMENT 'vm id',
   `name` varchar(255) NOT NULL,
-  `value` varchar(1024) NOT NULL,
+  `value` varchar(5120) NOT NULL,
   PRIMARY KEY (`id`),
   CONSTRAINT `fk_user_vm_details__vm_id` FOREIGN KEY `fk_user_vm_details__vm_id`(`vm_id`) REFERENCES `vm_instance`(`id`) ON DELETE CASCADE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/32dc5243/setup/db/db/schema-441to450.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-441to450.sql b/setup/db/db/schema-441to450.sql
index 0aa95e8..61721b7 100644
--- a/setup/db/db/schema-441to450.sql
+++ b/setup/db/db/schema-441to450.sql
@@ -756,3 +756,7 @@ DELETE t1 FROM guest_os_hypervisor t1, guest_os_hypervisor t2 WHERE (t1.hypervis
 UPDATE `cloud`.`vm_template` SET removed=NOW() WHERE unique_name="centos53-x86_64" AND hypervisor_type="XenServer";
 
 ALTER TABLE `cloud_usage`.`usage_vpn_user` CHANGE `user_name` `user_name` VARCHAR(255);
+
+--Increase key value size generated from RSA-8192 to be stored.
+ALTER TABLE `cloud`.`user_vm_details` MODIFY `value` VARCHAR(5120);
+


[23/28] git commit: updated refs/heads/master to 8c9093b

Posted by ra...@apache.org.
CLOUDSTACK-7645

[UI] Fix incorrect strings 'label.no' and 'label.added.network.offering'

Conflicts:
	ui/dictionary2.jsp


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

Branch: refs/heads/master
Commit: 4e820b37b0b8f5318e992330a3a9a7f6f9998cff
Parents: d82e556
Author: Mihaela Stoica <mi...@citrix.com>
Authored: Tue Nov 4 16:22:20 2014 +0000
Committer: Brian Federle <br...@citrix.com>
Committed: Wed Nov 12 08:24:10 2014 -0800

----------------------------------------------------------------------
 ui/dictionary2.jsp          | 3 +++
 ui/scripts/configuration.js | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4e820b37/ui/dictionary2.jsp
----------------------------------------------------------------------
diff --git a/ui/dictionary2.jsp b/ui/dictionary2.jsp
index 8f2a378..28b4f05 100644
--- a/ui/dictionary2.jsp
+++ b/ui/dictionary2.jsp
@@ -1010,5 +1010,8 @@ dictionary2 = {
 'label.agent.state': '<fmt:message key="label.agent.state" />',
 'label.duration.in.sec': '<fmt:message key="label.duration.in.sec" />',
 'state.detached': '<fmt:message key="state.detached" />',
+'label.na': '<fmt:message key="label.na" />',
+'label.added.network.offering': '<fmt:message key="label.added.network.offering" />',
+'label.no': '<fmt:message key="label.no" />'
 };
 </script>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4e820b37/ui/scripts/configuration.js
----------------------------------------------------------------------
diff --git a/ui/scripts/configuration.js b/ui/scripts/configuration.js
index f88ba85..2a9829d 100644
--- a/ui/scripts/configuration.js
+++ b/ui/scripts/configuration.js
@@ -3167,7 +3167,7 @@
 
                             messages: {
                                 notification: function(args) {
-                                    return 'label.added.network.offering';
+                                    return 'label.add.network.offering';
                                 }
                             }
                         }


[18/28] git commit: updated refs/heads/master to 8c9093b

Posted by ra...@apache.org.
CLOUDSTACK-7865: fixed pep8 errors and errors in wrong references
to the variables


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

Branch: refs/heads/master
Commit: 7efc4c388fc96bb76acd1dbc0c2d344ddc23f2d1
Parents: 6d268db
Author: SrikanteswaraRao Talluri <ta...@apache.org>
Authored: Tue Nov 11 19:18:59 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Tue Nov 11 19:21:38 2014 +0530

----------------------------------------------------------------------
 test/integration/component/maint/test_bugs.py | 465 +++++++++++----------
 1 file changed, 234 insertions(+), 231 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7efc4c38/test/integration/component/maint/test_bugs.py
----------------------------------------------------------------------
diff --git a/test/integration/component/maint/test_bugs.py b/test/integration/component/maint/test_bugs.py
index a543aa7..24dbee2 100644
--- a/test/integration/component/maint/test_bugs.py
+++ b/test/integration/component/maint/test_bugs.py
@@ -27,9 +27,7 @@ from marvin.codes import *
 from nose.plugins.attrib import attr
 
 
-
 class Test42xBugsMgmtSvr(cloudstackTestCase):
-
     @classmethod
     def setUpClass(cls):
         try:
@@ -40,37 +38,41 @@ class Test42xBugsMgmtSvr(cloudstackTestCase):
             cls.hypervisor = cls.testClient.getHypervisorInfo()
             # Get Domain, Zone, Template
             cls.domain = get_domain(cls.api_client)
-            cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
-            cls.pod = get_pod(cls.apiClient,zone_id=cls.zone.id)
+            cls.zone = get_zone(cls.api_client,
+                                cls.testClient.getZoneForTests())
+            cls.pod = get_pod(cls.apiClient, zone_id=cls.zone.id)
             cls.template = get_template(
-                                        cls.api_client,
-                                        cls.zone.id,
-                                        cls.services["ostype"]
-                                        )
+                cls.api_client,
+                cls.zone.id,
+                cls.services["ostype"]
+            )
 
             cls.services['mode'] = cls.zone.networktype
             cls.services["hypervisor"] = cls.testClient.getHypervisorInfo()
             # Creating Disk offering, Service Offering and Account
             cls.service_offering = ServiceOffering.create(
-                                            cls.apiClient,
-                                            cls.services["service_offerings"]
-                                            )
+                cls.apiClient,
+                cls.services["service_offerings"]
+            )
             cls.account = Account.create(
-                                         cls.api_client,
-                                         cls.services["account"],
-                                         domainid=cls.domain.id
-                                         )
+                cls.api_client,
+                cls.services["account"],
+                domainid=cls.domain.id
+            )
             # Create account
             cls.account_2 = Account.create(
-                                         cls.api_client,
-                                         cls.services["account2"],
-                                         domainid=cls.domain.id
-                                         )
+                cls.api_client,
+                cls.services["account2"],
+                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)
-            #add objects created in setUpCls to the _cleanup list
+            cls.userapiclient = cls.testClient.getUserApiClient(
+                cls.user.username,
+                cls.domain.name
+            )
+            # add objects created in setUpCls to the _cleanup list
             cls._cleanup = [cls.account,
                             cls.account_2,
                             cls.service_offering]
@@ -99,28 +101,34 @@ class Test42xBugsMgmtSvr(cloudstackTestCase):
 
         return
 
-
     @attr(tags=["advanced", "basic", "tested"])
     @attr(required_hardware="false")
     @attr(configuration='apply.allocation.algorithm.to.pods')
     def test_es_1223_apply_algo_to_pods(self):
         """
-        @Desc: Test VM creation while "apply.allocation.algorithm.to.pods" is set to true
+        @Desc: Test VM creation while "apply.allocation.algorithm.to.pods" is
+        set to true
         @Reference: https://issues.apache.org/jira/browse/CLOUDSTACK-4947
         @Steps:
-        Step1: Set global configuration "apply.allocation.algorithm.to.pods" to true
+        Step1: Set global configuration "apply.allocation.algorithm.to.pods"
+        to true
         Step2: Restart management server
         Step3: Verifying that VM creation is successful
         """
-        #Step1:  set global configuration "apply.allocation.algorithm.to.pods" to true
-        # Configurations.update(self.apiClient, "apply.allocation.algorithm.to.pods", "true")
+        # Step1:  set global configuration
+        # "apply.allocation.algorithm.to.pods" to true
+        # Configurations.update(self.apiClient,
+        # "apply.allocation.algorithm.to.pods", "true")
         # TODO: restart management server
-        if not is_config_suitable(apiclient=self.apiClient, name='apply.allocation.algorithm.to.pods', value='true'):
-            self.skipTest('apply.allocation.algorithm.to.pods should be true. skipping')
-        #TODO:Step2: Restart management server
+        if not is_config_suitable(apiclient=self.apiClient,
+                                  name='apply.allocation.algorithm.to.pods',
+                                  value='true'):
+            self.skipTest('apply.allocation.algorithm.to.pods '
+                          'should be true. skipping')
+        # TODO:Step2: Restart management server
         self.services["virtual_machine"]["zoneid"] = self.zone.id
         self.services["virtual_machine"]["template"] = self.template.id
-        #Step3: Verifying that VM creation is successful
+        # Step3: Verifying that VM creation is successful
         virtual_machine = VirtualMachine.create(
             self.apiClient,
             self.services["virtual_machine2"],
@@ -131,44 +139,53 @@ class Test42xBugsMgmtSvr(cloudstackTestCase):
         self.cleanup.append(virtual_machine)
         # Verify VM state
         self.assertEqual(
-                            virtual_machine.state,
-                            'Running',
-                            "Check VM state is Running or not"
-                        )
-
-        #cleanup: set global configuration "apply.allocation.algorithm.to.pods" back to false
-        Configurations.update(self.apiClient, "apply.allocation.algorithm.to.pods", "false")
-        #TODO:cleanup: Restart management server
+            virtual_machine.state,
+            'Running',
+            "Check VM state is Running or not"
+        )
+
+        # cleanup: set global configuration
+        # "apply.allocation.algorithm.to.pods" back to false
+        Configurations.update(
+            self.apiClient,
+            "apply.allocation.algorithm.to.pods",
+            "false"
+        )
+        # TODO:cleanup: Restart management server
         return
 
-    @attr(tags=["advanced", "basic","tested"])
+    @attr(tags=["advanced", "basic", "tested"])
     @attr(required_hardware="false")
     def test_local_storage_data_disk_tag(self):
         """
-        @Desc: Test whether tags are honoured while creating data disks on local storage
+        @Desc: Test whether tags are honoured while creating
+        data disks on local storage
         @Steps:
         This test needs multiple local storages
         Step1: create a tag 'loc' on the local storage
         Step2: create a disk offering with this storage tag 'loc'
-        Step3: create a VM and create disk by selecting the disk offering created in step2
-        step4: check whether the data disk created in step3 is created on local storage with tag 'loc'
+        Step3: create a VM and create disk by selecting the disk offering
+         created in step2
+        step4: check whether the data disk created in step3 is created on
+        local storage with tag 'loc'
         """
-        if self.zone.localstorageenabled != True:
-            self.skipTest('Local storage is not enable for this zone. skipping')
+        if self.zone.localstorageenabled:
+            self.skipTest('Local storage is not enable for this '
+                          'zone. skipping')
 
         local_storages = StoragePool.list(self.apiClient,
                                           zoneid=self.zone.id,
                                           scope='HOST')
         self.assertEqual(
-                            isinstance(local_storages, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
+            isinstance(local_storages, list),
+            True,
+            "Check list response returns a valid list"
+        )
         self.assertNotEqual(
-                            local_storages,
-                            None,
-                            "Check if local storage pools exists in ListStoragePools"
-                            )
+            local_storages,
+            None,
+            "Check if local storage pools exists in ListStoragePools"
+        )
 
         cmd = updateStoragePool.updateStoragePoolCmd()
         cmd.zoneid = self.zone.id
@@ -179,12 +196,12 @@ class Test42xBugsMgmtSvr(cloudstackTestCase):
         self.services["disk_offering"]["storagetype"] = 'local'
         self.services["disk_offering"]["tags"] = 'loc'
         disk_offering = DiskOffering.create(
-                                        self.apiClient,
-                                        self.services["disk_offering"]
-                                        )
+            self.apiClient,
+            self.services["disk_offering"]
+        )
         self.services["virtual_machine"]["zoneid"] = self.zone.id
         self.services["virtual_machine"]["template"] = self.template.id
-        #Step3: Verifying that VM creation is successful
+        # Step3: Verifying that VM creation is successful
         virtual_machine = VirtualMachine.create(
             self.apiClient,
             self.services["virtual_machine"],
@@ -192,60 +209,60 @@ class Test42xBugsMgmtSvr(cloudstackTestCase):
             domainid=self.account.domainid,
             serviceofferingid=self.service_offering.id,
             mode=self.services["mode"]
-            )
+        )
         self.cleanup.append(virtual_machine)
         self.cleanup.append(disk_offering)
         # Verify VM state
         self.assertEqual(
-                            virtual_machine.state,
-                            'Running',
-                            "Check VM state is Running or not"
-                        )
-        self.volume = Volume.create(self.apiClient,self.services["volume"],
-                                    zoneid=self.zone.id,
-                                    account=self.account.name,
-                                    domainid=self.account.domainid,
-                                    diskofferingid=disk_offering.id
-                                    )
-
-
+            virtual_machine.state,
+            'Running',
+            "Check VM state is Running or not"
+        )
+        self.volume = Volume.create(
+            self.apiClient,
+            self.services["volume"],
+            zoneid=self.zone.id,
+            account=self.account.name,
+            domainid=self.account.domainid,
+            diskofferingid=disk_offering.id
+        )
         virtual_machine.attach_volume(self.apiClient, self.volume)
 
         self.attached = True
         list_volume_response = Volume.list(
-                                                self.apiClient,
-                                                id=self.volume.id
-                                                )
+            self.apiClient,
+            id=self.volume.id
+        )
         self.assertEqual(
-                            isinstance(list_volume_response, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
+            isinstance(list_volume_response, list),
+            True,
+            "Check list response returns a valid list"
+        )
         self.assertNotEqual(
-                            list_volume_response,
-                            None,
-                            "Check if volume exists in ListVolumes"
-                            )
+            list_volume_response,
+            None,
+            "Check if volume exists in ListVolumes"
+        )
         volume = list_volume_response[0]
         self.assertNotEqual(
-                            volume.virtualmachineid,
-                            None,
-                            "Check if volume state (attached) is reflected"
-                            )
+            volume.virtualmachineid,
+            None,
+            "Check if volume state (attached) is reflected"
+        )
 
         storage_pool = StoragePool.list(self.apiClient, id=volume.storageid)
 
         self.assertEqual(
-                            volume.storagetype,
-                            'local',
-                            "Check list storage pool response has local as storage type"
-                        )
+            volume.storagetype,
+            'local',
+            "Check list storage pool response has local as storage type"
+        )
 
         self.assertEqual(
-                            storage_pool[0].tags,
-                            'loc',
-                            "Check list storage pool response has tag"
-                        )
+            storage_pool[0].tags,
+            'loc',
+            "Check list storage pool response has tag"
+        )
         return
 
     @attr(tags=["advanced", "basic"])
@@ -258,50 +275,23 @@ class Test42xBugsMgmtSvr(cloudstackTestCase):
         Step2: It should return a commit hash
         """
         # Step1: run cloudstack-sccs on management server
-        mgmt_ssh = SshClient(self.apiClient.connection.mgtSvr,
-                           22,
-                           self.apiClient.connection.user,
-                           self.apiClient.connection.passwd
-                             )
+        mgmt_ssh = SshClient(
+            self.apiClient.connection.mgtSvr,
+            22,
+            self.apiClient.connection.user,
+            self.apiClient.connection.passwd
+        )
         res = mgmt_ssh.execute("cloudstack-sccs")
         # Step2: It should return a commit hash
         return
 
     @attr(tags=["advanced", "basic"])
-    @attr(required_hardware="true")
-    def test_add_cluster_datacenter_spaces(self):
-        """
-        @Desc: Add VmWare cluster to the CS with the data center name contains space in between
-        @Steps:
-        Step1: Add VmWare cluster to the CS with the data center name contains space in between.
-        """
-        if self.hypervisor.lower() != 'vmware':
-            self.skipTest('Can be run only on vmware zone. skipping')
-        cmd = addCluster.addClusterCmd()
-        cmd.zoneid = self.zone.id
-        cmd.hypervisor = self.hypervisor
-        cmd.clustertype= self.services["vmware_cluster"]["clustertype"]
-        cmd.podId = self.pod.id
-        cmd.username = self.services["vmware_cluster"]["username"]
-        cmd.password = self.services["vmware_cluster"]["password"]
-        cmd.publicswitchtype = 'vmwaredvs'
-        cmd.guestswitchtype = 'vmwaredvs'
-        cmd.url = self.services["vmware_cluster"]["url"]
-        cmd.clustername = self.services["vmware_cluster"]["url"]
-
-        self.apiClient.addCluster(cmd)
-
-        return
-
-
-
-    @attr(tags=["advanced", "basic"])
     @attr(required_hardware="false")
     @attr(storage="s3")
     def test_es_1863_register_template_s3_domain_admin_user(self):
         """
-        @Desc: Test whether cloudstack allows Domain admin or user to register a template using
-        S3/Swift object store.
+        @Desc: Test whether cloudstack allows Domain admin or user
+        to register a template using S3/Swift object store.
         @Steps:
         Step1: create a Domain and users in it.
         Step2: Register a template as Domain admin.
@@ -310,9 +300,9 @@ class Test42xBugsMgmtSvr(cloudstackTestCase):
         """
         # Step1: create a Domain and users in it.
         self.newdomain = Domain.create(self.apiClient,
-                               self.services["domain"])
+                                       self.services["domain"])
 
-        #create account in the domain
+        # create account in the domain
         self.account_domain = Account.create(
             self.apiClient,
             self.services["account"],
@@ -322,18 +312,20 @@ class Test42xBugsMgmtSvr(cloudstackTestCase):
         self.cleanup.append(self.newdomain)
         # Getting authentication for user in newly created Account in domain
         self.domain_user = self.account_domain.user[0]
-        self.domain_userapiclient = self.testClient.getUserApiClient(self.domain_user.username, self.newdomain.name)
+        self.domain_userapiclient = self.testClient.getUserApiClient(
+            self.domain_user.username, self.newdomain.name
+        )
 
         # Step2: Register a template as Domain admin.
         self.services["templateregister"]["ostype"] = self.services["ostype"]
         self.domain_template = Template.register(
-                                        self.apiClient,
-                                        self.services["templateregister"],
-                                        zoneid=self.zone.id,
-                                        account=self.account_domain.name,
-                                        domainid=self.newdomain.id,
-                                        hypervisor=self.hypervisor
-                                        )
+            self.apiClient,
+            self.services["templateregister"],
+            zoneid=self.zone.id,
+            account=self.account_domain.name,
+            domainid=self.newdomain.id,
+            hypervisor=self.hypervisor
+        )
         # Wait for template to download
         self.domain_template.download(self.api_client)
 
@@ -341,20 +333,20 @@ class Test42xBugsMgmtSvr(cloudstackTestCase):
         time.sleep(60)
         # Step3: Register a template as Domain user.
         self.domain_user_template = Template.register(
-                                        self.domain_userapiclient,
-                                        self.services["templateregister"],
-                                        zoneid=self.zone.id,
-                                        account=self.account_domain.name,
-                                        domainid=self.newdomain.id,
-                                        hypervisor=self.hypervisor
-                                        )
+            self.domain_userapiclient,
+            self.services["templateregister"],
+            zoneid=self.zone.id,
+            account=self.account_domain.name,
+            domainid=self.newdomain.id,
+            hypervisor=self.hypervisor
+        )
         # Wait for template to download
         self.domain_user_template.download(self.api_client)
 
         # Wait for template status to be changed across
         time.sleep(60)
 
-        #TODO: Step4: Template should be registered successfully.
+        # TODO: Step4: Template should be registered successfully.
         return
 
     @attr(tags=["advanced", "basic"])
@@ -365,17 +357,18 @@ class Test42xBugsMgmtSvr(cloudstackTestCase):
         @Desc: Test root volume resize of stopped VM
         @Reference: https://issues.apache.org/jira/browse/CLOUDSTACK-6181
         @Steps:
-        Step1: Deploy VM in stopped state (startvm=false), resize via 'resizeVolume', start VM. Root is new size.
+        Step1: Deploy VM in stopped state (startvm=false),
+        resize via 'resizeVolume', start VM. Root is new size.
         """
         # Check whether usage server is running or not
 
-        if (self.hypervisor.lower() != 'kvm'):
+        if self.hypervisor.lower() != 'kvm':
             self.skipTest("Test can be run only on KVM hypervisor")
-        # deploy virtural machine in stopped state
+        # deploy virtual machine in stopped state
         self.services["virtual_machine"]["zoneid"] = self.zone.id
         self.services["virtual_machine"]["template"] = self.template.id
 
-        #Step3: Verifying that VM creation is successful
+        # Step3: Verifying that VM creation is successful
         virtual_machine = VirtualMachine.create(
             self.apiClient,
             self.services["virtual_machine"],
@@ -383,22 +376,22 @@ class Test42xBugsMgmtSvr(cloudstackTestCase):
             domainid=self.account.domainid,
             serviceofferingid=self.service_offering.id,
             startvm=False
-            )
+        )
         self.cleanup.append(virtual_machine)
         # Verify VM state
         self.assertEqual(
-                            virtual_machine.state,
-                            'Stopped',
-                            "Check VM state is Stopped or not"
-                        )
+            virtual_machine.state,
+            'Stopped',
+            "Check VM state is Stopped or not"
+        )
         volumes = list_volumes(
-                            self.apiClient,
-                            virtualmachineid=self.virtual_machine.id,
-                            type='ROOT',
-                            listall=True
-                            )
+            self.apiClient,
+            virtualmachineid=virtual_machine.id,
+            type='ROOT',
+            listall=True
+        )
 
-        self.assertIsNotNone(volumes,"root volume is not returned properly")
+        self.assertIsNotNone(volumes, "root volume is not returned properly")
         newrootsize = (self.template.size >> 30) + 2
         cmd = resizeVolume.resizeVolumeCmd()
         cmd.id = volumes[0].id
@@ -408,11 +401,11 @@ class Test42xBugsMgmtSvr(cloudstackTestCase):
         virtual_machine.start(self.apiClient)
 
         volumes_after_resize = list_volumes(
-                            self.apiClient,
-                            virtualmachineid=self.virtual_machine.id,
-                            type='ROOT',
-                            listall=True
-                            )
+            self.apiClient,
+            virtualmachineid=virtual_machine.id,
+            type='ROOT',
+            listall=True
+        )
 
         rootvolume = volumes_after_resize[0]
         success = False
@@ -420,10 +413,10 @@ class Test42xBugsMgmtSvr(cloudstackTestCase):
             success = True
 
         self.assertEqual(
-                         success,
-                         True,
-                         "Check if the root volume resized appropriately"
-                        )
+            success,
+            True,
+            "Check if the root volume resized appropriately"
+        )
         return
 
     @attr(tags=["advanced", "basic"])
@@ -438,13 +431,13 @@ class Test42xBugsMgmtSvr(cloudstackTestCase):
         """
         # Check whether usage server is running or not
 
-        if (self.hypervisor.lower() != 'kvm'):
+        if self.hypervisor.lower() != 'kvm':
             self.skipTest("Test can be run only on KVM hypervisor")
-        # deploy virtural machine in stopped state
+        # deploy virtual machine in stopped state
         self.services["virtual_machine"]["zoneid"] = self.zone.id
         self.services["virtual_machine"]["template"] = self.template.id
 
-        #Step3: Verifying that VM creation is successful
+        # Step3: Verifying that VM creation is successful
         virtual_machine = VirtualMachine.create(
             self.apiClient,
             self.services["virtual_machine"],
@@ -455,18 +448,18 @@ class Test42xBugsMgmtSvr(cloudstackTestCase):
         self.cleanup.append(virtual_machine)
         # Verify VM state
         self.assertEqual(
-                            virtual_machine.state,
-                            'Running',
-                            "Check VM state is Running or not"
-                        )
+            virtual_machine.state,
+            'Running',
+            "Check VM state is Running or not"
+        )
         volumes = list_volumes(
-                            self.apiClient,
-                            virtualmachineid=self.virtual_machine.id,
-                            type='ROOT',
-                            listall=True
-                            )
+            self.apiClient,
+            virtualmachineid=virtual_machine.id,
+            type='ROOT',
+            listall=True
+        )
 
-        self.assertIsNotNone(volumes,"root volume is not returned properly")
+        self.assertIsNotNone(volumes, "root volume is not returned properly")
         newrootsize = (self.template.size >> 30) + 2
         cmd = resizeVolume.resizeVolumeCmd()
         cmd.id = volumes[0].id
@@ -474,11 +467,11 @@ class Test42xBugsMgmtSvr(cloudstackTestCase):
         self.apiClient.resizeVolume(cmd)
 
         volumes_after_resize = list_volumes(
-                            self.apiClient,
-                            virtualmachineid=self.virtual_machine.id,
-                            type='ROOT',
-                            listall=True
-                            )
+            self.apiClient,
+            virtualmachineid=virtual_machine.id,
+            type='ROOT',
+            listall=True
+        )
 
         rootvolume = volumes_after_resize[0]
         success = False
@@ -486,10 +479,10 @@ class Test42xBugsMgmtSvr(cloudstackTestCase):
             success = True
 
         self.assertEqual(
-                         success,
-                         True,
-                         "Check if the root volume resized appropriately"
-                        )
+            success,
+            True,
+            "Check if the root volume resized appropriately"
+        )
         return
 
     @unittest.skip('In progress')
@@ -497,13 +490,15 @@ class Test42xBugsMgmtSvr(cloudstackTestCase):
     @attr(required_hardware="false")
     def test_CLOUDSTACK_5023(self):
         """
-        @Desc: Test whether we are able to delete PF rule while rabbit mq is collecting usage events.
+        @Desc: Test whether we are able to delete PF rule while
+         rabbit mq is collecting usage events.
         @Steps:
         step1. Run Usage server
-        step2. Delete a PF rule and check whether it is succesful and usage event is generated
+        step2. Delete a PF rule and check whether it is
+        successful and usage event is generated
         Configure RabbitMQ for usage event generation
         """
-        #TBA
+        # TBA
         return
 
     @attr(tags=["advanced", "basic"])
@@ -511,25 +506,25 @@ class Test42xBugsMgmtSvr(cloudstackTestCase):
     @attr(configuration='apply.allocation.algorithm.to.pods')
     def test_es_47_list_os_types_win_2012(self):
         """
-        @Desc: Test VM creation while "apply.allocation.algorithm.to.pods" is set to true
+        @Desc: Test VM creation while "apply.allocation.algorithm.to.pods"
+        is set to true
         @Reference: https://issues.apache.org/jira/browse/CLOUDSTACK-4947
         @Steps:
         Step1: register windows 2012 VM template as windows 8 template
-        Step2: deploy a VM with windows2012 template and  Verify that VM creation is successful
+        Step2: deploy a VM with windows2012 template and  Verify
+        that VM creation is successful
 
          """
 
         # register windows 2012 VM template as windows 8 template
         self.win2012_template = Template.register(
-                                        self.apiClient,
-                                        self.services["win2012template"],
-                                        zoneid=self.zone.id,
-                                        account=self.account.name,
-                                        domainid=self.domain.id,
-                                        hypervisor=self.hypervisor
-                                        )
-
-
+            self.apiClient,
+            self.services["win2012template"],
+            zoneid=self.zone.id,
+            account=self.account.name,
+            domainid=self.domain.id,
+            hypervisor=self.hypervisor
+        )
         # Wait for template to download
         self.win2012_template.download(self.apiClient)
         self.cleanup.append(self.win2012_template)
@@ -545,24 +540,26 @@ class Test42xBugsMgmtSvr(cloudstackTestCase):
             self.services["virtual_machine"],
             accountid=self.account.name,
             domainid=self.account.domainid,
-            serviceofferingid=self.service_offering.id,
-            )
+            serviceofferingid=self.service_offering.id
+        )
         self.cleanup.append(vm1)
         # Verify VM state
         self.assertEqual(
-                            vm1.state,
-                            'Running',
-                            "Check VM state is Running or not"
-                        )
+            vm1.state,
+            'Running',
+            "Check VM state is Running or not"
+        )
         return
 
     @attr(tags=["advanced", "basic", "test"])
     @attr(required_hardware="true")
     def test_secondary_storage_stats(self):
         """
-        @Desc: Dashboard is not showing correct secondary storage statistics
+        @Desc: Dashboard is not showing correct secondary
+        storage statistics
         @Steps:
-        Step1: listCapacity api should show correct secondary storage statistics
+        Step1: listCapacity api should show correct secondary
+        storage statistics
         """
         cmd = listCapacity.listCapacityCmd()
         cmd.type = 6
@@ -570,17 +567,20 @@ class Test42xBugsMgmtSvr(cloudstackTestCase):
         response = self.apiClient.listCapacity(cmd)
 
         self.assertEqual(
-                            isinstance(response, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
+            isinstance(response, list),
+            True,
+            "Check list response returns a valid list"
+        )
         self.assertNotEqual(
-                            response,
-                            None,
-                            "Check if listCapacity has returned properly"
-                            )
-        self.assertNotEqual(response[0].capacitytotal, 0, "check the total capacity of secondary storage returned")
-
+            response,
+            None,
+            "Check if listCapacity has returned properly"
+        )
+        self.assertNotEqual(
+            response[0].capacitytotal,
+            0,
+            "check the total capacity of secondary storage returned"
+        )
         return
 
     @attr(tags=["advanced", "basic"])
@@ -593,11 +593,12 @@ class Test42xBugsMgmtSvr(cloudstackTestCase):
         and see that it times out with in 30seconds
         """
         # Step1: run cloudstack-sccs on management server
-        mgmt_ssh = SshClient(self.apiClient.connection.mgtSvr,
-                           22,
-                           self.apiClient.connection.user,
-                           self.apiClient.connection.passwd
-                             )
+        mgmt_ssh = SshClient(
+            self.apiClient.connection.mgtSvr,
+            22,
+            self.apiClient.connection.user,
+            self.apiClient.connection.passwd
+        )
         res = mgmt_ssh.execute("time telnet localhost 8250")
 
         # Step2: It should return a commit hash
@@ -607,16 +608,18 @@ class Test42xBugsMgmtSvr(cloudstackTestCase):
     @attr(required_hardware="true")
     def test_add_cluster_datacenter_spaces(self):
         """
-        @Desc: Add VmWare cluster to the CS with the data center name contains space in between
+        @Desc: Add VmWare cluster to the CS with the data center
+        name contains space in between
         @Steps:
-        Step1: Add VmWare cluster to the CS with the data center name contains space in between.
+        Step1: Add VmWare cluster to the CS with the data center
+         name contains space in between.
         """
         if self.hypervisor.lower() != 'vmware':
             self.skipTest('Can be run only on vmware zone. skipping')
         cmd = addCluster.addClusterCmd()
         cmd.zoneid = self.zone.id
         cmd.hypervisor = self.hypervisor
-        cmd.clustertype= self.services["vmware_cluster"]["clustertype"]
+        cmd.clustertype = self.services["vmware_cluster"]["clustertype"]
         cmd.podId = self.pod.id
         cmd.username = self.services["vmware_cluster"]["username"]
         cmd.password = self.services["vmware_cluster"]["password"]


[02/28] git commit: updated refs/heads/master to 8c9093b

Posted by ra...@apache.org.
CLOUDSTACK-7843: sync Job Failures always reported as success on Event Bus


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

Branch: refs/heads/master
Commit: cdabb2407a0761939d5159fd2317ebd7dcca4eb7
Parents: 34f31f9
Author: Damodar <da...@citrix.com>
Authored: Wed Nov 5 17:19:46 2014 +0530
Committer: Kishan Kavala <ki...@apache.org>
Committed: Mon Nov 10 15:07:13 2014 +0530

----------------------------------------------------------------------
 .../cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java       | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cdabb240/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
----------------------------------------------------------------------
diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
index 91516d5..d5f7f9d 100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/AsyncJobManagerImpl.java
@@ -253,7 +253,6 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
         if (s_logger.isDebugEnabled()) {
             s_logger.debug("Publish async job-" + jobId + " complete on message bus");
         }
-        publishOnEventBus(job, "complete"); // publish before the instance type and ID are wiped out
 
         if (s_logger.isDebugEnabled()) {
             s_logger.debug("Wake up jobs related to job-" + jobId);
@@ -291,6 +290,8 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
             }
         });
 
+        publishOnEventBus(job, "complete"); // publish before the instance type and ID are wiped out
+
         //
         // disable wakeup scheduling now, since all API jobs are currently using block-waiting for sub-jobs
         //


[09/28] git commit: updated refs/heads/master to 8c9093b

Posted by ra...@apache.org.
CLOUDSTACK-7862: Fixed the script 'maint/test_high_availability.py' - Test Cases failing on Simulator as Testcases try to ssh to the VMs

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/2f7959d2
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2f7959d2
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2f7959d2

Branch: refs/heads/master
Commit: 2f7959d2190d3afbd71f42a84725b75107f925d8
Parents: f78defd
Author: Chandan Purushothama <Ch...@citrix.com>
Authored: Fri Nov 7 15:00:03 2014 -0800
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Mon Nov 10 16:37:02 2014 +0530

----------------------------------------------------------------------
 test/integration/component/maint/test_high_availability.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2f7959d2/test/integration/component/maint/test_high_availability.py
----------------------------------------------------------------------
diff --git a/test/integration/component/maint/test_high_availability.py b/test/integration/component/maint/test_high_availability.py
index cc687f8..3e69fd5 100644
--- a/test/integration/component/maint/test_high_availability.py
+++ b/test/integration/component/maint/test_high_availability.py
@@ -165,7 +165,7 @@ class TestHighAvailability(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(tags = ["advanced", "advancedns", "multihost"])
+    @attr(tags = ["advanced", "advancedns", "multihost"], required_hardware="true")
     def test_01_host_maintenance_mode(self):
         """Test host maintenance mode
         """
@@ -556,7 +556,7 @@ class TestHighAvailability(cloudstackTestCase):
                       )
         return
 
-    @attr(tags = ["advanced", "advancedns", "multihost"])
+    @attr(tags = ["advanced", "advancedns", "multihost"], required_hardware="true")
     def test_02_host_maintenance_mode_with_activities(self):
         """Test host maintenance mode with activities
         """


[26/28] git commit: updated refs/heads/master to 8c9093b

Posted by ra...@apache.org.
CLOUDSTACK-7896: UI > network > Add Guest Network > when zone dropdown is empty, do not make API call to get physical networks.


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

Branch: refs/heads/master
Commit: 9809164654159fd1cea4842d76a6a0b97fc72e54
Parents: 6c955a3
Author: Jessica Wang <je...@apache.org>
Authored: Wed Nov 12 16:24:15 2014 -0800
Committer: Jessica Wang <je...@apache.org>
Committed: Wed Nov 12 16:25:41 2014 -0800

----------------------------------------------------------------------
 ui/scripts/sharedFunctions.js | 76 +++++++++++++++++++-------------------
 1 file changed, 39 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98091646/ui/scripts/sharedFunctions.js
----------------------------------------------------------------------
diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js
index 6bcc50e..1adab5b 100644
--- a/ui/scripts/sharedFunctions.js
+++ b/ui/scripts/sharedFunctions.js
@@ -262,7 +262,7 @@ var addGuestNetworkDialog = {
                                     if (items != null) {
                                         for (var i = 0; i < items.length; i++) {
                                             if (items[i].networktype == 'Advanced') {
-                                                addGuestNetworkDialog.zoneObjs.push(items[i]);
+                                                addGuestNetworkDialog.zoneObjs.push(items[i]); 
                                             }
                                         }
                                     }
@@ -288,42 +288,44 @@ var addGuestNetworkDialog = {
                         if ('physicalNetworks' in args.context) { //Infrastructure menu > zone detail > guest traffic type > network tab (only shown in advanced zone) > add guest network dialog
                             addGuestNetworkDialog.physicalNetworkObjs = args.context.physicalNetworks;
                         } else { //Network menu > guest network section > add guest network dialog
-                            var selectedZoneId = args.$form.find('.form-item[rel=zoneId]').find('select').val();
-                            $.ajax({
-                                url: createURL('listPhysicalNetworks'),
-                                data: {
-                                    zoneid: selectedZoneId
-                                },
-                                async: false,
-                                success: function(json) {                                    
-                                	var items = [];
-                                	var physicalnetworks = json.listphysicalnetworksresponse.physicalnetwork;
-                                	if (physicalnetworks != null) {
-                                	    for (var i = 0; i < physicalnetworks.length; i++) {
-                                	    	$.ajax({
-                                	    		url: createURL('listTrafficTypes'),
-                                	    		data: {
-                                	    			physicalnetworkid: physicalnetworks[i].id
-                                	    		},
-                                	    		async: false,
-                                	    		success: function(json) {                                	    			
-                                	    			var traffictypes = json.listtraffictypesresponse.traffictype;
-                                	    			if (traffictypes != null) {
-                                	    				for (var k = 0; k < traffictypes.length; k++) {
-                                	    					if (traffictypes[k].traffictype == 'Guest') {
-                                	    						items.push(physicalnetworks[i]);
-                                	    						break;
-                                	    					}
-                                	    				}
-                                	    			} 
-                                	    		}
-                                	    	});
-                                	    }	
-                                	}  
-                                	
-                                	addGuestNetworkDialog.physicalNetworkObjs = items;                                	
-                                }
-                            });
+                            var selectedZoneId = args.$form.find('.form-item[rel=zoneId]').find('select').val();                           
+                            if (selectedZoneId != undefined && selectedZoneId.length > 0) {
+	                            $.ajax({
+	                                url: createURL('listPhysicalNetworks'),
+	                                data: {
+	                                    zoneid: selectedZoneId
+	                                },
+	                                async: false,
+	                                success: function(json) {                                    
+	                                	var items = [];
+	                                	var physicalnetworks = json.listphysicalnetworksresponse.physicalnetwork;
+	                                	if (physicalnetworks != null) {
+	                                	    for (var i = 0; i < physicalnetworks.length; i++) {
+	                                	    	$.ajax({
+	                                	    		url: createURL('listTrafficTypes'),
+	                                	    		data: {
+	                                	    			physicalnetworkid: physicalnetworks[i].id
+	                                	    		},
+	                                	    		async: false,
+	                                	    		success: function(json) {                                	    			
+	                                	    			var traffictypes = json.listtraffictypesresponse.traffictype;
+	                                	    			if (traffictypes != null) {
+	                                	    				for (var k = 0; k < traffictypes.length; k++) {
+	                                	    					if (traffictypes[k].traffictype == 'Guest') {
+	                                	    						items.push(physicalnetworks[i]);
+	                                	    						break;
+	                                	    					}
+	                                	    				}
+	                                	    			} 
+	                                	    		}
+	                                	    	});
+	                                	    }	
+	                                	}  
+	                                	
+	                                	addGuestNetworkDialog.physicalNetworkObjs = items;                                	
+	                                }
+	                            });
+                            }
                         }
                         var items = [];
                         if (addGuestNetworkDialog.physicalNetworkObjs != null) {


[08/28] git commit: updated refs/heads/master to 8c9093b

Posted by ra...@apache.org.
CLOUDSTACK-7863: Fix the script 'test_vpc_vms_deployment.py' - Test Cases failing on Simulator as Testcases try to ssh to the VMs

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/f78defda
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f78defda
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f78defda

Branch: refs/heads/master
Commit: f78defda0fa1c07d440b484c414b16a09e58433a
Parents: 3e00f99
Author: Chandan Purushothama <Ch...@citrix.com>
Authored: Fri Nov 7 15:32:45 2014 -0800
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Mon Nov 10 16:31:31 2014 +0530

----------------------------------------------------------------------
 test/integration/component/test_vpc_vms_deployment.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f78defda/test/integration/component/test_vpc_vms_deployment.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_vms_deployment.py b/test/integration/component/test_vpc_vms_deployment.py
index e61b2f8..f8aa556 100644
--- a/test/integration/component/test_vpc_vms_deployment.py
+++ b/test/integration/component/test_vpc_vms_deployment.py
@@ -1798,7 +1798,7 @@ class TestVMDeployVPC(cloudstackTestCase):
                              )
         return
 
-    @attr(tags=["advanced", "intervlan"], required_hardware="false")
+    @attr(tags=["advanced", "intervlan"], required_hardware="true")
     def test_07_delete_network_with_rules(self):
         """ Test delete network that has PF/staticNat/LB rules/Network Acl
         """
@@ -2352,7 +2352,7 @@ class TestVMDeployVPC(cloudstackTestCase):
                          )
         return
 
-    @attr(tags=["advanced", "intervlan"], required_hardware="false")
+    @attr(tags=["advanced", "intervlan"], required_hardware="true")
     def test_08_ip_reallocation_CS5986(self):
         """
         @Desc: Test to verify dnsmasq dhcp conflict issue due to /ect/hosts not getting udpated


[24/28] git commit: updated refs/heads/master to 8c9093b

Posted by ra...@apache.org.
CLOUDSTACK-7590 Deletion of Account is not deleting the account from the database

Revert "CLOUDSTACK-7073: Added domainId field to the user table in order to restrict duplicated users creation on the db level"

This reverts commit 5a96d8ef5cbc88df366016ae9dd7ee46e4ca417a.

Conflicts:
	setup/db/db/schema-440to450.sql


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

Branch: refs/heads/master
Commit: a4b92e908aa6271d3aa94656ca5d4d1ac6fd5c6c
Parents: 4e820b3
Author: Prachi Damle <pr...@citrix.com>
Authored: Tue Nov 11 19:25:46 2014 -0800
Committer: Prachi Damle <pr...@citrix.com>
Committed: Wed Nov 12 11:48:36 2014 -0800

----------------------------------------------------------------------
 engine/schema/src/com/cloud/user/UserVO.java          |  6 ------
 engine/schema/src/com/cloud/user/dao/UserDaoImpl.java | 13 -------------
 setup/db/db/schema-441to450.sql                       |  6 ------
 3 files changed, 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a4b92e90/engine/schema/src/com/cloud/user/UserVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/user/UserVO.java b/engine/schema/src/com/cloud/user/UserVO.java
index 8ab450d..68879f6 100644
--- a/engine/schema/src/com/cloud/user/UserVO.java
+++ b/engine/schema/src/com/cloud/user/UserVO.java
@@ -97,9 +97,6 @@ public class UserVO implements User, Identity, InternalIdentity {
     @Column(name = "default")
     boolean isDefault;
 
-    @Column(name = "domain_id")
-    private long domainId;
-
     public UserVO() {
         this.uuid = UUID.randomUUID().toString();
     }
@@ -273,7 +270,4 @@ public class UserVO implements User, Identity, InternalIdentity {
         return isDefault;
     }
 
-    public void setDomainId(long domainId) {
-        this.domainId = domainId;
-    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a4b92e90/engine/schema/src/com/cloud/user/dao/UserDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/user/dao/UserDaoImpl.java b/engine/schema/src/com/cloud/user/dao/UserDaoImpl.java
index d39177e..6ac398d 100644
--- a/engine/schema/src/com/cloud/user/dao/UserDaoImpl.java
+++ b/engine/schema/src/com/cloud/user/dao/UserDaoImpl.java
@@ -19,11 +19,9 @@ package com.cloud.user.dao;
 import java.util.List;
 
 import javax.ejb.Local;
-import javax.inject.Inject;
 
 import org.springframework.stereotype.Component;
 
-import com.cloud.user.Account;
 import com.cloud.user.UserVO;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.GenericDaoBase;
@@ -42,9 +40,6 @@ public class UserDaoImpl extends GenericDaoBase<UserVO, Long> implements UserDao
     protected SearchBuilder<UserVO> SecretKeySearch;
     protected SearchBuilder<UserVO> RegistrationTokenSearch;
 
-    @Inject
-    AccountDao _accountDao;
-
     protected UserDaoImpl() {
         UsernameSearch = createSearchBuilder();
         UsernameSearch.and("username", UsernameSearch.entity().getUsername(), SearchCriteria.Op.EQ);
@@ -133,12 +128,4 @@ public class UserDaoImpl extends GenericDaoBase<UserVO, Long> implements UserDao
         return listBy(sc);
     }
 
-    @Override
-    @DB
-    public UserVO persist(UserVO user) {
-        Account account = _accountDao.findById(user.getAccountId());
-        user.setDomainId(account.getDomainId());
-        return super.persist(user);
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a4b92e90/setup/db/db/schema-441to450.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-441to450.sql b/setup/db/db/schema-441to450.sql
index 61721b7..1f0e226 100644
--- a/setup/db/db/schema-441to450.sql
+++ b/setup/db/db/schema-441to450.sql
@@ -278,12 +278,6 @@ CREATE TABLE `cloud`.`brocade_network_vlan_map` (
 /* As part of the separation of Xen and XenServer, update the column for the network labels */
 ALTER TABLE `cloud`.`physical_network_traffic_types` CHANGE `xen_network_label` `xenserver_network_label` varchar(255) COMMENT 'The network name label of the physical device dedicated to this traffic on a XenServer host';
 
-/*Adding domainId field to the user table in order to restrict duplicated users creation on the db level*/
-ALTER TABLE `cloud`.`user` ADD COLUMN domain_id bigint(20) unsigned DEFAULT NULL;
-ALTER TABLE `cloud`.`user` ADD CONSTRAINT `fk_user__domain_id` FOREIGN KEY `fk_user__domain_id`(`domain_id`) REFERENCES `domain`(`id`) ON DELETE CASCADE;
-UPDATE `cloud`.`user` SET `cloud`.`user`.domain_id=(SELECT `cloud`.`account`.domain_id   FROM `cloud`.`account`   WHERE `cloud`.`account`.id=`cloud`.`user`.account_id) where id > 0;
-ALTER TABLE `cloud`.`user` ADD UNIQUE KEY `username_domain_id` (`username`,`domain_id`);
-
 ALTER TABLE `cloud`.`volumes` CHANGE COLUMN `iso_id` `iso_id` bigint(20) unsigned COMMENT 'The id of the iso from which the volume was created';
 
 DROP VIEW IF EXISTS `cloud`.`storage_pool_view`;


[03/28] git commit: updated refs/heads/master to 8c9093b

Posted by ra...@apache.org.
CLOUDSTACK-7851:MS does not start after the VM it is running on is rebooted


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

Branch: refs/heads/master
Commit: 34f31f90331d0027b133ccdc8fdb65ab86ce26cc
Parents: 310bb25
Author: Damodar <da...@citrix.com>
Authored: Thu Nov 6 12:04:30 2014 +0530
Committer: Kishan Kavala <ki...@apache.org>
Committed: Mon Nov 10 15:07:13 2014 +0530

----------------------------------------------------------------------
 packaging/centos63/cloud-management.rc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/34f31f90/packaging/centos63/cloud-management.rc
----------------------------------------------------------------------
diff --git a/packaging/centos63/cloud-management.rc b/packaging/centos63/cloud-management.rc
index eaabd30..6d28748 100755
--- a/packaging/centos63/cloud-management.rc
+++ b/packaging/centos63/cloud-management.rc
@@ -87,7 +87,8 @@ handle_pid_file() {
 }
 
 start() {
-    source $(dirname $0)/tomcat.sh
+    readpath=$(readlink -f $0)
+    source `dirname $readpath`/tomcat.sh
 }
 
 # See how we were called.