You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2014/12/18 12:56:21 UTC

[01/40] git commit: updated refs/heads/master to f4133a7

Repository: cloudstack
Updated Branches:
  refs/heads/master 1df0453d2 -> f4133a7f7


CLOUDSTACK-8053: Fix loop termination - test_vpc_host_maintenance.py

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


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

Branch: refs/heads/master
Commit: ab580de38d6517598571034cb5caa56ba5cdbdf1
Parents: a592b01
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Tue Dec 9 16:45:04 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Tue Dec 9 18:30:06 2014 +0530

----------------------------------------------------------------------
 test/integration/component/maint/test_vpc_host_maintenance.py | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ab580de3/test/integration/component/maint/test_vpc_host_maintenance.py
----------------------------------------------------------------------
diff --git a/test/integration/component/maint/test_vpc_host_maintenance.py b/test/integration/component/maint/test_vpc_host_maintenance.py
index 7027469..74d59e7 100644
--- a/test/integration/component/maint/test_vpc_host_maintenance.py
+++ b/test/integration/component/maint/test_vpc_host_maintenance.py
@@ -221,6 +221,7 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
             cls.hosts = Host.list(cls.api_client, clusterid=cluster.id)
             if len(cls.hosts) >= 2:
                 clusterWithSufficientHosts = cluster
+                break
 
         if clusterWithSufficientHosts is None:
             raise unittest.SkipTest("No Cluster with 2 hosts found")


[22/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
When deleting primary storage that's based on the SolidFireShared plug-in (which uses a shared-IOPS approach), remove the volume from the volume access group it's in


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

Branch: refs/heads/master
Commit: 453c5b3ec0365603a38468eb7de5d3dec0029ace
Parents: aca0f79
Author: Mike Tutkowski <mi...@solidfire.com>
Authored: Mon Dec 15 14:11:31 2014 -0700
Committer: Mike Tutkowski <mi...@solidfire.com>
Committed: Mon Dec 15 16:23:33 2014 -0700

----------------------------------------------------------------------
 ...olidFireSharedPrimaryDataStoreLifeCycle.java | 33 ++++++++++++++++++++
 1 file changed, 33 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/453c5b3e/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/lifecycle/SolidFireSharedPrimaryDataStoreLifeCycle.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/lifecycle/SolidFireSharedPrimaryDataStoreLifeCycle.java b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/lifecycle/SolidFireSharedPrimaryDataStoreLifeCycle.java
index b70333d..4fa49ef 100644
--- a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/lifecycle/SolidFireSharedPrimaryDataStoreLifeCycle.java
+++ b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/lifecycle/SolidFireSharedPrimaryDataStoreLifeCycle.java
@@ -52,6 +52,7 @@ import com.cloud.agent.api.CreateStoragePoolCommand;
 import com.cloud.agent.api.DeleteStoragePoolCommand;
 import com.cloud.agent.api.StoragePoolInfo;
 import com.cloud.dc.ClusterDetailsDao;
+import com.cloud.dc.ClusterDetailsVO;
 import com.cloud.dc.ClusterVO;
 import com.cloud.dc.dao.ClusterDao;
 import com.cloud.dc.dao.DataCenterDao;
@@ -491,6 +492,8 @@ public class SolidFireSharedPrimaryDataStoreLifeCycle implements PrimaryDataStor
             _tmpltMgr.evictTemplateFromStoragePool(templatePoolVO);
         }
 
+        Long clusterId = null;
+
         for (StoragePoolHostVO host : hostPoolRecords) {
             DeleteStoragePoolCommand deleteCmd = new DeleteStoragePoolCommand(storagePool);
 
@@ -523,6 +526,12 @@ public class SolidFireSharedPrimaryDataStoreLifeCycle implements PrimaryDataStor
             if (answer != null && answer.getResult()) {
                 s_logger.info("Successfully deleted storage pool using Host ID " + host.getHostId());
 
+                HostVO hostVO = this._hostDao.findById(host.getHostId());
+
+                if (hostVO != null) {
+                    clusterId = hostVO.getClusterId();
+                }
+
                 break;
             }
             else {
@@ -530,11 +539,35 @@ public class SolidFireSharedPrimaryDataStoreLifeCycle implements PrimaryDataStor
             }
         }
 
+        if (clusterId != null) {
+            removeVolumeFromVag(storagePool.getId(), clusterId);
+        }
+
         deleteSolidFireVolume(storagePool.getId());
 
         return _primaryDataStoreHelper.deletePrimaryDataStore(dataStore);
     }
 
+    private void removeVolumeFromVag(long storagePoolId, long clusterId) {
+        long sfVolumeId = getVolumeId(storagePoolId);
+        ClusterDetailsVO clusterDetail = _clusterDetailsDao.findDetail(clusterId, SolidFireUtil.getVagKey(storagePoolId));
+
+        String vagId = clusterDetail != null ? clusterDetail.getValue() : null;
+
+        if (vagId != null) {
+            List<HostVO> hosts = _hostDao.findByClusterId(clusterId);
+
+            SolidFireUtil.SolidFireConnection sfConnection = SolidFireUtil.getSolidFireConnection(storagePoolId, _storagePoolDetailsDao);
+
+            SolidFireUtil.SolidFireVag sfVag = SolidFireUtil.getSolidFireVag(sfConnection, Long.parseLong(vagId));
+
+            String[] hostIqns = SolidFireUtil.getNewHostIqns(sfVag.getInitiators(), SolidFireUtil.getIqnsFromHosts(hosts));
+            long[] volumeIds = SolidFireUtil.getNewVolumeIds(sfVag.getVolumeIds(), sfVolumeId, false);
+
+            SolidFireUtil.modifySolidFireVag(sfConnection, sfVag.getId(), hostIqns, volumeIds);
+        }
+    }
+
     private void deleteSolidFireVolume(long storagePoolId) {
         SolidFireUtil.SolidFireConnection sfConnection = SolidFireUtil.getSolidFireConnection(storagePoolId, _storagePoolDetailsDao);
 


[03/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK-8048: Fix test_ss_limits.py

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


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

Branch: refs/heads/master
Commit: e22cc6e9409a54858f3ffd803fcdde55e75ee8c6
Parents: b23fd5e
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Tue Dec 9 10:56:03 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Tue Dec 9 18:54:14 2014 +0530

----------------------------------------------------------------------
 test/integration/component/test_ss_limits.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e22cc6e9/test/integration/component/test_ss_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_ss_limits.py b/test/integration/component/test_ss_limits.py
index 4d6efc4..c83a7f5 100644
--- a/test/integration/component/test_ss_limits.py
+++ b/test/integration/component/test_ss_limits.py
@@ -233,7 +233,14 @@ class TestSecondaryStorageLimits(cloudstackTestCase):
         except Exception as e:
             self.fail("Failed to create template: %s" % e)
 
-        templateSize = (template.size / (1024**3))
+        templates = Template.list(apiclient,
+                                  templatefilter=\
+                                  self.services["template_2"]["templatefilter"],
+                                  id=template.id)
+        self.assertEqual(validateList(templates)[0],PASS,\
+                        "templates list validation failed")
+
+        templateSize = (templates[0].size / (1024**3))
         response = matchResourceCount(self.apiclient, templateSize,
                                       resourceType=RESOURCE_SECONDARY_STORAGE,
                                       accountid=self.account.id)


[39/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK-7184 config value for xen heartbeat timeout


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

Branch: refs/heads/master
Commit: 8b6e251b5d5e47a45f392d999fde0f14765c3ca1
Parents: 1eb20ee
Author: Daan Hoogland <da...@onecht.net>
Authored: Thu Dec 18 12:26:14 2014 +0100
Committer: Daan Hoogland <da...@onecht.net>
Committed: Thu Dec 18 12:26:14 2014 +0100

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8b6e251b/setup/db/db/schema-442to450.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-442to450.sql b/setup/db/db/schema-442to450.sql
index c51bd00..a12c0f59 100644
--- a/setup/db/db/schema-442to450.sql
+++ b/setup/db/db/schema-442to450.sql
@@ -988,3 +988,5 @@ INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervis
 INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'LXC', 'default', 'Debian GNU/Linux 7(32-bit)', 183, utc_timestamp(), 0);
 INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'LXC', 'default', 'Debian GNU/Linux 7(64-bit)', 184, utc_timestamp(), 0);
 
+INSERT IGNORE INTO `cloud`.`configuration` (`category`, `instance`, `component`, `name`, `value`, `default`, `description`) VALUES ('Advanced', 'DEFAULT', 'ManagementServer', 'xen.heartbeat.timeout' , '180', '120', 'Timeout value to send to the xenheartbeat script for guarding the self fencing functionality');
+


[26/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK-8075: UI > Instances menu > Add Instance > Select template/ISO > add a new tab "shared" which will list shared templates/ISOs when being clicked.


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

Branch: refs/heads/master
Commit: 20777ec3b4733301e2069e82e7eb231e4f3a2757
Parents: e7a96fd
Author: Jessica Wang <je...@apache.org>
Authored: Tue Dec 16 16:15:34 2014 -0800
Committer: Jessica Wang <je...@apache.org>
Committed: Tue Dec 16 16:15:34 2014 -0800

----------------------------------------------------------------------
 ui/scripts/instanceWizard.js | 35 +++++++++++++++++++++++++++++++----
 1 file changed, 31 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/20777ec3/ui/scripts/instanceWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instanceWizard.js b/ui/scripts/instanceWizard.js
index 99e79be..a067d7d 100644
--- a/ui/scripts/instanceWizard.js
+++ b/ui/scripts/instanceWizard.js
@@ -16,7 +16,7 @@
 // under the License.
 
 (function($, cloudStack) {
-    var zoneObjs, hypervisorObjs, featuredTemplateObjs, communityTemplateObjs, myTemplateObjs, featuredIsoObjs, serviceOfferingObjs, community, networkObjs;
+    var zoneObjs, hypervisorObjs, featuredTemplateObjs, communityTemplateObjs, myTemplateObjs, sharedTemplateObjs, featuredIsoObjs, communityIsoObjs, myIsoObjs, sharedIsoObjs, serviceOfferingObjs, community, networkObjs;
     var selectedZoneObj, selectedTemplateObj, selectedHypervisor, selectedDiskOfferingObj;
     var selectedTemplateOrIso; //'select-template', 'select-iso'
     var step6ContainerType = 'nothing-to-select'; //'nothing-to-select', 'select-network', 'select-security-group', 'select-advanced-sg'(advanced sg-enabled zone)
@@ -184,7 +184,22 @@
                                 });
                             }
                         }
-                    });
+                    });     
+                    $.ajax({
+                        url: createURL("listTemplates&templatefilter=sharedexecutable&zoneid=" + args.currentData.zoneid),
+                        dataType: "json",
+                        async: false,
+                        success: function(json) {
+                            if (json.listtemplatesresponse.template == null) {
+                            	sharedTemplateObjs = null;
+                            } else {
+                            	sharedTemplateObjs = $.grep(json.listtemplatesresponse.template, function(item, index) {
+                                    if ($.inArray(item.hypervisor, hypervisorArray) > -1)
+                                        return true;
+                                });
+                            }
+                        }
+                    });      
                 } else if (selectedTemplateOrIso == 'select-iso') {
                     $.ajax({
                         url: createURL("listIsos&isofilter=featured&zoneid=" + args.currentData.zoneid + "&bootable=true"),
@@ -222,6 +237,18 @@
                             }
                         }
                     });
+                    $.ajax({
+                        url: createURL("listIsos&isofilter=sharedexecutable&zoneid=" + args.currentData.zoneid + "&bootable=true"),
+                        dataType: "json",
+                        async: false,
+                        success: function(json) {
+                            if (json.listisosresponse.iso == null) {
+                            	sharedIsoObjs = null;
+                            } else {
+                            	sharedIsoObjs = json.listisosresponse.iso;
+                            }
+                        }
+                    });                  
                 }
                 //***** get templates/ISOs (end) *****
 
@@ -232,14 +259,14 @@
                         featuredtemplates: featuredTemplateObjs,
                         communitytemplates: communityTemplateObjs,
                         mytemplates: myTemplateObjs,
-                        sharedtemplates: [] // ** Needs implementation **
+                        sharedtemplates: sharedTemplateObjs
                     };
                 } else if (selectedTemplateOrIso == 'select-iso') {
                     templatesObj = {
                         featuredisos: featuredIsoObjs,
                         communityisos: communityIsoObjs,
                         myisos: myIsoObjs,
-                        sharedisos: [] // ** Needs implementation **
+                        sharedisos: sharedIsoObjs
                     };
                 }
                 args.response.success({


[21/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK-8072: Fixed NPE in deleting default ACL items in default ACL


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

Branch: refs/heads/master
Commit: aca0f7959274d4cc3d6a8a727c65977952d66dce
Parents: 6321a29
Author: Jayapal <ja...@apache.org>
Authored: Mon Dec 15 15:41:30 2014 +0530
Committer: Jayapal <ja...@apache.org>
Committed: Mon Dec 15 16:44:08 2014 +0530

----------------------------------------------------------------------
 server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/aca0f795/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java b/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java
index 51bb71f..bee4018 100644
--- a/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java
+++ b/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java
@@ -612,13 +612,14 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ
 
             Vpc vpc = _entityMgr.findById(Vpc.class, acl.getVpcId());
 
+            if((aclItem.getAclId() == NetworkACL.DEFAULT_ALLOW) || (aclItem.getAclId() == NetworkACL.DEFAULT_DENY)){
+                throw new InvalidParameterValueException("ACL Items in default ACL cannot be deleted");
+            }
+
             Account caller = CallContext.current().getCallingAccount();
 
             _accountMgr.checkAccess(caller, null, true, vpc);
 
-            if((aclItem.getAclId() == NetworkACL.DEFAULT_ALLOW) || (aclItem.getAclId() == NetworkACL.DEFAULT_DENY)){
-                throw new InvalidParameterValueException("ACL Items in default ACL cannot be deleted");
-            }
         }
         return _networkAclMgr.revokeNetworkACLItem(ruleId);
     }


[14/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK-255: fix NPE in createPortForwardingRule due to no PortForwarding provider
(cherry picked from commit c9d492d7140dd53f1630bc5ea14b948184233612)


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

Branch: refs/heads/master
Commit: 76dc20a0ee199d0b2d15f7ffe21fc9c45c72e9cc
Parents: fbe5497
Author: Wei Zhou <w....@tech.leaseweb.com>
Authored: Fri Dec 12 11:13:18 2014 +0100
Committer: Wei Zhou <w....@tech.leaseweb.com>
Committed: Fri Dec 12 11:15:08 2014 +0100

----------------------------------------------------------------------
 server/src/com/cloud/network/NetworkModelImpl.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/76dc20a0/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 2edf970..1fd354d 100755
--- a/server/src/com/cloud/network/NetworkModelImpl.java
+++ b/server/src/com/cloud/network/NetworkModelImpl.java
@@ -424,14 +424,14 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel {
 
         // We only support one provider for one service now
         Map<Service, Set<Provider>> serviceToProviders = getServiceProvidersMap(networkId);
-        Set<Provider> oldProviders = serviceToProviders.get(services.toArray()[0]);
-        Provider oldProvider = (Provider)oldProviders.toArray()[0];
         // Since IP already has service to bind with, the oldProvider can't be null
         Set<Provider> newProviders = serviceToProviders.get(service);
         if (newProviders == null || newProviders.isEmpty()) {
             throw new InvalidParameterException("There is no new provider for IP " + publicIp.getAddress() + " of service " + service.getName() + "!");
         }
         Provider newProvider = (Provider)newProviders.toArray()[0];
+        Set<Provider> oldProviders = serviceToProviders.get(services.toArray()[0]);
+        Provider oldProvider = (Provider)oldProviders.toArray()[0];
         Network network = _networksDao.findById(networkId);
         NetworkElement oldElement = getElementImplementingProvider(oldProvider.getName());
         NetworkElement newElement = getElementImplementingProvider(newProvider.getName());


[18/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK-8069: Fixed test script in test_tags.py

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


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

Branch: refs/heads/master
Commit: e791e8ec6d6484c5ea7853bf7e8184103846a75e
Parents: ecbeb00
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Fri Dec 12 17:00:26 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Fri Dec 12 19:01:17 2014 +0530

----------------------------------------------------------------------
 test/integration/component/test_tags.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e791e8ec/test/integration/component/test_tags.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_tags.py b/test/integration/component/test_tags.py
index c5a8ced..824cf01 100644
--- a/test/integration/component/test_tags.py
+++ b/test/integration/component/test_tags.py
@@ -1711,7 +1711,7 @@ class TestResourceTags(cloudstackTestCase):
                         self.apiclient,
                         listall=True,
                         resourceType='project',
-                        projectid=project.id,
+                        resourceIds=project.id,
                         key='region',
                         )
         self.debug("tags = %s" % tags)


[34/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK-8078: [Automation] Deletion of Affinity Groups - CloudRuntimeException: No Event Pubish can be wrapped within DB Transaction!

Changes:
-     The event of deleteing an affinity group is published on the MessageBus so that IAM Service can listen and process the event, However the publish operation should not be handled within a DB transaction, since it may take longer and hold the DB transaction for long unnecessarily
-    Publish any events to MessageBus outside of the transaction

Conflicts:
	server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java


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

Branch: refs/heads/master
Commit: 01ae7120ac2d8a9c673ab5d54d45f604a4a88581
Parents: a7861aa
Author: Prachi Damle <pr...@citrix.com>
Authored: Tue Dec 16 16:46:28 2014 -0800
Committer: Prachi Damle <pr...@citrix.com>
Committed: Wed Dec 17 13:53:11 2014 -0800

----------------------------------------------------------------------
 .../apache/cloudstack/affinity/AffinityGroupServiceImpl.java  | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01ae7120/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java b/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java
index 8e606ca..91835ea 100644
--- a/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java
+++ b/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java
@@ -298,13 +298,14 @@ public class AffinityGroupServiceImpl extends ManagerBase implements AffinityGro
                     if (groupDomain != null) {
                         _affinityGroupDomainMapDao.remove(groupDomain.getId());
                     }
-                    // remove its related ACL permission
-                    Pair<Class<?>, Long> params = new Pair<Class<?>, Long>(AffinityGroup.class, affinityGroupIdFinal);
-                    _messageBus.publish(_name, EntityManager.MESSAGE_REMOVE_ENTITY_EVENT, PublishScope.LOCAL, params);
                 }
             }
         });
 
+        // remove its related ACL permission
+        Pair<Class<?>, Long> params = new Pair<Class<?>, Long>(AffinityGroup.class, affinityGroupIdFinal);
+        _messageBus.publish(_name, EntityManager.MESSAGE_REMOVE_ENTITY_EVENT, PublishScope.LOCAL, params);
+
         if (s_logger.isDebugEnabled()) {
             s_logger.debug("Deleted affinity group id=" + affinityGroupId);
         }


[10/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK-8062: test_multiple_ip_ranges.py - Fix the test case to avoid using same vlan IP range in each test case

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

Branch: refs/heads/master
Commit: 7ff118c90b80a51efea73f87ac70dc686d92753b
Parents: 9bfb8e5
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Thu Dec 11 12:41:46 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Thu Dec 11 17:41:54 2014 +0530

----------------------------------------------------------------------
 .../component/test_multiple_ip_ranges.py        | 521 ++++++++++---------
 tools/marvin/marvin/config/test_data.py         |   8 +
 2 files changed, 281 insertions(+), 248 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7ff118c9/test/integration/component/test_multiple_ip_ranges.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_multiple_ip_ranges.py b/test/integration/component/test_multiple_ip_ranges.py
index 32c39f7..1beea4b 100644
--- a/test/integration/component/test_multiple_ip_ranges.py
+++ b/test/integration/component/test_multiple_ip_ranges.py
@@ -16,109 +16,41 @@
 # under the License.
 """ Tests for Multiple IP Ranges feature
 """
-from marvin.cloudstackTestCase import *
-from marvin.cloudstackAPI import *
+from marvin.cloudstackTestCase import cloudstackTestCase
 from marvin.cloudstackException import CloudstackAPIException
-from marvin.lib.utils import *
-from marvin.lib.base import *
-from marvin.lib.common import *
-from netaddr import *
-
+from marvin.lib.utils import cleanup_resources
+from marvin.lib.base import (PublicIpRange)
+from marvin.lib.common import (get_domain,
+                               get_zone,
+                               get_pod)
+from netaddr import IPAddress, IPNetwork
+import random
 from nose.plugins.attrib import attr
 
-class Services:
-    """Test Multiple IP Ranges
-    """
-    def __init__(self):
-        self.services = {
-                        "account": {
-                                    "email": "test@test.com",
-                                    "firstname": "Test",
-                                    "lastname": "User",
-                                    "username": "test",
-                                    # Random characters are appended for unique
-                                    # username
-                                    "password": "password",
-                        },
-                        "service_offering": {
-                                    "name": "Tiny Instance",
-                                    "displaytext": "Tiny Instance",
-                                    "cpunumber": 1,
-                                    "cpuspeed": 200,    # in MHz
-                                    "memory": 256,      # In MBs
-                        },
-                        "disk_offering": {
-                                    "displaytext": "Small Disk",
-                                    "name": "Small Disk",
-                                    "disksize": 1
-                        },
-                        "templates": {
-                                    "displaytext": 'Template',
-                                    "name": 'Template',
-                                    "ostype": "CentOS 5.3 (64-bit)",
-                                    "templatefilter": 'self',
-                        },
-                        "vlan_ip_range": {
-                                           "startip": "",
-                                           "endip": "",
-                                           "netmask": "",
-                                           "gateway": "",
-                                           "forvirtualnetwork": "false",
-                                           "vlan": "untagged",
-                        },
-                        "ostype": "CentOS 5.3 (64-bit)",
-                        "sleep": 60,
-                        "timeout": 10,
-          }
 
 class TestMultipleIpRanges(cloudstackTestCase):
+
     """Test Multiple IP Ranges for guest network
     """
 
-
     @classmethod
     def setUpClass(cls):
         cls.testClient = super(TestMultipleIpRanges, cls).getClsTestClient()
         cls.api_client = cls.testClient.getApiClient()
 
-        cls.services = Services().services
+        cls.services = cls.testClient.getParsedTestDataConfig()
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client)
         cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
         cls.pod = get_pod(cls.api_client, cls.zone.id)
-        cls.services['mode'] = cls.zone.networktype
-        cls.services["domainid"] = cls.domain.id
         cls.services["zoneid"] = cls.zone.id
