You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by an...@apache.org on 2013/10/03 08:05:59 UTC

[01/50] git commit: updated refs/heads/4.2 to 86c9363

Updated Branches:
  refs/heads/4.2 78517ee5c -> 86c93637f


CLOUDSTACK-4637: Add 30sec sleep before router is ssh'd

Egress rules testcases access vm via router. Sleep before
accessing router else the expect fails since router is not
accessible. Also use router.hostid instead of vm.hostid
to identify the host.

Signed-off-by: venkataswamybabu budumuru <ve...@citrix.com>


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

Branch: refs/heads/4.2
Commit: 7d06e77ed9bfacf6d3b74f396c705567d4bf8ba2
Parents: a9218f3
Author: Girish Shilamkar <gi...@clogeny.com>
Authored: Fri Sep 13 20:43:45 2013 -0400
Committer: venkataswamybabu budumuru <ve...@citrix.com>
Committed: Wed Sep 18 21:40:39 2013 +0530

----------------------------------------------------------------------
 .../component/test_egress_fw_rules.py           | 38 +++++++++++---------
 1 file changed, 21 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7d06e77e/test/integration/component/test_egress_fw_rules.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_egress_fw_rules.py b/test/integration/component/test_egress_fw_rules.py
index ef0fc5a..5c18f9c 100644
--- a/test/integration/component/test_egress_fw_rules.py
+++ b/test/integration/component/test_egress_fw_rules.py
@@ -18,7 +18,7 @@
 """
 """
 #Import Local Modules
-#import unittest
+import unittest
 from nose.plugins.attrib           import attr
 from marvin.cloudstackTestCase     import cloudstackTestCase
 from marvin.integration.lib.base   import (Account,
@@ -198,7 +198,6 @@ class TestEgressFWRules(cloudstackTestCase):
         # Enable Network offering
         self.network_offering.update(self.apiclient, state='Enabled')
 
-
     def create_vm(self, pfrule=False, egress_policy=True, RR=False):
         self.create_network_offering(egress_policy, RR)
          # Creating network using the network offering created
@@ -229,30 +228,37 @@ class TestEgressFWRules(cloudstackTestCase):
 
     def exec_script_on_user_vm(self, script, exec_cmd_params, expected_result, negative_test=False):
         try:
+
+            vm_network_id = self.virtual_machine.nic[0].networkid
+            vm_ipaddress  = self.virtual_machine.nic[0].ipaddress
+            list_routers_response = list_routers(self.apiclient,
+                                                 account=self.account.name,
+                                                 domainid=self.account.domainid,
+                                                 networkid=vm_network_id)
+            self.assertEqual(isinstance(list_routers_response, list),
+                             True,
+                             "Check for list routers response return valid data")
+            router = list_routers_response[0]
+
+            #Once host or mgt server is reached, SSH to the router connected to VM
+            # look for Router for Cloudstack VM network.
             if self.apiclient.hypervisor.lower() == 'vmware':
                 #SSH is done via management server for Vmware
                 sourceip = self.apiclient.connection.mgtSvr
             else:
                 #For others, we will have to get the ipaddress of host connected to vm
                 hosts = list_hosts(self.apiclient,
-                                   id=self.virtual_machine.hostid)
+                                   id=router.hostid)
                 self.assertEqual(isinstance(hosts, list),
                                  True,
                                  "Check list response returns a valid list")
                 host = hosts[0]
                 sourceip = host.ipaddress
-            #Once host or mgt server is reached, SSH to the router connected to VM
-            # look for Router for Cloudstack VM network.
-            vm_network_id = self.virtual_machine.nic[0].networkid
-            vm_ipaddress  = self.virtual_machine.nic[0].ipaddress
-            list_routers_response = list_routers(self.apiclient,
-                                                 account=self.account.name,
-                                                 domainid=self.account.domainid,
-                                                 networkid=vm_network_id)
-            self.assertEqual(isinstance(list_routers_response, list),
-                             True,
-                             "Check for list routers response return valid data")
-            router = list_routers_response[0]
+
+            self.debug("Sleep %s seconds for network on router to be up"
+                        % self.services['sleep'])
+            time.sleep(self.services['sleep'])
+
             if self.apiclient.hypervisor.lower() == 'vmware':
                 key_file = " -i /var/cloudstack/management/.ssh/id_rsa "
             else:
@@ -266,7 +272,6 @@ class TestEgressFWRules(cloudstackTestCase):
                           "expect \"root@%s's password: \"\n"  % (vm_ipaddress) + \
                           "send \"password\r\"\n" + \
                           "interact\n"
-
             self.debug("expect_script>>\n%s<<expect_script" % expect_script)
 
             script_file = '/tmp/expect_script.exp'
@@ -392,7 +397,6 @@ class TestEgressFWRules(cloudstackTestCase):
                                     "['0']",
                                     negative_test=False)
 
-
     @attr(tags = ["advanced"])
     @log_test_exceptions
     def test_01_1_egress_fr1(self):