-        cls.account = Account.create(
-                            cls.api_client,
-                            cls.services["account"],
-                            domainid=cls.domain.id
-                            )
-        cls.services["account"] = cls.account.name
-        cls.disk_offering = DiskOffering.create(
-                                    cls.api_client,
-                                    cls.services["disk_offering"]
-                                    )
-        cls.service_offering = ServiceOffering.create(
-                                            cls.api_client,
-                                            cls.services["service_offering"]
-                                            )
-        cls.template = get_template(
-                            cls.api_client,
-                            cls.zone.id,
-                            cls.services["ostype"]
-                            )
-        cls.services["templates"]["ostypeid"] = cls.template.ostypeid
-        cls.services["diskoffering"] = cls.disk_offering.id
-        cls._cleanup = [
-                        cls.account,
-                        ]
+        cls._cleanup = []
         return
 
     @classmethod
     def tearDownClass(cls):
         try:
-            #Cleanup resources used
+            # Cleanup resources used
             cleanup_resources(cls.api_client, cls._cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -127,12 +59,12 @@ class TestMultipleIpRanges(cloudstackTestCase):
     def setUp(self):
         self.apiclient = self.testClient.getApiClient()
         self.dbclient = self.testClient.getDbConnection()
-        self.cleanup = [ ]
+        self.cleanup = []
         return
 
     def tearDown(self):
         try:
-            #Clean up, terminate the resources created
+            # Clean up, terminate the resources created
             cleanup_resources(self.apiclient, self.cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -146,86 +78,102 @@ class TestMultipleIpRanges(cloudstackTestCase):
         self.endIp = publicIpRange[0].endip
         self.gateway = publicIpRange[0].gateway
         self.netmask = publicIpRange[0].netmask
-        #Pass ip address and mask length to IPNetwork to findout the CIDR
-        ip = IPNetwork(self.startIp+"/"+self.netmask)
-        new_cidr = ip.__iadd__(1)
+        # Pass ip address and mask length to IPNetwork to findout the CIDR
+        ip = IPNetwork(self.startIp + "/" + self.netmask)
+        # Take random increment factor to avoid adding the same vlan ip range
+        # in each test case
+        networkIncrementFactor = random.randint(1,255)
+        new_cidr = ip.__iadd__(networkIncrementFactor)
         ip2 = IPNetwork(new_cidr)
         return ip2
 
-    def verify_vlan_range(self,vlan,services):
-        #compare vlan_list response with configured values
+    def verify_vlan_range(self, vlan, services):
+        # compare vlan_list response with configured values
         self.assertEqual(
-                         isinstance(vlan, list),
-                         True,
-                         "Check list response returned a valid list"
-                         )
+            isinstance(vlan, list),
+            True,
+            "Check list response returned a valid list"
+        )
         self.assertNotEqual(
-                             len(vlan),
-                             0,
-                             "check list vlan response"
-                             )
+            len(vlan),
+            0,
+            "check list vlan response"
+        )
         self.assertEqual(
-                         str(vlan[0].startip),
-                         str(services["startip"]),
-                         "Start IP in vlan ip range is not matched with the configured start ip"
-                         )
+            str(vlan[0].startip),
+            str(services["startip"]),
+            "Start IP in vlan ip range is not matched with\
+                    the configured start ip"
+        )
         self.assertEqual(
-                         str(vlan[0].endip),
-                         str(services["endip"]),
-                         "End IP in vlan ip range is not matched with the configured end ip"
-                        )
+            str(vlan[0].endip),
+            str(services["endip"]),
+            "End IP in vlan ip range is not matched with\
+                    the configured end ip"
+        )
         self.assertEqual(
-                         str(vlan[0].gateway),
-                         str(services["gateway"]),
-                         "gateway in vlan ip range is not matched with the configured gateway"
-                         )
+            str(vlan[0].gateway),
+            str(services["gateway"]),
+            "gateway in vlan ip range is not matched with\
+                    the configured gateway"
+        )
         self.assertEqual(
-                         str(vlan[0].netmask),
-                         str(services["netmask"]),
-                         "netmask in vlan ip range is not matched with the configured netmask"
-                         )
+            str(vlan[0].netmask),
+            str(services["netmask"]),
+            "netmask in vlan ip range is not matched with\
+                    the configured netmask"
+        )
         return
 
     @attr(tags=["sg"])
     def test_01_add_ip_same_cidr(self):
         """Test add guest ip range in the existing cidr
         """
-        #call increment_cidr function to get exiting cidr from the setup and increment it
+        # call increment_cidr function to get exiting cidr from the setup and
+        # increment it
         ip2 = self.increment_cidr()
         test_nw = ip2.network
         ip = IPAddress(test_nw)
-        #Add IP range(5 IPs) in the new CIDR
+        # Add IP range(5 IPs) in the new CIDR
         test_gateway = ip.__add__(1)
         test_startIp = ip.__add__(3)
         test_endIp = ip.__add__(10)
-        test_startIp2= ip.__add__(11)
+        test_startIp2 = ip.__add__(11)
         test_endIp2 = ip.__add__(15)
-        #Populating services with new IP range
+        # Populating services with new IP range
         self.services["vlan_ip_range"]["startip"] = test_startIp
         self.services["vlan_ip_range"]["endip"] = test_endIp
         self.services["vlan_ip_range"]["gateway"] = test_gateway
         self.services["vlan_ip_range"]["netmask"] = self.netmask
         self.services["vlan_ip_range"]["zoneid"] = self.zone.id
         self.services["vlan_ip_range"]["podid"] = self.pod.id
-        #create new vlan ip range
-	self.debug("Creating new ip range with new cidr in the same vlan")
-        new_vlan = PublicIpRange.create(self.apiclient, self.services["vlan_ip_range"])
-        self.debug("Created new vlan range with startip:%s and endip:%s" %(test_startIp,test_endIp))
+        # create new vlan ip range
+        self.debug("Creating new ip range with new cidr in the same vlan")
+        new_vlan = PublicIpRange.create(
+            self.apiclient,
+            self.services["vlan_ip_range"])
+        self.debug(
+            "Created new vlan range with startip:%s and endip:%s" %
+            (test_startIp, test_endIp))
         self.cleanup.append(new_vlan)
-        new_vlan_res = new_vlan.list(self.apiclient,id=new_vlan.vlan.id)
-        #Compare list output with configured values
-        self.verify_vlan_range(new_vlan_res,self.services["vlan_ip_range"])
-        #Add few more ips in the same CIDR
+        new_vlan_res = new_vlan.list(self.apiclient, id=new_vlan.vlan.id)
+        # Compare list output with configured values
+        self.verify_vlan_range(new_vlan_res, self.services["vlan_ip_range"])
+        # Add few more ips in the same CIDR
         self.services["vlan_ip_range"]["startip"] = test_startIp2
         self.services["vlan_ip_range"]["endip"] = test_endIp2
-	self.debug("Creating new ip range in the existing CIDR")
-        new_vlan2 = PublicIpRange.create(self.apiclient, self.services["vlan_ip_range"])
-        self.debug("Created new vlan range with startip:%s and endip:%s" %(test_startIp2,test_endIp2))
+        self.debug("Creating new ip range in the existing CIDR")
+        new_vlan2 = PublicIpRange.create(
+            self.apiclient,
+            self.services["vlan_ip_range"])
+        self.debug(
+            "Created new vlan range with startip:%s and endip:%s" %
+            (test_startIp2, test_endIp2))
         self.cleanup.append(new_vlan2)
-        #list new vlan ip range
-        new_vlan2_res = new_vlan2.list(self.apiclient,id=new_vlan2.vlan.id)
-        #Compare list output with configured values
-        self.verify_vlan_range(new_vlan2_res,self.services["vlan_ip_range"])
+        # list new vlan ip range
+        new_vlan2_res = new_vlan2.list(self.apiclient, id=new_vlan2.vlan.id)
+        # Compare list output with configured values
+        self.verify_vlan_range(new_vlan2_res, self.services["vlan_ip_range"])
         return
 
     @attr(tags=["sg"])
@@ -236,29 +184,34 @@ class TestMultipleIpRanges(cloudstackTestCase):
            1.Get public vlan range (guest cidr) from the setup
            2.Add IP range to a new cidr
         """
-        #call increment_cidr function to get exiting cidr from the setup and increment it
+        # call increment_cidr function to get exiting cidr from the setup and
+        # increment it
         ip2 = self.increment_cidr()
         test_nw = ip2.network
         ip = IPAddress(test_nw)
-        #Add IP range(5 IPs) in the new CIDR
+        # Add IP range(5 IPs) in the new CIDR
         test_gateway = ip.__add__(1)
         test_startIp = ip.__add__(3)
         test_endIp = ip.__add__(10)
-        #Populating services with new IP range
+        # Populating services with new IP range
         self.services["vlan_ip_range"]["startip"] = test_startIp
         self.services["vlan_ip_range"]["endip"] = test_endIp
         self.services["vlan_ip_range"]["gateway"] = test_gateway
         self.services["vlan_ip_range"]["netmask"] = self.netmask
         self.services["vlan_ip_range"]["zoneid"] = self.zone.id
         self.services["vlan_ip_range"]["podid"] = self.pod.id
-        #create new vlan ip range
-	self.debug("Adding new ip range in different CIDR in same vlan")
-        new_vlan = PublicIpRange.create(self.apiclient, self.services["vlan_ip_range"])
-        self.debug("Created new vlan range with startip:%s and endip:%s" %(test_startIp,test_endIp))
+        # create new vlan ip range
+        self.debug("Adding new ip range in different CIDR in same vlan")
+        new_vlan = PublicIpRange.create(
+            self.apiclient,
+            self.services["vlan_ip_range"])
+        self.debug(
+            "Created new vlan range with startip:%s and endip:%s" %
+            (test_startIp, test_endIp))
         self.cleanup.append(new_vlan)
-        new_vlan_res = new_vlan.list(self.apiclient,id=new_vlan.vlan.id)
-        #Compare list output with configured values
-        self.verify_vlan_range(new_vlan_res,self.services["vlan_ip_range"])
+        new_vlan_res = new_vlan.list(self.apiclient, id=new_vlan.vlan.id)
+        # Compare list output with configured values
+        self.verify_vlan_range(new_vlan_res, self.services["vlan_ip_range"])
         return
 
     @attr(tags=["sg"])
@@ -270,37 +223,45 @@ class TestMultipleIpRanges(cloudstackTestCase):
            2.delete the ip range added at step1
            3.Verify the ip range deletion using list APIs
         """
-        #call increment_cidr function to get exiting cidr from the setup and increment it
+        # call increment_cidr function to get exiting cidr from the setup and
+        # increment it
         ip2 = self.increment_cidr()
         test_nw = ip2.network
         ip = IPAddress(test_nw)
-        #Add IP range(5 IPs) in the new CIDR
+        # Add IP range(5 IPs) in the new CIDR
         test_gateway = ip.__add__(1)
         test_startIp = ip.__add__(3)
         test_endIp = ip.__add__(10)
-        #Populating services with new IP range
+        # Populating services with new IP range
         self.services["vlan_ip_range"]["startip"] = test_startIp
         self.services["vlan_ip_range"]["endip"] = test_endIp
         self.services["vlan_ip_range"]["gateway"] = test_gateway
         self.services["vlan_ip_range"]["netmask"] = self.netmask
         self.services["vlan_ip_range"]["zoneid"] = self.zone.id
         self.services["vlan_ip_range"]["podid"] = self.pod.id
-        #create new vlan ip range
-	self.debug("Creating new ip range in the new cidr")
-        new_vlan = PublicIpRange.create(self.apiclient, self.services["vlan_ip_range"])
-        self.debug("Created new vlan range with startip:%s and endip:%s" %(test_startIp,test_endIp))
-        new_vlan_res = new_vlan.list(self.apiclient,id=new_vlan.vlan.id)
-        #Compare list output with configured values
-        self.verify_vlan_range(new_vlan_res,self.services["vlan_ip_range"])
-        #Delete the above IP range
-	self.debug("Deleting new ip range added in new cidr")
+        # create new vlan ip range
+        self.debug("Creating new ip range in the new cidr")
+        new_vlan = PublicIpRange.create(
+            self.apiclient,
+            self.services["vlan_ip_range"])
+        self.debug(
+            "Created new vlan range with startip:%s and endip:%s" %
+            (test_startIp, test_endIp))
+        new_vlan_res = new_vlan.list(self.apiclient, id=new_vlan.vlan.id)
+        # Compare list output with configured values
+        self.verify_vlan_range(new_vlan_res, self.services["vlan_ip_range"])
+        # Delete the above IP range
+        self.debug("Deleting new ip range added in new cidr")
         new_vlan.delete(self.apiclient)
-        #listing vlan ip ranges with the id should through exception , if not mark the test case as failed
+        # listing vlan ip ranges with the id should through exception , if not
+        # mark the test case as failed
         try:
             new_vlan.list(self.apiclient, id=new_vlan.vlan.id)
         except CloudstackAPIException as cs:
             self.debug(cs.errorMsg)
-            self.assertTrue(cs.errorMsg.find("entity does not exist")>0, msg="Failed to delete IP range")
+            self.assertTrue(
+                cs.errorMsg.find("entity does not exist") > 0,
+                msg="Failed to delete IP range")
         return
 
     @attr(tags=["sg"])
@@ -311,42 +272,51 @@ class TestMultipleIpRanges(cloudstackTestCase):
             1.Add non-contigous ip range in cidr added at step1
             2.Verify the ip range using list APIs
         """
-        #call increment_cidr function to get exiting cidr from the setup and increment it
+        # call increment_cidr function to get exiting cidr from the setup and
+        # increment it
         ip2 = self.increment_cidr()
         test_nw = ip2.network
         ip = IPAddress(test_nw)
-        #Add IP range(5 IPs) in the new CIDR
+        # Add IP range(5 IPs) in the new CIDR
         test_gateway = ip.__add__(1)
         test_startIp = ip.__add__(50)
         test_endIp = ip.__add__(60)
-        #Populating services with new IP range
+        # Populating services with new IP range
         self.services["vlan_ip_range"]["startip"] = test_startIp
         self.services["vlan_ip_range"]["endip"] = test_endIp
         self.services["vlan_ip_range"]["gateway"] = test_gateway
         self.services["vlan_ip_range"]["netmask"] = self.netmask
         self.services["vlan_ip_range"]["zoneid"] = self.zone.id
         self.services["vlan_ip_range"]["podid"] = self.pod.id
-        #create new vlan ip range
-        new_vlan = PublicIpRange.create(self.apiclient, self.services["vlan_ip_range"])
-        self.debug("Created new vlan range with startip:%s and endip:%s" %(test_startIp,test_endIp))
+        # create new vlan ip range
+        new_vlan = PublicIpRange.create(
+            self.apiclient,
+            self.services["vlan_ip_range"])
+        self.debug(
+            "Created new vlan range with startip:%s and endip:%s" %
+            (test_startIp, test_endIp))
         self.cleanup.append(new_vlan)
-        new_vlan_res = new_vlan.list(self.apiclient,id=new_vlan.vlan.id)
-        #Compare list output with configured values
-        self.verify_vlan_range(new_vlan_res,self.services["vlan_ip_range"])
-        #Add non-contiguous ip range in exiting cidr
+        new_vlan_res = new_vlan.list(self.apiclient, id=new_vlan.vlan.id)
+        # Compare list output with configured values
+        self.verify_vlan_range(new_vlan_res, self.services["vlan_ip_range"])
+        # Add non-contiguous ip range in exiting cidr
         test_startIp2 = ip.__add__(10)
         test_endIp2 = ip.__add__(20)
-        #Populating services with new IP range
+        # Populating services with new IP range
         self.services["vlan_ip_range"]["startip"] = test_startIp2
         self.services["vlan_ip_range"]["endip"] = test_endIp2
-        #create new vlan ip range
-	self.debug("Adding non contiguous ip range")
-        new_vlan = PublicIpRange.create(self.apiclient, self.services["vlan_ip_range"])
-        self.debug("Created new vlan range with startip:%s and endip:%s" %(test_startIp,test_endIp))
+        # create new vlan ip range
+        self.debug("Adding non contiguous ip range")
+        new_vlan = PublicIpRange.create(
+            self.apiclient,
+            self.services["vlan_ip_range"])
+        self.debug(
+            "Created new vlan range with startip:%s and endip:%s" %
+            (test_startIp, test_endIp))
         self.cleanup.append(new_vlan)
-        new_vlan_res = new_vlan.list(self.apiclient,id=new_vlan.vlan.id)
-        #Compare list output with configured values
-        self.verify_vlan_range(new_vlan_res,self.services["vlan_ip_range"])
+        new_vlan_res = new_vlan.list(self.apiclient, id=new_vlan.vlan.id)
+        # Compare list output with configured values
+        self.verify_vlan_range(new_vlan_res, self.services["vlan_ip_range"])
         return
 
     @attr(tags=["sg"])
@@ -354,48 +324,64 @@ class TestMultipleIpRanges(cloudstackTestCase):
         """Test adding overlapped ip range in existing cidr
 
             1.Add ip range in new cidr e.g:10.147.40.10-10.147.40.100
-            2.Add ip range overlapped with the ip range in step1 e.g.10.147.40.90-150
+            2.Add ip range overlapped with the ip range in
+              step1 e.g.10.147.40.90-150
         """
-        #call increment_cidr function to get exiting cidr from the setup and increment it
+        # call increment_cidr function to get exiting cidr from the setup and
+        # increment it
         ip2 = self.increment_cidr()
         test_nw = ip2.network
         ip = IPAddress(test_nw)
-        #Add IP range in the new CIDR
+        # Add IP range in the new CIDR
         test_gateway = ip.__add__(1)
         test_startIp = ip.__add__(10)
         test_endIp = ip.__add__(30)
         test_startIp2 = ip.__add__(20)
         test_endIp2 = ip.__add__(40)
-        #Populating services with new IP range
+        # Populating services with new IP range
         self.services["vlan_ip_range"]["startip"] = test_startIp
         self.services["vlan_ip_range"]["endip"] = test_endIp
         self.services["vlan_ip_range"]["gateway"] = test_gateway
         self.services["vlan_ip_range"]["netmask"] = self.netmask
         self.services["vlan_ip_range"]["zoneid"] = self.zone.id
         self.services["vlan_ip_range"]["podid"] = self.pod.id
-        #create new vlan ip range
-	self.debug("Creating new ip range with startip:%s and endip: %s".format(test_startIp,test_endIp))
-        new_vlan = PublicIpRange.create(self.apiclient, self.services["vlan_ip_range"])
-        self.debug("Created new vlan range with startip:%s and endip:%s" %(test_startIp,test_endIp))
+        # create new vlan ip range
+        self.debug(
+            "Creating new ip range with startip:%s and endip: %s".format(
+                test_startIp,
+                test_endIp))
+        new_vlan = PublicIpRange.create(
+            self.apiclient,
+            self.services["vlan_ip_range"])
+        self.debug(
+            "Created new vlan range with startip:%s and endip:%s" %
+            (test_startIp, test_endIp))
         self.cleanup.append(new_vlan)
-        new_vlan_res = new_vlan.list(self.apiclient,id=new_vlan.vlan.id)
-        #Compare list output with configured values
-        self.verify_vlan_range(new_vlan_res,self.services["vlan_ip_range"])
-        #Add overlapped ip range
-        #Populating services with new IP range
+        new_vlan_res = new_vlan.list(self.apiclient, id=new_vlan.vlan.id)
+        # Compare list output with configured values
+        self.verify_vlan_range(new_vlan_res, self.services["vlan_ip_range"])
+        # Add overlapped ip range
+        # Populating services with new IP range
         self.services["vlan_ip_range"]["startip"] = test_startIp2
         self.services["vlan_ip_range"]["endip"] = test_endIp2
-        #Try to create ip range overlapped with exiting ip range
-	self.debug("Adding overlapped ip range")
+        # Try to create ip range overlapped with exiting ip range
+        self.debug("Adding overlapped ip range")
         try:
-            new_vlan2 = PublicIpRange.create(self.apiclient, self.services["vlan_ip_range"])
+            new_vlan2 = PublicIpRange.create(
+                self.apiclient,
+                self.services["vlan_ip_range"])
         except CloudstackAPIException as cs:
             self.debug(cs.errorMsg)
-            self.assertTrue(cs.errorMsg.find("already has IPs that overlap with the new range")>0, msg="Fail:CS allowed adding overlapped ip ranges in guest cidr")
+            self.assertTrue(
+                cs.errorMsg.find("already has IPs that overlap with the new range") > 0,
+                msg="Fail:CS allowed adding overlapped ip\
+                        ranges in guest cidr")
             return
-        #Test will reach here if there is a bug in overlap ip range checking
+        # Test will reach here if there is a bug in overlap ip range checking
         self.cleanup.append(new_vlan2)
-        self.fail("CS should not accept overlapped ip ranges in guest traffic, but it allowed")
+        self.fail(
+            "CS should not accept overlapped ip ranges in\
+                    guest traffic, but it allowed")
         return
 
     @attr(tags=["sg"])
@@ -403,14 +389,17 @@ class TestMultipleIpRanges(cloudstackTestCase):
         """Test adding overlapped ip range with two existing cidr
 
             1.Add ip range in new cidr e.g:10.147.40.2-10.147.40.10
-            2.Add another ip range in the same cidr e.g:10.147.40.20-10.147.40.30
-            2.Add ip range overlapped with both the ip ranges e.g.10.147.40.10-20
+            2.Add another ip range in the same cidr
+              e.g:10.147.40.20-10.147.40.30
+            3.Add ip range overlapped with both the ip ranges
+              e.g.10.147.40.10-20
         """
-        #call increment_cidr function to get exiting cidr from the setup and increment it
+        # call increment_cidr function to get exiting cidr from the setup and
+        # increment it
         ip2 = self.increment_cidr()
         test_nw = ip2.network
         ip = IPAddress(test_nw)
-        #Add IP range in the new CIDR
+        # Add IP range in the new CIDR
         test_gateway = ip.__add__(1)
         test_startIp = ip.__add__(2)
         test_endIp = ip.__add__(5)
@@ -418,40 +407,55 @@ class TestMultipleIpRanges(cloudstackTestCase):
         test_endIp2 = ip.__add__(10)
         test_startIp3 = ip.__add__(5)
         test_endIp3 = ip.__add__(7)
-        #Populating services with new IP range
+        # Populating services with new IP range
         self.services["vlan_ip_range"]["startip"] = test_startIp
         self.services["vlan_ip_range"]["endip"] = test_endIp
         self.services["vlan_ip_range"]["gateway"] = test_gateway
         self.services["vlan_ip_range"]["netmask"] = self.netmask
         self.services["vlan_ip_range"]["zoneid"] = self.zone.id
         self.services["vlan_ip_range"]["podid"] = self.pod.id
-        #create new vlan ip range
-        new_vlan = PublicIpRange.create(self.apiclient, self.services["vlan_ip_range"])
-        self.debug("Created new vlan range with startip:%s and endip:%s" %(test_startIp,test_endIp))
+        # create new vlan ip range
+        new_vlan = PublicIpRange.create(
+            self.apiclient,
+            self.services["vlan_ip_range"])
+        self.debug(
+            "Created new vlan range with startip:%s and endip:%s" %
+            (test_startIp, test_endIp))
         self.cleanup.append(new_vlan)
-        new_vlan_res = new_vlan.list(self.apiclient,id=new_vlan.vlan.id)
-        #Compare list output with configured values
-        self.verify_vlan_range(new_vlan_res,self.services["vlan_ip_range"])
-        #Add 2nd IP range in the same CIDR
+        new_vlan_res = new_vlan.list(self.apiclient, id=new_vlan.vlan.id)
+        # Compare list output with configured values
+        self.verify_vlan_range(new_vlan_res, self.services["vlan_ip_range"])
+        # Add 2nd IP range in the same CIDR
         self.services["vlan_ip_range"]["startip"] = test_startIp2
         self.services["vlan_ip_range"]["endip"] = test_endIp2
-        new_vlan2 = PublicIpRange.create(self.apiclient, self.services["vlan_ip_range"])
-        self.debug("Created new vlan range with startip:%s and endip:%s" %(test_startIp2,test_endIp2))
+        new_vlan2 = PublicIpRange.create(
+            self.apiclient,
+            self.services["vlan_ip_range"])
+        self.debug(
+            "Created new vlan range with startip:%s and endip:%s" %
+            (test_startIp2, test_endIp2))
         self.cleanup.append(new_vlan2)
-        #Populating services with new IP range
+        # Populating services with new IP range
         self.services["vlan_ip_range"]["startip"] = test_startIp3
         self.services["vlan_ip_range"]["endip"] = test_endIp3
-        #Try to create ip range overlapped with exiting ip range
-	self.debug("Adding ip range overlapped with two cidrs")
+        # Try to create ip range overlapped with exiting ip range
+        self.debug("Adding ip range overlapped with two cidrs")
         try:
-            new_vlan3 = PublicIpRange.create(self.apiclient, self.services["vlan_ip_range"])
+            new_vlan3 = PublicIpRange.create(
+                self.apiclient,
+                self.services["vlan_ip_range"])
         except CloudstackAPIException as cs:
             self.debug(cs.errorMsg)
-            self.assertTrue(cs.errorMsg.find("already has IPs that overlap with the new range")>0, msg="Fail:CS allowed adding overlapped ip ranges in guest cidr")
+            self.assertTrue(
+                cs.errorMsg.find("already has IPs that overlap with the new range") > 0,
+                msg="Fail:CS allowed adding overlapped ip\
+                        ranges in guest cidr")
             return
-        #Test will reach here if there is a bug in overlap ip range checking
+        # Test will reach here if there is a bug in overlap ip range checking
         self.cleanup.append(new_vlan3)
-        self.fail("CS should not accept overlapped ip ranges in guest traffic, but it allowed")
+        self.fail(
+            "CS should not accept overlapped ip ranges in guest\
+                    traffic, but it allowed")
         return
 
     @attr(tags=["sg"])
@@ -461,50 +465,61 @@ class TestMultipleIpRanges(cloudstackTestCase):
             1.Add IP range in new CIDR
             2.Try to add ip range superset to CIDR added in step1
         """
-        #call increment_cidr function to get exiting cidr from the setup and increment it
+        # call increment_cidr function to get exiting cidr from the setup and
+        # increment it
         ip2 = self.increment_cidr()
         test_nw = ip2.network
         ip = IPAddress(test_nw)
-        #Add IP range in the new CIDR
+        # Add IP range in the new CIDR
         test_gateway = ip.__add__(1)
         test_startIp = ip.__add__(2)
         test_endIp = ip.__add__(10)
         test_startIp2 = ip.__add__(20)
         test_endIp2 = ip.__add__(30)
-        #Populating services with new IP range
+        # Populating services with new IP range
         self.services["vlan_ip_range"]["startip"] = test_startIp
         self.services["vlan_ip_range"]["endip"] = test_endIp
         self.services["vlan_ip_range"]["gateway"] = test_gateway
         self.services["vlan_ip_range"]["netmask"] = self.netmask
         self.services["vlan_ip_range"]["zoneid"] = self.zone.id
         self.services["vlan_ip_range"]["podid"] = self.pod.id
-         #create new vlan ip range
-        new_vlan = PublicIpRange.create(self.apiclient, self.services["vlan_ip_range"])
-        self.debug("Created new vlan range with startip:%s and endip:%s" %(test_startIp,test_endIp))
+        # create new vlan ip range
+        new_vlan = PublicIpRange.create(
+            self.apiclient,
+            self.services["vlan_ip_range"])
+        self.debug(
+            "Created new vlan range with startip:%s and endip:%s" %
+            (test_startIp, test_endIp))
         self.cleanup.append(new_vlan)
-        new_vlan_res = new_vlan.list(self.apiclient,id=new_vlan.vlan.id)
-        #Compare list output with configured values
-        self.verify_vlan_range(new_vlan_res,self.services["vlan_ip_range"])
-        #Add ip range superset to the existing CIDR
-        #Following code finds the netmask superset to existing CIDR
+        new_vlan_res = new_vlan.list(self.apiclient, id=new_vlan.vlan.id)
+        # Compare list output with configured values
+        self.verify_vlan_range(new_vlan_res, self.services["vlan_ip_range"])
+        # Add ip range superset to the existing CIDR
+        # Following code finds the netmask superset to existing CIDR
         cidr = ip2.cidr
-        mask_len = 2**(32-cidr.prefixlen)
+        mask_len = 2 ** (32 - cidr.prefixlen)
         netmask = IPAddress(self.netmask)
         superset = netmask.__isub__(mask_len)
-        #Add this superset netmask to services
+        # Add this superset netmask to services
         self.services["vlan_ip_range"]["netmask"] = superset
         self.services["vlan_ip_range"]["startip"] = test_startIp2
         self.services["vlan_ip_range"]["endip"] = test_endIp2
-	self.debug("Adding IP range super set to existing CIDR")
+        self.debug("Adding IP range super set to existing CIDR")
         try:
-            new_vlan2 = PublicIpRange.create(self.apiclient, self.services["vlan_ip_range"])
+            new_vlan2 = PublicIpRange.create(
+                self.apiclient,
+                self.services["vlan_ip_range"])
         except CloudstackAPIException as cs:
             self.debug(cs.errorMsg)
-            self.assertTrue(cs.errorMsg.find("superset")>0, msg="Fail: CS allowed adding ip range superset to existing CIDR")
+            self.assertTrue(
+                cs.errorMsg.find("superset") > 0,
+                msg="Fail: CS allowed adding ip range\
+                        superset to existing CIDR")
             return
-        #Test will reach here if there is a bug in allowing superset ip range
+        # Test will reach here if there is a bug in allowing superset ip range
         self.cleanup.append(new_vlan2)
-        self.fail("CS should not allow adding ip range superset to existing CIDR")
+        self.fail(
+            "CS should not allow adding ip range superset to existing CIDR")
         return
 
     @attr(tags=["sg"])
@@ -514,48 +529,58 @@ class TestMultipleIpRanges(cloudstackTestCase):
             1.Add IP range in new CIDR
             2.Try to add ip range subset to CIDR added in step1
         """
-        #call increment_cidr function to get exiting cidr from the setup and increment it
+        # call increment_cidr function to get exiting cidr from the setup and
+        # increment it
         ip2 = self.increment_cidr()
         test_nw = ip2.network
         ip = IPAddress(test_nw)
-        #Add IP range in the new CIDR
+        # Add IP range in the new CIDR
         test_gateway = ip.__add__(1)
         test_startIp = ip.__add__(2)
         test_endIp = ip.__add__(10)
         test_startIp2 = ip.__add__(20)
         test_endIp2 = ip.__add__(30)
-        #Populating services with new IP range
+        # Populating services with new IP range
         self.services["vlan_ip_range"]["startip"] = test_startIp
         self.services["vlan_ip_range"]["endip"] = test_endIp
         self.services["vlan_ip_range"]["gateway"] = test_gateway
         self.services["vlan_ip_range"]["netmask"] = self.netmask
         self.services["vlan_ip_range"]["zoneid"] = self.zone.id
         self.services["vlan_ip_range"]["podid"] = self.pod.id
-         #create new vlan ip range
-        new_vlan = PublicIpRange.create(self.apiclient, self.services["vlan_ip_range"])
-        self.debug("Created new vlan range with startip:%s and endip:%s" %(test_startIp,test_endIp))
+        # create new vlan ip range
+        new_vlan = PublicIpRange.create(
+            self.apiclient,
+            self.services["vlan_ip_range"])
+        self.debug(
+            "Created new vlan range with startip:%s and endip:%s" %
+            (test_startIp, test_endIp))
         self.cleanup.append(new_vlan)
-        new_vlan_res = new_vlan.list(self.apiclient,id=new_vlan.vlan.id)
-        #Compare list output with configured values
-        self.verify_vlan_range(new_vlan_res,self.services["vlan_ip_range"])
-        #Add ip range superset to the existing CIDR
-        #Following code finds the netmask superset to existing CIDR
+        new_vlan_res = new_vlan.list(self.apiclient, id=new_vlan.vlan.id)
+        # Compare list output with configured values
+        self.verify_vlan_range(new_vlan_res, self.services["vlan_ip_range"])
+        # Add ip range superset to the existing CIDR
+        # Following code finds the netmask superset to existing CIDR
         cidr = ip2.cidr
-        mask_len = 2**(32-(cidr.prefixlen+1))
+        mask_len = 2 ** (32 - (cidr.prefixlen + 1))
         netmask = IPAddress(self.netmask)
         subset = netmask.__iadd__(mask_len)
-        #Add this superset netmask to services
+        # Add this superset netmask to services
         self.services["vlan_ip_range"]["netmask"] = subset
         self.services["vlan_ip_range"]["startip"] = test_startIp2
         self.services["vlan_ip_range"]["endip"] = test_endIp2
-	self.debug("Adding ip range subset to existing cidr")
+        self.debug("Adding ip range subset to existing cidr")
         try:
-            new_vlan2 = PublicIpRange.create(self.apiclient, self.services["vlan_ip_range"])
+            new_vlan2 = PublicIpRange.create(
+                self.apiclient,
+                self.services["vlan_ip_range"])
         except CloudstackAPIException as cs:
             self.debug(cs.errorMsg)
-            self.assertTrue(cs.errorMsg.find("subset")>0, msg="Fail: CS allowed adding ip range subset to existing CIDR")
+            self.assertTrue(
+                cs.errorMsg.find("subset") > 0,
+                msg="Fail: CS allowed adding ip range subset to existing CIDR")
             return
-        #Test will reach here if there is a bug in allowing superset ip range
+        # Test will reach here if there is a bug in allowing superset ip range
         self.cleanup.append(new_vlan2)
-        self.fail("CS should not allow adding ip range subset to existing CIDR")
+        self.fail(
+            "CS should not allow adding ip range subset to existing CIDR")
         return

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7ff118c9/tools/marvin/marvin/config/test_data.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/config/test_data.py b/tools/marvin/marvin/config/test_data.py
index 4b50afa..5a468fe 100644
--- a/tools/marvin/marvin/config/test_data.py
+++ b/tools/marvin/marvin/config/test_data.py
@@ -829,6 +829,14 @@ test_data = {
             "epslifetime": "3600",
             "dpd": "false"
     },
+    "vlan_ip_range": {
+                "startip": "",
+                "endip": "",
+                "netmask": "",
+                "gateway": "",
+                "forvirtualnetwork": "false",
+                "vlan": "untagged",
+    },
     "ostype": "CentOS 5.6 (64-bit)",
     "sleep": 90,
     "timeout": 10,


[05/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK-7974: remove old hostname entry for a VM when adding a VM

When adding a VM, it adds an entry to /etc/hosts file on the VR but does not
clear up any older entries for the VM with a same name. The fix uncomments the
command that removes any old entries in the VM.

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

Branch: refs/heads/master
Commit: f38c2f87b11f5a00730e386759c2d46c2eef93c1
Parents: 8278d88
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Wed Dec 10 18:04:25 2014 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Wed Dec 10 18:23:16 2014 +0530

----------------------------------------------------------------------
 systemvm/patches/debian/config/opt/cloud/bin/edithosts.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f38c2f87/systemvm/patches/debian/config/opt/cloud/bin/edithosts.sh
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/edithosts.sh b/systemvm/patches/debian/config/opt/cloud/bin/edithosts.sh
index 4912bce..f0d9c00 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/edithosts.sh
+++ b/systemvm/patches/debian/config/opt/cloud/bin/edithosts.sh
@@ -121,8 +121,7 @@ then
   sed -i  /$ipv6],/d $DHCP_HOSTS
 fi
 # don't want to do this in the future, we can have same VM with multiple nics/entries
-#sed -i  /$host,/d $DHCP_HOSTS
-
+sed -i  /$host,/d $DHCP_HOSTS
 
 #put in the new entry
 if [ $ipv4 ]


[30/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK-8055: test_portable_ip.py - Tagging test case which can't be run on simulator

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

Branch: refs/heads/master
Commit: 94814603db6d825d23710071d4aba1c5893d3360
Parents: daabe92
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Wed Dec 17 14:11:16 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Wed Dec 17 17:28:44 2014 +0530

----------------------------------------------------------------------
 test/integration/component/test_portable_ip.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/94814603/test/integration/component/test_portable_ip.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_portable_ip.py b/test/integration/component/test_portable_ip.py
index 6bdc61a..83ef6b5 100644
--- a/test/integration/component/test_portable_ip.py
+++ b/test/integration/component/test_portable_ip.py
@@ -1288,7 +1288,7 @@ class TestPortableIpTransferAcrossNetworks(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(tags=["advanced","swamy"], required_hardware="false")
+    @attr(tags=["advanced","swamy"], required_hardware="true")
     def test_list_portable_ip_range_non_root_admin(self):
         """Test list portable ip ranges with non admin root account
         """


[04/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK-8030: Updated router to come up egress default ALLOW

    On default iptables rules are updated to add ACCEPT egress traffic.
    If the network egress default policy is false, CS remove ACCEPT and adds the DROP rule which
    is egress default rule when there are no other egress rules.

    If the CS network egress default policy is true, CS won't configure any default rule for egress because
    router already came up to accept egress traffic. If there are already egress rules for network then the
    egress rules get applied on VR.

    For isolated network with out firewall service, VR default allows egress traffic (guestnetwork --> public network)


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

Branch: refs/heads/master
Commit: 8278d88f76ee129af75cd585b916bd6719e34e4c
Parents: e22cc6e
Author: Jayapal <ja...@apache.org>
Authored: Wed Dec 3 16:49:24 2014 +0530
Committer: Jayapal <ja...@apache.org>
Committed: Wed Dec 10 10:13:41 2014 +0530

----------------------------------------------------------------------
 .../orchestration/NetworkOrchestrator.java      | 30 +++++++++++---------
 .../xenserver/resource/CitrixResourceBase.java  |  1 +
 .../network/element/VirtualRouterElement.java   |  5 ++--
 .../VirtualNetworkApplianceManagerImpl.java     |  5 +++-
 .../debian/config/etc/iptables/iptables-router  |  3 ++
 .../config/opt/cloud/bin/firewall_egress.sh     |  8 +++---
 6 files changed, 31 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8278d88f/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 17a2a9b..b28a26b 100755
--- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
@@ -1147,6 +1147,22 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
     // This method re-programs the rules/ips for existing network
     protected boolean reprogramNetworkRules(long networkId, Account caller, Network network) throws ResourceUnavailableException {
         boolean success = true;
+
+        //Apply egress rules first to effect the egress policy early on the guest traffic
+        List<FirewallRuleVO> firewallEgressRulesToApply = _firewallDao.listByNetworkPurposeTrafficType(networkId, Purpose.Firewall, FirewallRule.TrafficType.Egress);
+        NetworkOfferingVO offering = _networkOfferingDao.findById(network.getNetworkOfferingId());
+        DataCenter zone = _dcDao.findById(network.getDataCenterId());
+        if (_networkModel.areServicesSupportedInNetwork(network.getId(), Service.Firewall) && _networkModel.areServicesSupportedInNetwork(network.getId(), Service.Firewall)
+                && (network.getGuestType() == Network.GuestType.Isolated || (network.getGuestType() == Network.GuestType.Shared && zone.getNetworkType() == NetworkType.Advanced))) {
+            // add default egress rule to accept the traffic
+            _firewallMgr.applyDefaultEgressFirewallRule(network.getId(), offering.getEgressDefaultPolicy(), true);
+        }
+        if (!_firewallMgr.applyFirewallRules(firewallEgressRulesToApply, false, caller)) {
+            s_logger.warn("Failed to reapply firewall Egress rule(s) as a part of network id=" + networkId + " restart");
+            success = false;
+        }
+
+
         // associate all ip addresses
         if (!_ipAddrMgr.applyIpAssociations(network, false)) {
             s_logger.warn("Failed to apply ip addresses as a part of network id" + networkId + " restart");
@@ -1166,20 +1182,6 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
             success = false;
         }
 
-        List<FirewallRuleVO> firewallEgressRulesToApply = _firewallDao.listByNetworkPurposeTrafficType(networkId, Purpose.Firewall, FirewallRule.TrafficType.Egress);
-        NetworkOfferingVO offering = _networkOfferingDao.findById(network.getNetworkOfferingId());
-        //there are no egress rules then apply the default egress rule
-        DataCenter zone = _dcDao.findById(network.getDataCenterId());
-        if (_networkModel.areServicesSupportedInNetwork(network.getId(), Service.Firewall) && _networkModel.areServicesSupportedInNetwork(network.getId(), Service.Firewall)
-                && (network.getGuestType() == Network.GuestType.Isolated || (network.getGuestType() == Network.GuestType.Shared && zone.getNetworkType() == NetworkType.Advanced))) {
-            // add default egress rule to accept the traffic
-            _firewallMgr.applyDefaultEgressFirewallRule(network.getId(), offering.getEgressDefaultPolicy(), true);
-        }
-        if (!_firewallMgr.applyFirewallRules(firewallEgressRulesToApply, false, caller)) {
-            s_logger.warn("Failed to reapply firewall Egress rule(s) as a part of network id=" + networkId + " restart");
-            success = false;
-        }
-
         // apply port forwarding rules
         if (!_rulesMgr.applyPortForwardingRulesForNetwork(networkId, false, caller)) {
             s_logger.warn("Failed to reapply port forwarding rule(s) as a part of network id=" + networkId + " restart");

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8278d88f/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
index 9b282d8..a090b11 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
@@ -573,6 +573,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
     public ExecutionResult createFileInVR(String routerIp, String path, String filename, String content) {
         Connection conn = getConnection();
         String rc = callHostPlugin(conn, "vmops", "createFileInDomr", "domrip", routerIp, "filepath", path + filename, "filecontents", content);
+        s_logger.debug ("VR Config file " + filename + " got created in VR with ip " + routerIp + " with content \n" + content);
         // Fail case would be start with "fail#"
         return new ExecutionResult(rc.startsWith("succ#"), rc.substring(5));
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8278d88f/server/src/com/cloud/network/element/VirtualRouterElement.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/element/VirtualRouterElement.java b/server/src/com/cloud/network/element/VirtualRouterElement.java
index dc6ffc8..ae4c933 100755
--- a/server/src/com/cloud/network/element/VirtualRouterElement.java
+++ b/server/src/com/cloud/network/element/VirtualRouterElement.java
@@ -251,9 +251,10 @@ NetworkMigrationResponder, AggregatedCommandExecutor {
             }
 
             if (rules != null && rules.size() == 1) {
-                // for VR no need to add default egress rule to DENY traffic
+                // for VR no need to add default egress rule to ALLOW traffic
+                //The default allow rule is added from the router defalut iptables rules iptables-router
                 if (rules.get(0).getTrafficType() == FirewallRule.TrafficType.Egress && rules.get(0).getType() == FirewallRule.FirewallRuleType.System &&
-                        !_networkMdl.getNetworkEgressDefaultPolicy(config.getId()))
+                        _networkMdl.getNetworkEgressDefaultPolicy(config.getId()))
                     return true;
             }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8278d88f/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index fb39c0a..6c5ff9c 100755
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -2789,7 +2789,7 @@ VirtualMachineGuru, Listener, Configurable, StateListener<State, VirtualMachine.
 
 
         // construct rule when egress policy is true. In true case for VR we default allow rule need to be added
-        if (defaultEgressPolicy) {
+        if (!defaultEgressPolicy) {
             systemRule = String.valueOf(FirewallRule.FirewallRuleType.System);
 
             List<String> sourceCidr = new ArrayList<String>();
@@ -2799,6 +2799,9 @@ VirtualMachineGuru, Listener, Configurable, StateListener<State, VirtualMachine.
                     null, null, null, FirewallRule.TrafficType.Egress, FirewallRule.FirewallRuleType.System);
 
             rules.add(rule);
+        } else {
+            s_logger.debug(" Egress policy for the Network "+ networkId +" is "+defaultEgressPolicy + " So no need"+
+                    " of default rule is needed. ");
         }
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8278d88f/systemvm/patches/debian/config/etc/iptables/iptables-router
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/etc/iptables/iptables-router b/systemvm/patches/debian/config/etc/iptables/iptables-router
index 3f5bc5f..f16b942 100644
--- a/systemvm/patches/debian/config/etc/iptables/iptables-router
+++ b/systemvm/patches/debian/config/etc/iptables/iptables-router
@@ -24,6 +24,7 @@ COMMIT
 :INPUT DROP [0:0]
 :FORWARD DROP [0:0]
 :OUTPUT ACCEPT [0:0]
+:FW_EGRESS_RULES - [0:0]
 :FW_OUTBOUND - [0:0]
 -A INPUT -d 224.0.0.18/32 -j ACCEPT
 -A INPUT -d 225.0.0.50/32 -j ACCEPT
@@ -42,7 +43,9 @@ COMMIT
 -A FORWARD -i eth0 -o eth0 -m state --state NEW -j ACCEPT
 -A FORWARD -i eth0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
 -A FORWARD -i eth0 -o eth2 -j FW_OUTBOUND
+-A FW_EGRESS_RULES -j ACCEPT
 -I FW_OUTBOUND -m state --state RELATED,ESTABLISHED -j ACCEPT
+-A FW_OUTBOUND -j FW_EGRESS_RULES
 COMMIT
 *mangle
 :PREROUTING ACCEPT [0:0]

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8278d88f/systemvm/patches/debian/config/opt/cloud/bin/firewall_egress.sh
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/firewall_egress.sh b/systemvm/patches/debian/config/opt/cloud/bin/firewall_egress.sh
index b1e7a40..767f17e 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/firewall_egress.sh
+++ b/systemvm/patches/debian/config/opt/cloud/bin/firewall_egress.sh
@@ -145,11 +145,11 @@ fi
 
 success=0
 
-if [ "$pvalue" == "0" -o "$pvalue" == "2" ]
+if [ "$pvalue" == "1" -o "$pvalue" == "2" ]
   then
-     target="ACCEPT"
-  else
      target="DROP"
+  else
+     target="ACCEPT"
   fi
 
 fw_egress_chain
@@ -172,7 +172,7 @@ then
   fw_egress_backup_restore
 else
   logger -t cloud "deleting backup for guest network"
-    if [ "$pvalue" == "1" -o "$pvalue" == "2" ]
+    if [ "$pvalue" == "1" ]
        then
        #Adding default policy rule
        sudo iptables -A FW_EGRESS_RULES  -j ACCEPT


[24/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK-8076: UI > Templates menu > Template/ISO > "Filter by" dropdown > add a new option, "shared", which will list shared templates when being selected.


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

Branch: refs/heads/master
Commit: 6a8dcf5f204d51541b77d363567ad045b22071ae
Parents: 66b7738
Author: Jessica Wang <je...@apache.org>
Authored: Tue Dec 16 14:38:50 2014 -0800
Committer: Jessica Wang <je...@apache.org>
Committed: Tue Dec 16 14:38:50 2014 -0800

----------------------------------------------------------------------
 ui/scripts/templates.js | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a8dcf5f/ui/scripts/templates.js
----------------------------------------------------------------------
diff --git a/ui/scripts/templates.js b/ui/scripts/templates.js
index 1ca3214..dc0f055 100644
--- a/ui/scripts/templates.js
+++ b/ui/scripts/templates.js
@@ -43,6 +43,9 @@
                         mine: {
                             label: 'ui.listView.filters.mine'
                         },
+                        shared: {
+                            label: 'Shared'
+                        },
                         featured: {
                             label: 'label.featured'
                         },
@@ -589,6 +592,11 @@
                                             templatefilter: 'self'
                                         });
                                         break;
+                                    case "shared":
+                                        $.extend(data, {
+                                            templatefilter: 'shared'
+                                        });
+                                        break;
                                     case "featured":
                                         ignoreProject = true;
                                         $.extend(data, {
@@ -1452,6 +1460,9 @@
                         mine: {
                             label: 'ui.listView.filters.mine'
                         },
+                        shared: {
+                            label: 'Shared'
+                        },
                         featured: {
                             label: 'label.featured'
                         },
@@ -1717,6 +1728,11 @@
                                             isofilter: 'self'
                                         });
                                         break;
+                                    case "shared":
+                                        $.extend(data, {
+                                        	isofilter: 'shared'
+                                        });
+                                        break;
                                     case "featured":
                                         ignoreProject = true;
                                         $.extend(data, {


[09/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK-2823: pass cmdline info to system vms for 30 times
(cherry picked from commit 4eedfe53fcbab1d47b09eacaca1d803b67b6c4d2)


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

Branch: refs/heads/master
Commit: 9bfb8e571934f70d00a69c3aa58cf848d016afb9
Parents: e59dac2
Author: Wei Zhou <w....@tech.leaseweb.com>
Authored: Mon Dec 8 15:45:29 2014 +0100
Committer: Wei Zhou <w....@tech.leaseweb.com>
Committed: Thu Dec 11 08:33:42 2014 +0100

----------------------------------------------------------------------
 .../kvm/resource/LibvirtComputingResource.java  | 29 +++++++++-----------
 .../debian/config/etc/init.d/cloud-early-config |  4 +--
 2 files changed, 15 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9bfb8e57/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index 576abe6..68c776a 100755
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -3831,24 +3831,21 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
 
             // pass cmdline info to system vms
             if (vmSpec.getType() != VirtualMachine.Type.User) {
-                if ((conn.getVersion() < 1001000)) { // CLOUDSTACK-2823: try passCmdLine some times if kernel < 2.6.34 and qemu < 1.1.0 on hypervisor (for instance, CentOS 6.4)
-                    //wait for 5 minutes at most
-                    String controlIp = null;
-                    for (NicTO nic : nics) {
-                        if (nic.getType() == TrafficType.Control) {
-                            controlIp = nic.getIp();
-                        }
-                    }
-                    for (int count = 0; count < 30; count++) {
-                        passCmdLine(vmName, vmSpec.getBootArgs());
-                        //check router is up?
-                        boolean result = _virtRouterResource.connect(controlIp, 1, 5000);
-                        if (result) {
-                            break;
-                        }
+                //wait and try passCmdLine for 5 minutes at most for CLOUDSTACK-2823
+                String controlIp = null;
+                for (NicTO nic : nics) {
+                    if (nic.getType() == TrafficType.Control) {
+                        controlIp = nic.getIp();
+                        break;
                     }
-                } else {
+                }
+                for (int count = 0; count < 30; count++) {
                     passCmdLine(vmName, vmSpec.getBootArgs());
+                    //check router is up?
+                    boolean result = _virtRouterResource.connect(controlIp, 1, 5000);
+                    if (result) {
+                        break;
+                    }
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9bfb8e57/systemvm/patches/debian/config/etc/init.d/cloud-early-config
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/etc/init.d/cloud-early-config b/systemvm/patches/debian/config/etc/init.d/cloud-early-config
index 294ae5f..f7d752d 100755
--- a/systemvm/patches/debian/config/etc/init.d/cloud-early-config
+++ b/systemvm/patches/debian/config/etc/init.d/cloud-early-config
@@ -117,7 +117,7 @@ get_boot_params() {
           if [ ! -e /dev/vport0p1 ]; then
             log_it "/dev/vport0p1 not loaded, perhaps guest kernel is too old." && exit 2
           fi
-		  while [$cmd -eq ""]; do         
+          while [ -z "$cmd" ]; do
             while read line; do
               if [[ $line == cmdline:* ]]; then
                 cmd=${line//cmdline:/}
@@ -128,7 +128,7 @@ get_boot_params() {
                 echo $pubkey > /root/.ssh/authorized_keys
               fi
             done < /dev/vport0p1
-		  done
+	  done
           chmod go-rwx /root/.ssh/authorized_keys
           ;;
      vmware)


[23/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
use directIO flags when dd'ing template

This makes sure dom0 in xenserver doesn't get hammered
when copying templates. It doesn't make sense to use
the cache of dom0 as the template does not fit in
memory. The directIO flags prevent it from trying.

(cherry picked from commit 4e1527e87aaaa87d14d3c7d3a6782b80cbf36a8c)


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

Branch: refs/heads/master
Commit: 66b77380d06a38e24e3bd84e4804d3ff8d19ff95
Parents: 453c5b3
Author: Remi Bergsma <rb...@schubergphilis.com>
Authored: Mon Dec 15 16:36:35 2014 +0100
Committer: Daan Hoogland <da...@onecht.net>
Committed: Tue Dec 16 10:49:57 2014 +0100

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66b77380/scripts/vm/hypervisor/xenserver/copy_vhd_from_secondarystorage.sh
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/copy_vhd_from_secondarystorage.sh b/scripts/vm/hypervisor/xenserver/copy_vhd_from_secondarystorage.sh
index 098015a..61c65ea 100755
--- a/scripts/vm/hypervisor/xenserver/copy_vhd_from_secondarystorage.sh
+++ b/scripts/vm/hypervisor/xenserver/copy_vhd_from_secondarystorage.sh
@@ -104,7 +104,7 @@ copyvhd()
     exit 0
   fi
   if [ "${parent##*vhd has}" = " no parent" ]; then
-    dd if=$srcvhd of=$desvhd bs=2M     
+    dd if=$srcvhd of=$desvhd bs=2M oflag=direct iflag=direct
     if [ $? -ne 0 ]; then
       echo "31#failed to dd $srcvhd to $desvhd"
       cleanup


[35/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK-8022: [Automation] Deletion of Domain with Cleanup set to "true" fails

Changes:

-  This is a race condition between the deleteDomain thread and AccountChecker thread. DeleteDomain thread marks the domain as inactive and proceeds for cleanup, AccountChecker thread that runs at the same time cleans up any domains marked as inactive.
-  When the DeleteDomain thread finds that domain is already removed, it need not error out since the domain deletion has already happened


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

Branch: refs/heads/master
Commit: 1c5e8ebb3113e97c6c0be9b602f9a15852f2d2fd
Parents: 01ae712
Author: Prachi Damle <pr...@citrix.com>
Authored: Tue Dec 16 16:26:16 2014 -0800
Committer: Prachi Damle <pr...@citrix.com>
Committed: Wed Dec 17 13:53:30 2014 -0800

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1c5e8ebb/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java b/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java
index e02daf1..4c4fe86 100644
--- a/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java
+++ b/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java
@@ -154,8 +154,8 @@ public class DomainDaoImpl extends GenericDaoBase<DomainVO, Long> implements Dom
 
         DomainVO domain = findById(id);
         if (domain == null) {
-            s_logger.error("Unable to remove domain as domain " + id + " no longer exists");
-            return false;
+            s_logger.info("Unable to remove domain as domain " + id + " no longer exists");
+            return true;
         }
 
         if (domain.getParent() == null) {


[27/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK-8077: Not able to deploy VM using a shared template.


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

Branch: refs/heads/master
Commit: 9fb654cbad3ecd5e4a393f41ee5a6ad44c15680f
Parents: 20777ec
Author: Min Chen <mi...@citrix.com>
Authored: Tue Dec 16 15:54:45 2014 -0800
Committer: Min Chen <mi...@citrix.com>
Committed: Tue Dec 16 16:40:37 2014 -0800

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9fb654cb/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 7c60d4a..4e64524 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -2784,10 +2784,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
         }
 
         // Check templates permissions
-        if (!template.isPublicTemplate()) {
-            Account templateOwner = _accountMgr.getAccount(template.getAccountId());
-            _accountMgr.checkAccess(owner, null, true, templateOwner);
-        }
+        _accountMgr.checkAccess(owner, AccessType.UseEntry, false, template);
 
         // check if the user data is correct
         validateUserData(userData, httpmethod);


[38/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
if concurrent snapshot happening on the same vm, throw invalid parameter
exception to user.
Reviewed-by: Frank


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

Branch: refs/heads/master
Commit: 1eb20ee09559a505a6f5cc60bbdfa601f439194f
Parents: 8f2bd45
Author: Edison Su <su...@gmail.com>
Authored: Tue Dec 9 15:38:58 2014 -0800
Committer: Edison Su <su...@gmail.com>
Committed: Wed Dec 17 14:35:42 2014 -0800

----------------------------------------------------------------------
 server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1eb20ee0/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
index 1e13682..a3eb7b0 100755
--- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
+++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
@@ -938,7 +938,7 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
                     List<SnapshotVO> activeSnapshots =
                         _snapshotDao.listByInstanceId(volume.getInstanceId(), Snapshot.State.Creating, Snapshot.State.CreatedOnPrimary, Snapshot.State.BackingUp);
                     if (activeSnapshots.size() > 0) {
-                        throw new CloudRuntimeException("There is other active snapshot tasks on the instance to which the volume is attached, please try again later");
+                        throw new InvalidParameterValueException("There is other active snapshot tasks on the instance to which the volume is attached, please try again later");
                     }
                 }
 


[40/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
Merge remote-tracking branch 'origin/4.5'


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

Branch: refs/heads/master
Commit: f4133a7f7044fe2aaf2bf20dce9748637c7ca4c7
Parents: 1df0453 8b6e251
Author: Daan Hoogland <da...@onecht.net>
Authored: Thu Dec 18 12:55:47 2014 +0100
Committer: Daan Hoogland <da...@onecht.net>
Committed: Thu Dec 18 12:55:47 2014 +0100

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f4133a7f/setup/db/db/schema-442to450.sql
----------------------------------------------------------------------


[15/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK-8055: Tagging test cases which can't be run on simulator accordingly

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

Branch: refs/heads/master
Commit: 47ee7c0319351267ff5370a20ec5e1a66583f688
Parents: 76dc20a
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Wed Dec 10 12:31:51 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Fri Dec 12 18:39:24 2014 +0530

----------------------------------------------------------------------
 test/integration/component/test_ss_domain_limits.py  | 8 ++++----
 test/integration/component/test_ss_limits.py         | 8 ++++----
 test/integration/component/test_ss_max_limits.py     | 6 +++---
 test/integration/component/test_ss_project_limits.py | 4 ++--
 4 files changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/47ee7c03/test/integration/component/test_ss_domain_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_ss_domain_limits.py b/test/integration/component/test_ss_domain_limits.py
index 998bb8b..2591d2f 100644
--- a/test/integration/component/test_ss_domain_limits.py
+++ b/test/integration/component/test_ss_domain_limits.py
@@ -148,7 +148,7 @@ class TestMultipleChildDomain(cloudstackTestCase):
             return [FAIL, e, None]
         return [PASS, None, users]
 
-    @attr(tags=["advanced"], required_hardware="false")
+    @attr(tags=["advanced"], required_hardware="true")
     def test_01_multiple_domains_secondary_storage_limits(self):
         """Test secondary storage limit of domain and its sub-domains
 