[31/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-4732: search network name for virtual router when listRouters by keyword
(cherry picked from commit 98c79cc3138a1c2e3d85ce1f04c4431ba99272bd)


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

Branch: refs/heads/4.2
Commit: 5225bd434cfce108913e06f842630e346496fcb2
Parents: a206f42
Author: Wei Zhou <w....@leaseweb.com>
Authored: Tue Sep 24 15:01:14 2013 +0200
Committer: Wei Zhou <w....@leaseweb.com>
Committed: Tue Sep 24 15:01:53 2013 +0200

----------------------------------------------------------------------
 server/src/com/cloud/api/query/QueryManagerImpl.java | 1 +
 ui/scripts/system.js                                 | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5225bd43/server/src/com/cloud/api/query/QueryManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/QueryManagerImpl.java b/server/src/com/cloud/api/query/QueryManagerImpl.java
index 86276b3..6104ec0 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -1144,6 +1144,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
             ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%");
             ssc.addOr("instanceName", SearchCriteria.Op.LIKE, "%" + keyword + "%");
             ssc.addOr("state", SearchCriteria.Op.LIKE, "%" + keyword + "%");
+            ssc.addOr("networkName", SearchCriteria.Op.LIKE, "%" + keyword + "%");
 
             sc.addAnd("instanceName", SearchCriteria.Op.SC, ssc);
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5225bd43/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index 1ddbc21..77c387c 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -7049,7 +7049,7 @@
                             var listView = $.extend(true, {}, cloudStack.sections.system.subsections.virtualRouters.listView, {
                                 dataProvider: function(args) {
                                     var searchByArgs = args.filterBy.search.value.length ?
-                                        '&name=' + args.filterBy.search.value : '';
+                                        '&keyword=' + args.filterBy.search.value : '';
 
                                     var routers = [];
                                     $.ajax({


[20/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-4659: Vmware allows destroying VM that has pending tasks, worker VM GC actually relies on the assumption that Vmware is protected from that which is a false assumption. Recycle Worker VM only it is from previous session


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

Branch: refs/heads/4.2
Commit: 92db2d1a441572e820e7e881167303d5b1ae4027
Parents: df52280
Author: Kelven Yang <ke...@gmail.com>
Authored: Fri Sep 20 10:59:06 2013 -0700
Committer: Kelven Yang <ke...@gmail.com>
Committed: Fri Sep 20 10:59:30 2013 -0700

----------------------------------------------------------------------
 .../com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/92db2d1a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
index a04a6eb..02b4060 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
@@ -572,12 +572,16 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
         		s_logger.info("Worker VM's owner management server has changed runid, recycle it");
         	return true;
         }
-   	
+  
+        // disable time-out check until we have found out a VMware API that can check if
+        // there are pending tasks on the subject VM
+/*        
         if(System.currentTimeMillis() - startTick > _hungWorkerTimeout) {
         	if(s_logger.isInfoEnabled())
         		s_logger.info("Worker VM expired, seconds elapsed: " + (System.currentTimeMillis() - startTick) / 1000);
         	return true;
         }
+*/        
     	return false;
     }
 


[34/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
fix silly typo
(cherry picked from commit 522860c03de5d05126f92fc44b6e3f50ed8439f0)


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

Branch: refs/heads/4.2
Commit: 7f988d4e99bc6dc0e8d02b1eed9a501645ee14e1
Parents: 2be3678
Author: Wei Zhou <w....@leaseweb.com>
Authored: Thu Sep 26 22:47:23 2013 +0200
Committer: Wei Zhou <w....@leaseweb.com>
Committed: Thu Sep 26 22:47:58 2013 +0200

----------------------------------------------------------------------
 debian/rules | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7f988d4e/debian/rules
----------------------------------------------------------------------
diff --git a/debian/rules b/debian/rules
index 26a3495..7cbb9ed 100755
--- a/debian/rules
+++ b/debian/rules
@@ -71,7 +71,7 @@ install:
 	install -D packaging/debian/init/cloud-agent $(DESTDIR)/$(SYSCONFDIR)/init.d/$(PACKAGE)-agent
 	install -D agent/target/transformed/cloud-setup-agent $(DESTDIR)/usr/bin/cloudstack-setup-agent
 	install -D agent/target/transformed/cloud-ssh $(DESTDIR)/usr/bin/cloudstack-ssh
-	install -D agent/target/transformed/cloudstack-agent-upgrade $(DESTDIR)/usr/bin/cloudstack-setup-agent
+	install -D agent/target/transformed/cloudstack-agent-upgrade $(DESTDIR)/usr/bin/cloudstack-agent-upgrade
 	install -D agent/target/transformed/libvirtqemuhook $(DESTDIR)/usr/share/$(PACKAGE)-agent/lib/
 	install -D agent/target/transformed/* $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/agent
 


[47/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK: 4635 - Fixed test case issues due to wrong indentation


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

Branch: refs/heads/4.2
Commit: b35e76132d280496c1c32bdfb371cb993829b426
Parents: 7d15b50
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Tue Sep 10 01:42:50 2013 -0400
Committer: sailajam <sa...@citrix.com>
Committed: Tue Oct 1 11:23:01 2013 +0530

----------------------------------------------------------------------
 .../component/cpu_limits/test_domain_limits.py  | 68 ++++++++++----------
 1 file changed, 34 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b35e7613/test/integration/component/cpu_limits/test_domain_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/cpu_limits/test_domain_limits.py b/test/integration/component/cpu_limits/test_domain_limits.py
index 2668204..4e8fc6d 100644
--- a/test/integration/component/cpu_limits/test_domain_limits.py
+++ b/test/integration/component/cpu_limits/test_domain_limits.py
@@ -142,26 +142,26 @@ class TestDomainCPULimitsUpdateResources(cloudstackTestCase):
         if api_client is None:
             api_client = self.apiclient
 
-            self.debug("Deploying an instance in account: %s" %
+        self.debug("Deploying an instance in account: %s" %
                        self.account.name)
-            try:
-                vm = VirtualMachine.create(
-                    api_client,
-                    self.services["virtual_machine"],
-                    templateid=self.template.id,
-                    accountid=self.account.name,
-                    domainid=self.account.domainid,
-                    networkids=networks,
-                    serviceofferingid=service_off.id)
-                vms = VirtualMachine.list(api_client, id=vm.id, listall=True)
-                self.assertIsInstance(vms,
-                    list,
-                    "List VMs should return a valid response")
-                self.assertEqual(vms[0].state, "Running",
+        try:
+            vm = VirtualMachine.create(
+                 api_client,
+                 self.services["virtual_machine"],
+                 templateid=self.template.id,
+                 accountid=self.account.name,
+                 domainid=self.account.domainid,
+                 networkids=networks,
+                 serviceofferingid=service_off.id)
+            vms = VirtualMachine.list(api_client, id=vm.id, listall=True)
+            self.assertIsInstance(vms,
+                list,
+                "List VMs should return a valid response")
+            self.assertEqual(vms[0].state, "Running",
                     "Vm state should be running after deployment")
-                return vm
-            except Exception as e:
-                self.fail("Failed to deploy an instance: %s" % e)
+            return vm
+        except Exception as e:
+            self.fail("Failed to deploy an instance: %s" % e)
 
     def setupAccounts(self):
 
@@ -547,26 +547,26 @@ class TestMultipleChildDomains(cloudstackTestCase):
         if api_client is None:
             api_client = self.apiclient
 
-            self.debug("Deploying an instance in account: %s" %
+        self.debug("Deploying an instance in account: %s" %
                        account.name)
-            try:
-                vm = VirtualMachine.create(
-                    api_client,
-                    self.services["virtual_machine"],
-                    templateid=self.template.id,
-                    accountid=account.name,
-                    domainid=account.domainid,
-                    networkids=networks,
-                    serviceofferingid=service_off.id)
-                vms = VirtualMachine.list(api_client, id=vm.id, listall=True)
-                self.assertIsInstance(vms,
+        try:
+            vm = VirtualMachine.create(
+                 api_client,
+                 self.services["virtual_machine"],
+                 templateid=self.template.id,
+                 accountid=account.name,
+                 domainid=account.domainid,
+                 networkids=networks,
+                 serviceofferingid=service_off.id)
+            vms = VirtualMachine.list(api_client, id=vm.id, listall=True)
+            self.assertIsInstance(vms,
                     list,
                     "List VMs should return a valid response")
-                self.assertEqual(vms[0].state, "Running",
+            self.assertEqual(vms[0].state, "Running",
                     "Vm state should be running after deployment")
-                return vm
-            except Exception as e:
-                self.fail("Failed to deploy an instance: %s" % e)
+            return vm
+        except Exception as e:
+            self.fail("Failed to deploy an instance: %s" % e)
 
     def setupAccounts(self):
 


[25/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-2180: UI > Instances ? Reboot VM action > if the template from which vm is created is password-enabled, pop up "Password has been reset to xxxxxxx" dialog after action is complete.


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

Branch: refs/heads/4.2
Commit: 35e50761562fc558ec7e272cc7dbd1cff564d356
Parents: 38bbfdc
Author: Jessica Wang <je...@apache.org>
Authored: Mon Sep 23 11:57:10 2013 -0700
Committer: Jessica Wang <je...@apache.org>
Committed: Mon Sep 23 11:58:21 2013 -0700

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/35e50761/ui/scripts/instances.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js
index cf8aca5..a9f6d1c 100644
--- a/ui/scripts/instances.js
+++ b/ui/scripts/instances.js
@@ -458,6 +458,12 @@
                             },
                             notification: function(args) {
                                 return 'label.action.reboot.instance';
+                            },
+                            complete: function(args) {
+                            	if (args.password != null && args.password.length > 0)
+                                    return 'Password has been reset to ' + args.password;
+                            	else
+                            		return null;
                             }
                         },
                         notification: {


[33/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
Cloudstack-2997: the maxconn setting is masked by wrong conditions


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

Branch: refs/heads/4.2
Commit: 2be3678602e71b723a241afbe1e2365618ade4fe
Parents: 143fb72
Author: Abhinandan Prateek <ap...@apache.org>
Authored: Wed Sep 25 21:09:24 2013 +0530
Committer: Abhinandan Prateek <ap...@apache.org>
Committed: Wed Sep 25 21:14:45 2013 +0530

----------------------------------------------------------------------
 server/src/com/cloud/configuration/ConfigurationManagerImpl.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2be36786/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index d32c693..b09b8ca 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -4001,7 +4001,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
         }
         validateLoadBalancerServiceCapabilities(lbServiceCapabilityMap);
         
-        if (!serviceProviderMap.containsKey(Service.Lb) && lbServiceCapabilityMap != null && !lbServiceCapabilityMap.isEmpty()) {
+        if (lbServiceCapabilityMap != null && !lbServiceCapabilityMap.isEmpty()) {
             maxconn = cmd.getMaxconnections();
             if (maxconn == null) {
                 maxconn=Integer.parseInt(_configDao.getValue(Config.NetworkLBHaproxyMaxConn.key()));


[09/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-4573: fixed resource limit check when acquire public IP in VPC - update resource count for VPC public ip even when network_id is not set yet.


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

Branch: refs/heads/4.2
Commit: cea14ce8802f1f61522491f2581abbd776436ccf
Parents: a14145b
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Thu Sep 19 10:57:34 2013 -0700
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Thu Sep 19 10:57:34 2013 -0700

----------------------------------------------------------------------
 server/src/com/cloud/network/NetworkManagerImpl.java | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cea14ce8/server/src/com/cloud/network/NetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java
index 2c00c5b..7042e18 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -551,7 +551,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
                         addr.getSystem(), addr.getClass().getName(), addr.getUuid());
             }
             // don't increment resource count for direct and dedicated ip addresses
-            if (addr.getAssociatedWithNetworkId() != null && !isIpDedicated(addr)) {
+            if (updateIpResourceCount(addr)) {
                 _resourceLimitMgr.incrementResourceCount(owner.getId(), ResourceType.public_ip);
             }
         }
@@ -3783,7 +3783,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
             txn.start();
 
             // don't decrement resource count for direct and dedicated ips
-            if (ip.getAssociatedWithNetworkId() != null && !isIpDedicated(ip)) {
+            if (updateIpResourceCount(ip)) {
                 _resourceLimitMgr.decrementResourceCount(_ipAddressDao.findById(addrId).getAllocatedToAccountId(), ResourceType.public_ip);
             }
 
@@ -3807,7 +3807,10 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
 
         return ip;
     }
-
+    
+    protected boolean updateIpResourceCount(IPAddressVO ip) {
+        return (ip.getAssociatedWithNetworkId() != null || ip.getVpcId() != null) && !isIpDedicated(ip);
+    }
     
 
     Random _rand = new Random(System.currentTimeMillis());


[28/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-4405: additional patch for bridge name and firewall rules issues after KVM upgrade to 4.2

There still exist two issues after Edison's commits.
(1) Migration from new hosts to old hosts failed.
The bridge name on old host is set to cloudVirBr* if network.bridge.name.schema is set to 3.0 in /etc/cloudstack/agent/agent.properties, but the actual bridge name is breth*-* after running cloudstack-agent-upgrade.
(2) all ports of vms (Basic zone, or Advanced zone with security groups) on old hosts are open, because the iptables rules are binding to device (bridge) name which is changed by cloudstack-agent-upgrade.

After this, the KVM upgrade steps :
a. Install 4.2 cloudstack agent on each kvm host
b. Run "cloudstack-agent-upgrade". This script will upgrade all the existing bridge name to new bridge name, and update related firewall rules.
c. install a libvirt hook:
    c1. mkdir /etc/libvirt/hooks
    c2. cp /usr/share/cloudstack-agent/lib/libvirtqemuhook /etc/libvirt/hooks/qemu
    c3. chmod +x /etc/libvirt/hooks/qemu
    c4. service libvirtd restart
    c5. service cloudstack-agent restart


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

Branch: refs/heads/4.2
Commit: 175549f3ab952bbd39318c16c269c16526255475
Parents: 4280f6e
Author: Wei Zhou <w....@leaseweb.com>
Authored: Tue Sep 24 08:51:58 2013 +0200
Committer: Wei Zhou <w....@leaseweb.com>
Committed: Tue Sep 24 08:51:58 2013 +0200

----------------------------------------------------------------------
 agent/bindir/cloudstack-agent-upgrade.in         | 13 +++++++++++++
 .../hypervisor/kvm/resource/BridgeVifDriver.java | 16 +---------------
 scripts/vm/network/security_group.py             | 19 +++++++++++++------
 3 files changed, 27 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/175549f3/agent/bindir/cloudstack-agent-upgrade.in
----------------------------------------------------------------------
diff --git a/agent/bindir/cloudstack-agent-upgrade.in b/agent/bindir/cloudstack-agent-upgrade.in
index 4972d39..72b0fae 100644
--- a/agent/bindir/cloudstack-agent-upgrade.in
+++ b/agent/bindir/cloudstack-agent-upgrade.in
@@ -17,6 +17,8 @@
 # under the License.
 from cloudutils.networkConfig import networkConfig
 from cloudutils.utilities import bash
+import logging
+import re
 def isOldStyleBridge(brName):
     if brName.find("cloudVirBr") == 0:
        return True
@@ -33,6 +35,17 @@ def upgradeBridgeName(brName, enslavedDev):
     bash("ip link set %s down"%brName) 
     bash("ip link set %s name %s"%(brName, newBrName))
     bash("ip link set %s up" %newBrName)
+    cmd = "iptables-save | grep FORWARD | grep -w " +  brName
+    rules = bash(cmd).stdout.split('\n')
+    rules.pop()
+    for rule in rules:
+        try:
+            delrule = re.sub("-A", "-D", rule)
+            newrule = re.sub(" " + brName + " ", " " + newBrName + " ", rule)
+            bash("iptables " + delrule)
+            bash("iptables " + newrule)
+        except:
+            logging.exception("Ignoring failure to update rules for rule " + rule + " on bridge " + brName)
 if __name__ == '__main__':
    netlib = networkConfig() 
    bridges = netlib.listNetworks()

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/175549f3/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java
index e3779a7..42b2df2 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java
@@ -45,7 +45,6 @@ public class BridgeVifDriver extends VifDriverBase {
     
     private static final Object _vnetBridgeMonitor = new Object();
     private String _modifyVlanPath;
-    private String bridgeNameSchema;
 
     @Override
     public void configure(Map<String, Object> params) throws ConfigurationException {
@@ -61,8 +60,6 @@ public class BridgeVifDriver extends VifDriverBase {
             networkScriptsDir = "scripts/vm/network/vnet";
         }
 
-        bridgeNameSchema = (String) params.get("network.bridge.name.schema");
-
         String value = (String) params.get("scripts.timeout");
         _timeout = NumbersUtil.parseInt(value, 30 * 60) * 1000;
 
@@ -147,18 +144,7 @@ public class BridgeVifDriver extends VifDriverBase {
     }
 
     private String setVnetBrName(String pifName, String vnetId) {
-        String brName = null;
-        if (bridgeNameSchema != null) {
-            if (bridgeNameSchema.equalsIgnoreCase("3.0")) {
-                brName = "cloudVirBr" + vnetId;
-            } else if (bridgeNameSchema.equalsIgnoreCase("4.0")) {
-                brName = "br" + pifName + "-"+ vnetId;
-            }
-        } else {
-            brName = "br" + pifName + "-"+ vnetId;
-        }
-
-        return brName;
+        return "br" + pifName + "-"+ vnetId;
     }
 
     private String createVlanBr(String vlanId, String nic)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/175549f3/scripts/vm/network/security_group.py
----------------------------------------------------------------------
diff --git a/scripts/vm/network/security_group.py b/scripts/vm/network/security_group.py
index 0ac8b74..674cceb 100755
--- a/scripts/vm/network/security_group.py
+++ b/scripts/vm/network/security_group.py
@@ -250,7 +250,7 @@ def default_network_rules_systemvm(vm_name, localbrname):
         if bridge != localbrname:
             if not addFWFramework(bridge):
                 return False 
-            brfw = "BF-" + bridge
+            brfw = getBrfw(bridge)
             vifs = getVifsForBridge(vm_name, bridge)
             for vif in vifs:
                 try:
@@ -356,7 +356,7 @@ def default_network_rules(vm_name, vm_id, vm_ip, vm_mac, vif, brname, sec_ips):
         return False 
 
     vmName = vm_name
-    brfw = "BF-" + brname
+    brfw = getBrfw(brname)
     domID = getvmId(vm_name)
     delete_rules_for_vm_in_bridge_firewall_chain(vmName)
     vmchain = vm_name
@@ -549,7 +549,7 @@ def network_rules_for_rebooted_vm(vmName):
     if brName is None or brName is "":
         brName = "cloudbr0"
     else:
-        brName = re.sub("^BF-", "", brName)
+        brName = execute("iptables-save |grep physdev-is-bridged |grep FORWARD |grep BF |grep '\-o' |awk '{print $4}' | head -1").strip()
 
     if 1 in [ vm_name.startswith(c) for c in ['r-', 's-', 'v-'] ]:
         
@@ -562,8 +562,8 @@ def network_rules_for_rebooted_vm(vmName):
     vifs = getVifs(vmName)
     logging.debug(vifs, brName)
     for v in vifs:
-        execute("iptables -A " + "BF-" + brName + "-IN " + " -m physdev --physdev-is-bridged --physdev-in " + v + " -j "+ vmchain_default)
-        execute("iptables -A " + "BF-" + brName + "-OUT " + " -m physdev --physdev-is-bridged --physdev-out " + v + " -j "+ vmchain_default)
+        execute("iptables -A " + getBrfw(brName) + "-IN " + " -m physdev --physdev-is-bridged --physdev-in " + v + " -j "+ vmchain_default)
+        execute("iptables -A " + getBrfw(brName) + "-OUT " + " -m physdev --physdev-is-bridged --physdev-out " + v + " -j "+ vmchain_default)
 
     #change antispoof rule in vmchain
     try:
@@ -871,6 +871,13 @@ def getBridges(vmName):
 def getvmId(vmName):
     cmd = "virsh list |grep " + vmName + " | awk '{print $1}'"
     return bash("-c", cmd).stdout.strip()
+
+def getBrfw(brname):
+    cmd = "iptables-save |grep physdev-is-bridged |grep FORWARD |grep BF |grep '\-o' | grep -w " + brname  + "|awk '{print $9}' | head -1"
+    brfwname = bash("-c", cmd).stdout.strip()
+    if brfwname == "":
+        brfwname = "BF-" + brname
+    return brfwname
     
 def addFWFramework(brname):
     try:
@@ -885,7 +892,7 @@ def addFWFramework(brname):
         logging.debug("failed to turn on bridge netfilter")
         return False
 
-    brfw = "BF-" + brname
+    brfw = getBrfw(brname)
     try:
         execute("iptables -L " + brfw)
     except:


[15/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
Disable VMwareTools detection to avoid unreliable result caused by race-condition when VMwareTools is not ready in guest OS yet and the API is called


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

Branch: refs/heads/4.2
Commit: 8e0faaa406651dcd0025b563ed36acbdb733a0d0
Parents: 0bdbb9e
Author: Kelven Yang <ke...@gmail.com>
Authored: Thu Sep 19 22:19:22 2013 -0700
Committer: Kelven Yang <ke...@gmail.com>
Committed: Thu Sep 19 22:19:22 2013 -0700

----------------------------------------------------------------------
 client/pom.xml                                  | 23 +++++---------------
 .../vmware/resource/VmwareResource.java         | 17 +++++++++++++--
 2 files changed, 20 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8e0faaa4/client/pom.xml
----------------------------------------------------------------------
diff --git a/client/pom.xml b/client/pom.xml
index d25576a..119c96e 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -16,8 +16,8 @@
   <parent>
     <groupId>org.apache.cloudstack</groupId>
     <artifactId>cloudstack</artifactId>
-    <version>4.2.0-SNAPSHOT</version>
-  </parent>
+    <version>4.3.0-SNAPSHOT</version>
+  </parent> 
   <dependencies>
     <dependency>
       <groupId>org.apache.cloudstack</groupId>
@@ -173,7 +173,6 @@
     <dependency>
       <groupId>mysql</groupId>
       <artifactId>mysql-connector-java</artifactId>
-      <version>${cs.mysql.version}</version>
       <scope>runtime</scope>
     </dependency>
     <dependency>
@@ -196,13 +195,6 @@
       <artifactId>cloud-engine-components-api</artifactId>
       <version>${project.version}</version>
     </dependency>
-
-    <dependency>
-      <groupId>org.apache.cloudstack</groupId>
-      <artifactId>cloud-engine-compute</artifactId>
-      <version>${project.version}</version>
-    </dependency>
-
     <dependency>
       <groupId>org.apache.cloudstack</groupId>
       <artifactId>cloud-engine-network</artifactId>
@@ -290,7 +282,6 @@
     </dependency>
   </dependencies>
   <build>
-    <defaultGoal>install</defaultGoal>
     <plugins>
       <plugin>
         <groupId>ru.concerteza.buildnumber</groupId>
@@ -338,8 +329,8 @@
               <maxIdleTime>60000</maxIdleTime>
             </connector>
           </connectors>
-          <webXml>${project.build.directory}/${project.build.finalName}/WEB-INF/web.xml</webXml>
-          <webAppSourceDirectory>${project.build.directory}/${project.build.finalName}</webAppSourceDirectory>
+          <webXml>${project.build.directory}/generated-webapp/WEB-INF/web.xml</webXml>
+          <webAppSourceDirectory>${project.build.directory}/generated-webapp</webAppSourceDirectory>
           <webAppConfig>
             <contextPath>/client</contextPath>
             <extraClasspath>${project.build.directory}/utilities/scripts/db/;${project.build.directory}/utilities/scripts/db/db/</extraClasspath>
@@ -391,10 +382,7 @@
                   <fileset dir="${basedir}/../scripts" />
                 </copy>
                 <!-- CLOUDSTACK-1304 -->
-                <chmod perm="755">
-                  <fileset
-                    dir="${basedir}/target/generated-webapp/WEB-INF/classes/scripts" />
-                </chmod>
+                <chmod perm="755" file="${basedir}/target/generated-webapp/WEB-INF/classes/scripts/**" type="both" />
                 <copy todir="${basedir}/target/generated-webapp/WEB-INF/">
                   <fileset dir="${basedir}/WEB-INF/">
                     <include name="web.xml" />
@@ -561,7 +549,6 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-dependency-plugin</artifactId>
-        <version>2.5.1</version>
         <executions>
           <execution>
             <id>copy</id>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8e0faaa4/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index 0e9ce93..b80fd40 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -1659,12 +1659,13 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
                 throw new Exception(msg);
             }
 
+/*
             if(!isVMWareToolsInstalled(vmMo)){
                 String errMsg = "vmware tools is not installed or not running, cannot add nic to vm " + vmName;
                 s_logger.debug(errMsg);
                 return new PlugNicAnswer(cmd, false, "Unable to execute PlugNicCommand due to " + errMsg);
             }
-
+*/
             // TODO need a way to specify the control of NIC device type
             VirtualEthernetCardType nicDeviceType = VirtualEthernetCardType.E1000;
 
@@ -1739,12 +1740,13 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
                 throw new Exception(msg);
             }
 
+/*
             if(!isVMWareToolsInstalled(vmMo)){
                 String errMsg = "vmware tools not installed or not running, cannot remove nic from vm " + vmName;
                 s_logger.debug(errMsg);
                 return new UnPlugNicAnswer(cmd, false, "Unable to execute unPlugNicCommand due to " + errMsg);
             }
-
+*/
             VirtualDevice nic = findVirtualNicDevice(vmMo, cmd.getNic().getMac());
             if ( nic == null ) {
                 return new UnPlugNicAnswer(cmd, true, "success");
@@ -6869,6 +6871,17 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
     
     private boolean isVMWareToolsInstalled(VirtualMachineMO vmMo) throws Exception{
         GuestInfo guestInfo = vmMo.getVmGuestInfo();
+        if(guestInfo == null) {
+            s_logger.error("null GuestInfo is returned");
+            return false;
+        }
+
+        if(guestInfo.getGuestState() == null) {
+            s_logger.error("null GuestState is returned");
+            return false;
+        }
+        
+        s_logger.info("VMwareTools guest state: " + guestInfo.getGuestState());
         return (guestInfo != null && guestInfo.getGuestState() != null && guestInfo.getGuestState().equalsIgnoreCase("running"));
     }
 }


[35/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-4745: Add StaticNatRule through firewall manager

This would fix CreateIpForwardingCmd API on 4.2+.


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

Branch: refs/heads/4.2
Commit: 92e9f6daf8e7bcbe646a41132c69d615b0f9af60
Parents: 7f988d4
Author: Sheng Yang <sh...@citrix.com>
Authored: Thu Sep 26 13:59:35 2013 -0700
Committer: Sheng Yang <sh...@citrix.com>
Committed: Thu Sep 26 14:05:13 2013 -0700

----------------------------------------------------------------------
 .../cloud/network/firewall/FirewallManagerImpl.java   | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/92e9f6da/server/src/com/cloud/network/firewall/FirewallManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/firewall/FirewallManagerImpl.java b/server/src/com/cloud/network/firewall/FirewallManagerImpl.java
index d250a08..8c4583e 100644
--- a/server/src/com/cloud/network/firewall/FirewallManagerImpl.java
+++ b/server/src/com/cloud/network/firewall/FirewallManagerImpl.java
@@ -544,6 +544,8 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService,
             throws ResourceUnavailableException {
         boolean handled = false;
         switch (purpose){
+        /* StaticNatRule would be applied by Firewall provider, since the incompatible of two object */
+        case StaticNat:
         case Firewall:
             for (FirewallServiceProvider fwElement: _firewallElements) {
                 Network.Provider provider = fwElement.getProvider();
@@ -568,18 +570,6 @@ public class FirewallManagerImpl extends ManagerBase implements FirewallService,
                     break;
             }
             break;
-        case StaticNat:
-            for (StaticNatServiceProvider element: _staticNatElements) {
-                Network.Provider provider = element.getProvider();
-                boolean  isSnatProvider = _networkModel.isProviderSupportServiceInNetwork(network.getId(), Service.StaticNat, provider);
-                if (!isSnatProvider) {
-                    continue;
-                }
-                handled = element.applyStaticNats(network, (List<? extends StaticNat>) rules);
-                if (handled)
-                    break;
-            }
-            break;
 /*        case NetworkACL:
             for (NetworkACLServiceProvider element: _networkAclElements) {
                 Network.Provider provider = element.getProvider();


[38/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-4754: it's a race condition: delete template, and deploy vm from the template happened at the same time,


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

Branch: refs/heads/4.2
Commit: 583279f3373d3e9893c03468753b5ec4cb68a2ad
Parents: 94c8e28
Author: Edison Su <su...@gmail.com>
Authored: Fri Sep 27 16:09:22 2013 -0700
Committer: Edison Su <su...@gmail.com>
Committed: Fri Sep 27 16:09:46 2013 -0700

----------------------------------------------------------------------
 .../apache/cloudstack/storage/motion/DataMotionServiceImpl.java   | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/583279f3/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/DataMotionServiceImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/DataMotionServiceImpl.java b/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/DataMotionServiceImpl.java
index c1cbdc7..9f0f531 100644
--- a/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/DataMotionServiceImpl.java
+++ b/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/DataMotionServiceImpl.java
@@ -41,6 +41,9 @@ public class DataMotionServiceImpl implements DataMotionService {
 
     @Override
     public void copyAsync(DataObject srcData, DataObject destData, AsyncCompletionCallback<CopyCommandResult> callback) {
+        if (srcData.getDataStore() == null || destData.getDataStore() == null) {
+            throw new CloudRuntimeException("can't find data store");
+        }
 
         if (srcData.getDataStore().getDriver().canCopy(srcData, destData)) {
             srcData.getDataStore().getDriver().copyAsync(srcData, destData, callback);


[02/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
Added missing test for VPC load balancing rule from old QA repo to cloudstack repo

def test_04_VPC_CreateLBRuleInMultipleNetworksVRStoppedState

Since VPC now only allows load balancing on a single tier the test case
has been updated to check that condition

Ref : http://cloudstack.apache.org/docs/en-US/Apache_CloudStack/4.0.2/html/Installation_Guide/configure-vpc.html

Signed-off-by: venkataswamybabu budumuru <ve...@citrix.com>
(cherry picked from commit 5b5a617544fb8160b9429a24f1aa943e04d4f98a)


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

Branch: refs/heads/4.2
Commit: e49f14b7e3d6992ee77d40d3b6629f975ee6b9fb
Parents: 7d06e77
Author: Ashutosh K <as...@clogeny.com>
Authored: Tue Sep 10 09:53:19 2013 +0530
Committer: venkataswamybabu budumuru <ve...@citrix.com>
Committed: Wed Sep 18 21:49:12 2013 +0530

----------------------------------------------------------------------
 .../component/test_vpc_network_lbrules.py       | 30 ++++++++++++++++++++
 1 file changed, 30 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e49f14b7/test/integration/component/test_vpc_network_lbrules.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_network_lbrules.py b/test/integration/component/test_vpc_network_lbrules.py
index de29ce1..e7cb823 100644
--- a/test/integration/component/test_vpc_network_lbrules.py
+++ b/test/integration/component/test_vpc_network_lbrules.py
@@ -619,6 +619,36 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
         self.check_wget_from_vm(vm_1, public_ip_1, testnegative=False)
         return    
 
+    @attr(tags=["advanced","advancedns", "intervlan"])
+    def test_04_VPC_CreateLBRuleInMultipleNetworksVRStoppedState(self):
+        """ Test case no 222 : Create LB rules for a two/multiple virtual networks of a
+            VPC using a new Public IP Address available with the VPC when the Virtual Router is in Stopped State
+        """
+
+        # Validate the following
+        # 1. Create a VPC with cidr - 10.1.1.1/16
+        # 2. Create a Network offering - NO1 with all supported services
+        # 3. Add network1(10.1.1.1/24) using N01 to this VPC.
+        # 4. Add network2(10.1.2.1/24) using N01 to this VPC.
+        # 5. Deploy vm1, vm2 and vm3 in network1 on primary host.
+        # 7. Use the Create LB rule for vm1 and vm2 in network1.
+        # 8. Add vm3 to LB rule.
+        # 9. wget a file and check for LB rule.
+
+        network_1 = self.create_Network(self.services["network_offering"])
+        network_2 = self.create_Network(self.services["network_offering_no_lb"], '10.1.2.1')
+        vm_1 = self.create_VM_in_Network(network_1)
+        vm_2 = self.create_VM_in_Network(network_1)
+        vm_3 = self.create_VM_in_Network(network_2)
+        public_ip_1 = self.acquire_Public_IP(network_1)
+        lb_rule = self.create_LB_Rule(public_ip_1, network_1, [vm_1, vm_2], self.services["lbrule_http"])
+        # In a VPC, the load balancing service is supported only on a single tier.
+        # http://cloudstack.apache.org/docs/en-US/Apache_CloudStack/4.0.2/html/Installation_Guide/configure-vpc.html
+        with self.assertRaises(Exception):
+            lb_rule.assign(self.apiclient, [vm_3])
+        self.check_wget_from_vm(vm_1, public_ip_1, testnegative=False)
+        return
+
     @attr(tags=["advanced", "intervlan"])
     def test_05_VPC_CreateAndDeleteLBRule(self):
         """ Test case no 214 : Delete few(not all) LB rules for a single virtual network of a


[45/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-4696 Handle Netscaler Provider enable for both zones

Signed-off-by: venkataswamybabu budumuru <ve...@citrix.com>
(cherry picked from commit a5ede3af7f5837f9e8a1fb80e2a1f20f24ecb870)


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

Branch: refs/heads/4.2
Commit: f0b4f894695939270a4415352070e33aff02763b
Parents: dfc0180
Author: Sowmya Krishnan <so...@citrix.com>
Authored: Wed Sep 18 11:43:11 2013 +0530
Committer: venkataswamybabu budumuru <ve...@citrix.com>
Committed: Tue Oct 1 11:19:36 2013 +0530

----------------------------------------------------------------------
 .../component/test_netscaler_nw_off.py          | 45 +++-----------------
 1 file changed, 5 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f0b4f894/test/integration/component/test_netscaler_nw_off.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_netscaler_nw_off.py b/test/integration/component/test_netscaler_nw_off.py
index cb49dbe..3139257 100644
--- a/test/integration/component/test_netscaler_nw_off.py
+++ b/test/integration/component/test_netscaler_nw_off.py
@@ -408,13 +408,12 @@ class TestAddMultipleNSDiffZone(cloudstackTestCase):
         for zone in zones:
             if zone.networktype == 'Advanced':
                 zone_list.append(zone)
-
         self.assertGreater(
                            len(zone_list),
                            1,
                            "Atleast 2 advanced mode zones should be present for this test"
                            )
-
+        zoneid=zone_list[0].id
         physical_networks = PhysicalNetwork.list(
                                                  self.apiclient,
                                                  zoneid=zone_list[0].id
@@ -424,43 +423,12 @@ class TestAddMultipleNSDiffZone(cloudstackTestCase):
                 True,
                 "There should be atleast one physical network for advanced zone"
                 )
-        physical_network = physical_networks[0]
         self.debug("Adding netscaler device: %s" %
                                     self.services["netscaler_1"]["ipaddress"])
-        netscaler_1 = NetScaler.add(
-                                  self.apiclient,
-                                  self.services["netscaler_1"],
-                                  physicalnetworkid=physical_network.id
-                                  )
+        netscaler_1 = add_netscaler(self.apiclient, zoneid, self.services["netscaler_1"])
         self.cleanup.append(netscaler_1)
-        self.debug("Checking if Netscaler network service provider is enabled?")
-
-        nw_service_providers = NetworkServiceProvider.list(
-                                        self.apiclient,
-                                        name='Netscaler',
-                                        physicalnetworkid=physical_network.id
-                                        )
-        self.assertEqual(
-                         isinstance(nw_service_providers, list),
-                         True,
-                         "Network service providers list should not be empty"
-                         )
-        netscaler_provider = nw_service_providers[0]
-        if netscaler_provider.state != 'Enabled':
-            self.debug("Netscaler provider is not enabled. Enabling it..")
-            response = NetworkServiceProvider.update(
-                                          self.apiclient,
-                                          id=netscaler_provider.id,
-                                          state='Enabled'
-                                          )
-            self.assertEqual(
-                        response.state,
-                        "Enabled",
-                        "Network service provider should be in enabled state"
-                         )
-        else:
-            self.debug("Netscaler service provider is already enabled.")
 
+        physical_network = physical_networks[0]
         ns_list = NetScaler.list(
                                  self.apiclient,
                                  lbdeviceid=netscaler_1.lbdeviceid
@@ -492,6 +460,7 @@ class TestAddMultipleNSDiffZone(cloudstackTestCase):
                                                  self.apiclient,
                                                  zoneid=zone_list[1].id
                                                  )
+        zoneid=zone_list[1].id
         self.assertEqual(
                 isinstance(physical_networks, list),
                 True,
@@ -501,11 +470,7 @@ class TestAddMultipleNSDiffZone(cloudstackTestCase):
 
         self.debug("Adding netscaler device: %s" %
                                     self.services["netscaler_2"]["ipaddress"])
-        netscaler_2 = NetScaler.add(
-                                  self.apiclient,
-                                  self.services["netscaler_2"],
-                                  physicalnetworkid=physical_network.id
-                                  )
+        netscaler_2 = add_netscaler(self.apiclient, zoneid, self.services["netscaler_2"])
         self.cleanup.append(netscaler_2)
         ns_list = NetScaler.list(
                                  self.apiclient,


[07/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-4709: UI > template > register template > when zone dropdown is selected as All Zones, show all hypervisors supported in cloudstack instead of only hypervisors available in all zones.


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

Branch: refs/heads/4.2
Commit: e81e6ef5eb7477c3dae44f16fa9da1cf571d4c99
Parents: 25cf6c9
Author: Jessica Wang <je...@apache.org>
Authored: Thu Sep 19 10:19:19 2013 -0700
Committer: Jessica Wang <je...@apache.org>
Committed: Thu Sep 19 10:20:11 2013 -0700

----------------------------------------------------------------------
 ui/scripts/templates.js | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e81e6ef5/ui/scripts/templates.js
----------------------------------------------------------------------
diff --git a/ui/scripts/templates.js b/ui/scripts/templates.js
index 3f79b09..dc1a39b 100644
--- a/ui/scripts/templates.js
+++ b/ui/scripts/templates.js
@@ -181,10 +181,13 @@
                                                 return;
 
                                             var apiCmd;
-                                            if (args.zone == -1)
-                                                apiCmd = "listHypervisors&zoneid=-1";
-                                            else
+                                            if (args.zone == -1) { //All Zones
+                                                //apiCmd = "listHypervisors&zoneid=-1"; //"listHypervisors&zoneid=-1" has been changed to return only hypervisors available in all zones (bug 8809)
+                                            	apiCmd = "listHypervisors"; 
+                                            }
+                                            else {
                                                 apiCmd = "listHypervisors&zoneid=" + args.zone;
+                                            }
 
                                             $.ajax({
                                                 url: createURL(apiCmd),


[19/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CS-18283: 2.2.x to 4.2 upgrade - corrected the Service Provider name for the Network offeirng that can be used in VPC (from VirtualRouter to VpcVirtualRouter)


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

Branch: refs/heads/4.2
Commit: df52280409af9ae05eb007442277c40cc1109aca
Parents: fd49d25
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Fri Sep 20 10:21:48 2013 -0700
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Fri Sep 20 10:21:48 2013 -0700

----------------------------------------------------------------------
 server/src/com/cloud/network/NetworkManagerImpl.java | 2 +-
 setup/db/db/schema-410to420.sql                      | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/df522804/server/src/com/cloud/network/NetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java
index 7042e18..df3dfea 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -1354,7 +1354,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
         Map<Network.Service, Set<Network.Provider>> defaultVPCOffProviders =
                 new HashMap<Network.Service, Set<Network.Provider>>();
         defaultProviders.clear();
-        defaultProviders.add(Network.Provider.VirtualRouter);
+        defaultProviders.add(Network.Provider.VPCVirtualRouter);
         defaultVPCOffProviders.put(Service.Dhcp, defaultProviders);
         defaultVPCOffProviders.put(Service.Dns, defaultProviders);
         defaultVPCOffProviders.put(Service.UserData, defaultProviders);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/df522804/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-410to420.sql b/setup/db/db/schema-410to420.sql
index 197f375..d9560fd 100644
--- a/setup/db/db/schema-410to420.sql
+++ b/setup/db/db/schema-410to420.sql
@@ -2178,3 +2178,7 @@ CREATE VIEW `cloud`.`data_center_view` AS
         `cloud`.`dedicated_resources` ON data_center.id = dedicated_resources.data_center_id
 			left join
         `cloud`.`affinity_group` ON dedicated_resources.affinity_group_id = affinity_group.id;
+
+
+
+UPDATE `cloud`.`ntwk_offering_service_map` SET Provider='VpcVirtualRouter' WHERE network_offering_id IN (SELECT id from `cloud`.`network_offerings` WHERE name IN ('DefaultIsolatedNetworkOfferingForVpcNetworks', 'DefaultIsolatedNetworkOfferingForVpcNetworksNoLB'));
\ No newline at end of file


[27/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-4693: UI > Network > Add Guest Network dialog > physical network dropdown - populate only physical networks that have Guest traffic type.


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

Branch: refs/heads/4.2
Commit: 4280f6e29d832c51a67f8f5427f92fcb6bd656c5
Parents: 3eb899a
Author: Jessica Wang <je...@apache.org>
Authored: Mon Sep 23 16:10:36 2013 -0700
Committer: Jessica Wang <je...@apache.org>
Committed: Mon Sep 23 16:10:36 2013 -0700

----------------------------------------------------------------------
 ui/scripts/sharedFunctions.js | 33 +++++++++++++++++++++++++++++----
 1 file changed, 29 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4280f6e2/ui/scripts/sharedFunctions.js
----------------------------------------------------------------------
diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js
index 5369cee..fe3f673 100644
--- a/ui/scripts/sharedFunctions.js
+++ b/ui/scripts/sharedFunctions.js
@@ -235,9 +235,9 @@ var addGuestNetworkDialog = {
                     label: 'label.physical.network',
                     dependsOn: 'zoneId',
                     select: function(args) {
-                        if ('physicalNetworks' in args.context) {
+                        if ('physicalNetworks' in args.context) { //Infrastructure menu > zone detail > guest traffic type > network tab (only shown in advanced zone) > add guest network dialog
                             addGuestNetworkDialog.physicalNetworkObjs = args.context.physicalNetworks;
-                        } else {
+                        } else { //Network menu > guest network section > add guest network dialog
                             var selectedZoneId = args.$form.find('.form-item[rel=zoneId]').find('select').val();
                             $.ajax({
                                 url: createURL('listPhysicalNetworks'),
@@ -245,8 +245,33 @@ var addGuestNetworkDialog = {
                                     zoneid: selectedZoneId
                                 },
                                 async: false,
-                                success: function(json) {
-                                    addGuestNetworkDialog.physicalNetworkObjs = json.listphysicalnetworksresponse.physicalnetwork;
+                                success: function(json) {                                    
+                                	var items = [];
+                                	var physicalnetworks = json.listphysicalnetworksresponse.physicalnetwork;
+                                	if (physicalnetworks != null) {
+                                	    for (var i = 0; i < physicalnetworks.length; i++) {
+                                	    	$.ajax({
+                                	    		url: createURL('listTrafficTypes'),
+                                	    		data: {
+                                	    			physicalnetworkid: physicalnetworks[i].id
+                                	    		},
+                                	    		async: false,
+                                	    		success: function(json) {                                	    			
+                                	    			var traffictypes = json.listtraffictypesresponse.traffictype;
+                                	    			if (traffictypes != null) {
+                                	    				for (var k = 0; k < traffictypes.length; k++) {
+                                	    					if (traffictypes[k].traffictype == 'Guest') {
+                                	    						items.push(physicalnetworks[i]);
+                                	    						break;
+                                	    					}
+                                	    				}
+                                	    			} 
+                                	    		}
+                                	    	});
+                                	    }	
+                                	}  
+                                	
+                                	addGuestNetworkDialog.physicalNetworkObjs = items;                                	
                                 }
                             });
                         }


[26/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-4128: UI > zone wizard > secondary storage step > provider "S3" > Create NFS staging is required for S3 at this moment. So, disallow user to uncheck "Create NFS Secondary Staging" checkbox when provider is "S3".


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

Branch: refs/heads/4.2
Commit: 3eb899a5ba0b4350e09d3c147762b83291d9f804
Parents: 35e5076
Author: Jessica Wang <je...@apache.org>
Authored: Mon Sep 23 13:54:20 2013 -0700
Committer: Jessica Wang <je...@apache.org>
Committed: Mon Sep 23 13:54:20 2013 -0700

----------------------------------------------------------------------
 ui/scripts/zoneWizard.js | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3eb899a5/ui/scripts/zoneWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/zoneWizard.js b/ui/scripts/zoneWizard.js
index 7b26790..960fcb7 100755
--- a/ui/scripts/zoneWizard.js
+++ b/ui/scripts/zoneWizard.js
@@ -1913,13 +1913,7 @@
                                                  $fields.filter('[rel=usehttps]').hide();
                                                  $fields.filter('[rel=connectiontimeout]').hide();
                                                  $fields.filter('[rel=maxerrorretry]').hide();
-                                                 $fields.filter('[rel=sockettimeout]').hide();
-
-                                                 $fields.filter('[rel=createNfsCache]').find('input').attr('checked', 'checked');
-                                                 $fields.filter('[rel=createNfsCache]').find('input').attr("disabled", "disabled");
-                                                 $fields.filter('[rel=createNfsCache]').css('display', 'inline-block');
-                                                 $fields.filter('[rel=nfsCacheNfsServer]').css('display', 'inline-block');
-                                                 $fields.filter('[rel=nfsCachePath]').css('display', 'inline-block');
+                                                 $fields.filter('[rel=sockettimeout]').hide();   
                                             } else {
                                             	 $fields.filter('[rel=accesskey]').css('display', 'inline-block');
                                                  $fields.filter('[rel=secretkey]').css('display', 'inline-block');
@@ -1929,13 +1923,13 @@
                                                  $fields.filter('[rel=connectiontimeout]').css('display', 'inline-block');
                                                  $fields.filter('[rel=maxerrorretry]').css('display', 'inline-block');
                                                  $fields.filter('[rel=sockettimeout]').css('display', 'inline-block');
-
-                                                 $fields.filter('[rel=createNfsCache]').find('input').attr('checked', 'checked');
-                                                 $fields.filter('[rel=createNfsCache]').css('display', 'inline-block');
-                                                 $fields.filter('[rel=nfsCacheNfsServer]').css('display', 'inline-block');
-                                                 $fields.filter('[rel=nfsCachePath]').css('display', 'inline-block');
                                             }      
-
+                                            $fields.filter('[rel=createNfsCache]').find('input').attr('checked', 'checked');
+                                            $fields.filter('[rel=createNfsCache]').find('input').attr("disabled", "disabled");  //Create NFS staging is required for S3 at this moment. So, disallow user to uncheck "Create NFS Secondary Staging" checkbox
+                                            $fields.filter('[rel=createNfsCache]').css('display', 'inline-block');
+                                            $fields.filter('[rel=nfsCacheNfsServer]').css('display', 'inline-block');
+                                            $fields.filter('[rel=nfsCachePath]').css('display', 'inline-block');
+                                            
                                             //Swift
                                             $fields.filter('[rel=url]').hide();
                                             $fields.filter('[rel=account]').hide();


[43/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK: 4706 - Adding missing method get_region in common.py

Signed-off-by: venkataswamybabu budumuru <ve...@citrix.com>


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

Branch: refs/heads/4.2
Commit: 503fe75dc93be209f0382ddf9c0b548009342565
Parents: 07a6daf
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Wed Sep 18 20:50:37 2013 -0400
Committer: venkataswamybabu budumuru <ve...@citrix.com>
Committed: Mon Sep 30 15:18:30 2013 +0530

----------------------------------------------------------------------
 tools/marvin/marvin/integration/lib/common.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/503fe75d/tools/marvin/marvin/integration/lib/common.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/common.py b/tools/marvin/marvin/integration/lib/common.py
index e895885..164ef20 100644
--- a/tools/marvin/marvin/integration/lib/common.py
+++ b/tools/marvin/marvin/integration/lib/common.py
@@ -94,6 +94,22 @@ def add_netscaler(apiclient, zoneid, NSservice):
 
     return netscaler
 
+def get_region(apiclient, services=None):
+    "Returns a default region"
+
+    cmd = listRegions.listRegionsCmd()
+    if services:
+        if "regionid" in services:
+            cmd.id = services["regionid"]
+
+    regions = apiclient.listRegions(cmd)
+
+    if isinstance(regions, list):
+        assert len(regions) > 0
+        return regions[0]
+    else:
+        raise Exception("Failed to find specified region.")
+
 def get_domain(apiclient, services=None):
     "Returns a default domain"
 


[10/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-4704: 41-42 db upgrade - populate vpc_service_map table with the services/providers supported by VPC


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

Branch: refs/heads/4.2
Commit: 798f34a49cbfbb3a475f3dadf62d1ac1b8dfa510
Parents: cea14ce
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Thu Sep 19 13:08:38 2013 -0700
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Thu Sep 19 13:15:05 2013 -0700

----------------------------------------------------------------------
 .../src/com/cloud/network/vpc/dao/VpcDao.java   |  4 +-
 .../com/cloud/network/vpc/dao/VpcDaoImpl.java   | 10 ++--
 .../com/cloud/upgrade/dao/Upgrade410to420.java  | 56 ++++++++++++++++++++
 .../com/cloud/network/vpc/VpcManagerImpl.java   | 25 ++++-----
 .../test/com/cloud/vpc/dao/MockVpcDaoImpl.java  |  4 +-
 setup/db/db/schema-410to420.sql                 |  2 +-
 6 files changed, 77 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798f34a4/engine/schema/src/com/cloud/network/vpc/dao/VpcDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/vpc/dao/VpcDao.java b/engine/schema/src/com/cloud/network/vpc/dao/VpcDao.java
index 5a33217..57a2621 100644
--- a/engine/schema/src/com/cloud/network/vpc/dao/VpcDao.java
+++ b/engine/schema/src/com/cloud/network/vpc/dao/VpcDao.java
@@ -40,8 +40,8 @@ public interface VpcDao extends GenericDao<VpcVO, Long>{
     
     long countByAccountId(long accountId);
 
-    VpcVO persist(VpcVO vpc, Map<String, String> serviceProviderMap);
+    VpcVO persist(VpcVO vpc, Map<String, List<String>> serviceProviderMap);
 
     void persistVpcServiceProviders(long vpcId,
-                                    Map<String, String> serviceProviderMap);
+                                    Map<String, List<String>> serviceProviderMap);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798f34a4/engine/schema/src/com/cloud/network/vpc/dao/VpcDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/vpc/dao/VpcDaoImpl.java b/engine/schema/src/com/cloud/network/vpc/dao/VpcDaoImpl.java
index 6560b90..12868fe 100644
--- a/engine/schema/src/com/cloud/network/vpc/dao/VpcDaoImpl.java
+++ b/engine/schema/src/com/cloud/network/vpc/dao/VpcDaoImpl.java
@@ -128,7 +128,7 @@ public class VpcDaoImpl extends GenericDaoBase<VpcVO, Long> implements VpcDao{
 
     @Override
     @DB
-    public VpcVO persist(VpcVO vpc, Map<String, String> serviceProviderMap) {
+    public VpcVO persist(VpcVO vpc, Map<String, List<String>> serviceProviderMap) {
         Transaction txn = Transaction.currentTxn();
         txn.start();
         VpcVO newVpc = super.persist(vpc);
@@ -139,12 +139,14 @@ public class VpcDaoImpl extends GenericDaoBase<VpcVO, Long> implements VpcDao{
 
     @Override
     @DB
-    public void persistVpcServiceProviders(long vpcId, Map<String, String> serviceProviderMap) {
+    public void persistVpcServiceProviders(long vpcId, Map<String, List<String>> serviceProviderMap) {
         Transaction txn = Transaction.currentTxn();
         txn.start();
         for (String service : serviceProviderMap.keySet()) {
-            VpcServiceMapVO serviceMap = new VpcServiceMapVO(vpcId, Network.Service.getService(service), Network.Provider.getProvider(serviceProviderMap.get(service)));
-            _vpcSvcMap.persist(serviceMap);
+            for (String provider : serviceProviderMap.get(service)) {
+                VpcServiceMapVO serviceMap = new VpcServiceMapVO(vpcId, Network.Service.getService(service), Network.Provider.getProvider(provider));
+                _vpcSvcMap.persist(serviceMap);
+            }
         }
         txn.commit();
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798f34a4/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
index 43f03c0..646b406 100755
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
@@ -114,6 +114,7 @@ public class Upgrade410to420 implements DbUpgrade {
         setRAWformatForRBDVolumes(conn);
         migrateVolumeOnSecondaryStorage(conn);
         createFullCloneFlag(conn);
+        upgradeVpcServiceMap(conn);
     }
 
     private void createFullCloneFlag(Connection conn) {
@@ -2956,4 +2957,59 @@ public class Upgrade410to420 implements DbUpgrade {
             throw new CloudRuntimeException("Failed to update volume format to RAW for volumes on RBD pools due to exception ", e);
         }
     }
+    
+    
+    private void upgradeVpcServiceMap(Connection conn){
+        s_logger.debug("Upgrading VPC service Map");
+        PreparedStatement listVpc = null;
+        PreparedStatement listServiceProviders = null;
+        PreparedStatement insertProviders = null;
+        ResultSet rs = null;
+        ResultSet rs1 = null;
+        try {
+            //Get all vpc Ids along with vpc offering Id
+            listVpc = conn.prepareStatement("SELECT id, vpc_offering_id FROM `cloud`.`vpc` where removed is NULL");
+            rs = listVpc.executeQuery();
+            while (rs.next()) {
+                long vpc_id = rs.getLong(1);
+                long offering_id = rs.getLong(2);
+                //list all services and providers in offering
+                listServiceProviders = conn.prepareStatement("SELECT service, provider FROM `cloud`.`vpc_offering_service_map` where vpc_offering_id = ?");
+                listServiceProviders.setLong(1, offering_id);
+                rs1 = listServiceProviders.executeQuery();
+                //Insert entries in vpc_service_map
+                while (rs1.next()) {
+                    String service = rs1.getString(1);
+                    String provider = rs1.getString(2);
+                    insertProviders = conn.prepareStatement("INSERT INTO `cloud`.`vpc_service_map` (`vpc_id`, `service`, `provider`, `created`) VALUES (?, ?, ?, now());");
+                    insertProviders.setLong(1, vpc_id);
+                    insertProviders.setString(2, service);
+                    insertProviders.setString(3, provider);
+                    insertProviders.executeUpdate();
+                }
+                s_logger.debug("Upgraded service map for VPC: "+vpc_id);
+            }
+        }catch (SQLException e) {
+            throw new CloudRuntimeException("Error during VPC service map upgrade", e);
+        } finally {
+            try {
+                if (rs != null) {
+                    rs.close();
+                }
+                if (rs1 != null) {
+                    rs1.close();
+                }
+                if (listVpc != null) {
+                    listVpc.close();
+                }
+                if (listServiceProviders != null) {
+                    listServiceProviders.close();
+                }
+                if (insertProviders != null) {
+                    insertProviders.close();
+                }
+            } catch (SQLException e) {
+            }
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798f34a4/server/src/com/cloud/network/vpc/VpcManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpc/VpcManagerImpl.java b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
index f81dee9..8ee249f 100644
--- a/server/src/com/cloud/network/vpc/VpcManagerImpl.java
+++ b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
@@ -656,18 +656,11 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
         return vpc; 
     }
 
-    private Map<String, String> finalizeServicesAndProvidersForVpc(long zoneId, long offeringId) {
-        Map<String, String> svcProviders = new HashMap<String, String>();
-        Map<String, List<String>> providerSvcs = new HashMap<String, List<String>>();
+    private Map<String, List<String>> finalizeServicesAndProvidersForVpc(long zoneId, long offeringId) {
+        Map<String, List<String>> svcProviders = new HashMap<String, List<String>>();
         List<VpcOfferingServiceMapVO> servicesMap = _vpcOffSvcMapDao.listByVpcOffId(offeringId);
 
         for (VpcOfferingServiceMapVO serviceMap : servicesMap) {
-            if (svcProviders.containsKey(serviceMap.getService())) {
-                // FIXME - right now we pick up the first provider from the list, need to add more logic based on
-                // provider load, etc
-                continue;
-            }
-
             String service = serviceMap.getService();
             String provider = serviceMap.getProvider();
 
@@ -681,13 +674,15 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
                 throw new InvalidParameterValueException("Provider " + provider +
                         " should be enabled in at least one physical network of the zone specified");
             }
-
-            svcProviders.put(service, provider);
-            List<String> l = providerSvcs.get(provider);
-            if (l == null) {
-                providerSvcs.put(provider, l = new ArrayList<String>());
+            
+            List<String> providers = null;
+            if (svcProviders.get(service) == null) {
+                providers = new ArrayList<String>();
+            } else {
+                providers = svcProviders.get(service);
             }
-            l.add(service);
+            providers.add(provider);
+            svcProviders.put(service, providers);
         }
 
         return svcProviders;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798f34a4/server/test/com/cloud/vpc/dao/MockVpcDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/dao/MockVpcDaoImpl.java b/server/test/com/cloud/vpc/dao/MockVpcDaoImpl.java
index 562d67d..5e1c2ec 100644
--- a/server/test/com/cloud/vpc/dao/MockVpcDaoImpl.java
+++ b/server/test/com/cloud/vpc/dao/MockVpcDaoImpl.java
@@ -86,12 +86,12 @@ public class MockVpcDaoImpl extends GenericDaoBase<VpcVO, Long> implements VpcDa
     }
 
     @Override
-    public VpcVO persist(VpcVO vpc, Map<String, String> serviceProviderMap) {
+    public VpcVO persist(VpcVO vpc, Map<String, List<String>> serviceProviderMap) {
         return null;
     }
 
     @Override
-    public void persistVpcServiceProviders(long vpcId, Map<String, String> serviceProviderMap) {
+    public void persistVpcServiceProviders(long vpcId, Map<String, List<String>> serviceProviderMap) {
         return;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798f34a4/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-410to420.sql b/setup/db/db/schema-410to420.sql
index f7f10b9..197f375 100644
--- a/setup/db/db/schema-410to420.sql
+++ b/setup/db/db/schema-410to420.sql
@@ -270,7 +270,7 @@ CREATE TABLE  `vpc_service_map` (
   `created` datetime COMMENT 'date created',
   PRIMARY KEY (`id`),
   CONSTRAINT `fk_vpc_service_map__vpc_id` FOREIGN KEY(`vpc_id`) REFERENCES `vpc`(`id`) ON DELETE CASCADE,
-  UNIQUE (`vpc_id`, `service`)
+  UNIQUE (`vpc_id`, `service`, `provider`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
 CREATE TABLE `cloud`.`load_balancer_healthcheck_policies` (


[11/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-4710: Fix broken help link


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

Branch: refs/heads/4.2
Commit: fa297948f0b74edf8e5fc4cdeb1789d381e1d708
Parents: 798f34a
Author: Brian Federle <br...@citrix.com>
Authored: Thu Sep 19 13:36:58 2013 -0700
Committer: Brian Federle <br...@citrix.com>
Committed: Thu Sep 19 13:37:41 2013 -0700

----------------------------------------------------------------------
 ui/scripts/ui/core.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fa297948/ui/scripts/ui/core.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/core.js b/ui/scripts/ui/core.js
index c23484b..a11d14e 100644
--- a/ui/scripts/ui/core.js
+++ b/ui/scripts/ui/core.js
@@ -302,8 +302,8 @@
                 .appendTo($options);
 
             if (this == 'label.help') {
-                $link.click(function() {
-                    var helpURL = 'http://docs.cloud.com/CloudStack_Documentation';
+                $link.addClass('help').click(function() {
+                    var helpURL = 'http://cloudstack.apache.org/';
 
                     window.open(helpURL, '_blank');
 
@@ -311,7 +311,7 @@
                 });
             }
             if (this == 'label.about') {
-                $link.click(function() {
+                $link.addClass('about').click(function() {
                     var $logo = $('<div>').addClass('logo').html(_l('label.app.name')),
                         $version = $('<div>').addClass('version').html(g_cloudstackversion),
                         $about = $('<div>').addClass('about').append($logo).append($version);


[42/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-4646: Increase the wait time for the routers to go into stopped state

Signed-off-by: venkataswamybabu budumuru <ve...@citrix.com>
(cherry picked from commit 55ef4b8c3c6d583c7e4de4b11613db718c590b82)


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

Branch: refs/heads/4.2
Commit: 07a6daf6cb8d096ee661362d57632302cbf12422
Parents: 6b28e03
Author: SrikanteswaraRao Talluri <ka...@gmail.com>
Authored: Mon Sep 23 14:28:24 2013 +0530
Committer: venkataswamybabu budumuru <ve...@citrix.com>
Committed: Mon Sep 30 15:16:21 2013 +0530

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/07a6daf6/test/integration/component/test_redundant_router_cleanups.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_redundant_router_cleanups.py b/test/integration/component/test_redundant_router_cleanups.py
index 303ca8b..e30c102 100644
--- a/test/integration/component/test_redundant_router_cleanups.py
+++ b/test/integration/component/test_redundant_router_cleanups.py
@@ -653,7 +653,7 @@ class TestRedundantRouterNetworkCleanups(cloudstackTestCase):
 
         self.debug("Sleeping for network gc wait + interval time")
         # Sleep to ensure that all resources are deleted
-        time.sleep((delay + exp) * 2)
+        time.sleep((delay + exp) * 3)
 
         routers = Router.list(
                               self.apiclient,


[18/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
https://issues.apache.org/jira/browse/CLOUDSTACK-4245


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

Branch: refs/heads/4.2
Commit: fd49d252763b13deabb79433a5a02dd21208db8c
Parents: 16a2442
Author: radhikap <ra...@citrix.com>
Authored: Fri Sep 20 15:21:52 2013 +0530
Committer: radhikap <ra...@citrix.com>
Committed: Fri Sep 20 15:25:42 2013 +0530

----------------------------------------------------------------------
 docs/en-US/Release_Notes.xml | 8 ++++----
 docs/en-US/zone-add.xml      | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fd49d252/docs/en-US/Release_Notes.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/Release_Notes.xml b/docs/en-US/Release_Notes.xml
index d1def44..a0b17c4 100644
--- a/docs/en-US/Release_Notes.xml
+++ b/docs/en-US/Release_Notes.xml
@@ -1024,15 +1024,15 @@ under the License.
           >Jira</ulink> to track its issues. All new features and bugs for 4.2.0 have been tracked
         in Jira, and have a standard naming convention of "CLOUDSTACK-NNNN" where "NNNN" is the
         issue number.</para>
-      <para>For list of issues fixed, see <ulink
+      <para>For the list of issues fixed, see <ulink
           url="https://issues.apache.org/jira/issues/?filter=12324870">Issues Fixed in
         4.2</ulink>.</para>
     </section>
     <section id="known-issues-4.2">
       <title>Known Issues in 4.2.0</title>
-      <para>This section includes a summary of known issues that were fixed in 4.2.0. For list of
-        known issues, see <ulink url="https://issues.apache.org/jira/issues/?filter=12324873">Known
-          Issues</ulink>.</para>
+      <para>This section includes a summary of known issues that were fixed in 4.2.0. For the list
+        of known issues, see <ulink url="https://issues.apache.org/jira/issues/?filter=12324873"
+          >Known Issues</ulink>.</para>
     </section>
   </chapter>
   <chapter id="upgrade-instructions">

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fd49d252/docs/en-US/zone-add.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/zone-add.xml b/docs/en-US/zone-add.xml
index 841f7ee..4137b67 100644
--- a/docs/en-US/zone-add.xml
+++ b/docs/en-US/zone-add.xml
@@ -1,4 +1,4 @@
-<?xml vrsion='1.0' encoding='utf-8' ?>
+<?xml version='1.0' encoding='utf-8' ?>
 <!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
 <!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
 %BOOK_ENTITIES;


[30/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
fix issue: listHosts with hahost throws exception


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

Branch: refs/heads/4.2
Commit: a206f423a3851a4d090f58b05e2936dd68c528d0
Parents: a098878
Author: Wei Zhou <w....@leaseweb.com>
Authored: Tue Sep 24 11:59:05 2013 +0200
Committer: Wei Zhou <w....@leaseweb.com>
Committed: Tue Sep 24 11:59:05 2013 +0200

----------------------------------------------------------------------
 server/src/com/cloud/api/query/QueryManagerImpl.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a206f423/server/src/com/cloud/api/query/QueryManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/QueryManagerImpl.java b/server/src/com/cloud/api/query/QueryManagerImpl.java
index 615e207..86276b3 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -1571,7 +1571,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
         }
 
         if (haHosts != null && haTag != null && !haTag.isEmpty()) {
-            sc.setJoinParameters("hostTagSearch", "tag", haTag);
+            sc.setParameters("tag", haTag);
         }
 
         // search host details by ids


[46/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-4634: Fixed issue arising due to wrong indentation


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

Branch: refs/heads/4.2
Commit: 7d15b50704b3b177d2b39fe55e30a9bba0f7b40a
Parents: f0b4f89
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Tue Sep 10 00:25:21 2013 -0400
Committer: sailajam <sa...@citrix.com>
Committed: Tue Oct 1 11:21:21 2013 +0530

----------------------------------------------------------------------
 .../component/cpu_limits/test_maximum_limits.py | 56 ++++++++++----------
 1 file changed, 28 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7d15b507/test/integration/component/cpu_limits/test_maximum_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/cpu_limits/test_maximum_limits.py b/test/integration/component/cpu_limits/test_maximum_limits.py
index 2302504..9161cee 100644
--- a/test/integration/component/cpu_limits/test_maximum_limits.py
+++ b/test/integration/component/cpu_limits/test_maximum_limits.py
@@ -137,34 +137,34 @@ class TestMaxCPULimits(cloudstackTestCase):
         if api_client is None:
             api_client = self.apiclient
 
-            self.debug("Deploying instance")
-            try:
-                if account:
-                    vm = VirtualMachine.create(
-                        api_client,
-                        self.services["virtual_machine"],
-                        templateid=self.template.id,
-                        accountid=account.name,
-                        domainid=account.domainid,
-                        networkids=networks,
-                        serviceofferingid=service_off.id)
-                elif project:
-                    vm = VirtualMachine.create(
-                        api_client,
-                        self.services["virtual_machine"],
-                        templateid=self.template.id,
-                        projectid=project.id,
-                        networkids=networks,
-                        serviceofferingid=service_off.id)
-                vms = VirtualMachine.list(api_client, id=vm.id, listall=True)
-                self.assertIsInstance(vms,
-                    list,
-                    "List VMs should return a valid response")
-                self.assertEqual(vms[0].state, "Running",
-                    "Vm state should be running after deployment")
-                return vm
-            except Exception as e:
-                self.fail("Failed to deploy an instance: %s" % e)
+        self.debug("Deploying instance")
+        try:
+            if account:
+                vm = VirtualMachine.create(
+                     api_client,
+                     self.services["virtual_machine"],
+                     templateid=self.template.id,
+                     accountid=account.name,
+                     domainid=account.domainid,
+                     networkids=networks,
+                     serviceofferingid=service_off.id)
+            elif project:
+                vm = VirtualMachine.create(
+                     api_client,
+                     self.services["virtual_machine"],
+                     templateid=self.template.id,
+                     projectid=project.id,
+                     networkids=networks,
+                     serviceofferingid=service_off.id)
+            vms = VirtualMachine.list(api_client, id=vm.id, listall=True)
+            self.assertIsInstance(vms,
+                                  list,
+                                  "List VMs should return a valid response")
+            self.assertEqual(vms[0].state, "Running",
+                             "Vm state should be running after deployment")
+            return vm
+        except Exception as e:
+            self.fail("Failed to deploy an instance: %s" % e)
 
     def setupAccounts(self, account_limit=2, domain_limit=2, project_limit=2):
 


[21/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-4726: complete secondary storage configuration in devcloud-advanced.cfg and devcloud-advancedsg.cfg


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

Branch: refs/heads/4.2
Commit: 9d00a6da654bcf12ed2ad67b23efc0032abe858c
Parents: 92db2d1
Author: Wei Zhou <w....@leaseweb.com>
Authored: Mon Sep 23 11:09:05 2013 +0200
Committer: Wei Zhou <w....@leaseweb.com>
Committed: Mon Sep 23 11:09:05 2013 +0200

----------------------------------------------------------------------
 tools/devcloud/devcloud-advanced.cfg   | 4 +++-
 tools/devcloud/devcloud-advancedsg.cfg | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9d00a6da/tools/devcloud/devcloud-advanced.cfg
----------------------------------------------------------------------
diff --git a/tools/devcloud/devcloud-advanced.cfg b/tools/devcloud/devcloud-advanced.cfg
index 75c3a4f..fb25d03 100644
--- a/tools/devcloud/devcloud-advanced.cfg
+++ b/tools/devcloud/devcloud-advanced.cfg
@@ -104,7 +104,9 @@
             "internaldns1": "192.168.56.10", 
             "secondaryStorages": [
                 {
-                    "url": "nfs://192.168.56.10:/opt/storage/secondary"
+                    "url": "nfs://192.168.56.10:/opt/storage/secondary",
+                    "provider": "NFS",
+                    "details": [ ]
                 }
             ]
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9d00a6da/tools/devcloud/devcloud-advancedsg.cfg
----------------------------------------------------------------------
diff --git a/tools/devcloud/devcloud-advancedsg.cfg b/tools/devcloud/devcloud-advancedsg.cfg
index 6c26b15..c625e79 100644
--- a/tools/devcloud/devcloud-advancedsg.cfg
+++ b/tools/devcloud/devcloud-advancedsg.cfg
@@ -88,7 +88,9 @@
             "internaldns1": "192.168.56.10",
             "secondaryStorages": [
                 {
-                    "url": "nfs://192.168.56.10/opt/storage/secondary"
+                    "url": "nfs://192.168.56.10:/opt/storage/secondary",
+                    "provider": "NFS",
+                    "details": [ ]
                 }
             ]
         }


[17/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
Disable VMwareTools detection to avoid unreliable result caused by race-condition when VMwareTools is not ready in guest OS yet and the API is called. This is the corrected commit


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

Branch: refs/heads/4.2
Commit: 16a2442c41d87206e9511b842a87475eba0419f6
Parents: ebc9537
Author: Kelven Yang <ke...@gmail.com>
Authored: Thu Sep 19 23:18:26 2013 -0700
Committer: Kelven Yang <ke...@gmail.com>
Committed: Thu Sep 19 23:18:26 2013 -0700

----------------------------------------------------------------------
 .../com/cloud/hypervisor/vmware/resource/VmwareResource.java   | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/16a2442c/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index 0e9ce93..70b9f54 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -1659,12 +1659,13 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
                 throw new Exception(msg);
             }
 
+/*
             if(!isVMWareToolsInstalled(vmMo)){
                 String errMsg = "vmware tools is not installed or not running, cannot add nic to vm " + vmName;
                 s_logger.debug(errMsg);
                 return new PlugNicAnswer(cmd, false, "Unable to execute PlugNicCommand due to " + errMsg);
             }
-
+*/
             // TODO need a way to specify the control of NIC device type
             VirtualEthernetCardType nicDeviceType = VirtualEthernetCardType.E1000;
 
@@ -1739,12 +1740,13 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
                 throw new Exception(msg);
             }
 
+/*
             if(!isVMWareToolsInstalled(vmMo)){
                 String errMsg = "vmware tools not installed or not running, cannot remove nic from vm " + vmName;
                 s_logger.debug(errMsg);
                 return new UnPlugNicAnswer(cmd, false, "Unable to execute unPlugNicCommand due to " + errMsg);
             }
-
+*/
             VirtualDevice nic = findVirtualNicDevice(vmMo, cmd.getNic().getMac());
             if ( nic == null ) {
                 return new UnPlugNicAnswer(cmd, true, "success");


[44/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-4767: UI > Intances > Attach ISO action - pass zoneId to listIsos API


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

Branch: refs/heads/4.2
Commit: dfc0180477e4bf405b54c8362413a0db0a80c8b6
Parents: 503fe75
Author: Jessica Wang <je...@apache.org>
Authored: Mon Sep 30 11:10:09 2013 -0700
Committer: Jessica Wang <je...@apache.org>
Committed: Mon Sep 30 11:10:53 2013 -0700

----------------------------------------------------------------------
 ui/scripts/instances.js | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dfc01804/ui/scripts/instances.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js
index a9f6d1c..f450702 100644
--- a/ui/scripts/instances.js
+++ b/ui/scripts/instances.js
@@ -825,10 +825,14 @@
                                     label: 'ISO',
                                     select: function(args) {
                                         var items = [];
-                                        var map = {};
+                                        var map = {};                                        
                                         $.ajax({
-                                            url: createURL("listIsos&isReady=true&isofilter=featured"),
-                                            dataType: "json",
+                                            url: createURL("listIsos"),
+                                            data: {
+                                            	isofilter: 'featured',
+                                            	isReady: true,
+                                            	zoneid: args.context.instances[0].zoneid
+                                            },
                                             async: false,
                                             success: function(json) {
                                                 var isos = json.listisosresponse.iso;
@@ -842,8 +846,12 @@
                                             }
                                         });
                                         $.ajax({
-                                            url: createURL("listIsos&isReady=true&isofilter=community"),
-                                            dataType: "json",
+                                            url: createURL("listIsos"),
+                                            data: {
+                                            	isofilter: 'community',
+                                            	isReady: true,
+                                            	zoneid: args.context.instances[0].zoneid
+                                            },
                                             async: false,
                                             success: function(json) {
                                                 var isos = json.listisosresponse.iso;
@@ -859,8 +867,12 @@
                                             }
                                         });
                                         $.ajax({
-                                            url: createURL("listIsos&isReady=true&isofilter=selfexecutable"),
-                                            dataType: "json",
+                                            url: createURL("listIsos"),
+                                            data: {
+                                            	isofilter: 'selfexecutable',
+                                            	isReady: true,
+                                            	zoneid: args.context.instances[0].zoneid
+                                            },
                                             async: false,
                                             success: function(json) {
                                                 var isos = json.listisosresponse.iso;


[29/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-4405: change rpm and debian packaging to support automatic update (KVM upgrade)

Including following steps:
b. Run "cloudstack-agent-upgrade". This script will upgrade all the existing bridge name to new bridge name, and update related firewall rules.
c. install a libvirt hook:
    c1. mkdir /etc/libvirt/hooks
    c2. cp /usr/share/cloudstack-agent/lib/libvirtqemuhook /etc/libvirt/hooks/qemu
    c3. chmod +x /etc/libvirt/hooks/qemu
    c4. service libvirtd restart


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

Branch: refs/heads/4.2
Commit: a0988780ad88bb56becb0a13efedcd79c1bee142
Parents: 175549f
Author: Wei Zhou <w....@leaseweb.com>
Authored: Tue Sep 24 09:14:15 2013 +0200
Committer: Wei Zhou <w....@leaseweb.com>
Committed: Tue Sep 24 09:14:15 2013 +0200

----------------------------------------------------------------------
 debian/cloudstack-agent.postinst | 10 +++++++++-
 debian/rules                     |  2 ++
 packaging/centos63/cloud.spec    |  7 +++++++
 3 files changed, 18 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a0988780/debian/cloudstack-agent.postinst
----------------------------------------------------------------------
diff --git a/debian/cloudstack-agent.postinst b/debian/cloudstack-agent.postinst
index 499ae6a..9bad138 100644
--- a/debian/cloudstack-agent.postinst
+++ b/debian/cloudstack-agent.postinst
@@ -34,7 +34,15 @@ case "$1" in
                 fi
             done
         fi
+
+        # Running cloudstack-agent-upgrade to update bridge name for upgrade from CloudStack 4.0.x (and before) to CloudStack 4.1 (and later)
+        /usr/bin/cloudstack-agent-upgrade
+        if [ ! -d "/etc/libvirt/hooks" ] ; then
+            mkdir /etc/libvirt/hooks
+        fi
+        cp -a /usr/share/cloudstack-agent/lib/libvirtqemuhook /etc/libvirt/hooks/qemu
+        /etc/init.d/libvirt-bin restart
         ;;
 esac
 
-exit 0
\ No newline at end of file
+exit 0

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a0988780/debian/rules
----------------------------------------------------------------------
diff --git a/debian/rules b/debian/rules
index 5e3d58c..26a3495 100755
--- a/debian/rules
+++ b/debian/rules
@@ -71,6 +71,8 @@ install:
 	install -D packaging/debian/init/cloud-agent $(DESTDIR)/$(SYSCONFDIR)/init.d/$(PACKAGE)-agent
 	install -D agent/target/transformed/cloud-setup-agent $(DESTDIR)/usr/bin/cloudstack-setup-agent
 	install -D agent/target/transformed/cloud-ssh $(DESTDIR)/usr/bin/cloudstack-ssh
+	install -D agent/target/transformed/cloudstack-agent-upgrade $(DESTDIR)/usr/bin/cloudstack-setup-agent
+	install -D agent/target/transformed/libvirtqemuhook $(DESTDIR)/usr/share/$(PACKAGE)-agent/lib/
 	install -D agent/target/transformed/* $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/agent
 
 	# cloudstack-management

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a0988780/packaging/centos63/cloud.spec
----------------------------------------------------------------------
diff --git a/packaging/centos63/cloud.spec b/packaging/centos63/cloud.spec
index 5f8a2a5..1e88ea7 100644
--- a/packaging/centos63/cloud.spec
+++ b/packaging/centos63/cloud.spec
@@ -476,6 +476,13 @@ fi
 
 %post agent
 if [ "$1" == "1" ] ; then
+    echo "Running %{_bindir}/%{name}-agent-upgrade to update bridge name for upgrade from CloudStack 4.0.x (and before) to CloudStack 4.1 (and later)"
+    %{_bindir}/%{name}-agent-upgrade
+    if [ ! -d %{_sysconfdir}/libvirt/hooks ] ; then
+        mkdir %{_sysconfdir}/libvirt/hooks
+    fi
+    cp -a ${RPM_BUILD_ROOT}%{_datadir}/%{name}-agent/lib/libvirtqemuhook %{_sysconfdir}/libvirt/hooks/qemu
+    /sbin/service libvirtd restart
     /sbin/chkconfig --add cloudstack-agent > /dev/null 2>&1 || true
     /sbin/chkconfig --level 345 cloudstack-agent on > /dev/null 2>&1 || true
 fi


[22/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-4727 upgrade steps notes from abhinav has been incorporated


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

Branch: refs/heads/4.2
Commit: 1628cfc663dfe2707c483865f7d7d95f3a53dfc2
Parents: 9d00a6d
Author: Radhika PC <ra...@citrix.com>
Authored: Mon Sep 23 16:16:05 2013 +0530
Committer: Radhika PC <ra...@citrix.com>
Committed: Mon Sep 23 16:21:24 2013 +0530

----------------------------------------------------------------------
 docs/en-US/Release_Notes.xml | 355 +++++++++++++++++++++-----------------
 1 file changed, 199 insertions(+), 156 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1628cfc6/docs/en-US/Release_Notes.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/Release_Notes.xml b/docs/en-US/Release_Notes.xml
index a0b17c4..96e9928 100644
--- a/docs/en-US/Release_Notes.xml
+++ b/docs/en-US/Release_Notes.xml
@@ -217,8 +217,10 @@ under the License.
             <para><xref linkend="blacklist-route"/></para>
           </listitem>
         </itemizedlist>
-        <section id="kvm-vpc"><title>Support for KVM</title><para>VPC is now supported on KVM
-          hypervisors.</para></section>
+        <section id="kvm-vpc">
+          <title>Support for KVM</title>
+          <para>VPC is now supported on KVM hypervisors.</para>
+        </section>
         <section id="add-loadbalancer-rule-vpc">
           <title>Load Balancing Support for VPC</title>
           <para>In a VPC, you can configure two types of load balancing&mdash;external LB and
@@ -1039,7 +1041,7 @@ under the License.
     <title>Upgrade Instructions for 4.2</title>
     <para>This section contains upgrade instructions from prior versions of CloudStack to Apache
       CloudStack 4.2.0. We include instructions on upgrading to Apache CloudStack from pre-Apache
-      versions of Citrix CloudStack (last version prior to Apache is 3.0.2) and from the releases
+      versions of Citrix &PRODUCT; (last version prior to Apache is 3.0.2) and from the releases
       made while CloudStack was in the Apache Incubator.</para>
     <para>If you run into any issues during upgrades, please feel free to ask questions on
       users@cloudstack.apache.org or dev@cloudstack.apache.org.</para>
@@ -1080,11 +1082,11 @@ under the License.
         <listitem>
           <para>Stop your management server or servers. Run this on all management server
             hosts:</para>
-          <programlisting><prompt>#</prompt> service cloud-management stop</programlisting>
+          <programlisting><prompt>#</prompt> service cloudstack-management stop</programlisting>
         </listitem>
         <listitem>
           <para>If you are running a usage server or usage servers, stop those as well:</para>
-          <programlisting><prompt>#</prompt> service cloud-usage stop</programlisting>
+          <programlisting><prompt>#</prompt> service cloudstack-usage stop</programlisting>
         </listitem>
         <listitem>
           <para>Make a backup of your MySQL database. If you run into any issues or need to roll
@@ -1130,7 +1132,7 @@ under the License.
               If you've created your own packages and APT repository, substitute your own URL for
               the ones used in these examples.</para>
           </note>
-          <orderedlist id="debsteps">
+          <orderedlist id="debsteps" numeration="loweralpha">
             <listitem>
               <para>The first order of business will be to change the sources list for each system
                 with &PRODUCT; packages. This means all management servers, and any hosts that have
@@ -1176,28 +1178,11 @@ under the License.
             <listitem>
               <para>Restart the agent:</para>
               <programlisting language="Bash">
-service cloud-agent stop
+service cloudstack-agent stop
 killall jsvc
 service cloudstack-agent start
                             </programlisting>
             </listitem>
-            <listitem>
-              <para>During the upgrade, <filename>log4j-cloud.xml</filename> was simply copied over,
-                so the logs will continue to be added to
-                  <filename>/var/log/cloud/agent/agent.log</filename>. There's nothing
-                  <emphasis>wrong</emphasis> with this, but if you prefer to be consistent, you can
-                change this by copying over the sample configuration file:</para>
-              <programlisting language="Bash">
-cd /etc/cloudstack/agent
-mv log4j-cloud.xml.dpkg-dist log4j-cloud.xml
-service cloudstack-agent restart
-                            </programlisting>
-            </listitem>
-            <listitem>
-              <para>Once the agent is running, you can uninstall the old cloud-* packages from your
-                system:</para>
-              <programlisting language="Bash">sudo dpkg --purge cloud-agent</programlisting>
-            </listitem>
           </orderedlist>
         </listitem>
         <listitem>
@@ -1285,7 +1270,7 @@ service cloudstack-agent restart
               If you've created your own packages and yum repository, substitute your own URL for
               the ones used in these examples.</para>
           </note>
-          <orderedlist id="rpmsteps">
+          <orderedlist id="rpmsteps" numeration="loweralpha">
             <listitem>
               <para>The first order of business will be to change the yum repository for each system
                 with &PRODUCT; packages. This means all management servers, and any hosts that have
@@ -1310,31 +1295,25 @@ gpgcheck=0
             <listitem id="rpm-master">
               <para>Now that you have the repository configured, it's time to install the
                   <filename>cloudstack-management</filename> package by upgrading the older
-                  <filename>cloud-client</filename> package.</para>
-              <programlisting language="Bash">$ sudo yum upgrade cloud-client</programlisting>
+                  <filename>cloudstack-management</filename> package.</para>
+              <programlisting language="Bash">$ sudo yum upgrade cloudstack-management</programlisting>
             </listitem>
             <listitem id="kvm-agent-rpm">
               <para>For KVM hosts, you will need to upgrade the <filename>cloud-agent</filename>
                 package, similarly installing the new version as
                   <filename>cloudstack-agent</filename>.</para>
-              <programlisting language="Bash">$ sudo yum upgrade cloud-agent</programlisting>
-              <para>During the installation of <filename>cloudstack-agent</filename>, the RPM will
-                copy your <filename>agent.properties</filename>,
-                  <filename>log4j-cloud.xml</filename>, and
-                  <filename>environment.properties</filename> from
-                  <filename>/etc/cloud/agent</filename> to
-                  <filename>/etc/cloudstack/agent</filename>.</para>
+              <programlisting language="Bash">$ sudo yum upgrade cloudstack-agent</programlisting>
             </listitem>
             <listitem>
               <para>For CentOS 5.5, perform the following:</para>
-              <orderedlist>
+              <orderedlist numeration="lowerroman">
                 <listitem>
                   <para>Run the following command:</para>
                   <programlisting>rpm -Uvh http://download.cloud.com/support/jsvc/jakarta-commons-daemon-jsvc-1.0.1-8.9.el6.x86_64.rpm</programlisting>
                 </listitem>
                 <listitem>
                   <para>Upgrade the Usage server.</para>
-                  <programlisting>sudo yum upgrade cloud-usage</programlisting>
+                  <programlisting>sudo yum upgrade cloudstack-usage</programlisting>
                 </listitem>
               </orderedlist>
             </listitem>
@@ -1348,7 +1327,7 @@ gpgcheck=0
             <listitem>
               <para>Restart the agent:</para>
               <programlisting language="Bash">
-service cloud-agent stop
+service cloudstack-agent stop
 killall jsvc
 service cloudstack-agent start
                             </programlisting>
@@ -1421,54 +1400,60 @@ Done restarting router(s).
                   <colspec colwidth="2*" colname="2" colnum="2"/>
                   <thead>
                     <row>
-                      <entry><para>Field</para></entry>
-                      <entry><para>Value</para></entry>
+                      <entry><para>Hypervisor</para></entry>
+                      <entry><para>Description</para></entry>
                     </row>
                   </thead>
                   <tbody>
                     <row>
-                      <entry><para>Name</para></entry>
-                      <entry><para>systemvm-vmware-4.2</para></entry>
-                    </row>
-                    <row>
-                      <entry><para>Description</para></entry>
-                      <entry><para>systemvm-vmware-4.2</para></entry>
-                    </row>
-                    <row>
-                      <entry><para>URL</para></entry>
-                      <entry><para>http://download.cloud.com/templates/burbank/burbank-systemvm-08012012.ova</para></entry>
+                      <entry><para>XenServer</para></entry>
+                      <entry><para>Name: systemvm-xenserver-4.2.0</para>
+                        <para>Description: systemvm-xenserver-4.2.0</para>
+                        <para>URL:http://download.cloud.com/templates/4.2/systemvmtemplate-2013-07-12-master-xen.vhd.bz2 </para>
+                        <para>Zone: Choose the zone where this hypervisor is used</para>
+                        <para>Hypervisor: XenServer</para>
+                        <para>Format: VHD</para>
+                        <para>OS Type: Debian GNU/Linux 7.0 (32-bit) (or the highest Debian release
+                          number available in the dropdown)</para>
+                        <para>Extractable: no</para>
+                        <para>Password Enabled: no</para>
+                        <para>Public: no</para>
+                        <para>Featured: no</para>
+                      </entry>
                     </row>
                     <row>
-                      <entry><para>Zone</para></entry>
-                      <entry><para>Choose the zone where this hypervisor is used</para></entry>
+                      <entry><para>KVM</para></entry>
+                      <entry><para>Name: systemvm-kvm-4.2.0</para>
+                        <para>Description: systemvm-kvm-4.2.0</para>
+                        <para>URL:
+                          http://download.cloud.com/templates/4.2/systemvmtemplate-2013-06-12-master-kvm.qcow2.bz2</para>
+                        <para>Zone: Choose the zone where this hypervisor is used</para>
+                        <para>Hypervisor: KVM</para>
+                        <para>Format: QCOW2</para>
+                        <para>OS Type: Debian GNU/Linux 7.0 (32-bit) (or the highest Debian release
+                          number available in the dropdown)</para>
+                        <para>Extractable: no</para>
+                        <para>Password Enabled: no</para>
+                        <para>Public: no</para>
+                        <para>Featured: no</para>
+                      </entry>
                     </row>
                     <row>
-                      <entry><para>Hypervisor</para></entry>
                       <entry><para>VMware</para></entry>
-                    </row>
-                    <row>
-                      <entry><para>Format</para></entry>
-                      <entry><para>OVA</para></entry>
-                    </row>
-                    <row>
-                      <entry><para>OS Type</para></entry>
-                      <entry><para>Debian GNU/Linux 5.0 (32-bit)</para></entry>
-                    </row>
-                    <row>
-                      <entry><para>Extractable</para></entry>
-                      <entry><para>no</para></entry>
-                    </row>
-                    <row>
-                      <entry><para>Password Enabled</para></entry>
-                      <entry><para>no</para></entry>
-                    </row>
-                    <row>
-                      <entry><para>Public</para></entry>
-                      <entry><para>no</para></entry>
-                    </row>
-                    <row>
-                      <entry><para>Featured</para></entry>
-                      <entry><para>no</para></entry>
+                      <entry><para>Name: systemvm-vmware-4.2.0</para>
+                        <para>Description: systemvm-vmware-4.2.0</para>
+                        <para>URL:
+                          http://download.cloud.com/templates/4.2/systemvmtemplate-4.2-vh7.ova</para>
+                        <para>Zone: Choose the zone where this hypervisor is used</para>
+                        <para>Hypervisor: VMware</para>
+                        <para>Format: OVA</para>
+                        <para>OS Type: Debian GNU/Linux 7.0 (32-bit) (or the highest Debian release
+                          number available in the dropdown)</para>
+                        <para>Extractable: no</para>
+                        <para>Password Enabled: no</para>
+                        <para>Public: no</para>
+                        <para>Featured: no</para>
+                      </entry>
                     </row>
                   </tbody>
                 </tgroup>
@@ -1480,7 +1465,47 @@ Done restarting router(s).
             </listitem>
           </orderedlist>
         </listitem>
-        <listitem id="stopping-usage-servers">
+        <listitem>
+          <para>(KVM on RHEL 6.0/6.1 only) If your existing &PRODUCT; deployment includes one or
+            more clusters of KVM hosts running RHEL 6.0 or RHEL 6.1, perform the following:</para>
+          <orderedlist numeration="loweralpha">
+            <listitem>
+              <para>Ensure that you upgrade the operating system version on those hosts before
+                upgrading &PRODUCT;</para>
+              <para>To do that, change the yum repository for each system with &PRODUCT; packages,
+                that implies that all the Management Servers and any hosts that have the KVM agent.
+              </para>
+            </listitem>
+            <listitem>
+              <para>Open <filename>/etc/yum.repos.d/cloudstack.repo</filename> on any systems that
+                have &PRODUCT; packages installed.</para>
+            </listitem>
+            <listitem>
+              <para>Edit as follows:</para>
+              <programlisting>
+            [upgrade]
+            name=rhel63
+            baseurl=url-of-your-rhel6.3-repo
+            enabled=1
+            gpgcheck=0
+            [apache CloudStack]
+            name= Apache CloudStack
+            baseurl= http://cloudstack.apt-get.eu/rhel/4.0/
+            enabled=1
+            gpgcheck=0</programlisting>
+              <para>If you are using the community provided package repository, change the baseurl
+                to http:// cloudstack.apt-get.eu/rhel/4.2/</para>
+              <para>If you are using your own package repository, change this line to read as
+                appropriate for your 4.2.0 repository.</para>
+            </listitem>
+            <listitem>
+              <para>Now that you have the repository configured, upgrade the host operating system
+                from RHEL 6.0 to 6.3:</para>
+              <programlisting># yum upgrade</programlisting>
+            </listitem>
+          </orderedlist>
+        </listitem>
+        <listitem>
           <para>Stop all Usage Servers if running. Run this on all Usage Server hosts.</para>
           <programlisting language="Bash"><prompt>#</prompt> service cloud-usage stop</programlisting>
         </listitem>
@@ -1582,32 +1607,6 @@ service cloudstack-agent restart
             </listitem>
           </orderedlist>
         </listitem>
-        <listitem>
-          <para>(KVM only) Additional steps are required for each KVM host. These steps will not
-            affect running guests in the cloud. These steps are required only for clouds using KVM
-            as hosts and only on the KVM hosts.</para>
-          <orderedlist numeration="loweralpha">
-            <listitem>
-              <para>Copy the CloudPlatform 4.2 tar file to the host, untar it, and change directory
-                to the resulting directory.</para>
-            </listitem>
-            <listitem>
-              <para>Stop the running agent.</para>
-              <programlisting># service cloud-agent stop</programlisting>
-            </listitem>
-            <listitem>
-              <para>Update the agent software.</para>
-              <programlisting># ./install.sh</programlisting>
-            </listitem>
-            <listitem>
-              <para>Choose "U" to update the packages.</para>
-            </listitem>
-            <listitem>
-              <para>Start the agent.</para>
-              <programlisting># service cloudstack-agent start</programlisting>
-            </listitem>
-          </orderedlist>
-        </listitem>
         <listitem id="upgrade-rpm-packages-302">
           <para>If you are using CentOS or RHEL, follow this procedure to upgrade your packages. If
             not, skip to step <xref linkend="correct-components-xml-302"/>.</para>
@@ -1617,7 +1616,7 @@ service cloudstack-agent restart
               If you've created your own packages and yum repository, substitute your own URL for
               the ones used in these examples.</para>
           </note>
-          <orderedlist id="rpmsteps-302">
+          <orderedlist numeration="loweralpha" id="rpmsteps-302">
             <listitem>
               <para>The first order of business will be to change the yum repository for each system
                 with &PRODUCT; packages. This means all management servers, and any hosts that have
@@ -1766,11 +1765,26 @@ service cloudstack-agent start
                 "com.cloud.hypervisor.kvm.resource.LibvirtComputingResource".</para>
             </listitem>
             <listitem>
-              <para>Start the cloud agent and cloud management services.</para>
+              <para>Upgrade all the existing bridge names to new bridge names by running this
+                script:</para>
+              <programlisting> # cloudstack-agent-upgrade</programlisting>
+            </listitem>
+            <listitem>
+              <para> Install a libvirt hook with the following commands:</para>
+              <programlisting> # mkdir /etc/libvirt/hooks
+ # cp /usr/share/cloudstack-agent/lib/libvirtqemuhook /etc/libvirt/hooks/qemu
+ # chmod +x /etc/libvirt/hooks/qemu</programlisting>
+            </listitem>
+            <listitem>
+              <para>Restart libvirtd.</para>
+              <programlisting># service libvirtd restart</programlisting>
+            </listitem>
+            <listitem>
+              <para>Start the agent.</para>
               <programlisting># service cloudstack-agent start</programlisting>
             </listitem>
             <listitem>
-              <para>When the Management Server is up and running, log in to the CloudStack UI and
+              <para>When the Management Server is up and running, log in to the &PRODUCT; UI and
                 restart the virtual router for proper functioning of all the features.</para>
             </listitem>
           </orderedlist>
@@ -1805,13 +1819,13 @@ service cloudstack-agent start
           </orderedlist>
         </listitem>
         <listitem>
-          <para>Run the <command>cloud-sysvmadm</command> script to stop, then start, all Secondary
-            Storage VMs, Console Proxy VMs, and virtual routers. Run the script once on each
-            management server. Substitute your own IP address of the MySQL instance, the MySQL user
-            to connect as, and the password to use for that user. In addition to those parameters,
-            provide the <command>-c</command> and <command>-r</command> arguments. For
+          <para>Run the <command>cloudstack-sysvmadm</command> script to stop, then start, all
+            Secondary Storage VMs, Console Proxy VMs, and virtual routers. Run the script once on
+            each management server. Substitute your own IP address of the MySQL instance, the MySQL
+            user to connect as, and the password to use for that user. In addition to those
+            parameters, provide the <command>-c</command> and <command>-r</command> arguments. For
             example:</para>
-          <para><command># nohup cloud-sysvmadm -d 192.168.1.5 -u cloud -p password -c -r >
+          <para><command># nohup cloudstack-sysvmadm -d 192.168.1.5 -u cloud -p password -c -r >
               sysvm.log 2>&amp;1 &amp;</command></para>
           <para><command># tail -f sysvm.log</command></para>
           <para>This might take up to an hour or more to run, depending on the number of accounts in
@@ -2040,7 +2054,8 @@ service cloudstack-agent start
                         <para>Zone: Choose the zone where this hypervisor is used</para>
                         <para>Hypervisor: XenServer</para>
                         <para>Format: VHD</para>
-                        <para>OS Type: Debian GNU/Linux 6.0 (32-bit)</para>
+                        <para>OS Type: Debian GNU/Linux 7.0 (32-bit) (or the highest Debian release
+                          number available in the dropdown)</para>
                         <para>Extractable: no</para>
                         <para>Password Enabled: no</para>
                         <para>Public: no</para>
@@ -2056,7 +2071,8 @@ service cloudstack-agent start
                         <para>Zone: Choose the zone where this hypervisor is used</para>
                         <para>Hypervisor: KVM</para>
                         <para>Format: QCOW2</para>
-                        <para>OS Type: Debian GNU/Linux 5.0 (32-bit)</para>
+                        <para>OS Type: Debian GNU/Linux 7.0 (32-bit) (or the highest Debian release
+                          number available in the dropdown)</para>
                         <para>Extractable: no</para>
                         <para>Password Enabled: no</para>
                         <para>Public: no</para>
@@ -2072,7 +2088,8 @@ service cloudstack-agent start
                         <para>Zone: Choose the zone where this hypervisor is used</para>
                         <para>Hypervisor: VMware</para>
                         <para>Format: OVA</para>
-                        <para>OS Type: Debian GNU/Linux 5.0 (32-bit)</para>
+                        <para>OS Type: Debian GNU/Linux 7.0 (32-bit) (or the highest Debian release
+                          number available in the dropdown)</para>
                         <para>Extractable: no</para>
                         <para>Password Enabled: no</para>
                         <para>Public: no</para>
@@ -2095,6 +2112,46 @@ service cloudstack-agent start
             VM template for each hypervisor type. Otherwise, the upgrade will fail.</para>
         </listitem>
         <listitem>
+          <para>(KVM on RHEL 6.0/6.1 only) If your existing &PRODUCT; deployment includes one or
+            more clusters of KVM hosts running RHEL 6.0 or RHEL 6.1, perform the following:</para>
+          <orderedlist numeration="loweralpha">
+            <listitem>
+              <para>Ensure that you upgrade the operating system version on those hosts before
+                upgrading &PRODUCT;</para>
+              <para>To do that, change the yum repository for each system with &PRODUCT; packages,
+                that implies that all the Management Servers and any hosts that have the KVM agent.
+              </para>
+            </listitem>
+            <listitem>
+              <para>Open <filename>/etc/yum.repos.d/cloudstack.repo</filename> on any systems that
+                have &PRODUCT; packages installed.</para>
+            </listitem>
+            <listitem>
+              <para>Edit as follows:</para>
+              <programlisting>
+            [upgrade]
+            name=rhel63
+            baseurl=url-of-your-rhel6.3-repo
+            enabled=1
+            gpgcheck=0
+            [apache CloudStack]
+            name= Apache CloudStack
+            baseurl= http://cloudstack.apt-get.eu/rhel/4.0/
+            enabled=1
+            gpgcheck=0</programlisting>
+              <para>If you are using the community provided package repository, change the baseurl
+                to http:// cloudstack.apt-get.eu/rhel/4.2/</para>
+              <para>If you are using your own package repository, change this line to read as
+                appropriate for your 4.2.0 repository.</para>
+            </listitem>
+            <listitem>
+              <para>Now that you have the repository configured, upgrade the host operating system
+                from RHEL 6.0 to 6.3:</para>
+              <programlisting># yum upgrade</programlisting>
+            </listitem>
+          </orderedlist>
+        </listitem>
+        <listitem>
           <para>Stop all Usage Servers if running. Run this on all Usage Server hosts.</para>
           <programlisting># service cloud-usage stop</programlisting>
         </listitem>
@@ -2127,7 +2184,7 @@ service cloudstack-agent start
               If you've created your own packages and APT repository, substitute your own URL for
               the ones used in these examples.</para>
           </note>
-          <orderedlist id="debsteps-22">
+          <orderedlist numeration="loweralpha" id="debsteps-22">
             <listitem>
               <para>The first order of business will be to change the sources list for each system
                 with &PRODUCT; packages. This means all management servers, and any hosts that have
@@ -2206,7 +2263,7 @@ service cloudstack-agent restart
               If you've created your own packages and yum repository, substitute your own URL for
               the ones used in these examples.</para>
           </note>
-          <orderedlist id="rpmsteps-22">
+          <orderedlist numeration="loweralpha" id="rpmsteps-22">
             <listitem>
               <para>The first order of business will be to change the yum repository for each system
                 with &PRODUCT; packages. This means all management servers, and any hosts that have
@@ -2287,7 +2344,7 @@ service cloudstack-agent start
             </listitem>
             <listitem>
               <para>Merge your changes from the backup file into the new components.xml file.</para>
-              <programlisting><prompt>#</prompt> <command>vi</command> <filename>/etc/cloud/management/components.xml</filename>
+              <programlisting><prompt>#</prompt> <command>vi</command> <filename>/etc/cloudstack/management/components.xml</filename>
                             </programlisting>
             </listitem>
           </orderedlist>
@@ -2319,7 +2376,7 @@ service cloudstack-agent start
             CloudStack installation, the changes will be preserved in the upgrade. However, you need
             to do the following steps to place these changes in a new version of the file which is
             compatible with version 4.0.0-incubating.</para>
-          <orderedlist>
+          <orderedlist numeration="loweralpha">
             <listitem>
               <para>Make a backup copy of your file
                   <filename>/etc/cloud/management/db.properties</filename>. For example:</para>
@@ -2332,7 +2389,7 @@ service cloudstack-agent start
             </listitem>
             <listitem>
               <para>Merge your changes from the backup file into the new db.properties file.</para>
-              <programlisting><prompt>#</prompt> <command>vi</command> <filename>/etc/cloud/management/db.properties</filename></programlisting>
+              <programlisting><prompt>#</prompt> <command>vi</command> <filename>/etc/cloudstack/management/db.properties</filename></programlisting>
             </listitem>
           </orderedlist>
         </listitem>
@@ -2378,32 +2435,6 @@ service cloudstack-agent start
           <programlisting language="Bash"><prompt>#</prompt> service cloudstack-usage start</programlisting>
         </listitem>
         <listitem>
-          <para>(KVM only) Additional steps are required for each KVM host. These steps will not
-            affect running guests in the cloud. These steps are required only for clouds using KVM
-            as hosts and only on the KVM hosts.</para>
-          <orderedlist numeration="loweralpha">
-            <listitem>
-              <para>Copy the CloudPlatform 4.2 tar file to the host, untar it, and change directory
-                to the resulting directory.</para>
-            </listitem>
-            <listitem>
-              <para>Stop the running agent.</para>
-              <programlisting># service cloud-agent stop</programlisting>
-            </listitem>
-            <listitem>
-              <para>Update the agent software.</para>
-              <programlisting># ./install.sh</programlisting>
-            </listitem>
-            <listitem>
-              <para>Choose "U" to update the packages.</para>
-            </listitem>
-            <listitem>
-              <para>Start the agent.</para>
-              <programlisting># service cloudstack-agent start</programlisting>
-            </listitem>
-          </orderedlist>
-        </listitem>
-        <listitem>
           <para>(KVM only) Perform the following additional steps on each KVM host. </para>
           <para>These steps will not affect running guests in the cloud. These steps are required
             only for clouds using KVM as hosts and only on the KVM hosts.</para>
@@ -2421,21 +2452,33 @@ service cloudstack-agent start
                 appropriate.</para>
               <programlisting><prompt>#</prompt> <command>yum</command> update cloud-*</programlisting>
               <programlisting>
-                                <prompt>#</prompt> <command>apt-get</command> update
-                                <prompt>#</prompt> <command>apt-get</command> upgrade cloud-*
+ <prompt>#</prompt> <command>apt-get</command> update
+ <prompt>#</prompt> <command>apt-get</command> upgrade cloud-*
                             </programlisting>
             </listitem>
             <listitem>
-              <para>Start the agent.</para>
-              <programlisting># service cloudstack-agent start</programlisting>
-            </listitem>
-            <listitem>
               <para> Copy the contents of the <filename>agent.properties</filename> file to the new
                   <filename>agent.properties</filename> file by using the following command</para>
-              <programlisting><command>sed</command> -i 's/com.cloud.agent.resource.computing.LibvirtComputingResource/com.cloud.hypervisor.kvm.resource.LibvirtComputingResource/g' <filename>/etc/cloud/agent/agent.properties</filename></programlisting>
+              <programlisting><command>sed</command> -i 's/com.cloud.agent.resource.computing.LibvirtComputingResource/com.cloud.hypervisor.kvm.resource.LibvirtComputingResource/g' <filename>/etc/cloudstack/agent/agent.properties</filename></programlisting>
             </listitem>
             <listitem>
-              <para>Start the cloud agent and cloud management services.</para>
+              <para>Upgrade all the existing bridge names to new bridge names by running this
+                script:</para>
+              <programlisting> # cloudstack-agent-upgrade</programlisting>
+            </listitem>
+            <listitem>
+              <para> Install a libvirt hook with the following commands:</para>
+              <programlisting> # mkdir /etc/libvirt/hooks
+ # cp /usr/share/cloudstack-agent/lib/libvirtqemuhook /etc/libvirt/hooks/qemu
+ # chmod +x /etc/libvirt/hooks/qemu</programlisting>
+            </listitem>
+            <listitem>
+              <para>Restart libvirtd.</para>
+              <programlisting># service libvirtd restart</programlisting>
+            </listitem>
+            <listitem>
+              <para>Start the agent.</para>
+              <programlisting># service cloudstack-agent start</programlisting>
             </listitem>
             <listitem>
               <para>When the Management Server is up and running, log in to the CloudStack UI and
@@ -2459,8 +2502,8 @@ service cloudstack-agent start
                 the MySQL instance, the MySQL user to connect as, and the password to use for that
                 user. In addition to those parameters, provide the "-c" and "-r" arguments. For
                 example:</para>
-              <programlisting><prompt>#</prompt> <command>nohup cloud-sysvmadm</command> -d <replaceable>192.168.1.5</replaceable> -u cloud -p <replaceable>password</replaceable> -c -r > sysvm.log 2>&amp;1 &amp;
-                                <prompt>#</prompt> <command>tail</command> -f <filename>sysvm.log</filename></programlisting>
+              <programlisting><prompt>#</prompt> <command>nohup cloudstack-sysvmadm</command> -d <replaceable>192.168.1.5</replaceable> -u cloud -p <replaceable>password</replaceable> -c -r > sysvm.log 2>&amp;1 &amp;
+<prompt>#</prompt> <command>tail</command> -f <filename>sysvm.log</filename></programlisting>
               <para>This might take up to an hour or more to run, depending on the number of
                 accounts in the system.</para>
             </listitem>


[16/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
Revert "Disable VMwareTools detection to avoid unreliable result caused by race-condition when VMwareTools is not ready in guest OS yet and the API is called"

This reverts commit 8e0faaa406651dcd0025b563ed36acbdb733a0d0.


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

Branch: refs/heads/4.2
Commit: ebc95375e23a65d338171d21cf06c31db296d029
Parents: 8e0faaa
Author: Kelven Yang <ke...@gmail.com>
Authored: Thu Sep 19 23:05:17 2013 -0700
Committer: Kelven Yang <ke...@gmail.com>
Committed: Thu Sep 19 23:05:17 2013 -0700

----------------------------------------------------------------------
 client/pom.xml                                  | 23 +++++++++++++++-----
 .../vmware/resource/VmwareResource.java         | 17 ++-------------
 2 files changed, 20 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ebc95375/client/pom.xml
----------------------------------------------------------------------
diff --git a/client/pom.xml b/client/pom.xml
index 119c96e..d25576a 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -16,8 +16,8 @@
   <parent>
     <groupId>org.apache.cloudstack</groupId>
     <artifactId>cloudstack</artifactId>
-    <version>4.3.0-SNAPSHOT</version>
-  </parent> 
+    <version>4.2.0-SNAPSHOT</version>
+  </parent>
   <dependencies>
     <dependency>
       <groupId>org.apache.cloudstack</groupId>
@@ -173,6 +173,7 @@
     <dependency>
       <groupId>mysql</groupId>
       <artifactId>mysql-connector-java</artifactId>
+      <version>${cs.mysql.version}</version>
       <scope>runtime</scope>
     </dependency>
     <dependency>
@@ -195,6 +196,13 @@
       <artifactId>cloud-engine-components-api</artifactId>
       <version>${project.version}</version>
     </dependency>
+
+    <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-engine-compute</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
     <dependency>
       <groupId>org.apache.cloudstack</groupId>
       <artifactId>cloud-engine-network</artifactId>
@@ -282,6 +290,7 @@
     </dependency>
   </dependencies>
   <build>
+    <defaultGoal>install</defaultGoal>
     <plugins>
       <plugin>
         <groupId>ru.concerteza.buildnumber</groupId>
@@ -329,8 +338,8 @@
               <maxIdleTime>60000</maxIdleTime>
             </connector>
           </connectors>
-          <webXml>${project.build.directory}/generated-webapp/WEB-INF/web.xml</webXml>
-          <webAppSourceDirectory>${project.build.directory}/generated-webapp</webAppSourceDirectory>
+          <webXml>${project.build.directory}/${project.build.finalName}/WEB-INF/web.xml</webXml>
+          <webAppSourceDirectory>${project.build.directory}/${project.build.finalName}</webAppSourceDirectory>
           <webAppConfig>
             <contextPath>/client</contextPath>
             <extraClasspath>${project.build.directory}/utilities/scripts/db/;${project.build.directory}/utilities/scripts/db/db/</extraClasspath>
@@ -382,7 +391,10 @@
                   <fileset dir="${basedir}/../scripts" />
                 </copy>
                 <!-- CLOUDSTACK-1304 -->
-                <chmod perm="755" file="${basedir}/target/generated-webapp/WEB-INF/classes/scripts/**" type="both" />
+                <chmod perm="755">
+                  <fileset
+                    dir="${basedir}/target/generated-webapp/WEB-INF/classes/scripts" />
+                </chmod>
                 <copy todir="${basedir}/target/generated-webapp/WEB-INF/">
                   <fileset dir="${basedir}/WEB-INF/">
                     <include name="web.xml" />
@@ -549,6 +561,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-dependency-plugin</artifactId>
+        <version>2.5.1</version>
         <executions>
           <execution>
             <id>copy</id>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ebc95375/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index b80fd40..0e9ce93 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -1659,13 +1659,12 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
                 throw new Exception(msg);
             }
 
-/*
             if(!isVMWareToolsInstalled(vmMo)){
                 String errMsg = "vmware tools is not installed or not running, cannot add nic to vm " + vmName;
                 s_logger.debug(errMsg);
                 return new PlugNicAnswer(cmd, false, "Unable to execute PlugNicCommand due to " + errMsg);
             }
-*/
+
             // TODO need a way to specify the control of NIC device type
             VirtualEthernetCardType nicDeviceType = VirtualEthernetCardType.E1000;
 
@@ -1740,13 +1739,12 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
                 throw new Exception(msg);
             }
 
-/*
             if(!isVMWareToolsInstalled(vmMo)){
                 String errMsg = "vmware tools not installed or not running, cannot remove nic from vm " + vmName;
                 s_logger.debug(errMsg);
                 return new UnPlugNicAnswer(cmd, false, "Unable to execute unPlugNicCommand due to " + errMsg);
             }
-*/
+
             VirtualDevice nic = findVirtualNicDevice(vmMo, cmd.getNic().getMac());
             if ( nic == null ) {
                 return new UnPlugNicAnswer(cmd, true, "success");
@@ -6871,17 +6869,6 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
     
     private boolean isVMWareToolsInstalled(VirtualMachineMO vmMo) throws Exception{
         GuestInfo guestInfo = vmMo.getVmGuestInfo();
-        if(guestInfo == null) {
-            s_logger.error("null GuestInfo is returned");
-            return false;
-        }
-
-        if(guestInfo.getGuestState() == null) {
-            s_logger.error("null GuestState is returned");
-            return false;
-        }
-        
-        s_logger.info("VMwareTools guest state: " + guestInfo.getGuestState());
         return (guestInfo != null && guestInfo.getGuestState() != null && guestInfo.getGuestState().equalsIgnoreCase("running"));
     }
 }


[08/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
Fixed sysvmadm helper script (responsible for restarting/recreating VRs when needed on upgraded setups due to template changes) to have -v option. When -v is specified, all VPCs in the system will get restarted. As a part of the restart, VPC routers will get recreated


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

Branch: refs/heads/4.2
Commit: a14145bb5e063e4545789635943bf28712b8fa83
Parents: e81e6ef
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Thu Sep 19 10:26:59 2013 -0700
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Thu Sep 19 10:28:19 2013 -0700

----------------------------------------------------------------------
 setup/bindir/cloud-sysvmadm.in | 102 ++++++++++++++++++++++++++++++++++--
 1 file changed, 99 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a14145bb/setup/bindir/cloud-sysvmadm.in
----------------------------------------------------------------------
diff --git a/setup/bindir/cloud-sysvmadm.in b/setup/bindir/cloud-sysvmadm.in
index 3cb7858..e2a626e 100755
--- a/setup/bindir/cloud-sysvmadm.in
+++ b/setup/bindir/cloud-sysvmadm.in
@@ -23,13 +23,14 @@
 #set -x
 
 usage() {
-  printf "\nThe tool stopping/starting running system vms and domain routers \n\nUsage: %s: [-d] [-u] [-p] [-m] [-s] [-r] [-a] [-t] [-n] [-z]\n\n -d - cloud DB server ip address, defaulted to localhost if not specified \n -u - user name to access cloud DB, defaulted to "root" if not specified \n -p - cloud DB user password, defaulted to no password if not specified \n\n -m - the ip address of management server, defaulted to localhost if not specified\n\n -s - stop then start all running SSVMs and Console Proxies \n -r - stop then start all running Virtual Routers\n -a - stop then start all running SSVMs, Console Proxies, and Virtual Routers \n -n - restart all Guest networks \n -t - number of parallel threads used for stopping Domain Routers. Default is 10.\n -l - log file location. Default is cloud.log under current directory.\n -z - do restart only for the instances in the specific zone. If not specified, restart will apply to instances in all zones\n\n" $(basename $0) >&2
+  printf "\nThe tool stopping/starting running system vms and domain routers \n\nUsage: %s: [-d] [-u] [-p] [-m] [-s] [-r] [-a] [-t] [-n] [-z] [-v]\n\n -d - cloud DB server ip address, defaulted to localhost if not specified \n -u - user name to access cloud DB, defaulted to "root" if not specified \n -p - cloud DB user password, defaulted to no password if not specified \n\n -m - the ip address of management server, defaulted to localhost if not specified\n\n -s - stop then start all running SSVMs and Console Proxies \n -r - stop then start all running Virtual Routers\n -a - stop then start all running SSVMs, Console Proxies, and Virtual Routers \n -n - restart all Guest networks \n -t - number of parallel threads used for stopping Domain Routers. Default is 10.\n -l - log file location. Default is cloud.log under current directory.\n -z - do restart only for the instances in the specific zone. If not specified, restart will apply to instances in all zones\n -v - do restart all VPCs
  in the entire system\n\n" $(basename $0) >&2
 }
 
 
 system=
 router=
 all=
+vpc=
 db=localhost
 ms=localhost
 user=root
@@ -42,7 +43,7 @@ inzone=""
 
 
 
-while getopts 'sarhnd:m:u:p:t:l:z:' OPTION
+while getopts 'sarhnvd:m:u:p:t:l:z:' OPTION
 do
   case $OPTION in
   s)    system=1
@@ -53,6 +54,8 @@ do
         ;;
   a)    all=1
         ;;
+  v)    vpc=1
+        ;;
   d)    db="$OPTARG"
         ;;
   u)    user="$OPTARG"
@@ -317,6 +320,92 @@ restart_network(){
     
 }
 
+
+restart_vpc(){
+    echo -e "INFO: Restarting vpc with id $1"
+    echo "INFO: Restarting vpc with id $1" >>$LOGFILE
+    jobid=`curl -sS "http://$ms:8096/?command=restartVPC&id=$1&response=json" | sed 's/\"//g' | sed 's/ //g' | sed 's/{//g' | sed 's/}//g' | awk -F: {'print $3'}`
+    if [ "$jobid" == "" ]; then
+        echo "ERROR: Failed to restart vpc with id $1" >>$LOGFILE
+        echo 2
+        return
+    fi
+    
+    jobresult=$(query_async_job_result $jobid)
+    
+    if [ "$jobresult" != "1" ]; then
+        echo -e "ERROR: Failed to restart vpc with id $1 \n"
+        echo "ERROR: Failed to restart vpc with id $1" >>$LOGFILE
+    else
+        echo -e "INFO: Successfully restarted vpc with id $1 \n"
+        echo "INFO: Successfully restarted vpc with id $1" >>$LOGFILE
+    fi
+}
+
+
+restart_vpcs(){
+    vpcs=(`mysql -h $db --user=$user --password=$password --skip-column-names -U cloud -e "select id from vpc WHERE removed is null$zone"`)
+    length_vpcs=(${#vpcs[@]})
+    
+    echo -e "\nRestarting $length_vpcs vpcs... "
+    echo -e "Restarting $length_vpcs vpcs... " >>$LOGFILE
+    
+    #Spawn restart vpcs in parallel - run commands in <n> chunks - number of threads is configurable
+
+    pids=()
+    for d in "${vpcs[@]}"; do
+        
+        restart_vpc $d &
+
+        pids=( "${pids[@]}" $! )
+        
+        length_pids=(${#pids[@]})
+        unfinishedPids=(${#pids[@]})
+        
+        if [ $maxthreads -gt $length_vpcs ]; then
+            maxthreads=$length_vpcs
+        fi
+        
+        if [ $length_pids -ge $maxthreads ]; then
+            while [ $unfinishedPids -gt 0 ]; do
+                sleep 10
+                count=0
+                for ((  i = 0 ;  i < $length_pids;  i++  )); do
+                    if ! ps ax | grep -v grep | grep ${pids[$i]} > /dev/null; then
+                        count=`expr $count + 1`
+                    fi
+                done
+                
+                if [ $count -eq $unfinishedPids ]; then
+                    unfinishedPids=0
+                fi
+                
+            done
+            
+            #remove all elements from pids
+            if [ $unfinishedPids -eq 0 ]; then
+                pids=()
+                length_pids=(${#pids[@]})
+            fi
+            
+        fi
+        
+    done
+
+    
+    if [ "$length_vpcs" == "0" ];then
+        echo -e "No vpcs found \n" >>$LOGFILE
+    else    
+        while [ $unfinishedPids -gt 0 ]; do
+            sleep 10
+        done
+        
+        echo -e "Done restarting vpcs$inzone. \n"
+        echo -e "Done restarting vpcs$inzone. \n" >>$LOGFILE
+        
+    fi
+}
+
 query_async_job_result() {
 while [ 1 ]
 do
@@ -329,7 +418,7 @@ sleep 5
 done
 }
 
-if [ "$system$router$all$help$redundant" == "" ]
+if [ "$system$router$all$help$redundant$vpc" == "" ]
 then
   usage
   exit
@@ -361,3 +450,10 @@ if [ "$redundant" == "1" ]
 then
       restart_networks
 fi
+
+if [ "$vpc" == "1" ]
+then
+      restart_vpcs
+fi
+
+


[41/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-4691: move egress rules host maintenance tests to maint folder

Signed-off-by: venkataswamybabu budumuru <ve...@citrix.com>


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

Branch: refs/heads/4.2
Commit: 6b28e03d6d88e9b6bd9d0521a45c93d5b4af6501
Parents: a34bf45
Author: SrikanteswaraRao Talluri <ka...@gmail.com>
Authored: Wed Sep 25 15:16:13 2013 +0530
Committer: venkataswamybabu budumuru <ve...@citrix.com>
Committed: Mon Sep 30 15:06:46 2013 +0530

----------------------------------------------------------------------
 .../maint/test_egress_rules_host_maintenance.py | 290 +++++++++++++++++++
 .../maint/test_host_high_availability.py        |   4 +-
 test/integration/component/test_egress_rules.py |  12 +-
 tools/marvin/marvin/integration/lib/base.py     |  10 +-
 .../demo/simulator/testcase/libs/base.py        |   8 +-
 5 files changed, 307 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6b28e03d/test/integration/component/maint/test_egress_rules_host_maintenance.py
----------------------------------------------------------------------
diff --git a/test/integration/component/maint/test_egress_rules_host_maintenance.py b/test/integration/component/maint/test_egress_rules_host_maintenance.py
new file mode 100644
index 0000000..6f0f768
--- /dev/null
+++ b/test/integration/component/maint/test_egress_rules_host_maintenance.py
@@ -0,0 +1,290 @@
+# 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.
+
+""" P1 for Egresss & Ingress rules
+"""
+#Import Local Modules
+import marvin
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from marvin.remoteSSHClient import remoteSSHClient
+from marvin.integration.lib.utils import *
+from marvin.integration.lib.base import *
+from marvin.integration.lib.common import *
+
+#Import System modules
+import time
+import subprocess
+
+
+class Services:
+    """Test Security groups Services
+    """
+
+    def __init__(self):
+        self.services = {
+                "account": {
+                    "email": "test@test.com",
+                    "firstname": "Test",
+                    "lastname": "User",
+                    "username": "test",
+                    # Random characters are appended in create account to
+                    # ensure unique username generated each time
+                    "password": "password",
+                },
+                "virtual_machine": {
+                # Create a small virtual machine instance with disk offering
+                    "displayname": "Test VM",
+                    "username": "root",     # VM creds for SSH
+                    "password": "password",
+                    "ssh_port": 22,
+                    "hypervisor": 'XenServer',
+                    "privateport": 22,
+                    "publicport": 22,
+                    "protocol": 'TCP',
+                    "userdata": 'This is sample data',
+                },
+                "service_offering": {
+                    "name": "Tiny Instance",
+                    "displaytext": "Tiny Instance",
+                    "cpunumber": 1,
+                    "cpuspeed": 100,    # in MHz
+                    "memory": 128,       # In MBs
+                },
+                "security_group": {
+                    "name": 'SSH',
+                    "protocol": 'TCP',
+                    "startport": 22,
+                    "endport": 22,
+                    "cidrlist": '0.0.0.0/0',
+                },
+            "ostype": 'CentOS 5.3 (64-bit)',
+            # CentOS 5.3 (64-bit)
+            "sleep": 60,
+            "timeout": 10,
+        }
+
+
+class TestEgressAfterHostMaintenance(cloudstackTestCase):
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created templates
+            cleanup_resources(self.apiclient, self.cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @classmethod
+    def setUpClass(cls):
+        cls.services = Services().services
+        cls.api_client = super(
+                               TestEgressAfterHostMaintenance,
+                               cls
+                               ).getClsTestClient().getApiClient()
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.services['mode'] = cls.zone.networktype
+        cls.pod = get_pod(
+                          cls.api_client,
+                          zoneid=cls.zone.id
+                          )
+
+        template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostype"]
+                            )
+        cls.services["domainid"] = cls.domain.id
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"]
+                                            )
+        cls.account = Account.create(
+                            cls.api_client,
+                            cls.services["account"],
+                            domainid=cls.domain.id
+                            )
+        cls.services["account"] = cls.account.name
+        cls._cleanup = [
+                        cls.account,
+                        cls.service_offering
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+
+        return
+
+    @attr(speed = "slow")
+    @attr(tags = ["sg", "eip", "maintenance"])
+    def test_egress_after_host_maintenance(self):
+        """Test maintenance case for egress
+        """
+
+        # Validate the following:
+        # 1. createaccount of type user
+        # 2. createsecuritygroup (ssh) for this account
+        # 3. authorizeSecurityGroupIngress to allow ssh access to the VM
+        # 4. authorizeSecurityGroupEgress to allow ssh access only out to
+        #    CIDR: 0.0.0.0/0
+        # 5. deployVirtualMachine into this security group (ssh)
+        # 6. deployed VM should be Running, ssh should be allowed into the VM
+        # 7. Enable maintenance mode for host, cance maintenance mode
+        # 8. User should be able to SSH into VM after maintainace
+
+        security_group = SecurityGroup.create(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=self.account.name,
+                                        domainid=self.account.domainid
+                                      )
+        self.debug("Created security group with ID: %s" % security_group.id)
+
+        # Default Security group should not have any ingress rule
+        sercurity_groups = SecurityGroup.list(
+                                        self.apiclient,
+                                        account=self.account.name,
+                                        domainid=self.account.domainid
+                                      )
+        self.assertEqual(
+                         isinstance(sercurity_groups, list),
+                         True,
+                         "Check for list security groups response"
+                         )
+
+        self.assertEqual(
+                            len(sercurity_groups),
+                            2,
+                            "Check List Security groups response"
+                            )
+        # Authorize Security group to SSH to VM
+        self.debug(
+                "Authorizing ingress rule for sec group ID: %s for ssh access"
+                                                        % security_group.id)
+        ingress_rule = security_group.authorize(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=self.account.name,
+                                        domainid=self.account.domainid
+                                        )
+
+        self.assertEqual(
+                          isinstance(ingress_rule, dict),
+                          True,
+                          "Check ingress rule created properly"
+                    )
+
+        ssh_rule = (ingress_rule["ingressrule"][0]).__dict__
+
+        # Authorize Security group to SSH to VM
+        self.debug(
+                "Authorizing egress rule for sec group ID: %s for ssh access"
+                                                        % security_group.id)
+        egress_rule = security_group.authorizeEgress(
+                                        self.apiclient,
+                                        self.services["security_group"],
+                                        account=self.account.name,
+                                        domainid=self.account.domainid
+                                        )
+
+        self.assertEqual(
+                          isinstance(egress_rule, dict),
+                          True,
+                          "Check egress rule created properly"
+                    )
+        ssh_egress_rule = (egress_rule["egressrule"][0]).__dict__
+
+        self.virtual_machine = VirtualMachine.create(
+                                    self.apiclient,
+                                    self.services["virtual_machine"],
+                                    accountid=self.account.name,
+                                    domainid=self.account.domainid,
+                                    serviceofferingid=self.service_offering.id,
+                                    securitygroupids=[security_group.id]
+                                )
+        self.debug("Deploying VM in account: %s" % self.account.name)
+
+        # Should be able to SSH VM
+        try:
+            self.debug("SSH into VM: %s" % self.virtual_machine.id)
+            ssh = self.virtual_machine.get_ssh_client()
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.virtual_machine.ipaddress, e)
+                      )
+        vms = VirtualMachine.list(
+                                    self.apiclient,
+                                    id=self.virtual_machine.id,
+                                    listall=True
+                          )
+        self.assertEqual(
+                          isinstance(vms, list),
+                          True,
+                          "Check list VMs response for valid host"
+                    )
+        vm = vms[0]
+
+        self.debug("Enabling host maintenance for ID: %s" % vm.hostid)
+        cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
+        cmd.id = vm.hostid
+        self.apiclient.prepareHostForMaintenance(cmd)
+
+        self.debug("Canceling host maintenance for ID: %s" % vm.hostid)
+        cmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
+        cmd.id = vm.hostid
+        self.apiclient.cancelHostMaintenance(cmd)
+
+        self.debug("Waiting for SSVMs to come up")
+        wait_for_ssvms(
+                       self.apiclient,
+                       zoneid=self.zone.id,
+                       podid=self.pod.id,
+                      )
+        self.debug("Starting VM: %s" % self.virtual_machine.id)
+
+        self.virtual_machine.start(self.apiclient)
+        # Should be able to SSH VM
+        try:
+            self.debug("SSH into VM: %s" % self.virtual_machine.id)
+            ssh = self.virtual_machine.get_ssh_client(reconnect=True)
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (self.virtual_machine.ipaddress, e)
+                      )
+        return

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6b28e03d/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 5fb047b..b4c50c7 100644
--- a/test/integration/component/maint/test_host_high_availability.py
+++ b/test/integration/component/maint/test_host_high_availability.py
@@ -616,7 +616,7 @@ class TestHostHighAvailability(cloudstackTestCase):
             "The virtual machine is not ha enabled so check if VM is created on host which is also not ha enabled"
         )
 
-        #put the Host in maintainance mode
+        #put the Host in maintenance mode
         self.debug("Enabling maintenance mode for host %s" % vm_with_ha_enabled.hostid)
         cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
         cmd.id = vm_with_ha_enabled.hostid
@@ -748,7 +748,7 @@ class TestHostHighAvailability(cloudstackTestCase):
             "The virtual machine is not ha enabled so check if VM is created on host which is also not ha enabled"
         )
 
-        #put the Host in maintainance mode
+        #put the Host in maintenance mode
         self.debug("Enabling maintenance mode for host %s" % vm_with_ha_disabled.hostid)
         cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
         cmd.id = vm_with_ha_disabled.hostid

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6b28e03d/test/integration/component/test_egress_rules.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_egress_rules.py b/test/integration/component/test_egress_rules.py
index 10e0d03..05b4544 100644
--- a/test/integration/component/test_egress_rules.py
+++ b/test/integration/component/test_egress_rules.py
@@ -2149,7 +2149,7 @@ class TestInvalidParametersForEgress(cloudstackTestCase):
         return
 
 
-class TestEgressAfterHostMaintainance(cloudstackTestCase):
+class TestEgressAfterHostMaintenance(cloudstackTestCase):
 
     def setUp(self):
 
@@ -2171,7 +2171,7 @@ class TestEgressAfterHostMaintainance(cloudstackTestCase):
     def setUpClass(cls):
         cls.services = Services().services
         cls.api_client = super(
-                               TestEgressAfterHostMaintainance,
+                               TestEgressAfterHostMaintenance,
                                cls
                                ).getClsTestClient().getApiClient()
 
@@ -2222,7 +2222,7 @@ class TestEgressAfterHostMaintainance(cloudstackTestCase):
 
     @attr(speed = "slow")
     @attr(tags = ["sg", "eip", "maintenance"])
-    def test_egress_after_host_maintainance(self):
+    def test_egress_after_host_maintenance(self):
         """Test maintenance case for egress
         """
 
@@ -2234,7 +2234,7 @@ class TestEgressAfterHostMaintainance(cloudstackTestCase):
         #    CIDR: 0.0.0.0/0
         # 5. deployVirtualMachine into this security group (ssh)
         # 6. deployed VM should be Running, ssh should be allowed into the VM
-        # 7. Enable maintainance mode for host, cance maintainance mode
+        # 7. Enable maintenance mode for host, cance maintenance mode
         # 8. User should be able to SSH into VM after maintainace
 
         security_group = SecurityGroup.create(
@@ -2329,12 +2329,12 @@ class TestEgressAfterHostMaintainance(cloudstackTestCase):
                     )
         vm = vms[0]
 
-        self.debug("Enabling host maintainance for ID: %s" % vm.hostid)
+        self.debug("Enabling host maintenance for ID: %s" % vm.hostid)
         cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
         cmd.id = vm.hostid
         self.apiclient.prepareHostForMaintenance(cmd)
 
-        self.debug("Canceling host maintainance for ID: %s" % vm.hostid)
+        self.debug("Canceling host maintenance for ID: %s" % vm.hostid)
         cmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
         cmd.id = vm.hostid
         self.apiclient.cancelHostMaintenance(cmd)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6b28e03d/tools/marvin/marvin/integration/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/base.py b/tools/marvin/marvin/integration/lib/base.py
index df81406..0d52224 100755
--- a/tools/marvin/marvin/integration/lib/base.py
+++ b/tools/marvin/marvin/integration/lib/base.py
@@ -1803,7 +1803,7 @@ class Host:
         return
 
     def enableMaintenance(self, apiclient):
-        """enables maintainance mode Host"""
+        """enables maintenance mode Host"""
 
         cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
         cmd.id = self.id
@@ -1811,14 +1811,14 @@ class Host:
 
     @classmethod
     def enableMaintenance(cls, apiclient, id):
-        """enables maintainance mode Host"""
+        """enables maintenance mode Host"""
 
         cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
         cmd.id = id
         return apiclient.prepareHostForMaintenance(cmd)
 
     def cancelMaintenance(self, apiclient):
-        """Cancels maintainance mode Host"""
+        """Cancels maintenance mode Host"""
 
         cmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
         cmd.id = self.id
@@ -1826,7 +1826,7 @@ class Host:
 
     @classmethod
     def cancelMaintenance(cls, apiclient, id):
-        """Cancels maintainance mode Host"""
+        """Cancels maintenance mode Host"""
 
         cmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
         cmd.id = id
@@ -1895,7 +1895,7 @@ class StoragePool:
         return
 
     def enableMaintenance(self, apiclient):
-        """enables maintainance mode Storage pool"""
+        """enables maintenance mode Storage pool"""
 
         cmd = enableStorageMaintenance.enableStorageMaintenanceCmd()
         cmd.id = self.id

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6b28e03d/tools/marvin/marvin/sandbox/demo/simulator/testcase/libs/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/sandbox/demo/simulator/testcase/libs/base.py b/tools/marvin/marvin/sandbox/demo/simulator/testcase/libs/base.py
index 0b5da5c..7c8546c 100644
--- a/tools/marvin/marvin/sandbox/demo/simulator/testcase/libs/base.py
+++ b/tools/marvin/marvin/sandbox/demo/simulator/testcase/libs/base.py
@@ -1053,8 +1053,8 @@ class Host:
         return
 
     def enableMaintenance(self, apiclient):
-        """enables maintainance mode Host"""
-        
+        """enables maintenance mode Host"""
+
         cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
         cmd.id = self.id
         return apiclient.prepareHostForMaintenance(cmd)
@@ -1113,8 +1113,8 @@ class StoragePool:
         return
 
     def enableMaintenance(self, apiclient):
-        """enables maintainance mode Storage pool"""
-        
+        """enables maintenance mode Storage pool"""
+
         cmd = enableStorageMaintenance.enableStorageMaintenanceCmd()
         cmd.id = self.id
         return apiclient.enableStorageMaintenance(cmd)


[04/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-4702: UI > Network menu > Add Guest Network dialog > UI shouldn't pass null zoneid to listnetworkofferings API when zone dropdown is empty (i.e. when no advanced zone exists).


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

Branch: refs/heads/4.2
Commit: 7f08333cc66f5e13bf66d0c4a086c56c69caf858
Parents: f4066b5
Author: Jessica Wang <je...@apache.org>
Authored: Wed Sep 18 16:43:18 2013 -0700
Committer: Jessica Wang <je...@apache.org>
Committed: Wed Sep 18 16:43:18 2013 -0700

----------------------------------------------------------------------
 ui/scripts/sharedFunctions.js | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7f08333c/ui/scripts/sharedFunctions.js
----------------------------------------------------------------------
diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js
index 16ca41f..5369cee 100644
--- a/ui/scripts/sharedFunctions.js
+++ b/ui/scripts/sharedFunctions.js
@@ -450,7 +450,14 @@ var addGuestNetworkDialog = {
                     label: 'label.network.offering',
                     docID: 'helpGuestNetworkZoneNetworkOffering',
                     dependsOn: ['zoneId', 'scope'],
-                    select: function(args) {
+                    select: function(args) {                    	
+                    	if(args.$form.find('.form-item[rel=zoneId]').find('select').val() == null || args.$form.find('.form-item[rel=zoneId]').find('select').val().length == 0) {
+                    		args.response.success({
+                                data: null
+                            });
+                    		return;
+                    	}
+                    	
                         var data = {
                             state: 'Enabled',
                             zoneid: args.$form.find('.form-item[rel=zoneId]').find('select').val()


[32/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
System vm not coming up in multizone upgraded enviornment if a system vm
template is register twice per zone.

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

Branch: refs/heads/4.2
Commit: 143fb72e8bf6dac9f9e0765943bc28d001a7f1d1
Parents: 5225bd4
Author: Min Chen <mi...@citrix.com>
Authored: Tue Sep 24 11:58:34 2013 -0700
Committer: Min Chen <mi...@citrix.com>
Committed: Tue Sep 24 11:58:34 2013 -0700

----------------------------------------------------------------------
 .../src/com/cloud/storage/dao/VMTemplateDaoImpl.java  | 14 +++++++++++++-
 .../secondary/SecondaryStorageManagerImpl.java        |  2 +-
 2 files changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/143fb72e/engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java
index 2aca203..7abb58c 100755
--- a/engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java
+++ b/engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java
@@ -30,6 +30,9 @@ import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
 import com.cloud.storage.VMTemplateStorageResourceAssoc;
+
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
 import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO;
 import org.apache.log4j.Logger;
@@ -70,6 +73,8 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
     VMTemplateZoneDao _templateZoneDao;
     @Inject
     VMTemplateDetailsDao _templateDetailsDao;
+    @Inject
+    DataStoreManager _dataStoreMgr;    
 
     @Inject
     ConfigurationDao _configDao;
@@ -338,6 +343,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
         readySystemTemplateSearch.and("templateType", readySystemTemplateSearch.entity().getTemplateType(), SearchCriteria.Op.EQ);
         SearchBuilder<TemplateDataStoreVO>  templateDownloadSearch = _templateDataStoreDao.createSearchBuilder();
         templateDownloadSearch.and("downloadState", templateDownloadSearch.entity().getDownloadState(), SearchCriteria.Op.EQ);
+        templateDownloadSearch.and("dataStoreId", templateDownloadSearch.entity().getDataStoreId(), SearchCriteria.Op.EQ);
         readySystemTemplateSearch.join("vmTemplateJoinTemplateStoreRef", templateDownloadSearch, templateDownloadSearch.entity().getTemplateId(),
                 readySystemTemplateSearch.entity().getId(), JoinBuilder.JoinType.INNER);
         SearchBuilder<HostVO> hostHyperSearch2 = _hostDao.createSearchBuilder();
@@ -795,7 +801,13 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
         sc.setJoinParameters("tmplHyper", "type", Host.Type.Routing);
         sc.setJoinParameters("tmplHyper", "zoneId", zoneId);
         sc.setJoinParameters("vmTemplateJoinTemplateStoreRef", "downloadState", VMTemplateStorageResourceAssoc.Status.DOWNLOADED);
-
+        DataStore secStore = this._dataStoreMgr.getImageStore(zoneId);
+        if (secStore != null) {
+            sc.setJoinParameters("vmTemplateJoinTemplateStoreRef", "dataStoreId", secStore.getId());
+        } else{
+            s_logger.warn("No secondary storage is available in data center " + zoneId);
+        }
+        
         // order by descending order of id
         List<VMTemplateVO> tmplts = listBy(sc, new Filter(VMTemplateVO.class, "id", false, null, null));
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/143fb72e/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java b/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
index ba677a0..04fb844 100755
--- a/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
+++ b/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
@@ -743,7 +743,7 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
             DataStore store = templateMgr.getImageStore(dataCenterId, template.getId());
             if (store == null) {
                 if (s_logger.isDebugEnabled()) {
-                    s_logger.debug("No secondary storage available in zone " + dataCenterId + ", wait until it is ready to launch secondary storage vm");
+                    s_logger.debug("Secondary storage VM template " + template.getId() + " is not available in zone " + dataCenterId + ", wait until it is ready to launch secondary storage vm");
                 }
                 return false;
             }


[50/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
Merging 4.2-forward into 4.2


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

Branch: refs/heads/4.2
Commit: 86c93637f59dd9ec0fbe666e44cb541e3a52b488
Parents: 78517ee 4533d2d
Author: animesh <an...@apache.org>
Authored: Wed Oct 2 23:05:34 2013 -0700
Committer: animesh <an...@apache.org>
Committed: Wed Oct 2 23:05:34 2013 -0700

----------------------------------------------------------------------
 agent/bindir/cloudstack-agent-upgrade.in        |   13 +
 .../consoleproxy/ConsoleProxyResource.java      |   25 +-
 api/src/com/cloud/event/EventTypes.java         |    1 +
 .../api/command/user/vm/DeployVMCmd.java        |    3 +
 client/tomcatconf/commands.properties.in        |    3 +-
 debian/cloudstack-agent.install                 |    1 +
 debian/cloudstack-agent.postinst                |   10 +-
 debian/cloudstack-usage.postinst                |   12 +-
 debian/rules                                    |    5 +-
 docs/en-US/accessing-system-vms.xml             |   66 +
 docs/en-US/images/change-affinity-button.png    |  Bin 0 -> 7300 bytes
 docs/en-US/images/dedicate-resource-button.png  |  Bin 0 -> 7144 bytes
 docs/en-US/images/edit-traffic-type.png         |  Bin 0 -> 93662 bytes
 docs/en-US/images/plugin1.jpg                   |  Bin 0 -> 32999 bytes
 docs/en-US/images/plugin2.jpg                   |  Bin 0 -> 35149 bytes
 docs/en-US/images/plugin3.jpg                   |  Bin 0 -> 41983 bytes
 docs/en-US/images/plugin4.jpg                   |  Bin 0 -> 32125 bytes
 docs/en-US/images/plugin_intro.jpg              |  Bin 0 -> 22247 bytes
 docs/en-US/images/traffic-type.png              |  Bin 0 -> 19159 bytes
 docs/en-US/images/view-systemvm-details.png     |  Bin 0 -> 25483 bytes
 docs/en-US/images/workloads.png                 |  Bin 0 -> 69265 bytes
 docs/en-US/third-party-ui-plugin.xml            |  364 +++++
 docs/qig/publican.cfg                           |   22 +
 .../cloudstack/storage/command/CopyCommand.java |    4 +
 .../storage/datastore/db/StoragePoolVO.java     |    3 +-
 .../cloud/storage/dao/VMTemplateDaoImpl.java    |   14 +-
 .../com/cloud/upgrade/dao/Upgrade410to420.java  |  162 +-
 .../motion/AncientDataMotionStrategy.java       |    7 +
 .../storage/motion/DataMotionServiceImpl.java   |    3 +
 .../snapshot/XenserverSnapshotStrategy.java     |   21 +-
 .../storage/datastore/PrimaryDataStoreImpl.java |    6 +-
 .../storage/volume/VolumeServiceImpl.java       |   38 +-
 packaging/centos63/cloud.spec                   |    7 +
 packaging/debian/init/cloud-agent               |    2 +-
 patches/systemvm/debian/config/etc/init.d/cloud |   26 +-
 .../debian/config/etc/init.d/cloud-early-config |    2 +-
 .../redundant_router/check_heartbeat.sh.templ   |    2 +-
 .../kvm/resource/BridgeVifDriver.java           |   13 +-
 .../kvm/resource/LibvirtComputingResource.java  |   16 +-
 .../kvm/storage/KVMStoragePoolManager.java      |   14 +-
 .../kvm/storage/KVMStorageProcessor.java        |   26 +-
 .../kvm/storage/LibvirtStorageAdaptor.java      |   27 +-
 .../hypervisor/kvm/storage/StorageAdaptor.java  |    4 +-
 .../apache/cloudstack/utils/qemu/QemuImg.java   |   11 +-
 .../cloudstack/utils/qemu/QemuImgTest.java      |   20 +-
 plugins/hypervisors/ucs/pom.xml                 |    5 +
 .../src/com/cloud/ucs/manager/UcsCommands.java  |   31 +-
 .../com/cloud/ucs/manager/UcsHttpClient.java    |    7 +-
 .../src/com/cloud/ucs/manager/UcsManager.java   |    2 +
 .../com/cloud/ucs/manager/UcsManagerImpl.java   |   52 +-
 .../src/com/cloud/ucs/structure/UcsProfile.java |    0
 .../api/DisassociateUcsProfileCmd.java          |   61 +
 .../com/cloud/hypervisor/guru/VMwareGuru.java   |    1 +
 .../vmware/manager/VmwareManager.java           |    1 +
 .../vmware/manager/VmwareManagerImpl.java       |   53 +-
 .../manager/VmwareStorageManagerImpl.java       |   34 +-
 .../vmware/resource/VmwareContextFactory.java   |   15 +-
 .../vmware/resource/VmwareResource.java         |  156 +-
 .../VmwareSecondaryStorageContextFactory.java   |   10 +
 .../VmwareSecondaryStorageResourceHandler.java  |    1 +
 .../resource/VmwareStorageProcessor.java        |   28 +-
 .../VmwareStorageSubsystemCommandHandler.java   |   10 +-
 .../vmware/VmwareDatacenterApiUnitTest.java     |    6 +
 .../xen/resource/CitrixResourceBase.java        |  117 +-
 .../xen/resource/XenServer56FP1Resource.java    |    1 +
 .../xen/resource/XenServer56Resource.java       |   44 -
 .../xen/resource/XenServer610Resource.java      |   30 +-
 python/lib/cloudutils/serviceConfig.py          |    3 +-
 scripts/vm/hypervisor/xenserver/vmops           |   12 +-
 scripts/vm/network/security_group.py            |   19 +-
 .../cloud/agent/manager/AgentManagerImpl.java   |    5 +-
 .../com/cloud/api/query/QueryManagerImpl.java   |   13 +-
 .../cloud/api/query/dao/UserVmJoinDaoImpl.java  |   25 +-
 server/src/com/cloud/configuration/Config.java  |    1 +
 .../configuration/ConfigurationManagerImpl.java |    2 +-
 .../deploy/DeploymentPlanningManagerImpl.java   |   24 +-
 .../com/cloud/network/NetworkManagerImpl.java   |   15 +-
 .../network/firewall/FirewallManagerImpl.java   |   14 +-
 .../VirtualNetworkApplianceManagerImpl.java     |    7 +-
 .../com/cloud/resource/ResourceManagerImpl.java |   20 +-
 .../com/cloud/storage/VolumeManagerImpl.java    |  110 +-
 .../secondary/SecondaryStorageManagerImpl.java  |    2 +-
 .../com/cloud/template/TemplateManagerImpl.java |   10 +-
 server/src/com/cloud/vm/UserVmManagerImpl.java  |    6 +-
 server/test/com/cloud/vm/UserVmManagerTest.java |    6 +-
 .../resource/NfsSecondaryStorageResource.java   |   32 +-
 .../component/cpu_limits/__init__.py            |   16 +
 .../component/cpu_limits/test_cpu_limits.py     |  553 ++++---
 .../component/cpu_limits/test_domain_limits.py  |  557 ++++---
 .../component/cpu_limits/test_maximum_limits.py |  240 ++-
 .../component/cpu_limits/test_project_limits.py |  166 +-
 .../maint/test_egress_rules_host_maintenance.py |  290 ++++
 .../maint/test_host_high_availability.py        |    4 +-
 .../component/maint/test_multiple_ip_ranges.py  |  337 ++++
 .../memory_limits/test_domain_limits.py         |  288 ++--
 .../memory_limits/test_maximum_limits.py        |  205 ++-
 .../memory_limits/test_memory_limits.py         |  528 +++---
 .../memory_limits/test_project_limits.py        |  141 +-
 .../component/test_affinity_groups.py           |    2 +-
 .../component/test_egress_fw_rules.py           |   38 +-
 test/integration/component/test_egress_rules.py |   12 +-
 .../component/test_ip_reservation.py            |  316 ++++
 .../component/test_multiple_ip_ranges.py        |   75 +-
 .../component/test_netscaler_configs.py         |   47 +-
 test/integration/component/test_netscaler_lb.py |   20 +-
 .../component/test_netscaler_lb_algo.py         |   18 +-
 .../component/test_netscaler_lb_sticky.py       |    2 +-
 .../component/test_netscaler_nw_off.py          |  704 +++++++-
 .../component/test_network_offering.py          |  628 --------
 test/integration/component/test_portable_ip.py  | 1309 +++++++++++++++
 .../component/test_redundant_router_cleanups.py |    2 +-
 .../component/test_reset_ssh_keypair.py         | 1517 ++++++++++++++++++
 .../component/test_shared_networks.py           |    3 +-
 test/integration/component/test_stopped_vm.py   |  148 ++
 test/integration/component/test_templates.py    |   76 +-
 .../component/test_vpc_network_lbrules.py       |   30 +
 test/integration/smoke/test_network.py          |   12 +-
 .../smoke/test_reset_vm_on_reboot.py            |  219 +++
 test/integration/smoke/test_ssvm.py             |   63 +-
 tools/devcloud/devcloud-advanced.cfg            |    4 +-
 tools/devcloud/devcloud-advancedsg.cfg          |    4 +-
 tools/marvin/marvin/deployDataCenter.py         |    1 -
 tools/marvin/marvin/integration/lib/base.py     |   45 +-
 tools/marvin/marvin/integration/lib/common.py   |  140 +-
 tools/marvin/marvin/integration/lib/utils.py    |   19 +-
 .../demo/simulator/testcase/libs/base.py        |    8 +-
 ui/css/cloudstack3.css                          |    9 +-
 ui/index.jsp                                    |   61 +-
 ui/scripts/instances.js                         |   64 +-
 ui/scripts/network.js                           |   89 +-
 ui/scripts/sharedFunctions.js                   |  733 ++++++++-
 ui/scripts/system.js                            |  147 +-
 ui/scripts/templates.js                         |    9 +-
 ui/scripts/ui-custom/zoneWizard.js              |  131 +-
 ui/scripts/ui/widgets/detailView.js             |    8 +-
 ui/scripts/ui/widgets/listView.js               |    2 +-
 ui/scripts/ui/widgets/notifications.js          |    2 +-
 ui/scripts/zoneWizard.js                        |  230 +--
 .../vmware/mo/CustomFieldConstants.java         |    2 +
 .../hypervisor/vmware/mo/DatacenterMO.java      |    8 +-
 .../vmware/mo/HypervisorHostHelper.java         |   20 +-
 .../hypervisor/vmware/mo/VirtualMachineMO.java  |   32 +-
 .../hypervisor/vmware/util/VmwareClient.java    |   51 +-
 .../hypervisor/vmware/util/VmwareContext.java   |    4 +
 .../hypervisor/vmware/util/VmwareHelper.java    |   44 +-
 145 files changed, 9440 insertions(+), 2937 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/86c93637/debian/rules
----------------------------------------------------------------------
diff --cc debian/rules
index e88b226,7cbb9ed..e4c51fb
--- a/debian/rules
+++ b/debian/rules
@@@ -143,9 -145,10 +145,10 @@@ install
  	mkdir $(DESTDIR)/var/log/$(PACKAGE)/usage
  	mkdir $(DESTDIR)/usr/share/$(PACKAGE)-usage
  	mkdir $(DESTDIR)/usr/share/$(PACKAGE)-usage/plugins
 -	install -D usage/target/cloud-usage-$(VERSION)-SNAPSHOT.jar $(DESTDIR)/usr/share/$(PACKAGE)-usage/lib/$(PACKAGE)-usage.jar
 +	install -D usage/target/cloud-usage-$(VERSION).jar $(DESTDIR)/usr/share/$(PACKAGE)-usage/lib/$(PACKAGE)-usage.jar
  	install -D usage/target/dependencies/* $(DESTDIR)/usr/share/$(PACKAGE)-usage/lib/
- 	cp usage/target/transformed/* $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/usage/
+ 	cp usage/target/transformed/db.properties $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/usage/
+ 	cp usage/target/transformed/log4j-cloud_usage.xml $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/usage/log4j-cloud.xml
  	install -D packaging/debian/init/cloud-usage $(DESTDIR)/$(SYSCONFDIR)/init.d/$(PACKAGE)-usage
  
  	# cloudstack-awsapi

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/86c93637/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/86c93637/plugins/hypervisors/ucs/pom.xml
----------------------------------------------------------------------


[37/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-4734: Validate and Fail-over to another VmwareContext object when it is from the pool


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

Branch: refs/heads/4.2
Commit: 94c8e28f8d92ce711a5aaeabed52bb69ef3a6700
Parents: c9aa880
Author: Kelven Yang <ke...@gmail.com>
Authored: Fri Sep 27 15:11:07 2013 -0700
Committer: Kelven Yang <ke...@gmail.com>
Committed: Fri Sep 27 15:24:16 2013 -0700

----------------------------------------------------------------------
 .../vmware/resource/VmwareContextFactory.java   |  9 +++-
 .../VmwareSecondaryStorageContextFactory.java   | 10 ++++
 .../hypervisor/vmware/mo/DatacenterMO.java      |  8 ++-
 .../hypervisor/vmware/util/VmwareClient.java    | 51 +++++++++++++++++---
 .../hypervisor/vmware/util/VmwareContext.java   |  4 ++
 5 files changed, 71 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/94c8e28f/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareContextFactory.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareContextFactory.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareContextFactory.java
index ed607e1..3079998 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareContextFactory.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareContextFactory.java
@@ -80,8 +80,15 @@ public class VmwareContextFactory {
 	
 	public static VmwareContext getContext(String vCenterAddress, String vCenterUserName, String vCenterPassword) throws Exception {
 		VmwareContext context = s_pool.getContext(vCenterAddress, vCenterUserName);
-		if(context == null)
+		if(context == null) {
 			context = create(vCenterAddress, vCenterUserName, vCenterPassword);
+		} else {
+			if(!context.validate()) {
+				s_logger.info("Validation of the context faild. dispose and create a new one");
+				context.close();
+				context = create(vCenterAddress, vCenterUserName, vCenterPassword);
+			}
+		}
 		
 		if(context != null) {
 			context.registerStockObject(VmwareManager.CONTEXT_STOCK_NAME, s_vmwareMgr);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/94c8e28f/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageContextFactory.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageContextFactory.java b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageContextFactory.java
index 5365e58..253d6fd 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageContextFactory.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareSecondaryStorageContextFactory.java
@@ -16,11 +16,15 @@
 // under the License.
 package com.cloud.storage.resource;
 
+import org.apache.log4j.Logger;
+
 import com.cloud.hypervisor.vmware.util.VmwareClient;
 import com.cloud.hypervisor.vmware.util.VmwareContext;
 import com.cloud.hypervisor.vmware.util.VmwareContextPool;
 
 public class VmwareSecondaryStorageContextFactory {
+    private static final Logger s_logger = Logger.getLogger(VmwareSecondaryStorageContextFactory.class);
+    
 	private static volatile int s_seq = 1;
 
 	private static VmwareContextPool s_pool;
@@ -51,6 +55,12 @@ public class VmwareSecondaryStorageContextFactory {
 		VmwareContext context = s_pool.getContext(vCenterAddress, vCenterUserName);
 		if(context == null) {
 			context = create(vCenterAddress, vCenterUserName, vCenterPassword);
+		} else {
+			if(!context.validate()) {
+				s_logger.info("Validation of the context faild. dispose and create a new one");
+				context.close();
+				context = create(vCenterAddress, vCenterUserName, vCenterPassword);
+			}
 		}
 		
 		if(context != null) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/94c8e28f/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatacenterMO.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatacenterMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatacenterMO.java
index cabb60a..6d82aef 100755
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatacenterMO.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatacenterMO.java
@@ -20,6 +20,8 @@ package com.cloud.hypervisor.vmware.mo;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.log4j.Logger;
+
 import com.cloud.hypervisor.vmware.util.VmwareContext;
 import com.cloud.utils.Pair;
 import com.vmware.vim25.CustomFieldStringValue;
@@ -37,6 +39,7 @@ import com.vmware.vim25.VirtualEthernetCardDistributedVirtualPortBackingInfo;
 import edu.emory.mathcs.backport.java.util.Arrays;
 
 public class DatacenterMO extends BaseMO {
+    private static final Logger s_logger = Logger.getLogger(DatacenterMO.class);
 
 	public DatacenterMO(VmwareContext context, ManagedObjectReference morDc) {
 		super(context, morDc);
@@ -50,7 +53,9 @@ public class DatacenterMO extends BaseMO {
 		super(context, null);
 
 		_mor = _context.getVimClient().getDecendentMoRef(_context.getRootFolder(), "Datacenter", dcName);
-		assert(_mor != null);
+		if(_mor == null) {
+			s_logger.error("Unable to locate DC " + dcName);
+		}
 	}
 
 	@Override
@@ -61,7 +66,6 @@ public class DatacenterMO extends BaseMO {
 	public void registerTemplate(ManagedObjectReference morHost, String datastoreName,
 		String templateName, String templateFileName) throws Exception {
 
-
 		ManagedObjectReference morFolder = (ManagedObjectReference)_context.getVimClient().getDynamicProperty(
 			_mor, "vmFolder");
 		assert(morFolder != null);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/94c8e28f/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java
index 6ab9700..ff13b1c 100644
--- a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java
@@ -109,7 +109,6 @@ public class VmwareClient {
     }
 
     private ManagedObjectReference SVC_INST_REF = new ManagedObjectReference();
-    private ManagedObjectReference propCollectorRef;
     private static VimService vimService;
     private VimPortType vimPort;
     private String serviceCookie;
@@ -153,8 +152,6 @@ public class VmwareClient {
 
         vimPort.login(serviceContent.getSessionManager(), userName, password, null);
         isConnected = true;
-
-        propCollectorRef = serviceContent.getPropertyCollector();
     }
 
     /**
@@ -199,7 +196,7 @@ public class VmwareClient {
      * @return Service property collector
      */
     public ManagedObjectReference getPropCol() {
-        return propCollectorRef;
+        return getServiceContent().getPropertyCollector();
     }
 
     /**
@@ -209,6 +206,43 @@ public class VmwareClient {
         return getServiceContent().getRootFolder();
     }
 
+	public boolean validate() {
+		//
+		// There is no official API to validate an open vCenter API session. This is hacking way to tell if
+		// an open vCenter API session is still valid for making calls.
+		//
+		// It will give false result if there really does not exist data-center in the inventory, however, I consider
+		// this really is not possible in production deployment
+		//
+		
+        // Create PropertySpecs
+        PropertySpec pSpec = new PropertySpec();
+        pSpec.setType("Datacenter");
+        pSpec.setAll(false);
+        pSpec.getPathSet().add("name");
+
+        ObjectSpec oSpec = new ObjectSpec();
+        oSpec.setObj(getRootFolder());
+        oSpec.setSkip(false);
+        oSpec.getSelectSet().addAll(constructCompleteTraversalSpec());
+
+        PropertyFilterSpec spec = new PropertyFilterSpec();
+        spec.getPropSet().add(pSpec);
+        spec.getObjectSet().add(oSpec);
+        List<PropertyFilterSpec> specArr = new ArrayList<PropertyFilterSpec>();
+        specArr.add(spec);
+
+        try {
+        	List<ObjectContent> ocary = vimPort.retrieveProperties(getPropCol(), specArr);
+        	if(ocary != null && ocary.size() > 0)
+        		return true;
+        } catch(Exception e) {
+        	return false;
+        }
+        
+        return false;
+	}
+    
     /**
      * Get the property value of a managed object.
      *
@@ -268,7 +302,7 @@ public class VmwareClient {
         List<PropertyFilterSpec> specArr = new ArrayList<PropertyFilterSpec>();
         specArr.add(spec);
 
-        return vimPort.retrieveProperties(propCollectorRef, specArr);
+        return vimPort.retrieveProperties(getPropCol(), specArr);    
     }
 
     public boolean waitForTask2(ManagedObjectReference task) throws RuntimeFaultFaultMsg, RemoteException, InterruptedException {
@@ -416,7 +450,8 @@ public class VmwareClient {
         pSpec.setType(objmor.getType());
         spec.getPropSet().add(pSpec);
 
-        ManagedObjectReference filterSpecRef = vimPort.createFilter(propCollectorRef, spec, true);
+        ManagedObjectReference propertyCollector = this.getPropCol();
+        ManagedObjectReference filterSpecRef = vimPort.createFilter(propertyCollector, spec, true);
 
         boolean reached = false;
 
@@ -425,7 +460,7 @@ public class VmwareClient {
         List<ObjectUpdate> objupary = null;
         List<PropertyChange> propchgary = null;
         while (!reached) {
-            updateset = vimPort.waitForUpdates(propCollectorRef, version);
+            updateset = vimPort.waitForUpdates(propertyCollector, version);
             if (updateset == null || updateset.getFilterSet() == null) {
                 continue;
             }
@@ -628,7 +663,7 @@ public class VmwareClient {
         List<PropertyFilterSpec> specArr = new ArrayList<PropertyFilterSpec>();
         specArr.add(spec);
 
-        List<ObjectContent> ocary = vimPort.retrieveProperties(propCollectorRef, specArr);
+        List<ObjectContent> ocary = vimPort.retrieveProperties(getPropCol(), specArr);
 
         if (ocary == null || ocary.size() == 0) {
             return null;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/94c8e28f/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareContext.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareContext.java b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareContext.java
index 6c3dab7..c499576 100755
--- a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareContext.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareContext.java
@@ -102,6 +102,10 @@ public class VmwareContext {
 		if(s_logger.isInfoEnabled())
 			s_logger.info("New VmwareContext object, current outstanding count: " + getOutstandingContextCount());
 	}
+	
+	public boolean validate() {
+		return _vimClient.validate();
+	}
 
 	public void registerStockObject(String name, Object obj) {
 		synchronized(_stockMap) {


[06/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
Storage type was set to local due to which tests failed. Removed it.

Signed-off-by: Prasanna Santhanam <ts...@apache.org>
(cherry picked from commit a726bfdba5bc0bdf72bea151c28f40d75f566a85)


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

Branch: refs/heads/4.2
Commit: 25cf6c9bed7244d4205d0d0026cc0f36a1c2c5bb
Parents: 78b912e
Author: Girish Shilamkar <gi...@clogeny.com>
Authored: Thu Sep 19 02:28:07 2013 -0400
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Thu Sep 19 19:11:19 2013 +0530

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25cf6c9b/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 8b499d0..ace4499 100644
--- a/test/integration/component/test_reset_ssh_keypair.py
+++ b/test/integration/component/test_reset_ssh_keypair.py
@@ -59,7 +59,6 @@ class Services:
                         "cpunumber": 1,
                         "cpuspeed": 100,
                         "memory": 128,
-                        "storagetype": "local"
                 },
                 "egress": {
                     "name": 'web',


[36/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
add missing cloudstack-agent-upgrade in cloudstack-agent debian packages
(cherry picked from commit a6bfd9602129d8ae308ba58f36623c04826e15ca)


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

Branch: refs/heads/4.2
Commit: c9aa8800ceca288675242fd7311b5190faf6019a
Parents: 92e9f6d
Author: Wei Zhou <w....@leaseweb.com>
Authored: Fri Sep 27 10:31:54 2013 +0200
Committer: Wei Zhou <w....@leaseweb.com>
Committed: Fri Sep 27 10:32:50 2013 +0200

----------------------------------------------------------------------
 debian/cloudstack-agent.install | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c9aa8800/debian/cloudstack-agent.install
----------------------------------------------------------------------
diff --git a/debian/cloudstack-agent.install b/debian/cloudstack-agent.install
index a3cc869..d708514 100644
--- a/debian/cloudstack-agent.install
+++ b/debian/cloudstack-agent.install
@@ -21,6 +21,7 @@
 /etc/init.d/cloudstack-agent
 /usr/bin/cloudstack-setup-agent
 /usr/bin/cloudstack-ssh
+/usr/bin/cloudstack-agent-upgrade
 /var/log/cloudstack/agent
 /usr/share/cloudstack-agent/lib/*
 /usr/share/cloudstack-agent/plugins


[24/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-4716: upgrade resource count (cpu,memory,primary_storage,secondary_storage) in the upgrade to 4.2


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

Branch: refs/heads/4.2
Commit: 38bbfdc89a50bbb9464700d202d1cfa7b7955953
Parents: 0363b4a
Author: Wei Zhou <w....@leaseweb.com>
Authored: Mon Sep 23 14:13:31 2013 +0200
Committer: Wei Zhou <w....@leaseweb.com>
Committed: Mon Sep 23 14:14:01 2013 +0200

----------------------------------------------------------------------
 .../com/cloud/upgrade/dao/Upgrade410to420.java  | 149 +++++++++++++++++++
 1 file changed, 149 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/38bbfdc8/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
index 646b406..cd4a959 100755
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
@@ -115,6 +115,7 @@ public class Upgrade410to420 implements DbUpgrade {
         migrateVolumeOnSecondaryStorage(conn);
         createFullCloneFlag(conn);
         upgradeVpcServiceMap(conn);
+        upgradeResourceCount(conn);
     }
 
     private void createFullCloneFlag(Connection conn) {
@@ -3012,4 +3013,152 @@ public class Upgrade410to420 implements DbUpgrade {
             }
         }
     }
+
+    private void upgradeResourceCount(Connection conn) {
+        s_logger.debug("upgradeResourceCount start");
+        PreparedStatement pstmt1 = null;
+        PreparedStatement pstmt2 = null;
+        PreparedStatement pstmt3 = null;
+        PreparedStatement pstmt4 = null;
+        PreparedStatement pstmt5 = null;
+        ResultSet rs = null;
+        ResultSet rsAccount = null;
+        ResultSet rsCount = null;
+        try {
+            pstmt1 = conn.prepareStatement("select id, domain_id FROM `cloud`.`account` where removed is NULL ");
+            rsAccount = pstmt1.executeQuery();
+            while (rsAccount.next()) {
+                long account_id = rsAccount.getLong(1);
+                long domain_id = rsAccount.getLong(2);
+                // 1. update cpu,memory for all accounts
+                pstmt2 = conn.prepareStatement( "SELECT SUM(service_offering.cpu), SUM(service_offering.ram_size)" +
+                            " FROM `cloud`.`vm_instance`, `cloud`.`service_offering`" +
+                            " WHERE vm_instance.service_offering_id = service_offering.id AND vm_instance.account_id = ?" + " AND vm_instance.removed is NULL" +
+                            " AND vm_instance.vm_type='User' AND state not in ('Destroyed', 'Error', 'Expunging')");
+                pstmt2.setLong(1, account_id);
+                rsCount = pstmt2.executeQuery();
+                if (rsCount.next()) {
+                    upgradeResourceCountforAccount(conn, account_id, domain_id, "cpu", rsCount.getLong(1));
+                    upgradeResourceCountforAccount(conn, account_id, domain_id, "memory", rsCount.getLong(2));
+                } else {
+                    upgradeResourceCountforAccount(conn, account_id, domain_id, "cpu", 0L);
+                    upgradeResourceCountforAccount(conn, account_id, domain_id, "memory", 0L);
+                }
+                // 2. update primary_storage for all accounts
+                pstmt3 = conn.prepareStatement("SELECT sum(size) FROM `cloud`.`volumes` WHERE account_id= ?" +
+                        " AND (path is not NULL OR state in ('Allocated')) AND removed is NULL" +
+                        " AND instance_id IN (SELECT id FROM `cloud`.`vm_instance` WHERE vm_type='User')");
+                pstmt3.setLong(1, account_id);
+                rsCount = pstmt3.executeQuery();
+                if (rsCount.next()) {
+                    upgradeResourceCountforAccount(conn, account_id, domain_id, "primary_storage", rsCount.getLong(1));
+                } else {
+                    upgradeResourceCountforAccount(conn, account_id, domain_id, "primary_storage", 0L);
+                }
+                // 3. update secondary_storage for all accounts
+                long totalVolumesSize = 0;
+                long totalSnapshotsSize = 0;
+                long totalTemplatesSize = 0;
+                pstmt4 = conn.prepareStatement("SELECT sum(size) FROM `cloud`.`volumes` WHERE account_id= ?" +
+                        " AND path is NULL AND state not in ('Allocated') AND removed is NULL");
+                pstmt4.setLong(1, account_id);
+                rsCount = pstmt4.executeQuery();
+                if (rsCount.next()) {
+                    totalVolumesSize = rsCount.getLong(1);
+                }
+                pstmt4 = conn.prepareStatement("SELECT sum(size) FROM `cloud`.`snapshots` WHERE account_id= ? AND removed is NULL");
+                pstmt4.setLong(1, account_id);
+                rsCount = pstmt4.executeQuery();
+                if (rsCount.next()) {
+                    totalSnapshotsSize = rsCount.getLong(1);
+                }
+                pstmt4 = conn.prepareStatement("SELECT sum(template_store_ref.size) FROM `cloud`.`template_store_ref`,`cloud`.`vm_template` WHERE account_id = ?" +
+                		" AND template_store_ref.template_id = vm_template.id AND download_state = 'DOWNLOADED' AND destroyed = false AND removed is NULL");
+                pstmt4.setLong(1, account_id);
+                rsCount = pstmt4.executeQuery();
+                if (rsCount.next()) {
+                    totalTemplatesSize = rsCount.getLong(1);
+                }
+                upgradeResourceCountforAccount(conn, account_id, domain_id, "secondary_storage", totalVolumesSize + totalSnapshotsSize + totalTemplatesSize);
+            }
+            // 4. upgrade cpu,memory,primary_storage,secondary_storage for domains
+            String resource_types[] = {"cpu","memory", "primary_storage", "secondary_storage"};
+            pstmt5 = conn.prepareStatement("select id FROM `cloud`.`domain`");
+            rsAccount = pstmt5.executeQuery();
+            while (rsAccount.next()) {
+                long domain_id = rsAccount.getLong(1);
+                for(int count=0; count < resource_types.length; count++) {
+                    String resource_type = resource_types[count];
+                    upgradeResourceCountforDomain(conn, domain_id, resource_type, 0L); // reset value to 0 before statistics
+                }
+            }
+            for(int count= 0; count < resource_types.length; count++) {
+                String resource_type = resource_types[count];
+                pstmt5 = conn.prepareStatement("select account.domain_id,sum(resource_count.count) from `cloud`.`account` left join `cloud`.`resource_count` on account.id=resource_count.account_id " +
+                        "where resource_count.type=? group by account.domain_id;");
+                pstmt5.setString(1, resource_type);
+                rsCount = pstmt5.executeQuery();
+                while (rsCount.next()) {
+                    long domain_id = rsCount.getLong(1);
+                    long resource_count = rsCount.getLong(2);
+                    upgradeResourceCountforDomain(conn, domain_id, resource_type, resource_count);
+                }
+            }
+            s_logger.debug("upgradeResourceCount finish");
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("Unable to upgrade resource count (cpu,memory,primary_storage,secondary_storage) ", e);
+        } finally {
+            try {
+                if (rs != null) {
+                    rs.close();
+                }
+                if (rsAccount != null) {
+                    rsAccount.close();
+                }
+                if (rsCount != null) {
+                    rsCount.close();
+                }
+                if (pstmt1 != null) {
+                    pstmt1.close();
+                }
+                if (pstmt2 != null) {
+                    pstmt2.close();
+                }
+                if (pstmt3 != null) {
+                    pstmt3.close();
+                }
+                if (pstmt4 != null) {
+                    pstmt4.close();
+                }
+                if (pstmt5 != null) {
+                    pstmt5.close();
+                }
+            } catch (SQLException e) {
+            }
+        }
+    }
+
+    private static void upgradeResourceCountforAccount(Connection conn, Long account_id, Long domain_id, String type, Long resource_count) throws SQLException {
+        //update or insert into resource_count table.
+        PreparedStatement pstmt = null;
+        pstmt = conn.prepareStatement("INSERT INTO `cloud`.`resource_count` (account_id, type, count) VALUES (?,?,?) ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id), count=?");
+        pstmt.setLong(1, account_id);
+        pstmt.setString(2, type);
+        pstmt.setLong(3, resource_count);
+        pstmt.setLong(4, resource_count);
+        pstmt.executeUpdate();
+        pstmt.close();
+    }
+    
+    private static void upgradeResourceCountforDomain(Connection conn, Long domain_id, String type, Long resource_count) throws SQLException {
+        //update or insert into resource_count table.
+        PreparedStatement pstmt = null;
+        pstmt = conn.prepareStatement("INSERT INTO `cloud`.`resource_count` (domain_id, type, count) VALUES (?,?,?) ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id), count=?");
+        pstmt.setLong(1, domain_id);
+        pstmt.setString(2, type);
+        pstmt.setLong(3, resource_count);
+        pstmt.setLong(4, resource_count);
+        pstmt.executeUpdate();
+        pstmt.close();
+    }
 }


[03/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-4700: UI > Instances > Reset VM action > if the template from which vm is created is password-enabled, pop up "Password hsa been reset to xxxxxxx" dialog.


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

Branch: refs/heads/4.2
Commit: f4066b51fbbeed3101e017050535f2796a3f0667
Parents: e49f14b
Author: Jessica Wang <je...@apache.org>
Authored: Wed Sep 18 11:39:37 2013 -0700
Committer: Jessica Wang <je...@apache.org>
Committed: Wed Sep 18 11:41:30 2013 -0700

----------------------------------------------------------------------
 ui/scripts/instances.js             | 32 ++++++++++++++++++++------------
 ui/scripts/ui/widgets/detailView.js |  8 +++++---
 2 files changed, 25 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f4066b51/ui/scripts/instances.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js
index 20d3d9a..cf8aca5 100644
--- a/ui/scripts/instances.js
+++ b/ui/scripts/instances.js
@@ -605,6 +605,12 @@
                             },
                             notification: function(args) {
                                 return 'Reset VM';
+                            },
+                            complete: function(args) {
+                            	if (args.password != null && args.password.length > 0)
+                                    return 'Password has been reset to ' + args.password;
+                            	else
+                            		return null;
                             }
                         },
 
@@ -613,24 +619,26 @@
                                 url: createURL("restoreVirtualMachine&virtualmachineid=" + args.context.instances[0].id),
                                 dataType: "json",
                                 async: true,
-                                success: function(json) {
-                                    var item = json.restorevmresponse;
-                                    args.response.success({
-                                        data: item
-                                    });
+                                success: function(json) {                                    
+                                	var jid = json.restorevmresponse.jobid;                                    	
+                                	args.response.success({
+                                        _custom: {
+                                            jobId: jid,
+                                            getUpdatedItem: function(json) {                                         
+                                                return json.queryasyncjobresultresponse.jobresult.virtualmachine;
+                                            },
+                                            getActionFilter: function() {
+                                                return vmActionfilter;
+                                            }
+                                        }
+                                    });                          	
                                 }
                             });
 
                         },
 
                         notification: {
-                            poll: function(args) {
-                                args.complete({
-                                    data: {
-                                        state: 'Stopped'
-                                    }
-                                });
-                            }
+                            poll: pollAsyncJobResult
                         }
 
                     },

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f4066b51/ui/scripts/ui/widgets/detailView.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/widgets/detailView.js b/ui/scripts/ui/widgets/detailView.js
index 3a59d41..0e975e4 100644
--- a/ui/scripts/ui/widgets/detailView.js
+++ b/ui/scripts/ui/widgets/detailView.js
@@ -223,9 +223,11 @@
                                         }
 
                                         if (messages.complete) {
-                                            cloudStack.dialog.notice({
-                                                message: messages.complete(args2.data)
-                                            });
+                                        	if( messages.complete(args2.data) != null && messages.complete(args2.data).length > 0) {
+                                        		 cloudStack.dialog.notice({
+                                                     message: messages.complete(args2.data)
+                                                 });
+                                        	} 
                                         }
                                         if (additional && additional.complete) additional.complete($.extend(true, args, {
                                             $detailView: $detailView


[12/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-4713: UI > EIP/ELB Basic Zone - fix a bug that IPs that are acquired are not showing in listView of IP Addresses page under Network menu.


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

Branch: refs/heads/4.2
Commit: e81a2b4ff29553f458ddabcad7e97236df2b52bc
Parents: fa29794
Author: Jessica Wang <je...@apache.org>
Authored: Thu Sep 19 16:44:42 2013 -0700
Committer: Jessica Wang <je...@apache.org>
Committed: Thu Sep 19 16:47:16 2013 -0700

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e81a2b4f/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index a09e565..9d4cf38 100755
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -2057,6 +2057,8 @@
                         var data = {};
                         listViewDataProvider(args, data);
 
+                        //The following 10 lines caused CLOUDSTACK-4713 (EIP/ELB Basic Zone - unable to see any IPs that are acquired)
+                        /*
                         if (g_supportELB == "guest") // IPs are allocated on guest network
                             $.extend(data, {
                                 forvirtualnetwork: false,
@@ -2067,6 +2069,7 @@
                                 forvirtualnetwork: true,
                                 forloadbalancing: true
                             });
+                        */
 
                         if (args.context.networks) {
                             $.extend(data, {


[05/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-1749: change cloud service name in systemvm


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

Branch: refs/heads/4.2
Commit: 78b912e38f550d93f1cc008236205b4df300e26f
Parents: 7f08333
Author: Wei Zhou <w....@leaseweb.com>
Authored: Thu Sep 19 10:52:28 2013 +0200
Committer: Wei Zhou <w....@leaseweb.com>
Committed: Thu Sep 19 10:52:28 2013 +0200

----------------------------------------------------------------------
 patches/systemvm/debian/config/etc/init.d/cloud | 26 ++++++++++----------
 1 file changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/78b912e3/patches/systemvm/debian/config/etc/init.d/cloud
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/etc/init.d/cloud b/patches/systemvm/debian/config/etc/init.d/cloud
index b8e6ed2..83853bc 100755
--- a/patches/systemvm/debian/config/etc/init.d/cloud
+++ b/patches/systemvm/debian/config/etc/init.d/cloud
@@ -5,9 +5,9 @@
 # Required-Stop:     $local_fs
 # Should-Start:      
 # Should-Stop:       
-# Default-Start:     2 3 4 5
+# Default-Start:     
 # Default-Stop:      0 1 6
-# Short-Description: 	Start up the cloud.com service
+# Short-Description: 	Start up the CloudStack cloud service
 ### END INIT INFO
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
@@ -74,7 +74,7 @@ _failure() {
   fi
 }
 RETVAL=$?
-CLOUD_COM_HOME="/usr/local/cloud"
+CLOUDSTACK_HOME="/usr/local/cloud"
 
 # mkdir -p /var/log/vmops
 
@@ -82,23 +82,23 @@ get_pids() {
   local i
   for i in $(ps -ef| grep java | grep -v grep | awk '{print $2}'); 
   do 
-    echo $(pwdx $i) | grep "$CLOUD_COM_HOME"  | awk -F: '{print $1}'; 
+    echo $(pwdx $i) | grep "$CLOUDSTACK_HOME"  | awk -F: '{print $1}'; 
   done
 }
 
 start() {
    local pid=$(get_pids)
    if [ "$pid" != "" ]; then
-       echo "cloud.com sevice is already running, PID = $pid"
+       echo "CloudStack cloud sevice is already running, PID = $pid"
        return 0
    fi
 
-   echo -n "Starting cloud.com service (type=$TYPE) "
-   if [ -f $CLOUD_COM_HOME/systemvm/run.sh ];
+   echo -n "Starting CloudStack cloud service (type=$TYPE) "
+   if [ -f $CLOUDSTACK_HOME/systemvm/run.sh ];
    then
      if [ "$pid" == "" ]
      then
-       (cd $CLOUD_COM_HOME/systemvm; nohup ./run.sh > /var/log/cloud/cloud.out 2>&1 & )
+       (cd $CLOUDSTACK_HOME/systemvm; nohup ./run.sh > /var/log/cloud/cloud.out 2>&1 & )
        pid=$(get_pids)
        echo $pid > /var/run/cloud.pid 
      fi
@@ -107,29 +107,29 @@ start() {
      _failure
    fi
    echo
-   echo 'start' > $CLOUD_COM_HOME/systemvm/user_request
+   echo 'start' > $CLOUDSTACK_HOME/systemvm/user_request
 }
 
 stop() {
   local pid
-  echo -n  "Stopping cloud.com service (type=$TYPE): "
+  echo -n  "Stopping CloudStack cloud service (type=$TYPE): "
   for pid in $(get_pids)
   do
     kill $pid
   done
   _success
   echo
-  echo 'stop' > $CLOUD_COM_HOME/systemvm/user_request
+  echo 'stop' > $CLOUDSTACK_HOME/systemvm/user_request
 }
 
 status() {
   local pids=$(get_pids)
   if [ "$pids" == "" ]
   then
-    echo "cloud.com service is not running"
+    echo "CloudStack cloud service is not running"
     return 1
   fi
-  echo "cloud.com service (type=$TYPE) is running: process id: $pids"
+  echo "CloudStack cloud service (type=$TYPE) is running: process id: $pids"
   return 0
 }
 


[48/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK: 4640 - Fixed indentation issues in function createInstance


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

Branch: refs/heads/4.2
Commit: 219c64eef38ca1b44724abd299c79a9eb508bb73
Parents: b35e761
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Tue Sep 10 03:00:10 2013 -0400
Committer: sailajam <sa...@citrix.com>
Committed: Tue Oct 1 11:24:33 2013 +0530

----------------------------------------------------------------------
 .../component/cpu_limits/test_cpu_limits.py     | 36 ++++++++++----------
 .../component/cpu_limits/test_project_limits.py | 28 +++++++--------
 2 files changed, 32 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/219c64ee/test/integration/component/cpu_limits/test_cpu_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/cpu_limits/test_cpu_limits.py b/test/integration/component/cpu_limits/test_cpu_limits.py
index 8acf8b7..d721a45 100644
--- a/test/integration/component/cpu_limits/test_cpu_limits.py
+++ b/test/integration/component/cpu_limits/test_cpu_limits.py
@@ -154,10 +154,10 @@ class TestCPULimits(cloudstackTestCase):
         if api_client is None:
             api_client = self.apiclient
 
-            self.debug("Deploying an instance in account: %s" %
+        self.debug("Deploying an instance in account: %s" %
                        self.account.name)
-            try:
-                vm = VirtualMachine.create(
+        try:
+            vm = VirtualMachine.create(
                     api_client,
                     self.services["virtual_machine"],
                     templateid=self.template.id,
@@ -165,15 +165,15 @@ class TestCPULimits(cloudstackTestCase):
                     domainid=self.account.domainid,
                     networkids=networks,
                     serviceofferingid=service_off.id)
-                vms = VirtualMachine.list(api_client, id=vm.id, listall=True)
-                self.assertIsInstance(vms,
+            vms = VirtualMachine.list(api_client, id=vm.id, listall=True)
+            self.assertIsInstance(vms,
                     list,
                     "List VMs should return a valid response")
-                self.assertEqual(vms[0].state, "Running",
+            self.assertEqual(vms[0].state, "Running",
                     "Vm state should be running after deployment")
-                return vm
-            except Exception as e:
-                self.fail("Failed to deploy an instance: %s" % e)
+            return vm
+        except Exception as e:
+            self.fail("Failed to deploy an instance: %s" % e)
 
     @attr(tags=["advanced", "advancedns","simulator"])
     def test_01_multiplecore_start_stop_instance(self):
@@ -401,10 +401,10 @@ class TestDomainCPULimitsConfiguration(cloudstackTestCase):
         if api_client is None:
             api_client = self.apiclient
 
-            self.debug("Deploying an instance in account: %s" %
+        self.debug("Deploying an instance in account: %s" %
                        self.account.name)
-            try:
-                vm = VirtualMachine.create(
+        try:
+            vm = VirtualMachine.create(
                     api_client,
                     self.services["virtual_machine"],
                     templateid=self.template.id,
@@ -412,15 +412,15 @@ class TestDomainCPULimitsConfiguration(cloudstackTestCase):
                     domainid=self.account.domainid,
                     networkids=networks,
                     serviceofferingid=service_off.id)
-                vms = VirtualMachine.list(api_client, id=vm.id, listall=True)
-                self.assertIsInstance(vms,
+            vms = VirtualMachine.list(api_client, id=vm.id, listall=True)
+            self.assertIsInstance(vms,
                     list,
                     "List VMs should return a valid response")
-                self.assertEqual(vms[0].state, "Running",
+            self.assertEqual(vms[0].state, "Running",
                     "Vm state should be running after deployment")
-                return vm
-            except Exception as e:
-                self.fail("Failed to deploy an instance: %s" % e)
+            return vm
+        except Exception as e:
+            self.fail("Failed to deploy an instance: %s" % e)
 
     def setupAccounts(self):
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/219c64ee/test/integration/component/cpu_limits/test_project_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/cpu_limits/test_project_limits.py b/test/integration/component/cpu_limits/test_project_limits.py
index 3c432db..63d1a98 100644
--- a/test/integration/component/cpu_limits/test_project_limits.py
+++ b/test/integration/component/cpu_limits/test_project_limits.py
@@ -162,23 +162,23 @@ class TestProjectsCPULimits(cloudstackTestCase):
         if api_client is None:
             api_client = self.api_client
 
-            try:
-                self.vm = VirtualMachine.create(
-                    api_client,
-                    self.services["virtual_machine"],
-                    templateid=self.template.id,
-                    projectid=project.id,
-                    networkids=networks,
-                    serviceofferingid=service_off.id)
-                vms = VirtualMachine.list(api_client, id=self.vm.id, listall=True)
-                self.assertIsInstance(vms,
+        try:
+            self.vm = VirtualMachine.create(
+                        api_client,
+                        self.services["virtual_machine"],
+                        templateid=self.template.id,
+                        projectid=project.id,
+                        networkids=networks,
+                        serviceofferingid=service_off.id)
+            vms = VirtualMachine.list(api_client, id=self.vm.id, listall=True)
+            self.assertIsInstance(vms,
                     list,
                     "List VMs should return a valid response")
-                self.assertEqual(vms[0].state, "Running",
+            self.assertEqual(vms[0].state, "Running",
                     "Vm state should be running after deployment")
-                return self.vm
-            except Exception as e:
-                self.fail("Failed to deploy an instance: %s" % e)
+            return self.vm
+        except Exception as e:
+            self.fail("Failed to deploy an instance: %s" % e)
 
     def setupProjectAccounts(self):
 


[14/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-4713: EIP/ELB Basic Zone: UI > Network > IP Addresses > make extra API call to get IPs allocated at guest network.


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

Branch: refs/heads/4.2
Commit: 0bdbb9e72f8590f7cd5384a9ed227e99374f90f8
Parents: 24e898b
Author: Jessica Wang <je...@apache.org>
Authored: Thu Sep 19 18:34:42 2013 -0700
Committer: Jessica Wang <je...@apache.org>
Committed: Thu Sep 19 18:34:42 2013 -0700

----------------------------------------------------------------------
 ui/scripts/network.js | 78 +++++++++++++++++++++++++---------------------
 1 file changed, 42 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0bdbb9e7/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index 9d4cf38..421582a 100755
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -2054,57 +2054,63 @@
                     },
 
                     dataProvider: function(args) {
-                        var data = {};
-                        listViewDataProvider(args, data);
-
-                        //The following 10 lines caused CLOUDSTACK-4713 (EIP/ELB Basic Zone - unable to see any IPs that are acquired)
-                        /*
-                        if (g_supportELB == "guest") // IPs are allocated on guest network
-                            $.extend(data, {
-                                forvirtualnetwork: false,
-                                forloadbalancing: true
-                            });
-                        else if (g_supportELB == "public") // IPs are allocated on public network
-                            $.extend(data, {
-                                forvirtualnetwork: true,
-                                forloadbalancing: true
-                            });
-                        */
-
+                    	var items = [];                    	
+                    	var data = {};
+                        listViewDataProvider(args, data);     
                         if (args.context.networks) {
                             $.extend(data, {
                                 associatedNetworkId: args.context.networks[0].id
                             });
-
                         }
-
                         if ("vpc" in args.context) {
                             $.extend(data, {
                                 vpcid: args.context.vpc[0].id
                             });
-                        }
-
+                        }  
+                        
                         $.ajax({
                             url: createURL('listPublicIpAddresses'),
-                            data: data,
+                            data: $.extend({}, data, {
+                                forvirtualnetwork: true, //IPs are allocated on public network
+                            }),
                             dataType: "json",
-                            async: true,
+                            async: false,
                             success: function(json) {
-                                var items = json.listpublicipaddressesresponse.publicipaddress;
-
-                                $(items).each(function() {
-                                    getExtaPropertiesForIpObj(this, args);
-                                });
-
-                                args.response.success({
-                                    actionFilter: actionFilters.ipAddress,
-                                    data: items
-                                });
-                            },
-                            error: function(data) {
-                                args.response.error(parseXMLHttpResponse(data));
+                                var ips = json.listpublicipaddressesresponse.publicipaddress;                                
+                                if(ips != null) {
+                                	for(var i = 0; i < ips.length; i++) {                                		
+                                		getExtaPropertiesForIpObj(ips[i], args);
+                                		items.push(ips[i]);                                		
+                                	}
+                                }                                
                             }
                         });
+                                                
+                        if (g_supportELB == "guest") {                  
+	                        $.ajax({
+	                            url: createURL('listPublicIpAddresses'),
+	                            data: $.extend({}, data, {
+	                                forvirtualnetwork: false, // ELB IPs are allocated on guest network       
+	                                forloadbalancing: true
+	                            }),
+	                            dataType: "json",
+	                            async: false,
+	                            success: function(json) {
+	                                var ips = json.listpublicipaddressesresponse.publicipaddress;	                                
+	                                if(ips != null) {
+	                                	for(var i = 0; i < ips.length; i++) {	                                		
+	                                		getExtaPropertiesForIpObj(ips[i], args);
+	                                		items.push(ips[i]);                                		
+	                                	}
+	                                }                                
+	                            }
+	                        });
+                        }
+                         
+                        args.response.success({
+                            actionFilter: actionFilters.ipAddress,
+                            data: items
+                        });                        
                     },
 
                     // Detail view


[13/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-4714: EIP/ELB Basic Zone > EIP/ELB Basic Zone > Network page > Add Load Balancer tab > add AutoScale rule > spinning wheel is hanging forever with JS error "args.context.ipAddresses is undefined".


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

Branch: refs/heads/4.2
Commit: 24e898b4cddf1a8ebc3b4886526d94921ade869b
Parents: e81a2b4
Author: Jessica Wang <je...@apache.org>
Authored: Thu Sep 19 17:10:43 2013 -0700
Committer: Jessica Wang <je...@apache.org>
Committed: Thu Sep 19 17:10:43 2013 -0700

----------------------------------------------------------------------
 ui/scripts/autoscaler.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/24e898b4/ui/scripts/autoscaler.js
----------------------------------------------------------------------
diff --git a/ui/scripts/autoscaler.js b/ui/scripts/autoscaler.js
index 6fabf68..ab1b459 100644
--- a/ui/scripts/autoscaler.js
+++ b/ui/scripts/autoscaler.js
@@ -1116,7 +1116,7 @@
                     var apiCmd, apiCmdRes;
                     if (!('multiRules' in args.context)) { //from a new LB
                         var data = {
-                            zoneid: args.context.ipAddresses[0].zoneid, //args.context.networks[0] doesn't have zoneid property, so use args.context.ipAddresses[0] instead
+                            zoneid: args.context.networks[0].zoneid, //get zoneid from args.context.networks[0] instead of args.context.ipAddresses[0] because args.context.ipAddresses is null when adding AutoScale rule from Add Load Balancer tab in Network page
                             serviceofferingid: args.data.serviceOfferingId,
                             templateid: args.data.templateNames,
                             destroyvmgraceperiod: args.data.destroyVMgracePeriod,


[49/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-4790: Skip reserved VMware scsi device number for SCSI disks


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

Branch: refs/heads/4.2
Commit: 4533d2d88fa22ac05633df10dc5a1a2c157f3490
Parents: 219c64e
Author: Kelven Yang <ke...@gmail.com>
Authored: Wed Oct 2 17:52:39 2013 -0700
Committer: Kelven Yang <ke...@gmail.com>
Committed: Wed Oct 2 17:52:39 2013 -0700

----------------------------------------------------------------------
 .../vmware/resource/VmwareResource.java         |  3 +-
 .../hypervisor/vmware/mo/VirtualMachineMO.java  | 15 +++++--
 .../hypervisor/vmware/util/VmwareHelper.java    | 44 ++++++++++++++------
 3 files changed, 45 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4533d2d8/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index 70b9f54..de2eb9b 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -2857,7 +2857,8 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
                 String[] diskChain = syncDiskChain(dcMo, vmMo, vmSpec, 
                     	vol, matchingExistingDisk,
                     	dataStoresDetails);
-                
+                if(controllerKey == scsiControllerKey && VmwareHelper.isReservedScsiDeviceNumber(scsiUnitNumber))
+                	scsiUnitNumber++;
                 device = VmwareHelper.prepareDiskDevice(vmMo, null, controllerKey, 
                 	diskChain, 
                 	volumeDsDetails.first(),

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4533d2d8/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
index f64c3c0..abc5bf8 100644
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
@@ -908,8 +908,9 @@ public class VirtualMachineMO extends BaseMO {
 		assert(vmdkDatastorePath != null);
 		assert(morDs != null);
 
+		int ideControllerKey = getIDEDeviceControllerKey();
 		if(controllerKey < 0) {
-            controllerKey = getIDEDeviceControllerKey();
+            controllerKey = ideControllerKey;
         }
 
 		VirtualDisk newDisk = new VirtualDisk();
@@ -952,6 +953,8 @@ public class VirtualMachineMO extends BaseMO {
 		}
 
 		int deviceNumber = getNextDeviceNumber(controllerKey);
+		if(controllerKey != ideControllerKey && VmwareHelper.isReservedScsiDeviceNumber(deviceNumber))
+			deviceNumber++;
 
 		newDisk.setControllerKey(controllerKey);
 	    newDisk.setKey(-deviceNumber);
@@ -1714,9 +1717,13 @@ public class VirtualMachineMO extends BaseMO {
 
 	public int getNextScsiDiskDeviceNumber() throws Exception {
 		int scsiControllerKey = getScsiDeviceControllerKey();
-		return getNextDeviceNumber(scsiControllerKey);
+		int deviceNumber = getNextDeviceNumber(scsiControllerKey);
+		if(VmwareHelper.isReservedScsiDeviceNumber(deviceNumber))
+			deviceNumber++;
+		
+		return deviceNumber;
 	}
-
+	
 	public int getScsiDeviceControllerKey() throws Exception {
 	    List<VirtualDevice> devices = (List<VirtualDevice>)_context.getVimClient().
 	    	getDynamicProperty(_mor, "config.hardware.device");
@@ -1732,7 +1739,7 @@ public class VirtualMachineMO extends BaseMO {
 	    assert(false);
 	    throw new Exception("SCSI Controller Not Found");
 	}
-
+	
 	public int getScsiDeviceControllerKeyNoException() throws Exception {
 	    List<VirtualDevice> devices = (List<VirtualDevice>)_context.getVimClient().
 	    	getDynamicProperty(_mor, "config.hardware.device");

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4533d2d8/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareHelper.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareHelper.java b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareHelper.java
index bcf9f14..1927b9f 100644
--- a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareHelper.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareHelper.java
@@ -72,6 +72,10 @@ import com.cloud.utils.exception.ExceptionUtil;
 
 public class VmwareHelper {
     private static final Logger s_logger = Logger.getLogger(VmwareHelper.class);
+    
+	public static boolean isReservedScsiDeviceNumber(int deviceNumber) {
+		return deviceNumber == 7;
+	}
 
 	public static VirtualDevice prepareNicDevice(VirtualMachineMO vmMo, ManagedObjectReference morNetwork, VirtualEthernetCardType deviceType,
 		String portGroupName, String macAddress, int deviceNumber, int contextNumber, boolean conntected, boolean connectOnStart) throws Exception {
@@ -178,11 +182,15 @@ public class VmwareHelper {
         backingInfo.setFileName(vmdkDatastorePath);
         disk.setBacking(backingInfo);
 
+        int ideControllerKey = vmMo.getIDEDeviceControllerKey();
 		if(controllerKey < 0)
-			controllerKey = vmMo.getIDEDeviceControllerKey();
-        if(deviceNumber < 0)
+			controllerKey = ideControllerKey;
+        if(deviceNumber < 0) {
         	deviceNumber = vmMo.getNextDeviceNumber(controllerKey);
-		disk.setControllerKey(controllerKey);
+        	if(controllerKey != ideControllerKey && isReservedScsiDeviceNumber(deviceNumber))
+        		deviceNumber++;
+        }
+        disk.setControllerKey(controllerKey);
 
 	    disk.setKey(-contextNumber);
 	    disk.setUnitNumber(deviceNumber);
@@ -246,12 +254,16 @@ public class VmwareHelper {
 			throw new Exception("Unsupported disk backing: " + parentBacking.getClass().getCanonicalName());
 		}
 
+		int ideControllerKey = vmMo.getIDEDeviceControllerKey();
 		if(controllerKey < 0)
-			controllerKey = vmMo.getIDEDeviceControllerKey();
+			controllerKey = ideControllerKey;
 		disk.setControllerKey(controllerKey);
-		if(deviceNumber < 0)
+		if(deviceNumber < 0) {
 			deviceNumber = vmMo.getNextDeviceNumber(controllerKey);
-
+			if(controllerKey != ideControllerKey && isReservedScsiDeviceNumber(deviceNumber))
+				deviceNumber++;
+		}
+		
 	    disk.setKey(-contextNumber);
 	    disk.setUnitNumber(deviceNumber);
 	    disk.setCapacityInKB(sizeInMb*1024);
@@ -282,11 +294,15 @@ public class VmwareHelper {
 	        backingInfo.setDiskMode(VirtualDiskMode.PERSISTENT.value());
 			disk.setBacking(backingInfo);
 			
+			int ideControllerKey = vmMo.getIDEDeviceControllerKey();
 			if(controllerKey < 0)
-				controllerKey = vmMo.getIDEDeviceControllerKey();
-	        if(deviceNumber < 0)
+				controllerKey = ideControllerKey;
+	        if(deviceNumber < 0) {
 	        	deviceNumber = vmMo.getNextDeviceNumber(controllerKey);
-
+	        	if(controllerKey != ideControllerKey && isReservedScsiDeviceNumber(deviceNumber))
+	        		deviceNumber++;
+	        }
+	        
 			disk.setControllerKey(controllerKey);
 		    disk.setKey(-contextNumber);
 		    disk.setUnitNumber(deviceNumber);
@@ -332,11 +348,15 @@ public class VmwareHelper {
 
         disk.setBacking(backingInfo);
 
+        int ideControllerKey = vmMo.getIDEDeviceControllerKey();
 		if(controllerKey < 0)
-			controllerKey = vmMo.getIDEDeviceControllerKey();
-        if(deviceNumber < 0)
+			controllerKey = ideControllerKey;
+        if(deviceNumber < 0) {
         	deviceNumber = vmMo.getNextDeviceNumber(controllerKey);
-
+        	if(controllerKey != ideControllerKey && isReservedScsiDeviceNumber(deviceNumber))
+        		deviceNumber++;
+        }
+        
 		disk.setControllerKey(controllerKey);
 	    disk.setKey(-contextNumber);
 	    disk.setUnitNumber(deviceNumber);


[23/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-4727 upgrade steps IDREF issue fixed


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

Branch: refs/heads/4.2
Commit: 0363b4ae180e377feb74f22dacbabd24a6bde2cd
Parents: 1628cfc
Author: Radhika PC <ra...@citrix.com>
Authored: Mon Sep 23 16:41:33 2013 +0530
Committer: Radhika PC <ra...@citrix.com>
Committed: Mon Sep 23 16:43:31 2013 +0530

----------------------------------------------------------------------
 docs/en-US/Release_Notes.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0363b4ae/docs/en-US/Release_Notes.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/Release_Notes.xml b/docs/en-US/Release_Notes.xml
index 96e9928..6f803b1 100644
--- a/docs/en-US/Release_Notes.xml
+++ b/docs/en-US/Release_Notes.xml
@@ -1505,7 +1505,7 @@ Done restarting router(s).
             </listitem>
           </orderedlist>
         </listitem>
-        <listitem>
+        <listitem id="stopping-usage-servers">
           <para>Stop all Usage Servers if running. Run this on all Usage Server hosts.</para>
           <programlisting language="Bash"><prompt>#</prompt> service cloud-usage stop</programlisting>
         </listitem>


[39/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-4344: pass delay and retries explicitly to remoteSSHclient to reduce time taken by the tests

Signed-off-by: venkataswamybabu budumuru <ve...@citrix.com>


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

Branch: refs/heads/4.2
Commit: 94f741bbf5e025c230172df2977a0986c5b73ec2
Parents: 583279f
Author: SrikanteswaraRao Talluri <ka...@gmail.com>
Authored: Tue Sep 17 15:59:34 2013 +0530
Committer: venkataswamybabu budumuru <ve...@citrix.com>
Committed: Mon Sep 30 12:21:39 2013 +0530

----------------------------------------------------------------------
 test/integration/smoke/test_network.py | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/94f741bb/test/integration/smoke/test_network.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_network.py b/test/integration/smoke/test_network.py
index 042ac84..f204595 100644
--- a/test/integration/smoke/test_network.py
+++ b/test/integration/smoke/test_network.py
@@ -464,7 +464,9 @@ class TestPortForwarding(cloudstackTestCase):
                                             src_nat_ip_addr.ipaddress,
                                             self.virtual_machine.ssh_port,
                                             self.virtual_machine.username,
-                                            self.virtual_machine.password
+                                            self.virtual_machine.password,
+                                            retries=2,
+                                            delay=0
                                             )
         return
 
@@ -580,7 +582,9 @@ class TestPortForwarding(cloudstackTestCase):
                                             ip_address.ipaddress.ipaddress,
                                             self.virtual_machine.ssh_port,
                                             self.virtual_machine.username,
-                                            self.virtual_machine.password
+                                            self.virtual_machine.password,
+                                            retries=2,
+                                            delay=0
                                             )
         return
 
@@ -883,7 +887,9 @@ class TestReleaseIP(cloudstackTestCase):
                                     self.ip_addr.ipaddress,
                                     self.services["natrule"]["publicport"],
                                     self.virtual_machine.username,
-                                    self.virtual_machine.password
+                                    self.virtual_machine.password,
+                                    retries=2,
+                                    delay=0
                                     )
         return
 


[40/50] git commit: updated refs/heads/4.2 to 86c9363

Posted by an...@apache.org.
CLOUDSTACK-702: Adding test for deploying vm in new cidr 1. Add guest ip range in new cidr and deploy vm in that

Signed-off-by: sanjeevneelarapu <sa...@citrix.com>
Signed-off-by: venkataswamybabu budumuru <ve...@citrix.com>
(cherry picked from commit ff2bd3d44325ef915cb3d7b11a966c9c7c387cb3)


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

Branch: refs/heads/4.2
Commit: a34bf457dfb3726842c1fde002be61c53b0a60d7
Parents: 94f741b
Author: sanjeevneelarapu <sa...@citrix.com>
Authored: Mon Sep 23 16:41:11 2013 +0530
Committer: venkataswamybabu budumuru <ve...@citrix.com>
Committed: Mon Sep 30 14:56:08 2013 +0530

----------------------------------------------------------------------
 .../component/maint/test_multiple_ip_ranges.py  | 337 +++++++++++++++++++
 1 file changed, 337 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a34bf457/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
new file mode 100644
index 0000000..782957c
--- /dev/null
+++ b/test/integration/component/maint/test_multiple_ip_ranges.py
@@ -0,0 +1,337 @@
+# 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.
+""" Tests for Multiple IP Ranges feature
+"""
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from marvin.cloudstackException import cloudstackAPIException
+from marvin.integration.lib.utils import *
+from marvin.integration.lib.base import *
+from marvin.integration.lib.common import *
+#from netaddr import *
+import netaddr
+
+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",
+                        },
+                        "server_without_disk": {
+                                        "displayname": "Test VM-No Disk",
+                                        "username": "root",
+                                        "password": "password",
+                                        "hypervisor": 'XenServer',
+                        },
+     			"cidr": {
+                                  "name": "cidr1 -Test",
+                                  "gateway" :"10.147.43.1",
+                                  "netmask" :"255.255.255.128",
+                                  "startip" :"10.147.43.3",
+                                  "endip" :"10.147.43.10",
+                        },
+                        "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.api_client = super(TestMultipleIpRanges, cls).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.pod = get_pod(cls.api_client, cls.zone.id, cls.services)
+        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,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = [ ]
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the resources created
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    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"
+                         )
+        self.assertNotEqual(
+                             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"
+                         )
+        self.assertEqual(
+                         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"
+                         )
+        self.assertEqual(
+                         str(vlan[0].netmask),
+                         str(services["netmask"]),
+                         "netmask in vlan ip range is not matched with the configured netmask"
+                         )
+        return
+
+    def list_Routers(self):
+        """Check if any VR is already present in the setup
+           Will return True if yes else return False
+        """
+        list_zone = Zone.list(self.apiclient)
+        network_type = list_zone[0].networktype
+        sg_enabled = list_zone[0].securitygroupsenabled
+        if network_type == "Basic":
+            vr_list = Router.list(self.apiclient, listall='true')
+            self.debug("vr list {}".format(vr_list))
+            if isinstance(vr_list,list) and len(vr_list) > 0:
+                self.debug("VR is running in the setup")
+                return True
+            else:
+                self.debug("VR is not present in the setup")
+                return False
+        elif network_type == "Advanced" and sg_enabled == True:
+            nw_list = Network.list(
+                                   self.apiclient,
+                                   supportedservices='SecurityGroup',
+                                   )
+            nw_id = nw_list[0].id
+            vr_list = Router.list(
+                                   self.apiclient,
+                                   networkid = nw_id,
+                                   listall = 'true',
+                                 )
+            if isinstance(vr_list, list) and len(vr_list) > 0:
+                self.debug("VR is present in the setup")
+                return True
+            else :
+                self.debug("VR is not present in the setup")
+                return False
+        else :
+            self.debug("Network type is not shared")
+            return None
+
+    def test_01_deploy_vm_in_new_cidr(self):
+        """Deploy guest vm after adding guest IP range in new CIDR
+
+            1.Add IP range in new CIDR
+            2.Deploy guest vm
+        """
+        dc_id = self.dbclient.execute(
+                                      "select id from data_center where uuid = '%s';" % str(self.services["zoneid"])
+                                      )
+        dc_id = dc_id[0][0]
+        id_list = self.dbclient.execute(
+                            "select id from user_ip_address where allocated is null and data_center_id = '%s';" % str(dc_id)
+                            )
+        ip_list = []
+        for i in range(len(id_list)):
+            ip_list.append(id_list[i][0])
+        #Check if VR is already present in the setup
+        vr_state = self.list_Routers();
+        if vr_state is True :
+            for id in ip_list:
+                self.dbclient.execute(
+                        "update user_ip_address set allocated=now() where id = '%s';" % str(id)
+                        )
+        else :
+            ip_list = ip_list[:-2]
+            for id in ip_list:
+                self.dbclient.execute(
+                        "update user_ip_address set allocated=now() where id = '%s';" % str(id)
+                        )
+        #Add IP range in the new CIDR
+        test_gateway = self.services["cidr"]["gateway"]
+        test_startIp = self.services["cidr"]["startip"]
+        test_endIp = self.services["cidr"]["endip"]
+        test_netmask = self.services["cidr"]["netmask"]
+        #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"] = test_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))
+        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"])
+        #Deploy vm in existing subnet if VR is not present
+        if vr_state is False :
+            vm_res = 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"],
+                                            )
+            self.cleanup.append(vm_res)
+        #Deploy guest vm
+        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))
+        finally :
+            #Mark ip_Adddresses allocated state to Null which were marked as allocated at the beginning of the test
+            for id in ip_list :
+                self.dbclient.execute(
+                                      "update user_ip_address set allocated=default where id = '%s';" % str(id)
+                                      )
+        self.vm_response = VirtualMachine.list(
+                                               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["cidr"]["startip"]), unicode(self.services["cidr"]["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.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)
+        return
+