@@ -261,7 +261,7 @@ class TestMultipleChildDomain(cloudstackTestCase):
         self.assertTrue(result[2], "Resource count does not match")
         return
 
-    @attr(tags=["advanced"], required_hardware="false")
+    @attr(tags=["advanced"], required_hardware="true")
     def test_02_multiple_domains_secondary_storage_counts(self):
         """Test secondary storage counts in multiple child domains
         # Steps
@@ -325,7 +325,7 @@ class TestMultipleChildDomain(cloudstackTestCase):
                 self.fail("Failed to get zone list: %s" % e)
 	    return
 
-    @attr(tags=["advanced"], required_hardware="false")
+    @attr(tags=["advanced"], required_hardware="true")
     def test_03_copy_template(self):
         """Test secondary storage counts in multiple child domains
         # Steps
@@ -485,7 +485,7 @@ class TestDeleteAccount(cloudstackTestCase):
             return [FAIL, e, None]
         return [PASS, None, users]
 
-    @attr(tags=["advanced"], required_hardware="false")
+    @attr(tags=["advanced"], required_hardware="true")
     def test_04_create_template_delete_account(self):
         """Test secondary storage limit of domain and its sub-domains
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/47ee7c03/test/integration/component/test_ss_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_ss_limits.py b/test/integration/component/test_ss_limits.py
index c83a7f5..c498302 100644
--- a/test/integration/component/test_ss_limits.py
+++ b/test/integration/component/test_ss_limits.py
@@ -128,7 +128,7 @@ class TestSecondaryStorageLimits(cloudstackTestCase):
         return [PASS, None]
 
     @data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
-    @attr(tags = ["advanced"], required_hardware="false")
+    @attr(tags = ["advanced"], required_hardware="true")
     def test_01_register_template(self, value):
         """Test register template
         # Validate the following:
@@ -189,7 +189,7 @@ class TestSecondaryStorageLimits(cloudstackTestCase):
         return
 
     @data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
-    @attr(tags=["advanced"], required_hardware="false")
+    @attr(tags=["advanced"], required_hardware="true")
     def test_02_create_template_snapshot(self, value):
         """Test create snapshot and templates from volume
 
@@ -248,7 +248,7 @@ class TestSecondaryStorageLimits(cloudstackTestCase):
         return
 
     @data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
-    @attr(tags = ["advanced"], required_hardware="false")
+    @attr(tags = ["advanced"], required_hardware="true")
     def test_03_register_iso(self, value):
         """Test register iso
         Steps and validations:
@@ -310,7 +310,7 @@ class TestSecondaryStorageLimits(cloudstackTestCase):
         return
 
     @data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
-    @attr(tags = ["advanced"], required_hardware="false")
+    @attr(tags = ["advanced"], required_hardware="true")
     def test_04_copy_template(self, value):
         """Test copy template between zones
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/47ee7c03/test/integration/component/test_ss_max_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_ss_max_limits.py b/test/integration/component/test_ss_max_limits.py
index 49a1e4f..dbbfb45 100644
--- a/test/integration/component/test_ss_max_limits.py
+++ b/test/integration/component/test_ss_max_limits.py
@@ -170,7 +170,7 @@ class TestMaxSecondaryStorageLimits(cloudstackTestCase):
             return [FAIL, e]
         return [PASS, None]
 
-    @attr(tags=["advanced"], required_hardware="false")
+    @attr(tags=["advanced"], required_hardware="true")
     def test_01_deploy_vm_domain_limit_reached(self):
         """Test Try to deploy VM with admin account where account has not used
             the resources but @ domain they are not available
@@ -207,7 +207,7 @@ class TestMaxSecondaryStorageLimits(cloudstackTestCase):
             template.delete(self.userapiclient)
         return
 
-    @attr(tags=["advanced"], required_hardware="false")
+    @attr(tags=["advanced"], required_hardware="true")
     def test_02_deploy_vm_account_limit_reached(self):
         """Test Try to deploy VM with admin account where account has used
             the resources but @ domain they are available
@@ -244,7 +244,7 @@ class TestMaxSecondaryStorageLimits(cloudstackTestCase):
             template.delete(self.userapiclient)
         return
 
-    @attr(tags=["advanced"], required_hardware="false")
+    @attr(tags=["advanced"], required_hardware="true")
     def test_03_deploy_vm_project_limit_reached(self):
         """Test TTry to deploy VM with admin account where account has not used
         the resources but @ project they are not available

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/47ee7c03/test/integration/component/test_ss_project_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_ss_project_limits.py b/test/integration/component/test_ss_project_limits.py
index 0668f07..ca58dbd 100644
--- a/test/integration/component/test_ss_project_limits.py
+++ b/test/integration/component/test_ss_project_limits.py
@@ -129,7 +129,7 @@ class TestProjectsVolumeLimits(cloudstackTestCase):
             return [FAIL, e]
         return [PASS, None]
 
-    @attr(tags=["advanced"], required_hardware="false")
+    @attr(tags=["advanced"], required_hardware="true")
     def test_01_register_template_with_project(self):
         """Test register template
         # Validate the following:
@@ -194,7 +194,7 @@ class TestProjectsVolumeLimits(cloudstackTestCase):
         self.assertEqual(response[0], PASS, response[1])
         return
 
-    @attr(tags = ["advanced"], required_hardware="false")
+    @attr(tags = ["advanced"], required_hardware="true")
     def test_02_register_iso(self):
         """Test register iso
         Steps and validations:


[32/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK-8075: UI > Instances menu > Add Instance > Select template/ISO > "shared" tab > select a shared template, click Next button => fix error "unable to find matched template object".


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

Branch: refs/heads/master
Commit: 11fa48108ffc5ef7b276f7261b29eaca406105b8
Parents: ed5bc1c
Author: Jessica Wang <je...@apache.org>
Authored: Wed Dec 17 10:58:43 2014 -0800
Committer: Jessica Wang <je...@apache.org>
Committed: Wed Dec 17 10:58:43 2014 -0800

----------------------------------------------------------------------
 ui/scripts/instanceWizard.js | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/11fa4810/ui/scripts/instanceWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instanceWizard.js b/ui/scripts/instanceWizard.js
index a067d7d..984c6e3 100644
--- a/ui/scripts/instanceWizard.js
+++ b/ui/scripts/instanceWizard.js
@@ -323,11 +323,22 @@
                                 }
                             }
                         }
-                    }
-                    if (selectedTemplateObj == null)
+                    }                    
+                    if (selectedTemplateObj == null) {
+                        if (sharedTemplateObjs != null && sharedTemplateObjs.length > 0) {
+                            for (var i = 0; i < sharedTemplateObjs.length; i++) {
+                                if (sharedTemplateObjs[i].id == args.currentData.templateid) {
+                                    selectedTemplateObj = sharedTemplateObjs[i];
+                                    break;
+                                }
+                            }
+                        }
+                    }                    
+                    if (selectedTemplateObj == null) {
                         alert("unable to find matched template object");
-                    else
+                    } else {
                         selectedHypervisor = selectedTemplateObj.hypervisor;
+                    }
                 } else { //(args.currentData["select-template"] == "select-iso"
                     selectedHypervisor = args.currentData.hypervisorid;
                 }


[20/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK-8070: Upgrade router.ram.size using encryption util

Upgrade fails if value is set using plain text encoding, the value needs to
be encrypted (if a key was provided during db was setup).

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

Branch: refs/heads/master
Commit: 6321a29e4336de9ffe96e27968f896ec5a8bf37d
Parents: b07c9b7
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Sat Dec 13 00:15:40 2014 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Sat Dec 13 00:17:09 2014 +0530

----------------------------------------------------------------------
 .../com/cloud/upgrade/dao/Upgrade442to450.java  | 25 ++++++++++++++++++++
 setup/db/db/schema-442to450.sql                 |  2 --
 2 files changed, 25 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6321a29e/engine/schema/src/com/cloud/upgrade/dao/Upgrade442to450.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade442to450.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade442to450.java
index aeb44a1..e8a517b 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade442to450.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade442to450.java
@@ -18,6 +18,7 @@
 package com.cloud.upgrade.dao;
 
 import java.io.File;
+import java.io.UnsupportedEncodingException;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -30,6 +31,7 @@ import java.util.Map;
 import java.util.Set;
 
 import com.cloud.hypervisor.Hypervisor;
+import com.cloud.utils.crypt.DBEncryptionUtil;
 import org.apache.log4j.Logger;
 
 import com.cloud.utils.exception.CloudRuntimeException;
@@ -68,10 +70,33 @@ public class Upgrade442to450 implements DbUpgrade {
         updateSystemVmTemplates(conn);
         dropInvalidKeyFromStoragePoolTable(conn);
         dropDuplicatedForeignKeyFromAsyncJobTable(conn);
+        updateMaxRouterSizeConfig(conn);
         upgradeMemoryOfVirtualRoutervmOffering(conn);
         upgradeMemoryOfInternalLoadBalancervmOffering(conn);
     }
 
+    private void updateMaxRouterSizeConfig(Connection conn) {
+        PreparedStatement updatePstmt = null;
+        try {
+            String encryptedValue = DBEncryptionUtil.encrypt("256");
+            updatePstmt = conn.prepareStatement("UPDATE `cloud`.`configuration` SET value=? WHERE name='router.ram.size' AND category='Hidden'");
+            updatePstmt.setBytes(1, encryptedValue.getBytes("UTF-8"));
+            updatePstmt.executeUpdate();
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("Unable to upgrade max ram size of router in config.", e);
+        } catch (UnsupportedEncodingException e) {
+            throw new CloudRuntimeException("Unable encrypt configuration values ", e);
+        } finally {
+            try {
+                if (updatePstmt != null) {
+                    updatePstmt.close();
+                }
+            } catch (SQLException e) {
+            }
+        }
+        s_logger.debug("Done updating router.ram.size config to 256");
+    }
+
     private void upgradeMemoryOfVirtualRoutervmOffering(Connection conn) {
         PreparedStatement updatePstmt = null;
         PreparedStatement selectPstmt = null;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6321a29e/setup/db/db/schema-442to450.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-442to450.sql b/setup/db/db/schema-442to450.sql
index 3981415..c51bd00 100644
--- a/setup/db/db/schema-442to450.sql
+++ b/setup/db/db/schema-442to450.sql
@@ -448,8 +448,6 @@ UPDATE configuration SET value='KVM,XenServer,VMware,BareMetal,Ovm,LXC,Hyperv' W
 UPDATE `cloud`.`configuration` SET description="If set to true, will set guest VM's name as it appears on the hypervisor, to its hostname. The flag is supported for VMware hypervisor only" WHERE name='vm.instancename.flag';
 INSERT IGNORE INTO `cloud`.`configuration`(category, instance, component, name, value, description, default_value) VALUES ('Advanced', 'DEFAULT', 'management-server', 'implicit.host.tags', 'GPU', 'Tag hosts at the time of host disovery based on the host properties/capabilities ', 'GPU');
 
-UPDATE `cloud`.`configuration` SET value='256' WHERE name='router.ram.size';
-
 DROP VIEW IF EXISTS `cloud`.`domain_router_view`;
 CREATE VIEW `cloud`.`domain_router_view` AS
     select


[36/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
add event for volume migration
Reviewed-by: Frank


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

Branch: refs/heads/master
Commit: 50d5d488d4f7288cd5f1c0b6f8dd8352c93eed2d
Parents: 1c5e8eb
Author: Edison Su <su...@gmail.com>
Authored: Mon Dec 8 15:08:45 2014 -0800
Committer: Edison Su <su...@gmail.com>
Committed: Wed Dec 17 14:33:54 2014 -0800

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/50d5d488/server/src/com/cloud/storage/VolumeApiServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
index 03b64ac..40b9574 100644
--- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
@@ -1691,6 +1691,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
 
     @DB
     @Override
+    @ActionEvent(eventType = EventTypes.EVENT_VOLUME_MIGRATE, eventDescription = "migrating volume", async = true)
     public Volume migrateVolume(MigrateVolumeCmd cmd) {
         Long volumeId = cmd.getVolumeId();
         Long storagePoolId = cmd.getStoragePoolId();


[28/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK-8074: Fixed maint/test_multiple_ip_ranges.py

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


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

Branch: refs/heads/master
Commit: c3508f61a18384e9201d3d1dc87c35c67e200039
Parents: 9fb654c
Author: Ashutosh K <as...@clogeny.com>
Authored: Tue Dec 16 17:13:05 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Wed Dec 17 17:28:25 2014 +0530

----------------------------------------------------------------------
 .../component/maint/test_multiple_ip_ranges.py  | 972 ++++++++++---------
 1 file changed, 510 insertions(+), 462 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c3508f61/test/integration/component/maint/test_multiple_ip_ranges.py
----------------------------------------------------------------------
diff --git a/test/integration/component/maint/test_multiple_ip_ranges.py b/test/integration/component/maint/test_multiple_ip_ranges.py
index 982dd7c..f73c470 100644
--- a/test/integration/component/maint/test_multiple_ip_ranges.py
+++ b/test/integration/component/maint/test_multiple_ip_ranges.py
@@ -16,117 +16,72 @@
 # under the License.
 """ Tests for Multiple IP Ranges feature
 """
-from marvin.cloudstackTestCase import *
-from marvin.cloudstackAPI import *
-from marvin.cloudstackException import CloudstackAPIException
-from marvin.lib.utils import *
-from marvin.lib.base import *
-from marvin.lib.common import *
-# from netaddr import *
+from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.lib.utils import cleanup_resources, get_process_status
+from marvin.lib.base import (Account,
+                             DiskOffering,
+                             VirtualMachine,
+                             Router,
+                             ServiceOffering,
+                             PublicIpRange)
+from marvin.lib.common import (get_domain,
+                               get_zone,
+                               list_routers,
+                               list_hosts,
+                               get_pod,
+                               get_template)
 import netaddr
 from nose.plugins.attrib import attr
+from netaddr import IPNetwork, IPAddress
+from marvin.sshClient import SshClient
+import random
 
-class Services:
-    """Test Multiple IP Ranges
-    """
-    def __init__(self):
-        self.services = {
-                        "account": {
-                                    "email": "test@test.com",
-                                    "firstname": "Test",
-                                    "lastname": "User",
-                                    "username": "test",
-                                    # Random characters are appended for unique
-                                    # username
-                                    "password": "password",
-                        },
-                        "service_offering": {
-                                    "name": "Tiny Instance",
-                                    "displaytext": "Tiny Instance",
-                                    "cpunumber": 1,
-                                    "cpuspeed": 200,  # in MHz
-                                    "memory": 256,  # In MBs
-                        },
-                        "disk_offering": {
-                                    "displaytext": "Small Disk",
-                                    "name": "Small Disk",
-                                    "disksize": 1
-                        },
-                        "templates": {
-                                    "displaytext": 'Template',
-                                    "name": 'Template',
-                                    "ostype": "CentOS 5.3 (64-bit)",
-                                    "templatefilter": 'self',
-                        },
-                        "vlan_ip_range": {
-                                           "startip": "10.147.43.130",
-                                           "endip": "10.147.43.135",
-                                           "netmask": "255.255.255.192",
-                                           "gateway": "10.147.43.129",
-                                           "forvirtualnetwork": "false",
-                                           "vlan": "untagged",
-                        },
-                        "server_without_disk": {
-                                        "displayname": "Test VM-No Disk",
-                                        "username": "root",
-                                        "password": "password",
-                                        "hypervisor": 'XenServer',
-                        },
-                        "host": {
-				"publicport": 22,
-	                        "username": "root",    # Host creds for SSH
-				"password": "password",
-                        },
-			"ostype": "CentOS 5.3 (64-bit)",
-                        "sleep": 60,
-                        "timeout": 10,
-          }
 
 class TestMultipleIpRanges(cloudstackTestCase):
+
     """Test Multiple IP Ranges for guest network
     """
     @classmethod
     def setUpClass(cls):
-        cls.testClient = super(TestEgressAfterHostMaintenance, cls).getClsTestClient()
+        cls.testClient = super(TestMultipleIpRanges, cls).getClsTestClient()
         cls.api_client = cls.testClient.getApiClient()
         cls.dbclient = cls.testClient.getDbConnection()
 
-        cls.services = Services().services
+        cls.testdata = cls.testClient.getParsedTestDataConfig()
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client)
         cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
         cls.pod = get_pod(cls.api_client, cls.zone.id)
-        cls.services['mode'] = cls.zone.networktype
-        cls.services["domainid"] = cls.domain.id
-        cls.services["zoneid"] = cls.zone.id
+        cls.testdata['mode'] = cls.zone.networktype
+        cls.testdata["domainid"] = cls.domain.id
+        cls.testdata["zoneid"] = cls.zone.id
         cls.account = Account.create(
-                            cls.api_client,
-                            cls.services["account"],
-                            domainid=cls.domain.id
-                            )
-        cls.services["account"] = cls.account.name
+            cls.api_client,
+            cls.testdata["account"],
+            domainid=cls.domain.id
+        )
+        cls.testdata["account"] = cls.account.name
         cls.disk_offering = DiskOffering.create(
-                                    cls.api_client,
-                                    cls.services["disk_offering"]
-                                    )
+            cls.api_client,
+            cls.testdata["disk_offering"]
+        )
         cls.service_offering = ServiceOffering.create(
-                                            cls.api_client,
-                                            cls.services["service_offering"]
-                                            )
+            cls.api_client,
+            cls.testdata["service_offering"]
+        )
         cls.template = get_template(
-                            cls.api_client,
-                            cls.zone.id,
-                            cls.services["ostype"]
-                            )
-        cls.services["templates"]["ostypeid"] = cls.template.ostypeid
-        cls.services["diskoffering"] = cls.disk_offering.id
+            cls.api_client,
+            cls.zone.id,
+            cls.testdata["ostype"]
+        )
+        cls.testdata["diskoffering"] = cls.disk_offering.id
         cls.dc_id = cls.dbclient.execute(
-                                      "select id from data_center where uuid = '%s';" % str(cls.services["zoneid"])
-                                      )
+            "select id from data_center where uuid = '%s';" % str(
+                cls.testdata["zoneid"]))
         cls.dc_id = cls.dc_id[0][0]
         cls.ids = cls.dbclient.execute(
-                            "select id from user_ip_address where allocated is null and data_center_id = '%s';" % str(cls.dc_id)
-                            )
+            "select id from user_ip_address where allocated is null and data_center_id = '%s';" % str(
+                cls.dc_id))
         cls.id_list = []
         for i in range(len(cls.ids)):
             cls.id_list.append(cls.ids[i][0])
@@ -142,45 +97,76 @@ class TestMultipleIpRanges(cloudstackTestCase):
             cls.id_list = cls.id_list[:-2]
         for id in cls.id_list:
             cls.dbclient.execute(
-                                 "update user_ip_address set allocated=now() where id = '%s';" % str(id)
-                                 )
-        # Add IP range in the new CIDR
-        cls.services["vlan_ip_range"]["zoneid"] = cls.zone.id
-        cls.services["vlan_ip_range"]["podid"] = cls.pod.id
+                "update user_ip_address set allocated=now() where id = '%s';" %
+                str(id))
         # create new vlan ip range
         # Before creating ip range check the zone's network type
-        if cls.zone.networktype == 'Basic':
-            cls.new_vlan = PublicIpRange.create(cls.api_client, cls.services["vlan_ip_range"])
+        if cls.zone.networktype.lower() == 'basic':
+            cls.new_vlan = cls.createNewVlanRange()
         else:
-            raise unittest.SkipTest("These tests can be run only on basic zone. So skipping the tests")
+            raise unittest.SkipTest(
+                "These tests can be run only on basic zone.\
+                        So skipping the tests")
         # Deploy vm in existing subnet if VR is not present
-        if cls.vr_state is False :
+        if cls.vr_state is False:
             cls.vm_res = VirtualMachine.create(
-                                            cls.api_client,
-                                            cls.services["server_without_disk"],
-                                            templateid=cls.template.id,
-                                            accountid=cls.account.name,
-                                            domainid=cls.services["domainid"],
-                                            zoneid=cls.services["zoneid"],
-                                            serviceofferingid=cls.service_offering.id,
-                                            mode=cls.services["mode"],
-                                            )
+                cls.api_client,
+                cls.testdata["server_without_disk"],
+                templateid=cls.template.id,
+                accountid=cls.account.name,
+                domainid=cls.testdata["domainid"],
+                zoneid=cls.testdata["zoneid"],
+                serviceofferingid=cls.service_offering.id,
+                mode=cls.testdata["mode"],
+            )
         cls._cleanup = [
-                        cls.new_vlan,
-                        cls.account,
-                        ]
+            cls.new_vlan,
+            cls.account,
+        ]
         return
 
     @classmethod
+    def createNewVlanRange(cls):
+        """ Increment current cidr of vlan range present in network
+            and create new range
+        """
+        publicIpRange = PublicIpRange.list(cls.api_client)
+        cls.startIp = publicIpRange[0].startip
+        cls.endIp = publicIpRange[0].endip
+        cls.gateway = publicIpRange[0].gateway
+        cls.netmask = publicIpRange[0].netmask
+        # Pass ip address and mask length to IPNetwork to findout the CIDR
+        ip = IPNetwork(cls.startIp + "/" + cls.netmask)
+        # Take random increment factor to avoid adding the same vlan ip range
+        # in each test case
+        networkIncrementFactor = random.randint(1,255)
+        new_cidr = ip.__iadd__(networkIncrementFactor)
+        ip2 = IPNetwork(new_cidr)
+        test_nw = ip2.network
+        ip = IPAddress(test_nw)
+        # Add IP range(5 IPs) in the new CIDR
+        test_gateway = ip.__add__(1)
+        test_startIp = ip.__add__(3)
+        test_endIp = ip.__add__(10)
+        # Populating services with new IP range
+        cls.testdata["vlan_ip_range"]["startip"] = test_startIp
+        cls.testdata["vlan_ip_range"]["endip"] = test_endIp
+        cls.testdata["vlan_ip_range"]["gateway"] = test_gateway
+        cls.testdata["vlan_ip_range"]["netmask"] = cls.netmask
+        cls.testdata["vlan_ip_range"]["zoneid"] = cls.zone.id
+        cls.testdata["vlan_ip_range"]["podid"] = cls.pod.id
+
+        return PublicIpRange.create(
+                cls.api_client,
+                cls.testdata["vlan_ip_range"])
+
+    @classmethod
     def tearDownClass(cls):
         try:
             for id in cls.id_list:
                 cls.dbclient.execute(
-                                     "update user_ip_address set allocated=default where id = '%s';" % str(id)
-                                     )
-            # Wait for expunge interval to cleanup VMs
-            wait_for_cleanup(cls.api_client, ["expunge.delay", "expunge.interval"])
-            time.sleep(30)
+                    "update user_ip_address set allocated=default where id = '%s';" %
+                    str(id))
             # Cleanup resources used
             cleanup_resources(cls.api_client, cls._cleanup)
         except Exception as e:
@@ -190,48 +176,55 @@ class TestMultipleIpRanges(cloudstackTestCase):
     def setUp(self):
         self.apiclient = self.testClient.getApiClient()
         self.dbclient = self.testClient.getDbConnection()
-        self.cleanup = [ ]
+        self.cleanup = []
         # Deploy guest vm
-        try :
+        try:
             self.virtual_machine = VirtualMachine.create(
-                                            self.apiclient,
-                                            self.services["server_without_disk"],
-                                            templateid=self.template.id,
-                                            accountid=self.account.name,
-                                            domainid=self.services["domainid"],
-                                            zoneid=self.services["zoneid"],
-                                            serviceofferingid=self.service_offering.id,
-                                            mode=self.services["mode"],
-                                            )
-        except Exception as e :
-            raise Exception("Warning: Exception during vm deployment: {}".format(e))
+                self.apiclient,
+                self.testdata["server_without_disk"],
+                templateid=self.template.id,
+                accountid=self.account.name,
+                domainid=self.testdata["domainid"],
+                zoneid=self.testdata["zoneid"],
+                serviceofferingid=self.service_offering.id,
+                mode=self.testdata["mode"],
+            )
+        except Exception as e:
+            raise Exception(
+                "Warning: Exception during vm deployment: {}".format(e))
         self.vm_response = VirtualMachine.list(
-                                               self.apiclient,
-                                               id=self.virtual_machine.id
-                                               )
+            self.apiclient,
+            id=self.virtual_machine.id
+        )
         self.assertEqual(
             isinstance(self.vm_response, list),
             True,
             "Check VM list response returned a valid list"
-            )
-        self.ip_range = list(netaddr.iter_iprange(unicode(self.services["vlan_ip_range"]["startip"]), unicode(self.services["vlan_ip_range"]["endip"])))
-        self.nic_ip = netaddr.IPAddress(unicode(self.vm_response[0].nic[0].ipaddress))
+        )
+        self.ip_range = list(
+            netaddr.iter_iprange(
+                unicode(
+                    self.testdata["vlan_ip_range"]["startip"]), unicode(
+                    self.testdata["vlan_ip_range"]["endip"])))
+        self.nic_ip = netaddr.IPAddress(
+            unicode(
+                self.vm_response[0].nic[0].ipaddress))
         self.debug("vm got {} as ip address".format(self.nic_ip))
         self.assertIn(
-              self.nic_ip,
-              self.ip_range,
-              "VM did not get the ip address from the new ip range"
-              )
+            self.nic_ip,
+            self.ip_range,
+            "VM did not get the ip address from the new ip range"
+        )
         ip_alias = self.dbclient.execute(
-                              "select ip4_address from nic_ip_alias;"
-                              )
+            "select ip4_address from nic_ip_alias;"
+        )
         self.alias_ip = str(ip_alias[0][0])
         self.debug("alias ip : %s" % self.alias_ip)
         self.assertNotEqual(
-                            self.alias_ip,
-                            None,
-                            "Error in creating ip alias. Please check MS logs"
-			    )
+            self.alias_ip,
+            None,
+            "Error in creating ip alias. Please check MS logs"
+        )
         self.cleanup.append(self.virtual_machine)
         return
 
@@ -246,35 +239,38 @@ class TestMultipleIpRanges(cloudstackTestCase):
     def verify_vlan_range(self, vlan, services):
         # compare vlan_list response with configured values
         self.assertEqual(
-                         isinstance(vlan, list),
-                         True,
-                         "Check list response returned a valid list"
-                         )
+            isinstance(vlan, list),
+            True,
+            "Check list response returned a valid list"
+        )
         self.assertNotEqual(
-                             len(vlan),
-                             0,
-                             "check list vlan response"
-                             )
+            len(vlan),
+            0,
+            "check list vlan response"
+        )
         self.assertEqual(
-                         str(vlan[0].startip),
-                         str(services["startip"]),
-                         "Start IP in vlan ip range is not matched with the configured start ip"
-                         )
+            str(vlan[0].startip),
+            str(services["startip"]),
+            "Start IP in vlan ip range is not matched with the\
+                    configured start ip"
+        )
         self.assertEqual(
-                         str(vlan[0].endip),
-                         str(services["endip"]),
-                         "End IP in vlan ip range is not matched with the configured end ip"
-                        )
+            str(vlan[0].endip),
+            str(services["endip"]),
+            "End IP in vlan ip range is not matched with the configured end ip"
+        )
         self.assertEqual(
-                         str(vlan[0].gateway),
-                         str(services["gateway"]),
-                         "gateway in vlan ip range is not matched with the configured gateway"
-                         )
+            str(vlan[0].gateway),
+            str(services["gateway"]),
+            "gateway in vlan ip range is not matched with the\
+                    configured gateway"
+        )
         self.assertEqual(
-                         str(vlan[0].netmask),
-                         str(services["netmask"]),
-                         "netmask in vlan ip range is not matched with the configured netmask"
-                         )
+            str(vlan[0].netmask),
+            str(services["netmask"]),
+            "netmask in vlan ip range is not matched with\
+                    the configured netmask"
+        )
         return
 
     @attr(tags=["sg"])
@@ -283,14 +279,20 @@ class TestMultipleIpRanges(cloudstackTestCase):
             1.Deploy guest vm
             2.Verify vm gets the ip address from new cidr
         """
-        self.ip_range = list(netaddr.iter_iprange(unicode(self.services["vlan_ip_range"]["startip"]), unicode(self.services["vlan_ip_range"]["endip"])))
-        self.nic_ip = netaddr.IPAddress(unicode(self.vm_response[0].nic[0].ipaddress))
+        self.ip_range = list(
+            netaddr.iter_iprange(
+                unicode(
+                    self.testdata["vlan_ip_range"]["startip"]), unicode(
+                    self.testdata["vlan_ip_range"]["endip"])))
+        self.nic_ip = netaddr.IPAddress(
+            unicode(
+                self.vm_response[0].nic[0].ipaddress))
         self.debug("vm got {} as ip address".format(self.nic_ip))
         self.assertIn(
-              self.nic_ip,
-              self.ip_range,
-              "VM did not get the ip address from the new ip range"
-              )
+            self.nic_ip,
+            self.ip_range,
+            "VM did not get the ip address from the new ip range"
+        )
         return
 
     @attr(tags=["sg"])
@@ -300,51 +302,60 @@ class TestMultipleIpRanges(cloudstackTestCase):
             2.Verify dns service listens on alias ip in VR
         """
         list_router_response = list_routers(
-                                    self.apiclient,
-                                    zoneid=self.zone.id,
-                                    listall=True
-                                    )
+            self.apiclient,
+            zoneid=self.zone.id,
+            listall=True
+        )
         self.assertEqual(
-                            isinstance(list_router_response, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
+            isinstance(list_router_response, list),
+            True,
+            "Check list response returns a valid list"
+        )
         router = list_router_response[0]
         hosts = list_hosts(
-                           self.apiclient,
-                           zoneid=router.zoneid,
-                           type='Routing',
-                           state='Up',
-                           id=router.hostid
-                           )
+            self.apiclient,
+            zoneid=router.zoneid,
+            type='Routing',
+            state='Up',
+            id=router.hostid
+        )
         self.assertEqual(
-                            isinstance(hosts, list),
-                            True,
-                            "Check list host returns a valid list"
-                        )
+            isinstance(hosts, list),
+            True,
+            "Check list host returns a valid list"
+        )
         host = hosts[0]
         self.debug("Router ID: %s, state: %s" % (router.id, router.state))
         self.assertEqual(
-                            router.state,
-                            'Running',
-                            "Check list router response for router state"
-                        )
+            router.state,
+            'Running',
+            "Check list router response for router state"
+        )
+
+        port = self.testdata['configurableData']['host']["publicport"]
+        username = self.testdata['configurableData']['host']["username"]
+        password = self.testdata['configurableData']['host']["password"]
+
+        # SSH to host so that host key is saved in first
+        # attempt
+        SshClient(host.ipaddress, port, username, password)
+
         proc = self.alias_ip + ":53"
         result = get_process_status(
-                                host.ipaddress,
-                                self.services['host']["publicport"],
-                                self.services['host']["username"],
-                                self.services['host']["password"],
-                                router.linklocalip,
-                                "netstat -atnp | grep %s" % proc
-                                )
+            host.ipaddress,
+            port,
+            username,
+            password,
+            router.linklocalip,
+            "netstat -atnp | grep %s" % proc
+        )
         res = str(result)
         self.debug("Dns process status on alias ip: %s" % res)
         self.assertNotEqual(
-                         res.find(proc)
-                         - 1,
-                         "dnsmasq service is not running on alias ip"
-                        )
+            res.find(proc)
+            - 1,
+            "dnsmasq service is not running on alias ip"
+        )
         return
 
     @attr(tags=["sg"])
@@ -354,51 +365,60 @@ class TestMultipleIpRanges(cloudstackTestCase):
             2.Verify password service(socat) listens on alias ip in VR
         """
         list_router_response = list_routers(
-                                    self.apiclient,
-                                    zoneid=self.zone.id,
-                                    listall=True
-                                    )
+            self.apiclient,
+            zoneid=self.zone.id,
+            listall=True
+        )
         self.assertEqual(
-                            isinstance(list_router_response, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
+            isinstance(list_router_response, list),
+            True,
+            "Check list response returns a valid list"
+        )
         router = list_router_response[0]
         hosts = list_hosts(
-                           self.apiclient,
-                           zoneid=router.zoneid,
-                           type='Routing',
-                           state='Up',
-                           id=router.hostid
-                           )
+            self.apiclient,
+            zoneid=router.zoneid,
+            type='Routing',
+            state='Up',
+            id=router.hostid
+        )
         self.assertEqual(
-                            isinstance(hosts, list),
-                            True,
-                            "Check list host returns a valid list"
-                        )
+            isinstance(hosts, list),
+            True,
+            "Check list host returns a valid list"
+        )
         host = hosts[0]
         self.debug("Router ID: %s, state: %s" % (router.id, router.state))
         self.assertEqual(
-                            router.state,
-                            'Running',
-                            "Check list router response for router state"
-                        )
+            router.state,
+            'Running',
+            "Check list router response for router state"
+        )
+
+        port = self.testdata['configurableData']['host']["publicport"]
+        username = self.testdata['configurableData']['host']["username"]
+        password = self.testdata['configurableData']['host']["password"]
+
+        # SSH to host so that host key is saved in first
+        # attempt
+        SshClient(host.ipaddress, port, username, password)
+
         proc = "socat"
         result = get_process_status(
-                                host.ipaddress,
-                                self.services['host']["publicport"],
-                                self.services['host']["username"],
-                                self.services['host']["password"],
-                                router.linklocalip,
-                                "netstat -atnp | grep %s" % proc
-                                )
+            host.ipaddress,
+            port,
+            username,
+            password,
+            router.linklocalip,
+            "netstat -atnp | grep %s" % proc
+        )
         res = str(result)
         self.debug("password process status on VR: %s" % res)
         self.assertNotEqual(
-                         res.find(self.alias_ip)
-                         - 1,
-                         "password service is not running on alias ip"
-                        )
+            res.find(self.alias_ip)
+            - 1,
+            "password service is not running on alias ip"
+        )
         return
 
     @attr(tags=["sg"])
@@ -408,51 +428,60 @@ class TestMultipleIpRanges(cloudstackTestCase):
             2.Verify userdata service(apache2) listens on alias ip in VR
         """
         list_router_response = list_routers(
-                                    self.apiclient,
-                                    zoneid=self.zone.id,
-                                    listall=True
-                                    )
+            self.apiclient,
+            zoneid=self.zone.id,
+            listall=True
+        )
         self.assertEqual(
-                            isinstance(list_router_response, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
+            isinstance(list_router_response, list),
+            True,
+            "Check list response returns a valid list"
+        )
         router = list_router_response[0]
         hosts = list_hosts(
-                           self.apiclient,
-                           zoneid=router.zoneid,
-                           type='Routing',
-                           state='Up',
-                           id=router.hostid
-                           )
+            self.apiclient,
+            zoneid=router.zoneid,
+            type='Routing',
+            state='Up',
+            id=router.hostid
+        )
         self.assertEqual(
-                            isinstance(hosts, list),
-                            True,
-                            "Check list host returns a valid list"
-                        )
+            isinstance(hosts, list),
+            True,
+            "Check list host returns a valid list"
+        )
         host = hosts[0]
         self.debug("Router ID: %s, state: %s" % (router.id, router.state))
         self.assertEqual(
-                            router.state,
-                            'Running',
-                            "Check list router response for router state"
-                        )
+            router.state,
+            'Running',
+            "Check list router response for router state"
+        )
+
+        port = self.testdata['configurableData']['host']["publicport"]
+        username = self.testdata['configurableData']['host']["username"]
+        password = self.testdata['configurableData']['host']["password"]
+
+        # SSH to host so that host key is saved in first
+        # attempt
+        SshClient(host.ipaddress, port, username, password)
+
         proc = "apache2"
         result = get_process_status(
-                                host.ipaddress,
-                                self.services['host']["publicport"],
-                                self.services['host']["username"],
-                                self.services['host']["password"],
-                                router.linklocalip,
-                                "netstat -atnp | grep %s" % proc
-                                )
+            host.ipaddress,
+            port,
+            username,
+            password,
+            router.linklocalip,
+            "netstat -atnp | grep %s" % proc
+        )
         res = str(result)
         self.debug("userdata process status on VR: %s" % res)
         self.assertNotEqual(
-                         res.find(self.alias_ip + ":80 ")
-                         - 1,
-                         "password service is not running on alias ip"
-                        )
+            res.find(self.alias_ip + ":80 ")
+            - 1,
+            "password service is not running on alias ip"
+        )
         return
 
     @attr(tags=["sg"])
@@ -464,93 +493,94 @@ class TestMultipleIpRanges(cloudstackTestCase):
             4.Verify ip alias removal after vm expunge
         """
         list_router_response = list_routers(
-                                    self.apiclient,
-                                    zoneid=self.zone.id,
-                                    listall=True
-                                    )
+            self.apiclient,
+            zoneid=self.zone.id,
+            listall=True
+        )
         self.assertEqual(
-                            isinstance(list_router_response, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
+            isinstance(list_router_response, list),
+            True,
+            "Check list response returns a valid list"
+        )
         router = list_router_response[0]
         hosts = list_hosts(
-                           self.apiclient,
-                           zoneid=router.zoneid,
-                           type='Routing',
-                           state='Up',
-                           id=router.hostid
-                           )
+            self.apiclient,
+            zoneid=router.zoneid,
+            type='Routing',
+            state='Up',
+            id=router.hostid
+        )
         self.assertEqual(
-                            isinstance(hosts, list),
-                            True,
-                            "Check list host returns a valid list"
-                        )
+            isinstance(hosts, list),
+            True,
+            "Check list host returns a valid list"
+        )
         host = hosts[0]
         self.debug("Router ID: %s, state: %s" % (router.id, router.state))
         self.assertEqual(
-                            router.state,
-                            'Running',
-                            "Check list router response for router state"
-                        )
+            router.state,
+            'Running',
+            "Check list router response for router state"
+        )
+
+        port = self.testdata['configurableData']['host']["publicport"]
+        username = self.testdata['configurableData']['host']["username"]
+        password = self.testdata['configurableData']['host']["password"]
+
+        # SSH to host so that host key is saved in first
+        # attempt
+        SshClient(host.ipaddress, port, username, password)
+
         proc = "ip addr show eth0"
         result = get_process_status(
-                                host.ipaddress,
-                                self.services['host']["publicport"],
-                                self.services['host']["username"],
-                                self.services['host']["password"],
-                                router.linklocalip,
-                                proc
-                                )
+            host.ipaddress,
+            port,
+            username,
+            password,
+            router.linklocalip,
+            proc
+        )
         res = str(result)
         self.debug("ip alias configuration on VR: %s" % res)
         self.assertNotEqual(
-                         res.find(self.alias_ip)
-                         - 1,
-                         "ip alias is not created on VR eth0"
-                        )
+            res.find(self.alias_ip)
+            - 1,
+            "ip alias is not created on VR eth0"
+        )
         self.virtual_machine.delete(self.apiclient)
-        expunge_del = Configurations.list(
-                                          self.apiclient,
-                                          name='expunge.delay'
-                                         )
-        expunge_int = Configurations.list(
-                                          self.apiclient,
-                                          name='expunge.interval'
-                                         )
-        wait_time = int(expunge_del[0].value) + int(expunge_int[0].value) + int(30)
-        self.debug("Waiting for {} seconds for the vm to expunge".format(wait_time))
-        # wait for the vm to expunge
-        time.sleep(wait_time)
-        self.debug("Verify that expunging the last vm in the CIDR should delete the ip alias from VR")
+        self.debug(
+            "Verify that expunging the last vm in the CIDR should\
+                    delete the ip alias from VR")
         ip_alias2 = self.dbclient.execute(
-                              "select ip4_address from nic_ip_alias;"
-                              )
+            "select ip4_address from nic_ip_alias;"
+        )
         self.assertEqual(
-                         isinstance(ip_alias2, list),
-                         True,
-                         "Error in sql query"
-                         )
+            isinstance(ip_alias2, list),
+            True,
+            "Error in sql query"
+        )
         self.assertEqual(
-                         len(ip_alias2),
-                         0,
-                         "Failure in clearing ip alias entry from cloud db"
-			)
+            len(ip_alias2),
+            0,
+            "Failure in clearing ip alias entry from cloud db"
+        )
+
         proc = "ip addr show eth0"
         result = get_process_status(
-                                host.ipaddress,
-                                self.services['host']["publicport"],
-                                self.services['host']["username"],
-                                self.services['host']["password"],
-                                router.linklocalip,
-                                proc
-                                )
+            host.ipaddress,
+            port,
+            username,
+            password,
+            router.linklocalip,
+            proc
+        )
         res = str(result)
         self.assertEqual(
-                         res.find(self.alias_ip),
-                         - 1,
-                         "Failed to clean up ip alias from VR even after last vm expunge in the CIDR"
-                         )
+            res.find(
+                self.alias_ip),
+            - 1,
+            "Failed to clean up ip alias from VR even after\
+                    last vm expunge in the CIDR")
         self.debug("IP alias got deleted from VR successfully.")
         self.cleanup.remove(self.virtual_machine)
         return
@@ -564,86 +594,95 @@ class TestMultipleIpRanges(cloudstackTestCase):
             4.Verify ip alias on VR
         """
         list_router_response = list_routers(
-                                    self.apiclient,
-                                    zoneid=self.zone.id,
-                                    listall=True
-                                    )
+            self.apiclient,
+            zoneid=self.zone.id,
+            listall=True
+        )
         self.assertEqual(
-                            isinstance(list_router_response, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
+            isinstance(list_router_response, list),
+            True,
+            "Check list response returns a valid list"
+        )
         router = list_router_response[0]
         hosts = list_hosts(
-                           self.apiclient,
-                           zoneid=router.zoneid,
-                           type='Routing',
-                           state='Up',
-                           id=router.hostid
-                           )
+            self.apiclient,
+            zoneid=router.zoneid,
+            type='Routing',
+            state='Up',
+            id=router.hostid
+        )
         self.assertEqual(
-                            isinstance(hosts, list),
-                            True,
-                            "Check list host returns a valid list"
-                        )
+            isinstance(hosts, list),
+            True,
+            "Check list host returns a valid list"
+        )
         host = hosts[0]
         self.debug("Router ID: %s, state: %s" % (router.id, router.state))
         self.assertEqual(
-                            router.state,
-                            'Running',
-                            "Check list router response for router state"
-                        )
+            router.state,
+            'Running',
+            "Check list router response for router state"
+        )
+
+        port = self.testdata['configurableData']['host']["publicport"]
+        username = self.testdata['configurableData']['host']["username"]
+        password = self.testdata['configurableData']['host']["password"]
+
+        # SSH to host so that host key is saved in first
+        # attempt
+        SshClient(host.ipaddress, port, username, password)
+
         proc = "ip addr show eth0"
         result = get_process_status(
-                                host.ipaddress,
-                                self.services['host']["publicport"],
-                                self.services['host']["username"],
-                                self.services['host']["password"],
-                                router.linklocalip,
-                                proc
-                                )
+            host.ipaddress,
+            port,
+            username,
+            password,
+            router.linklocalip,
+            proc
+        )
         res = str(result)
         self.debug("ip alias configuration on VR: %s" % res)
         self.assertNotEqual(
-                         res.find(self.alias_ip)
-                         - 1,
-                         "ip alias is not created on VR eth0"
-                        )
+            res.find(self.alias_ip)
+            - 1,
+            "ip alias is not created on VR eth0"
+        )
         resp = Router.reboot(
-                             self.apiclient,
-                             router.id
-                             )
+            self.apiclient,
+            router.id
+        )
         self.debug("Reboot router api response: %s" % resp)
         list_router_response = list_routers(
-                                            self.apiclient,
-                                            zoneid=self.zone.id,
-                                            listall=True
-                                            )
+            self.apiclient,
+            zoneid=self.zone.id,
+            listall=True
+        )
         self.assertEqual(
-                            isinstance(list_router_response, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
+            isinstance(list_router_response, list),
+            True,
+            "Check list response returns a valid list"
+        )
         router = list_router_response[0]
         self.assertEqual(
-                            router.state,
-                            'Running',
-                            "Router is not in running state after reboot"
-                        )
+            router.state,
+            'Running',
+            "Router is not in running state after reboot"
+        )
         result = get_process_status(
-                                host.ipaddress,
-                                self.services['host']["publicport"],
-                                self.services['host']["username"],
-                                self.services['host']["password"],
-                                router.linklocalip,
-                                proc
-                                )
+            host.ipaddress,
+            port,
+            username,
+            password,
+            router.linklocalip,
+            proc
+        )
         res = str(result)
         self.assertNotEqual(
-                         res.find(self.alias_ip),
-                         - 1,
-                         "IP alias not present on VR after VR reboot"
-                         )
+            res.find(self.alias_ip),
+            - 1,
+            "IP alias not present on VR after VR reboot"
+        )
         return
 
     @attr(tags=["sg"])
@@ -655,90 +694,99 @@ class TestMultipleIpRanges(cloudstackTestCase):
             4.Verify ip alias on VR
         """
         list_router_response = list_routers(
-                                    self.apiclient,
-                                    zoneid=self.zone.id,
-                                    listall=True
-                                    )
+            self.apiclient,
+            zoneid=self.zone.id,
+            listall=True
+        )
         self.assertEqual(
-                            isinstance(list_router_response, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
+            isinstance(list_router_response, list),
+            True,
+            "Check list response returns a valid list"
+        )
         router = list_router_response[0]
         hosts = list_hosts(
-                           self.apiclient,
-                           zoneid=router.zoneid,
-                           type='Routing',
-                           state='Up',
-                           id=router.hostid
-                           )
+            self.apiclient,
+            zoneid=router.zoneid,
+            type='Routing',
+            state='Up',
+            id=router.hostid
+        )
         self.assertEqual(
-                            isinstance(hosts, list),
-                            True,
-                            "Check list host returns a valid list"
-                        )
+            isinstance(hosts, list),
+            True,
+            "Check list host returns a valid list"
+        )
         host = hosts[0]
         self.debug("Router ID: %s, state: %s" % (router.id, router.state))
         self.assertEqual(
-                            router.state,
-                            'Running',
-                            "Check list router response for router state"
-                        )
+            router.state,
+            'Running',
+            "Check list router response for router state"
+        )
+
+        port = self.testdata['configurableData']['host']["publicport"]
+        username = self.testdata['configurableData']['host']["username"]
+        password = self.testdata['configurableData']['host']["password"]
+
+        # SSH to host so that host key is saved in first
+        # attempt
+        SshClient(host.ipaddress, port, username, password)
+
         proc = "ip addr show eth0"
         result = get_process_status(
-                                host.ipaddress,
-                                self.services['host']["publicport"],
-                                self.services['host']["username"],
-                                self.services['host']["password"],
-                                router.linklocalip,
-                                proc
-                                )
+            host.ipaddress,
+            port,
+            username,
+            password,
+            router.linklocalip,
+            proc
+        )
         res = str(result)
         self.debug("ip alias configuration on VR: %s" % res)
         self.assertNotEqual(
-                         res.find(self.alias_ip)
-                         - 1,
-                         "ip alias is not created on VR eth0"
-                        )
+            res.find(self.alias_ip)
+            - 1,
+            "ip alias is not created on VR eth0"
+        )
         self.debug("Stopping VR")
-        stop_res = Router.stop(
-                           self.apiclient,
-                           router.id,
-                           )
+        Router.stop(
+            self.apiclient,
+            router.id,
+        )
         self.debug("Starting VR")
-        start_res = Router.start(
-                                 self.apiclient,
-                                 router.id
-                                 )
+        Router.start(
+            self.apiclient,
+            router.id
+        )
         list_router_response = list_routers(
-                                            self.apiclient,
-                                            zoneid=self.zone.id,
-                                            listall=True
-                                            )
+            self.apiclient,
+            zoneid=self.zone.id,
+            listall=True
+        )
         self.assertEqual(
-                            isinstance(list_router_response, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
+            isinstance(list_router_response, list),
+            True,
+            "Check list response returns a valid list"
+        )
         router = list_router_response[0]
         self.assertEqual(
-                            router.state,
-                            'Running',
-                            "Router is not in running state after reboot"
-                        )
+            router.state,
+            'Running',
+            "Router is not in running state after reboot"
+        )
         self.debug("VR is up and Running")
         result = get_process_status(
-                                host.ipaddress,
-                                self.services['host']["publicport"],
-                                self.services['host']["username"],
-                                self.services['host']["password"],
-                                router.linklocalip,
-                                proc
-                                )
+            host.ipaddress,
+            port,
+            username,
+            password,
+            router.linklocalip,
+            proc
+        )
         res = str(result)
         self.assertNotEqual(
-                         res.find(self.alias_ip),
-                         - 1,
-                         "IP alias not present on VR after VR stop and start"
-                         )
+            res.find(self.alias_ip),
+            - 1,
+            "IP alias not present on VR after VR stop and start"
+        )
         return


[12/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK:8058: Fix test_reset_ssh_keypair.py for EIP setup

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

Branch: refs/heads/master
Commit: 9aefd9bf4f580dd5954520b6b53909b1f732b7f8
Parents: bbebac7
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Thu Dec 11 10:16:25 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Thu Dec 11 17:48:17 2014 +0530

----------------------------------------------------------------------
 .../component/test_reset_ssh_keypair.py         | 45 ++++++++++++++++++++
 1 file changed, 45 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9aefd9bf/test/integration/component/test_reset_ssh_keypair.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_reset_ssh_keypair.py b/test/integration/component/test_reset_ssh_keypair.py
index 370e9a8..a2e743a 100644
--- a/test/integration/component/test_reset_ssh_keypair.py
+++ b/test/integration/component/test_reset_ssh_keypair.py
@@ -107,6 +107,15 @@ def wait_vm_start(apiclient, vmid, timeout, sleep):
 
     return timeout
 
+def SetPublicIpForVM(apiclient, vm):
+    """ List VM and set the publicip (if available) of VM
+    to ssh_ip attribute"""
+
+    vms = VirtualMachine.list(apiclient, id=vm.id, listall=True)
+    virtual_machine = vms[0]
+    if hasattr(vm, "publicip"):
+        vm.ssh_ip = virtual_machine.publicip
+    return vm
 
 class TestResetSSHKeypair(cloudstackTestCase):
 
@@ -353,6 +362,12 @@ class TestResetSSHKeypair(cloudstackTestCase):
                    % (virtual_machine.name, self.services["timeout"]))
 
         self.debug("SSH key path: %s" % str(keyPairFilePath))
+
+        # In case of EIP setup, public IP changes after VM start operation
+        # Assign the new publicip of the VM to its ssh_ip attribute
+        # so that correct IP address is used for getting the ssh client of VM
+        virtual_machine = SetPublicIpForVM(self.apiclient, virtual_machine)
+
         try:
             virtual_machine.get_ssh_client(keyPairFileLocation=str(keyPairFilePath))
         except Exception as e:
@@ -462,6 +477,11 @@ class TestResetSSHKeypair(cloudstackTestCase):
             self.fail("The virtual machine %s failed to start even after %s minutes"
                    % (virtual_machine.name, self.services["timeout"]))
 
+        # In case of EIP setup, public IP changes after VM start operation
+        # Assign the new publicip of the VM to its ssh_ip attribute
+        # so that correct IP address is used for getting the ssh client of VM
+        virtual_machine = SetPublicIpForVM(self.apiclient, virtual_machine)
+
         self.debug("SSHing with new keypair")
         try:
             virtual_machine.get_ssh_client(
@@ -572,6 +592,11 @@ class TestResetSSHKeypair(cloudstackTestCase):
             self.fail("The virtual machine %s failed to start even after %s minutes"
                    % (virtual_machine.name, self.services["timeout"]))
 
+        # In case of EIP setup, public IP changes after VM start operation
+        # Assign the new publicip of the VM to its ssh_ip attribute
+        # so that correct IP address is used for getting the ssh client of VM
+        virtual_machine = SetPublicIpForVM(self.apiclient, virtual_machine)
+
         self.debug("SSHing with new keypair")
         try:
             virtual_machine.get_ssh_client(
@@ -683,6 +708,11 @@ class TestResetSSHKeypair(cloudstackTestCase):
             self.fail("The virtual machine %s failed to start even after %s minutes"
                    % (virtual_machine.name, self.services["timeout"]))
 
+        # In case of EIP setup, public IP changes after VM start operation
+        # Assign the new publicip of the VM to its ssh_ip attribute
+        # so that correct IP address is used for getting the ssh client of VM
+        virtual_machine = SetPublicIpForVM(self.apiclient, virtual_machine)
+
         self.debug("SSHing with new keypair")
         try:
             virtual_machine.get_ssh_client(
@@ -1172,6 +1202,11 @@ class TestResetSSHKeyUserRights(cloudstackTestCase):
             self.fail("The virtual machine %s failed to start even after %s minutes"
                    % (vms[0].name, self.services["timeout"]))
 
+        # In case of EIP setup, public IP changes after VM start operation
+        # Assign the new publicip of the VM to its ssh_ip attribute
+        # so that correct IP address is used for getting the ssh client of VM
+        virtual_machine = SetPublicIpForVM(self.apiclient, virtual_machine)
+
         self.debug("SSHing with new keypair")
         try:
             virtual_machine.get_ssh_client(
@@ -1311,6 +1346,11 @@ class TestResetSSHKeyUserRights(cloudstackTestCase):
             self.fail("The virtual machine %s failed to start even after %s minutes"
                    % (virtual_machine.name, self.services["timeout"]))
 
+        # In case of EIP setup, public IP changes after VM start operation
+        # Assign the new publicip of the VM to its ssh_ip attribute
+        # so that correct IP address is used for getting the ssh client of VM
+        virtual_machine = SetPublicIpForVM(self.apiclient, virtual_machine)
+
         self.debug("SSHing with new keypair")
         try:
             virtual_machine.get_ssh_client(
@@ -1451,6 +1491,11 @@ class TestResetSSHKeyUserRights(cloudstackTestCase):
             self.fail("The virtual machine %s failed to start even after %s minutes"
                    % (virtual_machine.name, self.services["timeout"]))
 
+        # In case of EIP setup, public IP changes after VM start operation
+        # Assign the new publicip of the VM to its ssh_ip attribute
+        # so that correct IP address is used for getting the ssh client of VM
+        virtual_machine = SetPublicIpForVM(self.apiclient, virtual_machine)
+
         self.debug("SSHing with new keypair")
         try:
             virtual_machine.get_ssh_client(


[07/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK-8059: test_host_high_availability.py - Adding necessary code to check the hosts in cluster and update the host with appropriate tags to make it HA enabled

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

Branch: refs/heads/master
Commit: 40f26142b38bda5b10b01b2a2aad77d1b0b5f36e
Parents: 75f9201
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Wed Dec 10 16:14:49 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Wed Dec 10 18:45:43 2014 +0530

----------------------------------------------------------------------
 .../maint/test_host_high_availability.py        | 36 ++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/40f26142/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 0d76f81..1824e75 100644
--- a/test/integration/component/maint/test_host_high_availability.py
+++ b/test/integration/component/maint/test_host_high_availability.py
@@ -19,14 +19,17 @@
 """
 #Import Local Modules
 from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.cloudstackTestCase import cloudstackTestCase, unittest
 from marvin.cloudstackAPI import (migrateVirtualMachine,
                                   prepareHostForMaintenance,
                                   cancelHostMaintenance)
 from marvin.lib.utils import cleanup_resources
 from marvin.lib.base import (Account,
                              VirtualMachine,
-                             ServiceOffering)
+                             ServiceOffering,
+                             Cluster,
+                             Host,
+                             Configurations)
 from marvin.lib.common import (get_zone,
                                get_domain,
                                get_template,
@@ -99,6 +102,33 @@ class TestHostHighAvailability(cloudstackTestCase):
             cls.zone.id,
             cls.services["ostype"]
         )
+
+
+        clusterWithSufficientHosts = None
+        clusters = Cluster.list(cls.api_client, zoneid=cls.zone.id)
+        for cluster in clusters:
+            cls.hosts = Host.list(cls.api_client, clusterid=cluster.id, type="Routing")
+            if len(cls.hosts) >= 3:
+                clusterWithSufficientHosts = cluster
+                break
+
+        if clusterWithSufficientHosts is None:
+            raise unittest.SkipTest("No Cluster with 3 hosts found")
+
+        configs = Configurations.list(
+                                      cls.api_client,
+                                      name='ha.tag'
+                                      )
+
+        assert isinstance(configs, list), "Config list not\
+                retrieved for ha.tag"
+
+        if configs[0].value != "ha":
+            raise unittest.SkipTest("Please set the global config\
+                    value for ha.tag as 'ha'")
+
+        Host.update(cls.api_client, id=cls.hosts[2].id, hosttags="ha")
+
         cls.services["virtual_machine"]["zoneid"] = cls.zone.id
         cls.services["virtual_machine"]["template"] = cls.template.id
 
@@ -123,6 +153,8 @@ class TestHostHighAvailability(cloudstackTestCase):
     @classmethod
     def tearDownClass(cls):
         try:
+            # Remove the host from HA
+            Host.update(cls.api_client, id=cls.hosts[2].id, hosttags="")
             #Cleanup resources used
             cleanup_resources(cls.api_client, cls._cleanup)
         except Exception as e:


[25/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK-8075: Front-end support for shared templates/ISOs


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

Branch: refs/heads/master
Commit: e7a96fde790fe812843e1efe9d05814cfb76d7cc
Parents: 6a8dcf5
Author: Brian Federle <br...@citrix.com>
Authored: Tue Dec 16 14:53:20 2014 -0800
Committer: Brian Federle <br...@citrix.com>
Committed: Tue Dec 16 15:16:30 2014 -0800

----------------------------------------------------------------------
 ui/css/cloudstack3.css                 |  4 ++--
 ui/index.jsp                           | 14 ++++++++++++--
 ui/scripts/instanceWizard.js           | 10 ++++++----
 ui/scripts/ui-custom/instanceWizard.js | 11 ++++++++---
 4 files changed, 28 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e7a96fde/ui/css/cloudstack3.css
----------------------------------------------------------------------
diff --git a/ui/css/cloudstack3.css b/ui/css/cloudstack3.css
index 2914834..b3f9b06 100644
--- a/ui/css/cloudstack3.css
+++ b/ui/css/cloudstack3.css
@@ -5847,14 +5847,14 @@ label.error {
 
 .multi-wizard .ui-tabs li.ui-state-default a {
   float: left;
-  padding: 15px;
-  width: 110px;
   text-align: center;
   font-size: 11px;
   margin-right: 1px;
   color: #4E6070;
   text-decoration: none;
   background: #DEE3E5;
+  padding-left: 0;
+  padding-right: 0;
 }
 
 .multi-wizard .ui-tabs li.ui-state-active a {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e7a96fde/ui/index.jsp
----------------------------------------------------------------------
diff --git a/ui/index.jsp b/ui/index.jsp
index bab00eb..83d5d54 100644
--- a/ui/index.jsp
+++ b/ui/index.jsp
@@ -148,7 +148,8 @@
                                     <ul>
                                         <li class="first"><a href="#instance-wizard-featured-templates"><fmt:message key="label.featured"/></a></li>
                                         <li><a href="#instance-wizard-community-templates"><fmt:message key="label.community"/></a></li>
-                                        <li class="last"><a href="#instance-wizard-my-templates"><fmt:message key="label.my.templates"/></a></li>
+                                        <li><a href="#instance-wizard-my-templates"><fmt:message key="label.my.templates"/></a></li>
+                                        <li class="last"><a href="#instance-wizard-shared-templates"><fmt:message key="label.shared"/></a></li>
                                     </ul>
 
                                     <!-- Used for Select Template only -->
@@ -166,6 +167,10 @@
                                         <div class="select-container">
                                         </div>
                                     </div>
+                                    <div id="instance-wizard-shared-templates">
+                                        <div class="select-container">
+                                        </div>
+                                    </div>
 
                                     <!-- Root disk size -->
                                     <div class="section custom-size">
@@ -184,7 +189,8 @@
                                     <ul>
                                         <li class="first"><a href="#instance-wizard-featured-isos"><fmt:message key="label.featured"/></a></li>
                                         <li><a href="#instance-wizard-community-isos"><fmt:message key="label.community"/></a></li>
-                                        <li class="last"><a href="#instance-wizard-my-isos"><fmt:message key="label.menu.my.isos"/></a></li>
+                                        <li><a href="#instance-wizard-my-isos"><fmt:message key="label.menu.my.isos"/></a></li>
+                                        <li class="last"><a href="#instance-wizard-shared-isos"><fmt:message key="label.shared"/></a></li>
                                     </ul>
                                     <div id="instance-wizard-featured-isos">
                                         <div class="select-container">
@@ -198,6 +204,10 @@
                                         <div class="select-container">
                                         </div>
                                     </div>
+                                    <div id="instance-wizard-shared-isos">
+                                        <div class="select-container">
+                                        </div>
+                                    </div>
                                 </div>
                             </div>
                         </div>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e7a96fde/ui/scripts/instanceWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instanceWizard.js b/ui/scripts/instanceWizard.js
index 2a02ad5..99e79be 100644
--- a/ui/scripts/instanceWizard.js
+++ b/ui/scripts/instanceWizard.js
@@ -231,14 +231,16 @@
                     templatesObj = {
                         featuredtemplates: featuredTemplateObjs,
                         communitytemplates: communityTemplateObjs,
-                        mytemplates: myTemplateObjs
-                    }
+                        mytemplates: myTemplateObjs,
+                        sharedtemplates: [] // ** Needs implementation **
+                    };
                 } else if (selectedTemplateOrIso == 'select-iso') {
                     templatesObj = {
                         featuredisos: featuredIsoObjs,
                         communityisos: communityIsoObjs,
-                        myisos: myIsoObjs
-                    }
+                        myisos: myIsoObjs,
+                        sharedisos: [] // ** Needs implementation **
+                    };
                 }
                 args.response.success({
                     hypervisor: {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e7a96fde/ui/scripts/ui-custom/instanceWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui-custom/instanceWizard.js b/ui/scripts/ui-custom/instanceWizard.js
index 527dc10..a4adc18 100644
--- a/ui/scripts/ui-custom/instanceWizard.js
+++ b/ui/scripts/ui-custom/instanceWizard.js
@@ -342,7 +342,7 @@
                                         var $templateHypervisor = $step.find('input[type=hidden][wizard-field=hypervisor]');
 
                                         // Get hypervisor from template
-                                        if (type == 'featuredtemplates' || type == 'communitytemplates' || type == 'mytemplates') {
+                                        if (type == 'featuredtemplates' || type == 'communitytemplates' || type == 'mytemplates' || type == 'sharedtemplates') {
                                             $selects.each(function() {
                                                 var $select = $(this);
                                                 var template = $.grep(args.data.templates[type], function(tmpl, v) {
@@ -359,7 +359,7 @@
                                             $templateHypervisor.attr('disabled', 'disabled');
                                         }
 
-                                        if (type == 'featuredisos' || type == 'communityisos' || type == 'myisos') {
+                                        if (type == 'featuredisos' || type == 'communityisos' || type == 'myisos' || type == 'sharedisos') {
                                             // Create hypervisor select
                                             $selects.find('input').bind('click', function() {
                                                 var $select = $(this).closest('.select');
@@ -368,6 +368,7 @@
                                                 $("#instance-wizard-featured-isos .select-container div.selected").removeClass('selected').find('div.hypervisor').remove();
                                                 $("#instance-wizard-community-isos .select-container div.selected").removeClass('selected').find('div.hypervisor').remove();
                                                 $("#instance-wizard-my-isos .select-container div.selected").removeClass('selected').find('div.hypervisor').remove();
+                                                $("#instance-wizard-shared-isos .select-container div.selected").removeClass('selected').find('div.hypervisor').remove();
 
                                                 $select.addClass('selected').append(
                                                     $('<div>').addClass('hypervisor')
@@ -396,13 +397,17 @@
                                     // Featured ISOs
                                     $(
                                         [
+                                            // Templates
                                             ['featuredtemplates', 'instance-wizard-featured-templates'],
                                             ['communitytemplates', 'instance-wizard-community-templates'],
                                             ['mytemplates', 'instance-wizard-my-templates'],
+                                            ['sharedtemplates', 'instance-wizard-shared-templates'],
 
+                                            // ISOs
                                             ['featuredisos', 'instance-wizard-featured-isos'],
                                             ['communityisos', 'instance-wizard-community-isos'],
-                                            ['myisos', 'instance-wizard-my-isos']
+                                            ['myisos', 'instance-wizard-my-isos'],
+                                            ['sharedisos', 'instance-wizard-shared-isos'],
                                             //['isos', 'instance-wizard-all-isos']
                                         ]
                                     ).each(function() {


[06/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK-8057: test_dedicate_guest_vlan_range.py - Marking a test as invalid

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

Branch: refs/heads/master
Commit: 75f920185308307fe4b3abf1b60b071346656ab7
Parents: f38c2f8
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Wed Dec 10 14:58:49 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Wed Dec 10 18:45:30 2014 +0530

----------------------------------------------------------------------
 test/integration/component/test_dedicate_guest_vlan_ranges.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/75f92018/test/integration/component/test_dedicate_guest_vlan_ranges.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_dedicate_guest_vlan_ranges.py b/test/integration/component/test_dedicate_guest_vlan_ranges.py
index 29bc280..9a0e7f0 100644
--- a/test/integration/component/test_dedicate_guest_vlan_ranges.py
+++ b/test/integration/component/test_dedicate_guest_vlan_ranges.py
@@ -434,7 +434,7 @@ class TestDedicateGuestVLANRange(cloudstackTestCase):
         return
 
 
-    @attr(tags = ["advanced", "selfservice"], required_hardware="false")
+    @attr(tags = ["invalid"])
     def test_04_dedicate_guest_vlan_in_project(self):
         """Dedicate guest vlan range project owner account and test guest network vlan in project
 


[31/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK-8071: Fixed api key issue in test_snapshots_improvement.py

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


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

Branch: refs/heads/master
Commit: ed5bc1c7ea1885e95c7cad0045243c7f43e9f516
Parents: 9481460
Author: Ashutosh K <as...@clogeny.com>
Authored: Mon Dec 15 15:54:51 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Wed Dec 17 17:28:53 2014 +0530

----------------------------------------------------------------------
 .../component/test_snapshots_improvement.py        | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ed5bc1c7/test/integration/component/test_snapshots_improvement.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_snapshots_improvement.py b/test/integration/component/test_snapshots_improvement.py
index 6638ddd..1fd4239 100644
--- a/test/integration/component/test_snapshots_improvement.py
+++ b/test/integration/component/test_snapshots_improvement.py
@@ -303,7 +303,9 @@ class TestCreateSnapshot(cloudstackTestCase):
     def setUpClass(cls):
         cls.testClient = super(TestCreateSnapshot, cls).getClsTestClient()
         cls.api_client = cls.testClient.getApiClient()
-
+        cls.hypervisor = cls.testClient.getHypervisorInfo()
+        if cls.hypervisor.lower() in ['hyperv']:
+            raise unittest.SkipTest("Snapshots feature is not supported on Hyper-V")
         cls.services = Services().services
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client)
@@ -345,13 +347,17 @@ class TestCreateSnapshot(cloudstackTestCase):
                             self.services["account"],
                             domainid=self.domain.id
                             )
+
+        self.apiclient = self.testClient.getUserApiClient(
+                                UserName=self.account.name,
+                                DomainName=self.account.domain)
         self.cleanup = [self.account, ]
         return
 
     def tearDown(self):
         try:
             # Clean up, terminate the created instance, volumes and snapshots
-            cleanup_resources(self.apiclient, self.cleanup)
+            cleanup_resources(self.api_client, self.cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
@@ -615,13 +621,8 @@ class TestCreateSnapshot(cloudstackTestCase):
             self.debug("Create a template from snapshot: %s" % snapshot.name)
             jobs.append(self.create_Template_from_Snapshot(snapshot))
 
-
-        userapiclient = self.testClient.getUserApiClient(
-                                UserName=self.account.name,
-                                DomainName=self.account.domain)
-
         # Verify IO usage by submitting the concurrent jobs
-        self.testClient.submitCmdsAndWait(jobs, apiclient=userapiclient)
+        self.testClient.submitCmdsAndWait(jobs)
 
         self.debug("Verifying if templates are created properly or not?")
         templates = Template.list(


[37/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
if local storage is in maitenance mode or removed, won't change its
status in case of mgt server restart
Reviewed-by:Frank


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

Branch: refs/heads/master
Commit: 8f2bd456600b65f376c93a64075e9f8c1c949d4f
Parents: 50d5d48
Author: Edison Su <su...@gmail.com>
Authored: Mon Dec 8 15:25:06 2014 -0800
Committer: Edison Su <su...@gmail.com>
Committed: Wed Dec 17 14:34:48 2014 -0800

----------------------------------------------------------------------
 server/src/com/cloud/storage/StorageManagerImpl.java | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f2bd456/server/src/com/cloud/storage/StorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java
index 1feea01..7de4ea0 100755
--- a/server/src/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/com/cloud/storage/StorageManagerImpl.java
@@ -583,8 +583,12 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
                 store = dataStoreMgr.getDataStore(pool.getId(), DataStoreRole.Primary);
             }
 
-            HostScope scope = new HostScope(host.getId(), host.getClusterId(), host.getDataCenterId());
-            lifeCycle.attachHost(store, scope, pInfo);
+            pool = _storagePoolDao.findById(store.getId());
+            if (pool.getStatus() != StoragePoolStatus.Maintenance && pool.getStatus() != StoragePoolStatus.Removed) {
+                HostScope scope = new HostScope(host.getId(), host.getClusterId(), host.getDataCenterId());
+                lifeCycle.attachHost(store, scope, pInfo);
+            }
+
         } catch (Exception e) {
             s_logger.warn("Unable to setup the local storage pool for " + host, e);
             throw new ConnectionException(true, "Unable to setup the local storage pool for " + host, e);


[11/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK:8018: Fix test_redundant_router.test_redundantVR_internals - The SSH to router was being done from wrong host

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

Branch: refs/heads/master
Commit: bbebac733969ffa0125befdba28c49b48c44ee50
Parents: 7ff118c
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Thu Dec 11 17:12:50 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Thu Dec 11 17:44:30 2014 +0530

----------------------------------------------------------------------
 test/integration/component/maint/test_redundant_router.py | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bbebac73/test/integration/component/maint/test_redundant_router.py
----------------------------------------------------------------------
diff --git a/test/integration/component/maint/test_redundant_router.py b/test/integration/component/maint/test_redundant_router.py
index 099ae2c..01d635b 100644
--- a/test/integration/component/maint/test_redundant_router.py
+++ b/test/integration/component/maint/test_redundant_router.py
@@ -720,8 +720,7 @@ class TestRVRInternals(cloudstackTestCase):
 
         hosts = Host.list(
             self.apiclient,
-            id=master_router.hostid,
-            listall=True
+            id=master_router.hostid
         )
         self.assertEqual(
             isinstance(hosts, list),
@@ -734,8 +733,7 @@ class TestRVRInternals(cloudstackTestCase):
 
         hosts = Host.list(
             self.apiclient,
-            id=backup_router.hostid,
-            listall=True
+            id=backup_router.hostid
         )
         self.assertEqual(
             isinstance(hosts, list),
@@ -796,7 +794,7 @@ class TestRVRInternals(cloudstackTestCase):
             )
         else:
             result = get_process_status(
-                master_host.ipaddress,
+                backup_host.ipaddress,
                 22,
                 self.testdata['configurableData']['host']["username"],
                 self.testdata['configurableData']['host']["password"],


[17/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK-8055: Tagging test cases which can't be run on simulator accordingly

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

Branch: refs/heads/master
Commit: ecbeb003ec94149adfeb8234f11979b5d99fba7b
Parents: 44d295e
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Fri Dec 12 14:32:08 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Fri Dec 12 18:58:14 2014 +0530

----------------------------------------------------------------------
 test/integration/component/test_ip_reservation.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ecbeb003/test/integration/component/test_ip_reservation.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_ip_reservation.py b/test/integration/component/test_ip_reservation.py
index 37b783f..14b6f5c 100644
--- a/test/integration/component/test_ip_reservation.py
+++ b/test/integration/component/test_ip_reservation.py
@@ -305,7 +305,7 @@ class TestIpReservation(cloudstackTestCase):
         return
 
     @data(NAT_RULE, STATIC_NAT_RULE)
-    @attr(tags=["advanced"])
+    @attr(tags=["advanced"], required_hardware="true")
     def test_nat_rules(self, value):
         """ Test NAT rules working with IP reservation
         # steps


[16/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK-8068: Fixing test script issue in test_ps_project_limits.py

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


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

Branch: refs/heads/master
Commit: 44d295e5c0ae2ecf8a6b0e6abf32fa665db8e83e
Parents: 47ee7c0
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Fri Dec 12 13:45:12 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Fri Dec 12 18:54:28 2014 +0530

----------------------------------------------------------------------
 test/integration/component/test_ps_project_limits.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/44d295e5/test/integration/component/test_ps_project_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_ps_project_limits.py b/test/integration/component/test_ps_project_limits.py
index 9420e30..bab37f6 100644
--- a/test/integration/component/test_ps_project_limits.py
+++ b/test/integration/component/test_ps_project_limits.py
@@ -190,7 +190,7 @@ class TestProjectsVolumeLimits(cloudstackTestCase):
             host = hosts[0]
             self.vm.migrate(self.apiclient, host.id)
         except Exception as e:
-            self.fail("Exception occured" % e)
+            self.fail("Exception occured: %s" % e)
 
         expectedCount = self.initialResourceCount
         response = matchResourceCount(


[13/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK-8061: Extracting volume when it is in migrating state causes
    both the operations to fail.


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

Branch: refs/heads/master
Commit: fbe54974c514572d1c224528446618c31952e25a
Parents: 9aefd9b
Author: Min Chen <mi...@citrix.com>
Authored: Wed Dec 10 14:16:00 2014 -0800
Committer: Min Chen <mi...@citrix.com>
Committed: Thu Dec 11 11:36:34 2014 -0800

----------------------------------------------------------------------
 .../src/com/cloud/vm/VmWorkExtractVolume.java   |  38 ++++++
 .../com/cloud/storage/VolumeApiServiceImpl.java | 124 ++++++++++++++++++-
 2 files changed, 156 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fbe54974/engine/components-api/src/com/cloud/vm/VmWorkExtractVolume.java
----------------------------------------------------------------------
diff --git a/engine/components-api/src/com/cloud/vm/VmWorkExtractVolume.java b/engine/components-api/src/com/cloud/vm/VmWorkExtractVolume.java
new file mode 100644
index 0000000..82b5db4
--- /dev/null
+++ b/engine/components-api/src/com/cloud/vm/VmWorkExtractVolume.java
@@ -0,0 +1,38 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.vm;
+
+public class VmWorkExtractVolume extends VmWork {
+    private static final long serialVersionUID = -565778516928408602L;
+
+    private long volumeId;
+    private long zoneId;
+
+    public VmWorkExtractVolume(long userId, long accountId, long vmId, String handlerName, long volumeId, long zoneId) {
+        super(userId, accountId, vmId, handlerName);
+        this.volumeId = volumeId;
+        this.zoneId = zoneId;
+    }
+
+    public long getVolumeId() {
+        return volumeId;
+    }
+
+    public long getZoneId() {
+        return zoneId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fbe54974/server/src/com/cloud/storage/VolumeApiServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
index 9deaae2..0914c57 100644
--- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
@@ -141,6 +141,7 @@ import com.cloud.vm.VmWork;
 import com.cloud.vm.VmWorkAttachVolume;
 import com.cloud.vm.VmWorkConstants;
 import com.cloud.vm.VmWorkDetachVolume;
+import com.cloud.vm.VmWorkExtractVolume;
 import com.cloud.vm.VmWorkJobHandler;
 import com.cloud.vm.VmWorkJobHandlerProxy;
 import com.cloud.vm.VmWorkMigrateVolume;
@@ -2043,14 +2044,70 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
             return volumeStoreRef.getExtractUrl();
         }
 
-        dataStoreMgr.getPrimaryDataStore(volume.getPoolId());
-        ImageStoreEntity secStore = (ImageStoreEntity)dataStoreMgr.getImageStore(zoneId);
-        secStore.getUri();
+        VMInstanceVO vm = null;
+        if (volume.getInstanceId() != null) {
+            vm = _vmInstanceDao.findById(volume.getInstanceId());
+        }
+
+        if (vm != null) {
+            // serialize VM operation
+            AsyncJobExecutionContext jobContext = AsyncJobExecutionContext.getCurrentExecutionContext();
+            if (jobContext.isJobDispatchedBy(VmWorkConstants.VM_WORK_JOB_DISPATCHER)) {
+                // avoid re-entrance
+
+                VmWorkJobVO placeHolder = null;
+                placeHolder = createPlaceHolderWork(vm.getId());
+                try {
+                    return orchestrateExtractVolume(volume.getId(), zoneId);
+                } finally {
+                    _workJobDao.expunge(placeHolder.getId());
+                }
 
+            } else {
+                Outcome<String> outcome = extractVolumeThroughJobQueue(vm.getId(), volume.getId(), zoneId);
+
+                try {
+                    outcome.get();
+                } catch (InterruptedException e) {
+                    throw new RuntimeException("Operation is interrupted", e);
+                } catch (java.util.concurrent.ExecutionException e) {
+                    throw new RuntimeException("Execution excetion", e);
+                }
+
+                Object jobResult = _jobMgr.unmarshallResultObject(outcome.getJob());
+                if (jobResult != null) {
+                    if (jobResult instanceof ConcurrentOperationException)
+                        throw (ConcurrentOperationException)jobResult;
+                    else if (jobResult instanceof RuntimeException)
+                        throw (RuntimeException)jobResult;
+                    else if (jobResult instanceof Throwable)
+                        throw new RuntimeException("Unexpected exception", (Throwable)jobResult);
+                }
+
+                // retrieve the entity url from job result
+                if (jobResult != null && jobResult instanceof String) {
+                    return (String)jobResult;
+                }
+                return null;
+            }
+        }
+
+        return orchestrateExtractVolume(volume.getId(), zoneId);
+    }
+
+    private String orchestrateExtractVolume(long volumeId, long zoneId) {
+        // get latest volume state to make sure that it is not updated by other parallel operations
+        VolumeVO volume = _volsDao.findById(volumeId);
+        if (volume == null || volume.getState() != Volume.State.Ready) {
+            throw new InvalidParameterValueException("Volume to be extracted has been removed or not in right state!");
+        }
+        // perform extraction
+        ImageStoreEntity secStore = (ImageStoreEntity)dataStoreMgr.getImageStore(zoneId);
         String value = _configDao.getValue(Config.CopyVolumeWait.toString());
         NumbersUtil.parseInt(value, Integer.parseInt(Config.CopyVolumeWait.getDefaultValue()));
+
         // Copy volume from primary to secondary storage
-        VolumeInfo srcVol = volFactory.getVolume(volume.getId());
+        VolumeInfo srcVol = volFactory.getVolume(volumeId);
         AsyncCallFuture<VolumeApiResult> cvAnswer = volService.copyVolume(srcVol, secStore);
         // Check if you got a valid answer.
         VolumeApiResult cvResult = null;
@@ -2071,11 +2128,10 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
         VolumeInfo vol = cvResult.getVolume();
 
         String extractUrl = secStore.createEntityExtractUrl(vol.getPath(), vol.getFormat(), vol);
-        volumeStoreRef = _volumeStoreDao.findByVolume(volumeId);
+        VolumeDataStoreVO volumeStoreRef = _volumeStoreDao.findByVolume(volumeId);
         volumeStoreRef.setExtractUrl(extractUrl);
         volumeStoreRef.setExtractUrlCreated(DateUtil.now());
         _volumeStoreDao.update(volumeStoreRef.getId(), volumeStoreRef);
-
         return extractUrl;
     }
 
@@ -2350,6 +2406,23 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
         _storagePoolAllocators = storagePoolAllocators;
     }
 
+    public class VmJobVolumeUrlOutcome extends OutcomeImpl<String> {
+
+        public VmJobVolumeUrlOutcome(final AsyncJob job) {
+            super(String.class, job, VmJobCheckInterval.value(), new Predicate() {
+                @Override
+                public boolean checkCondition() {
+                    AsyncJobVO jobVo = _entityMgr.findById(AsyncJobVO.class, job.getId());
+                    assert (jobVo != null);
+                    if (jobVo == null || jobVo.getStatus() != JobInfo.Status.IN_PROGRESS)
+                        return true;
+
+                    return false;
+                }
+            }, AsyncJob.Topics.JOB_STATE);
+        }
+    }
+
     public class VmJobVolumeOutcome extends OutcomeImpl<Volume> {
         private long _volumeId;
 
@@ -2498,6 +2571,39 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
         return new VmJobVolumeOutcome(workJob,volumeId);
     }
 
+    public Outcome<String> extractVolumeThroughJobQueue(final Long vmId, final long volumeId,
+            final long zoneId) {
+
+        final CallContext context = CallContext.current();
+        final User callingUser = context.getCallingUser();
+        final Account callingAccount = context.getCallingAccount();
+
+        final VMInstanceVO vm = _vmInstanceDao.findById(vmId);
+
+        VmWorkJobVO workJob = new VmWorkJobVO(context.getContextId());
+
+        workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER);
+        workJob.setCmd(VmWorkExtractVolume.class.getName());
+
+        workJob.setAccountId(callingAccount.getId());
+        workJob.setUserId(callingUser.getId());
+        workJob.setStep(VmWorkJobVO.Step.Starting);
+        workJob.setVmType(VirtualMachine.Type.Instance);
+        workJob.setVmInstanceId(vm.getId());
+        workJob.setRelated(AsyncJobExecutionContext.getOriginJobId());
+
+        // save work context info (there are some duplications)
+        VmWorkExtractVolume workInfo = new VmWorkExtractVolume(callingUser.getId(), callingAccount.getId(), vm.getId(),
+                VolumeApiServiceImpl.VM_WORK_JOB_HANDLER, volumeId, zoneId);
+        workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo));
+
+        _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId());
+
+        AsyncJobExecutionContext.getCurrentExecutionContext().joinJob(workJob.getId());
+
+        return new VmJobVolumeUrlOutcome(workJob);
+    }
+
     public Outcome<Volume> migrateVolumeThroughJobQueue(final Long vmId, final long volumeId,
             final long destPoolId, final boolean liveMigrate) {
 
@@ -2566,6 +2672,12 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
     }
 
     @ReflectionUse
+    private Pair<JobInfo.Status, String> orchestrateExtractVolume(VmWorkExtractVolume work) throws Exception {
+        String volUrl = orchestrateExtractVolume(work.getVolumeId(), work.getZoneId());
+        return new Pair<JobInfo.Status, String>(JobInfo.Status.SUCCEEDED, _jobMgr.marshallResultObject(volUrl));
+    }
+
+    @ReflectionUse
     private Pair<JobInfo.Status, String> orchestrateAttachVolumeToVM(VmWorkAttachVolume work) throws Exception {
         Volume vol = orchestrateAttachVolumeToVM(work.getVmId(), work.getVolumeId(), work.getDeviceId());
 


[02/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK-8049: Tagging test cases which cannot be run on simulator accordingly

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

Branch: refs/heads/master
Commit: b23fd5ee53c228681697359b0ad007ba5b539416
Parents: ab580de
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Tue Dec 9 12:29:17 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Tue Dec 9 18:53:19 2014 +0530

----------------------------------------------------------------------
 test/integration/component/test_ps_resize_volume.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b23fd5ee/test/integration/component/test_ps_resize_volume.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_ps_resize_volume.py b/test/integration/component/test_ps_resize_volume.py
index 5df4a62..bff1672 100644
--- a/test/integration/component/test_ps_resize_volume.py
+++ b/test/integration/component/test_ps_resize_volume.py
@@ -159,7 +159,7 @@ class TestResizeVolume(cloudstackTestCase):
             return [FAIL, e]
         return [PASS, None]
 
-    @attr(tags=["advanced"], required_hardware="false")
+    @attr(tags=["advanced"], required_hardware="true")
     def test_01_increase_volume_size_within_account_limit(self):
 	"""Test increasing volume size within the account limit and verify primary storage usage
 
@@ -223,7 +223,7 @@ class TestResizeVolume(cloudstackTestCase):
             self.fail("Failed with exception: %s" % e)
         return
 
-    @attr(tags=["advanced"], required_hardware="false")
+    @attr(tags=["advanced"], required_hardware="true")
     def test_02_increase_volume_size_above_account_limit(self):
 	"""Test increasing volume size above the account limit
 
@@ -281,7 +281,7 @@ class TestResizeVolume(cloudstackTestCase):
             volume.resize(apiclient, diskofferingid=self.disk_offering_20_GB.id)
         return
 
-    @attr(tags=["advanced"], required_hardware="false")
+    @attr(tags=["advanced"], required_hardware="true")
     def test_03_increase_volume_size_above_domain_limit(self):
 	"""Test increasing volume size above the domain limit
 


[29/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK-8081: Fixed VM snapshot test cases in test_escalation_instances.py and also dealt cleanup issues

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

Branch: refs/heads/master
Commit: daabe92a992f072c6305b14b88fcda99e19a7190
Parents: c3508f6
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Wed Dec 17 11:32:49 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Wed Dec 17 17:28:35 2014 +0530

----------------------------------------------------------------------
 .../component/test_escalations_instances.py     | 61 +++++++-------------
 1 file changed, 22 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/daabe92a/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 9f053a1..e79cd3d 100644
--- a/test/integration/component/test_escalations_instances.py
+++ b/test/integration/component/test_escalations_instances.py
@@ -2113,26 +2113,6 @@ class TestInstances(cloudstackTestCase):
                 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, 8):
-                Resources.updateLimit(
-                    cls.api_client,
-                    account=cls.account.name,
-                    domainid=cls.domain.id,
-                    max=-1,
-                    resourcetype=i
-                )
-            cls._cleanup.append(cls.account)
             cls._cleanup.append(cls.service_offering)
             cls._cleanup.append(cls.disk_offering)
         except Exception as e:
@@ -2144,12 +2124,29 @@ class TestInstances(cloudstackTestCase):
 
         self.apiClient = self.testClient.getApiClient()
         self.cleanup = []
-        self.cleanup_vm = []
+        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, 8):
+            Resources.updateLimit(
+                    self.api_client,
+                    account=self.account.name,
+                    domainid=self.domain.id,
+                    max=-1,
+                    resourcetype=i
+            )
+        self.cleanup.append(self.account)
 
     def tearDown(self):
         # Clean up, terminate the created resources
-        for vm in self.cleanup_vm:
-            vm.delete(self.apiClient, expunge=True)
         cleanup_resources(self.apiClient, self.cleanup)
         return
 
@@ -2242,7 +2239,6 @@ class TestInstances(cloudstackTestCase):
             vm_created,
             "VM creation failed"
         )
-        self.cleanup.append(vm_created)
         # Listing all the VMs for a user again for matching zone
         list_vms_after = VirtualMachine.list(
             self.userapiclient,
@@ -2372,7 +2368,6 @@ class TestInstances(cloudstackTestCase):
             vm_created,
             "VM creation failed"
         )
-        self.cleanup.append(vm_created)
         # Listing all the VMs for a user again
         list_vms_after = VirtualMachine.list(
             self.userapiclient,
@@ -2535,7 +2530,6 @@ class TestInstances(cloudstackTestCase):
             vm_created,
             "VM creation failed"
         )
-        self.cleanup.append(vm_created)
         # Listing all the VMs for a user again
         list_vms_after = VirtualMachine.list(
             self.userapiclient,
@@ -2568,6 +2562,7 @@ class TestInstances(cloudstackTestCase):
         snapshot1 = VmSnapshot.create(
             self.userapiclient,
             vm_created.id,
+            snapshotmemory=True
         )
         self.assertIsNotNone(
             snapshot1,
@@ -2576,6 +2571,7 @@ class TestInstances(cloudstackTestCase):
         snapshot2 = VmSnapshot.create(
             self.userapiclient,
             vm_created.id,
+            snapshotmemory=True
         )
         self.assertIsNotNone(
             snapshot2,
@@ -2699,7 +2695,6 @@ class TestInstances(cloudstackTestCase):
             vm_created,
             "VM creation failed"
         )
-        self.cleanup.append(vm_created)
         # Listing all the VMs for a user again
         list_vms_after = VirtualMachine.list(
             self.userapiclient,
@@ -2747,7 +2742,6 @@ class TestInstances(cloudstackTestCase):
                 volume_created,
                 "Volume is not created"
             )
-            self.cleanup.append(volume_created)
             # Attaching all the volumes created to VM
             vm_created.attach_volume(
                 self.userapiclient,
@@ -2943,7 +2937,6 @@ class TestInstances(cloudstackTestCase):
                 vm_created,
                 "VM creation failed"
             )
-            self.cleanup.append(vm_created)
             # Listing details of current Service Offering
             vm_so_list = ServiceOffering.list(
                 self.userapiclient,
@@ -3074,7 +3067,6 @@ class TestInstances(cloudstackTestCase):
             vm_created,
             "VM creation failed"
         )
-        self.cleanup.append(vm_created)
         # Listing details of current Service Offering
         vm_so_list = ServiceOffering.list(
             self.userapiclient,
@@ -3198,7 +3190,6 @@ class TestInstances(cloudstackTestCase):
             vm_created,
             "VM creation failed"
         )
-        self.cleanup.append(vm_created)
         # Listing all the VMs for a user again
         list_vms_after = VirtualMachine.list(
             self.userapiclient,
@@ -3326,7 +3317,6 @@ class TestInstances(cloudstackTestCase):
             vm_created,
             "VM creation failed"
         )
-        self.cleanup.append(vm_created)
         # Verifying the displayname and group details for deployed VM
         self.assertEquals(
             self.services["virtual_machine"]["displayname"],
@@ -3425,7 +3415,6 @@ class TestInstances(cloudstackTestCase):
             vm_created,
             "VM creation failed"
         )
-        self.cleanup.append(vm_created)
         # Listing all the VMs for a user again
         list_vms_after = VirtualMachine.list(
             self.userapiclient,
@@ -3533,7 +3522,6 @@ class TestInstances(cloudstackTestCase):
                 network,
                 "Network creation failed"
             )
-            self.cleanup.append(network)
             networks_list_size = networks_list_size + 1
 
         # Listing the networks again
@@ -3573,7 +3561,6 @@ class TestInstances(cloudstackTestCase):
             vm_created,
             "VM creation failed"
         )
-        self.cleanup.insert(-2, vm_created)
         # Listing all the VMs for a user again
         list_vms_after = VirtualMachine.list(
             self.userapiclient,
@@ -3693,7 +3680,6 @@ class TestInstances(cloudstackTestCase):
             vm_created,
             "VM creation failed"
         )
-        self.cleanup_vm.append(vm_created)
         # Listing all the VMs for a user again
         list_vms_after = VirtualMachine.list(
             self.userapiclient,
@@ -3797,8 +3783,6 @@ class TestInstances(cloudstackTestCase):
             vm_created,
             "VM creation failed"
         )
-        # self.cleanup.append(vm_created)
-        self.cleanup.append(network)
         # Listing all the VMs for a user again
         vm_response = VirtualMachine.list(
             self.userapiclient,
@@ -3921,7 +3905,6 @@ class TestInstances(cloudstackTestCase):
             vm1, "VM1 creation failed with ip address %s and host name %s" %
             (vm_ip1, name1))
         # self.cleanup.append(vm_created)
-        self.cleanup.append(network)
         # Listing all the VMs for a user again
         vm_response = VirtualMachine.list(
             self.userapiclient,


[33/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK-8079: If the cluster capacity threshold is reached, HA-enabled VM is not migrated on another host during HA

Changes:
-  When there is HA we try to redeploy the affected vm using regular planners and if that fails we retry using the special planner for HA (which skips checking disable threshold)
Now because of job framework the InsufficientCapacittyException gets masked and the special planners are not called. Job framework needs to be fixed to rethrow the correct exception.
- Also the VM Work Job framework is  not setting the DeploymentPlanner to the VmWorkJob.  So the HA Planner being passed by HAMgr was not getting used.
- Now the job framework sets the planner passed in by any caller of the VM Start operation, to the job


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

Branch: refs/heads/master
Commit: a7861aa5faabc9ce9422ae2c903471fbf8239abc
Parents: 11fa4810
Author: Prachi Damle <pr...@citrix.com>
Authored: Wed Dec 17 11:42:03 2014 -0800
Committer: Prachi Damle <pr...@citrix.com>
Committed: Wed Dec 17 13:48:24 2014 -0800

----------------------------------------------------------------------
 .../src/com/cloud/vm/VirtualMachineManagerImpl.java              | 3 +++
 engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java   | 4 ++--
 server/src/com/cloud/storage/VolumeApiServiceImpl.java           | 3 +++
 3 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a7861aa5/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
index 8377906..c87b772 100755
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -3949,6 +3949,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
             VmWorkStart workInfo = new VmWorkStart(callingUser.getId(), callingAccount.getId(), vm.getId(), VirtualMachineManagerImpl.VM_WORK_JOB_HANDLER);
             workInfo.setPlan(planToDeploy);
             workInfo.setParams(params);
+            if (planner != null) {
+                workInfo.setDeploymentPlanner(planner.getName());
+            }
             workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo));
 
             _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a7861aa5/engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java b/engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java
index f302002..c023511 100644
--- a/engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java
+++ b/engine/orchestration/src/com/cloud/vm/VmWorkJobDispatcher.java
@@ -111,8 +111,8 @@ public class VmWorkJobDispatcher extends AdapterBase implements AsyncJobDispatch
         } catch(Throwable e) {
             s_logger.error("Unable to complete " + job + ", job origin:" + job.getRelated(), e);
 
-            RuntimeException ex = new RuntimeException("Job failed due to exception " + e.getMessage());
-            _asyncJobMgr.completeAsyncJob(job.getId(), JobInfo.Status.FAILED, 0, _asyncJobMgr.marshallResultObject(ex));
+            //RuntimeException ex = new RuntimeException("Job failed due to exception " + e.getMessage());
+            _asyncJobMgr.completeAsyncJob(job.getId(), JobInfo.Status.FAILED, 0, _asyncJobMgr.marshallResultObject(e));
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a7861aa5/server/src/com/cloud/storage/VolumeApiServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
index 0914c57..03b64ac 100644
--- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
@@ -925,6 +925,9 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
                     if (jobResult instanceof ConcurrentOperationException) {
                         throw (ConcurrentOperationException)jobResult;
                     }
+                    else if (jobResult instanceof ResourceAllocationException) {
+                        throw (ResourceAllocationException)jobResult;
+                    }
                     else if (jobResult instanceof RuntimeException) {
                         throw (RuntimeException)jobResult;
                     }


[08/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK-8014: Fix NPE searching including removed templates

Steps to reproduce if you have this issue:
- Create a VM's volume snapshot
- Remove VM's template and mark the template as removed with timestamp in DB
- Restart mgmt server and create a volume out of snapshot you should get NPE

Fix: In `storagePoolHasEnoughSpace`, we're only searching for a VM's volume's
snapshot's template by Id and not including removed templates. This is a corner
case and NPE hits when template has been marked removed for a VM's volume's
template so we should search including removed templates.

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

Branch: refs/heads/master
Commit: e59dac201dc66ac80728632d7218b9a787142243
Parents: 40f2614
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Wed Dec 10 19:08:26 2014 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Wed Dec 10 19:30:56 2014 +0530

----------------------------------------------------------------------
 server/src/com/cloud/storage/StorageManagerImpl.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e59dac20/server/src/com/cloud/storage/StorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java
index 0b8a43b..1feea01 100755
--- a/server/src/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/com/cloud/storage/StorageManagerImpl.java
@@ -1576,8 +1576,8 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
         long totalAskingSize = 0;
         for (Volume volume : volumes) {
             if (volume.getTemplateId() != null) {
-                VMTemplateVO tmpl = _templateDao.findById(volume.getTemplateId());
-                if (tmpl.getFormat() != ImageFormat.ISO) {
+                VMTemplateVO tmpl = _templateDao.findByIdIncludingRemoved(volume.getTemplateId());
+                if (tmpl != null && tmpl.getFormat() != ImageFormat.ISO) {
                     allocatedSizeWithtemplate = _capacityMgr.getAllocatedPoolCapacity(poolVO, tmpl);
                 }
             }


[19/40] git commit: updated refs/heads/master to f4133a7

Posted by da...@apache.org.
CLOUDSTACK-8067: Fixed NPEs in MS log related to console proxy VM

(cherry picked from commit 1115bc9cc6ebf2b321bb5a3ff6958d649150cfe5)
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/b07c9b7a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b07c9b7a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b07c9b7a

Branch: refs/heads/master
Commit: b07c9b7a9c0c4bfff63c722a7d619a96280102f1
Parents: e791e8e
Author: Anshul Gangwar <an...@citrix.com>
Authored: Thu Dec 11 11:12:18 2014 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Fri Dec 12 21:41:38 2014 +0530

----------------------------------------------------------------------
 server/src/com/cloud/consoleproxy/AgentHookBase.java | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b07c9b7a/server/src/com/cloud/consoleproxy/AgentHookBase.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/consoleproxy/AgentHookBase.java b/server/src/com/cloud/consoleproxy/AgentHookBase.java
index 9864cae..8a5bae5 100644
--- a/server/src/com/cloud/consoleproxy/AgentHookBase.java
+++ b/server/src/com/cloud/consoleproxy/AgentHookBase.java
@@ -208,12 +208,13 @@ public abstract class AgentHookBase implements AgentHook {
             HostVO consoleProxyHost = findConsoleProxyHost(startupCmd);
 
             assert (consoleProxyHost != null);
-
-            Answer answer = _agentMgr.send(consoleProxyHost.getId(), cmd);
-            if (answer == null || !answer.getResult()) {
-                s_logger.error("Console proxy agent reported that it failed to execute http handling startup command");
-            } else {
-                s_logger.info("Successfully sent out command to start HTTP handling in console proxy agent");
+            if (consoleProxyHost != null) {
+                Answer answer = _agentMgr.send(consoleProxyHost.getId(), cmd);
+                if (answer == null || !answer.getResult()) {
+                    s_logger.error("Console proxy agent reported that it failed to execute http handling startup command");
+                } else {
+                    s_logger.info("Successfully sent out command to start HTTP handling in console proxy agent");
+                }
             }
         }catch (NoSuchAlgorithmException e) {
             s_logger.error("Unexpected exception in SecureRandom Algorithm selection ", e);