You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ml...@apache.org on 2014/03/10 22:37:29 UTC

[01/18] git commit: updated refs/heads/resize-root to 6d6e790

Repository: cloudstack
Updated Branches:
  refs/heads/resize-root e42502a86 -> 6d6e790d8


CLOUDSTACK-5478: Enable publishing uuid for all the async apis in the CallContext.
The advantage would be that event publishing can pick up the uuid and publish them.


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

Branch: refs/heads/resize-root
Commit: ded7e682dc0a84f41c9953522016a86f4948ea35
Parents: 548c810
Author: Nitin Mehta <ni...@citrix.com>
Authored: Fri Mar 7 16:50:21 2014 -0800
Committer: Nitin Mehta <ni...@citrix.com>
Committed: Fri Mar 7 16:50:21 2014 -0800

----------------------------------------------------------------------
 api/src/com/cloud/event/EventTypes.java          |  5 +++++
 server/src/com/cloud/api/ApiDispatcher.java      |  7 +++++++
 server/src/com/cloud/api/ApiServer.java          | 11 ++++++++++-
 server/src/com/cloud/event/ActionEventUtils.java | 12 ++++++++----
 server/src/com/cloud/vm/UserVmManagerImpl.java   |  1 -
 5 files changed, 30 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ded7e682/api/src/com/cloud/event/EventTypes.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/event/EventTypes.java b/api/src/com/cloud/event/EventTypes.java
index ec54ea1..7994ada 100755
--- a/api/src/com/cloud/event/EventTypes.java
+++ b/api/src/com/cloud/event/EventTypes.java
@@ -493,10 +493,13 @@ public class EventTypes {
         entityEventDetails.put(EVENT_VM_REBOOT, VirtualMachine.class.getName());
         entityEventDetails.put(EVENT_VM_UPDATE, VirtualMachine.class.getName());
         entityEventDetails.put(EVENT_VM_UPGRADE, VirtualMachine.class.getName());
+        entityEventDetails.put(EVENT_VM_DYNAMIC_SCALE, VirtualMachine.class.getName());
         entityEventDetails.put(EVENT_VM_RESETPASSWORD, VirtualMachine.class.getName());
+        entityEventDetails.put(EVENT_VM_RESETSSHKEY, VirtualMachine.class.getName());
         entityEventDetails.put(EVENT_VM_MIGRATE, VirtualMachine.class.getName());
         entityEventDetails.put(EVENT_VM_MOVE, VirtualMachine.class.getName());
         entityEventDetails.put(EVENT_VM_RESTORE, VirtualMachine.class.getName());
+        entityEventDetails.put(EVENT_VM_EXPUNGE, VirtualMachine.class.getName());
 
         entityEventDetails.put(EVENT_ROUTER_CREATE, VirtualRouter.class.getName());
         entityEventDetails.put(EVENT_ROUTER_DESTROY, VirtualRouter.class.getName());
@@ -544,9 +547,11 @@ public class EventTypes {
         entityEventDetails.put(EVENT_LB_CERT_REMOVE, LoadBalancer.class.getName());
 
         // Account events
+        entityEventDetails.put(EVENT_ACCOUNT_ENABLE, Account.class.getName());
         entityEventDetails.put(EVENT_ACCOUNT_DISABLE, Account.class.getName());
         entityEventDetails.put(EVENT_ACCOUNT_CREATE, Account.class.getName());
         entityEventDetails.put(EVENT_ACCOUNT_DELETE, Account.class.getName());
+        entityEventDetails.put(EVENT_ACCOUNT_UPDATE, Account.class.getName());
         entityEventDetails.put(EVENT_ACCOUNT_MARK_DEFAULT_ZONE, Account.class.getName());
 
         // UserVO Events

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ded7e682/server/src/com/cloud/api/ApiDispatcher.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiDispatcher.java b/server/src/com/cloud/api/ApiDispatcher.java
index 5d4b4d3..8f980d9 100755
--- a/server/src/com/cloud/api/ApiDispatcher.java
+++ b/server/src/com/cloud/api/ApiDispatcher.java
@@ -21,6 +21,7 @@ import java.util.Map;
 import javax.annotation.PostConstruct;
 import javax.inject.Inject;
 
+import com.cloud.event.EventTypes;
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseAsyncCmd;
 import org.apache.cloudstack.api.BaseAsyncCreateCmd;
@@ -82,8 +83,14 @@ public class ApiDispatcher {
 
             final BaseAsyncCmd asyncCmd = (BaseAsyncCmd)cmd;
             final String startEventId = params.get(ApiConstants.CTX_START_EVENT_ID);
+            String uuid = params.get("uuid");
             ctx.setStartEventId(Long.valueOf(startEventId));
 
+            // Fow now use the key from EventTypes.java rather than getInstanceType bcz the later doesn't refer to the interfaces
+            if(EventTypes.getEntityForEvent(asyncCmd.getEventType()) != null){
+                ctx.putContextParameter(EventTypes.getEntityForEvent(asyncCmd.getEventType()), uuid);
+            }
+
             // Synchronise job on the object if needed
             if (asyncCmd.getJob() != null && asyncCmd.getSyncObjId() != null && asyncCmd.getSyncObjType() != null) {
                 Long queueSizeLimit = null;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ded7e682/server/src/com/cloud/api/ApiServer.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiServer.java b/server/src/com/cloud/api/ApiServer.java
index a9b1130..7ad7c10 100755
--- a/server/src/com/cloud/api/ApiServer.java
+++ b/server/src/com/cloud/api/ApiServer.java
@@ -53,6 +53,7 @@ import javax.naming.ConfigurationException;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
 
+import com.cloud.event.EventTypes;
 import org.apache.cloudstack.acl.APIChecker;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.ApiConstants;
@@ -517,6 +518,8 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
                 objectUuid = createCmd.getEntityUuid();
                 params.put("id", objectId.toString());
             } else {
+                // Extract the uuid before params are processed and id reflects internal db id
+                objectUuid = params.get("id");
                 dispatchChainFactory.getStandardDispatchChain().dispatch(new DispatchTask(cmdObj, params));
             }
 
@@ -528,10 +531,16 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
             if (caller != null) {
                 params.put("ctxAccountId", String.valueOf(caller.getId()));
             }
+            if(objectUuid != null){
+                params.put("uuid", objectUuid);
+            }
 
             long startEventId = ctx.getStartEventId();
             asyncCmd.setStartEventId(startEventId);
 
+            if(EventTypes.getEntityForEvent(asyncCmd.getEventType()) != null){
+                ctx.putContextParameter(EventTypes.getEntityForEvent(asyncCmd.getEventType()), objectUuid);
+            }
             // save the scheduled event
             final Long eventId =
                 ActionEventUtils.onScheduledActionEvent((callerUserId == null) ? User.UID_SYSTEM : callerUserId, asyncCmd.getEntityOwnerId(), asyncCmd.getEventType(),
@@ -577,7 +586,7 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
                 !(cmdObj instanceof ListVolumesCmd) && !(cmdObj instanceof ListUsersCmd) && !(cmdObj instanceof ListAccountsCmd) &&
                 !(cmdObj instanceof ListStoragePoolsCmd) && !(cmdObj instanceof ListDiskOfferingsCmd) && !(cmdObj instanceof ListServiceOfferingsCmd) &&
                 !(cmdObj instanceof ListZonesByCmd)) {
-                buildAsyncListResponse((BaseListCmd)cmdObj, caller);
+                buildAsyncListResponse((BaseListCmd) cmdObj, caller);
             }
 
             SerializationContext.current().setUuidTranslation(true);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ded7e682/server/src/com/cloud/event/ActionEventUtils.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/event/ActionEventUtils.java b/server/src/com/cloud/event/ActionEventUtils.java
index 9724d99..5954670 100755
--- a/server/src/com/cloud/event/ActionEventUtils.java
+++ b/server/src/com/cloud/event/ActionEventUtils.java
@@ -25,7 +25,6 @@ import java.util.Map;
 import javax.annotation.PostConstruct;
 import javax.inject.Inject;
 
-import com.cloud.vm.VirtualMachine;
 import org.apache.log4j.Logger;
 import org.springframework.beans.factory.NoSuchBeanDefinitionException;
 
@@ -186,13 +185,19 @@ public class ActionEventUtils {
         // get the entity details for which ActionEvent is generated
         String entityType = null;
         String entityUuid = null;
+        CallContext context = CallContext.current();
         Class entityKey = getEntityKey(eventType);
         if (entityKey != null)
         {
-            CallContext context = CallContext.current();
+            //FIXME - Remove this
             entityUuid = (String)context.getContextParameter(entityKey);
             if (entityUuid != null)
                 entityType = entityKey.getName();
+        }else if (EventTypes.getEntityForEvent(eventType) != null){
+            entityType = EventTypes.getEntityForEvent(eventType);
+            if (entityType != null){
+                entityUuid = (String)context.getContextParameter(entityType);
+            }
         }
 
         org.apache.cloudstack.framework.events.Event event =
@@ -240,6 +245,7 @@ public class ActionEventUtils {
 
     private static Class getEntityKey(String eventType)
     {
+        // FIXME - Remove this
         if (eventType.startsWith("DOMAIN."))
         {
             return Domain.class;
@@ -251,8 +257,6 @@ public class ActionEventUtils {
         else if (eventType.startsWith("USER."))
         {
             return User.class;
-        }else if (eventType.startsWith("VM.")){
-            return VirtualMachine.class;
         }
 
         return null;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ded7e682/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index 9c38430..d1df3c1 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -2982,7 +2982,6 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
         long vmId = cmd.getEntityId();
         Long hostId = cmd.getHostId();
         UserVmVO vm = _vmDao.findById(vmId);
-        CallContext.current().putContextParameter(VirtualMachine.class, vm.getUuid());
 
         Pair<UserVmVO, Map<VirtualMachineProfile.Param, Object>> vmParamPair = null;
         try {


[15/18] git commit: updated refs/heads/resize-root to 6d6e790

Posted by ml...@apache.org.
CLOUDSTACK-6170


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

Branch: refs/heads/resize-root
Commit: 1d74daf6fe7c87931b6308d4e2e0e39f109a85ac
Parents: a1b778f
Author: Mike Tutkowski <mi...@solidfire.com>
Authored: Mon Mar 10 11:42:56 2014 -0600
Committer: Mike Tutkowski <mi...@solidfire.com>
Committed: Mon Mar 10 11:43:54 2014 -0600

----------------------------------------------------------------------
 .../apache/cloudstack/engine/orchestration/CloudOrchestrator.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1d74daf6/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/CloudOrchestrator.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/CloudOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/CloudOrchestrator.java
index 7969e43..fc1b85c 100755
--- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/CloudOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/CloudOrchestrator.java
@@ -188,7 +188,7 @@ public class CloudOrchestrator implements OrchestrationService {
         rootDiskOfferingInfo.setDiskOffering(offering);
         rootDiskOfferingInfo.setSize(rootDiskSize);
 
-        if (offering.isCustomizedIops()) {
+        if (offering.isCustomizedIops() != null && offering.isCustomizedIops()) {
             Map<String, String> userVmDetails = _userVmDetailsDao.listDetailsKeyPairs(vm.getId());
 
             if (userVmDetails != null) {


[04/18] git commit: updated refs/heads/resize-root to 6d6e790

Posted by ml...@apache.org.
CLOUDSTACK-5626: Simplifying VM Migrate code

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


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

Branch: refs/heads/resize-root
Commit: 3b3ae024591fae4db9a6ca991d4838d98b96154e
Parents: 09c3753
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Thu Mar 6 21:38:41 2014 -0500
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Mon Mar 10 11:18:26 2014 +0530

----------------------------------------------------------------------
 .../component/test_cpu_domain_limits.py         |  11 +-
 test/integration/component/test_cpu_limits.py   |  15 ++-
 .../component/test_cpu_project_limits.py        |   7 +-
 .../integration/component/test_memory_limits.py |  15 ++-
 .../component/test_mm_domain_limits.py          |   7 +-
 .../component/test_mm_project_limits.py         |   7 +-
 .../component/test_vpc_vm_life_cycle.py         | 108 ++++---------------
 tools/marvin/marvin/codes.py                    |   1 +
 tools/marvin/marvin/integration/lib/common.py   |  25 +++--
 9 files changed, 80 insertions(+), 116 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3b3ae024/test/integration/component/test_cpu_domain_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_cpu_domain_limits.py b/test/integration/component/test_cpu_domain_limits.py
index c427e4f..1247a79 100644
--- a/test/integration/component/test_cpu_domain_limits.py
+++ b/test/integration/component/test_cpu_domain_limits.py
@@ -30,10 +30,11 @@ from marvin.integration.lib.base import (
 from marvin.integration.lib.common import (get_domain,
                                         get_zone,
                                         get_template,
-                                        find_suitable_host,
+                                        findSuitableHostForMigration,
                                         get_resource_type
                                         )
 from marvin.integration.lib.utils import cleanup_resources
+from marvin.codes import ERROR_NO_HOST_FOR_MIGRATION
 
 class Services:
     """Test resource limit services
@@ -329,7 +330,9 @@ class TestDomainCPULimitsUpdateResources(cloudstackTestCase):
             self.assertEqual(resource_count, expected_resource_count,
                 "Initial resource count should match with the expected resource count")
 
-            host = find_suitable_host(self.apiclient, vm)
+            host = findSuitableHostForMigration(self.apiclient, vm.id)
+            if host is None:
+                self.skipTest(ERROR_NO_HOST_FOR_MIGRATION)
             self.debug("Migrating instance: %s to host: %s" %
                        (vm.name, host.name))
             try:
@@ -477,7 +480,9 @@ class TestDomainCPULimitsUpdateResources(cloudstackTestCase):
             self.assertEqual(resource_count_after_delete, expected_resource_count,
                 "Resource count should match with the expected count")
 
-            host = find_suitable_host(self.apiclient, vm_2)
+            host = findSuitableHostForMigration(self.apiclient, vm_2.id)
+            if host is None:
+                self.skipTest(ERROR_NO_HOST_FOR_MIGRATION)
             self.debug("Migrating instance: %s to host: %s" % (vm_2.name,
                                                                host.name))
             try:

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3b3ae024/test/integration/component/test_cpu_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_cpu_limits.py b/test/integration/component/test_cpu_limits.py
index bdf2869..f043773 100644
--- a/test/integration/component/test_cpu_limits.py
+++ b/test/integration/component/test_cpu_limits.py
@@ -30,10 +30,11 @@ from marvin.integration.lib.base import (
 from marvin.integration.lib.common import (get_domain,
                                         get_zone,
                                         get_template,
-                                        find_suitable_host,
+                                        findSuitableHostForMigration,
                                         get_resource_type
                                         )
 from marvin.integration.lib.utils import cleanup_resources
+from marvin.codes import ERROR_NO_HOST_FOR_MIGRATION
 
 
 class Services:
@@ -251,7 +252,9 @@ class TestCPULimits(cloudstackTestCase):
         self.assertEqual(resource_count, expected_resource_count,
                          "Resource count should match with the expected resource count")
 
-        host = find_suitable_host(self.apiclient, self.vm)
+        host = findSuitableHostForMigration(self.apiclient, self.vm.id)
+        if host is None:
+            self.skipTest(ERROR_NO_HOST_FOR_MIGRATION)
         self.debug("Migrating instance: %s to host: %s" % (self.vm.name, host.name))
         try:
             self.vm.migrate(self.apiclient, host.id)
@@ -570,7 +573,9 @@ class TestDomainCPULimitsConfiguration(cloudstackTestCase):
         self.assertEqual(resource_count, expected_resource_count,
             "Initial resource count should with the expected resource count")
 
-        host = find_suitable_host(self.apiclient, vm)
+        host = findSuitableHostForMigration(self.apiclient, vm.id)
+        if host is None:
+            self.skipTest(ERROR_NO_HOST_FOR_MIGRATION)
         self.debug("Migrating instance: %s to host: %s" %
                    (vm.name, host.name))
         try:
@@ -725,7 +730,9 @@ class TestDomainCPULimitsConfiguration(cloudstackTestCase):
             self.assertEqual(resource_count_after_delete, expected_resource_count,
                 "Resource count should be less than before after deleting the instance")
 
-            host = find_suitable_host(self.apiclient, vm_2)
+            host = findSuitableHostForMigration(self.apiclient, vm_2.id)
+            if host is None:
+                self.skipTest(ERROR_NO_HOST_FOR_MIGRATION)
             self.debug("Migrating instance: %s to host: %s" % (vm_2.name,
                                                                host.name))
             try:

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3b3ae024/test/integration/component/test_cpu_project_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_cpu_project_limits.py b/test/integration/component/test_cpu_project_limits.py
index a8a1b3c..ed7cd88 100644
--- a/test/integration/component/test_cpu_project_limits.py
+++ b/test/integration/component/test_cpu_project_limits.py
@@ -30,10 +30,11 @@ from marvin.integration.lib.base import (
 from marvin.integration.lib.common import (get_domain,
                                         get_zone,
                                         get_template,
-                                        find_suitable_host,
+                                        findSuitableHostForMigration,
                                         get_resource_type
                                         )
 from marvin.integration.lib.utils import cleanup_resources
+from marvin.codes import ERROR_NO_HOST_FOR_MIGRATION
 
 class Services:
     """Test resource limit services
@@ -291,7 +292,9 @@ class TestProjectsCPULimits(cloudstackTestCase):
         self.assertEqual(resource_count, expected_resource_count,
                          "Resource count should match with the expected resource count")
 
-        host = find_suitable_host(self.apiclient, self.vm)
+        host = findSuitableHostForMigration(self.apiclient, self.vm.id)
+        if host is None:
+            self.skipTest(ERROR_NO_HOST_FOR_MIGRATION)
         self.debug("Migrating instance: %s to host: %s" %
                                                     (self.vm.name, host.name))
         try:

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3b3ae024/test/integration/component/test_memory_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_memory_limits.py b/test/integration/component/test_memory_limits.py
index 7921e4b..231307f 100644
--- a/test/integration/component/test_memory_limits.py
+++ b/test/integration/component/test_memory_limits.py
@@ -30,10 +30,11 @@ from marvin.integration.lib.common import (get_domain,
                                         get_zone,
                                         get_template,
                                         wait_for_cleanup,
-                                        find_suitable_host,
+                                        findSuitableHostForMigration,
                                         get_resource_type
                                         )
 from marvin.integration.lib.utils import cleanup_resources
+from marvin.codes import ERROR_NO_HOST_FOR_MIGRATION
 
 class Services:
     """Test memory resource limit services
@@ -248,7 +249,9 @@ class TestMemoryLimits(cloudstackTestCase):
         self.assertEqual(resource_count, expected_resource_count,
                          "Resource count should match with the expected resource count")
 
-        host = find_suitable_host(self.apiclient, self.vm)
+        host = findSuitableHostForMigration(self.apiclient, self.vm.id)
+        if host is None:
+            self.skipTest(ERROR_NO_HOST_FOR_MIGRATION)
         self.debug("Migrating instance: %s to host: %s" % (self.vm.name, host.name))
         try:
             self.vm.migrate(self.apiclient, host.id)
@@ -587,7 +590,9 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
             self.assertEqual(resource_count, expected_resource_count,
                          "Initial resource count should with the expected resource count")
 
-            host = find_suitable_host(self.apiclient, vm)
+            host = findSuitableHostForMigration(self.apiclient, vm.id)
+            if host is None:
+                self.skipTest(ERROR_NO_HOST_FOR_MIGRATION)
             self.debug("Migrating instance: %s to host: %s" %
                                                         (vm.name, host.name))
             try:
@@ -743,7 +748,9 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
             self.assertEqual(resource_count_after_delete, expected_resource_count,
                          "Resource count should match with the expected resource count")
 
-            host = find_suitable_host(self.apiclient, vm_2)
+            host = findSuitableHostForMigration(self.apiclient, vm_2.id)
+            if host is None:
+                self.skipTest(ERROR_NO_HOST_FOR_MIGRATION)
             self.debug("Migrating instance: %s to host: %s" % (vm_2.name,
                                                                host.name))
             try:

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3b3ae024/test/integration/component/test_mm_domain_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_mm_domain_limits.py b/test/integration/component/test_mm_domain_limits.py
index 68660c1..a2b7395 100644
--- a/test/integration/component/test_mm_domain_limits.py
+++ b/test/integration/component/test_mm_domain_limits.py
@@ -30,11 +30,12 @@ from marvin.integration.lib.common import (get_domain,
                                         get_zone,
                                         get_template,
 					                    wait_for_cleanup,
-                                        find_suitable_host,
+                                        findSuitableHostForMigration,
                                         get_resource_type,
                                         update_resource_count
                                         )
 from marvin.integration.lib.utils import cleanup_resources
+from marvin.codes import ERROR_NO_HOST_FOR_MIGRATION
 
 class Services:
     """Test memory resource limit services
@@ -388,7 +389,9 @@ class TestDomainMemoryLimits(cloudstackTestCase):
             self.assertEqual(resource_count, expected_resource_count,
                          "Resource count should match with the expected resource count")
 
-            host = find_suitable_host(self.apiclient, vm)
+            host = findSuitableHostForMigration(self.apiclient, vm.id)
+            if host is None:
+                self.skipTest(ERROR_NO_HOST_FOR_MIGRATION)
             self.debug("Migrating instance: %s to host: %s" %
                                                         (vm.name, host.name))
             try:

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3b3ae024/test/integration/component/test_mm_project_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_mm_project_limits.py b/test/integration/component/test_mm_project_limits.py
index c314011..29a3b54 100644
--- a/test/integration/component/test_mm_project_limits.py
+++ b/test/integration/component/test_mm_project_limits.py
@@ -30,10 +30,11 @@ from marvin.integration.lib.common import (get_domain,
                                         get_zone,
                                         get_template,
 					                    wait_for_cleanup,
-                                        find_suitable_host,
+                                        findSuitableHostForMigration,
                                         get_resource_type
                                         )
 from marvin.integration.lib.utils import cleanup_resources
+from marvin.codes import ERROR_NO_HOST_FOR_MIGRATION
 
 class Services:
     """Test memory resource limit services
@@ -291,7 +292,9 @@ class TestProjectsMemoryLimits(cloudstackTestCase):
         resource_count = project_list[0].memorytotal
         self.debug(resource_count)
 
-        host = find_suitable_host(self.apiclient, self.vm)
+        host = findSuitableHostForMigration(self.apiclient, self.vm.id)
+        if host is None:
+            self.skipTest(ERROR_NO_HOST_FOR_MIGRATION)
         self.debug("Migrating instance: %s to host: %s" %
                                                     (self.vm.name, host.name))
         try:

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3b3ae024/test/integration/component/test_vpc_vm_life_cycle.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_vm_life_cycle.py b/test/integration/component/test_vpc_vm_life_cycle.py
index 01373ac..e40067e 100644
--- a/test/integration/component/test_vpc_vm_life_cycle.py
+++ b/test/integration/component/test_vpc_vm_life_cycle.py
@@ -41,9 +41,10 @@ from marvin.integration.lib.common import (get_domain,
                                            get_free_vlan,
                                            wait_for_cleanup,
                                            list_virtual_machines,
-                                           list_hosts)
+                                           list_hosts,
+                                           findSuitableHostForMigration)
 
-from marvin.codes import PASS
+from marvin.codes import PASS, ERROR_NO_HOST_FOR_MIGRATION
 
 import time
 
@@ -715,35 +716,13 @@ class TestVMLifeCycleVPC(cloudstackTestCase):
         #    works as expected.
         # 3. Make sure that we are able to access google.com from this user Vm
 
-        vm_list = VirtualMachine.list(self.apiclient, id=self.vm_1.id)
-        self.assertEqual(validateList(vm_list)[0], PASS, "vm list validation failed, vm list is %s" % vm_list)
-
-        vm_hostid = vm_list[0].hostid
-
-        self.debug("Checking if the host is available for migration?")
-        hosts = Host.list(
-                          self.apiclient,
-                          zoneid=self.zone.id,
-                          type='Routing'
-                          )
-
-        self.assertEqual(
-                         isinstance(hosts, list),
-                         True,
-                         "List hosts should return a valid list"
-                         )
-        if len(hosts) < 2:
-            raise unittest.SkipTest(
-            "No host available for migration. Test requires atleast 2 hosts")
-
-        # Remove the host of current VM from the hosts list
-        hosts[:] = [host for host in hosts if host.id != vm_hostid]
-
-        host = hosts[0]
-
         self.debug("Validating if the network rules work properly or not?")
         self.validate_network_rules()
 
+        host = findSuitableHostForMigration(self.apiclient, self.vm_1.id)
+        if host is None:
+            self.skipTest(ERROR_NO_HOST_FOR_MIGRATION)
+
         self.debug("Migrating VM-ID: %s to Host: %s" % (
                                                         self.vm_1.id,
                                                         host.id
@@ -1506,30 +1485,13 @@ class TestVMLifeCycleSharedNwVPC(cloudstackTestCase):
         #    works as expected.
         # 3. Make sure that we are able to access google.com from this user Vm
 
-        self.debug("Checking if the host is available for migration?")
-        hosts = Host.list(
-                          self.apiclient,
-                          zoneid=self.zone.id,
-                          type='Routing'
-                          )
-
-        self.assertEqual(
-                         isinstance(hosts, list),
-                         True,
-                         "List hosts should return a valid list"
-                         )
-        if len(hosts) < 2:
-            raise unittest.SkipTest(
-            "No host available for migration. Test requires atleast 2 hosts")
-
-        # Remove the host of current VM from the hosts list
-        hosts[:] = [host for host in hosts if host.id != self.vm_1.hostid]
-
-        host = hosts[0]
-
         self.debug("Validating if network rules are coonfigured properly?")
         self.validate_network_rules()
 
+        host = findSuitableHostForMigration(self.apiclient, self.vm_1.id)
+        if host is None:
+            self.skipTest(ERROR_NO_HOST_FOR_MIGRATION)
+
         self.debug("Migrating VM-ID: %s to Host: %s" % (
                                                         self.vm_1.id,
                                                         host.id
@@ -2559,30 +2521,13 @@ class TestVMLifeCycleStoppedVPCVR(cloudstackTestCase):
         #    works as expected.
         # 3. Make sure that we are able to access google.com from this user Vm
 
-        self.debug("Checking if the host is available for migration?")
-        hosts = Host.list(
-                          self.apiclient,
-                          zoneid=self.zone.id,
-                          type='Routing'
-                          )
-
-        self.assertEqual(
-                         isinstance(hosts, list),
-                         True,
-                         "List hosts should return a valid list"
-                         )
-        if len(hosts) < 2:
-            raise unittest.SkipTest(
-            "No host available for migration. Test requires atleast 2 hosts")
-
-        # Remove the host of current VM from the hosts list
-        hosts[:] = [host for host in hosts if host.id != self.vm_1.hostid]
-
-        host = hosts[0]
-
         self.debug("Validating if the network rules work properly or not?")
         self.validate_network_rules()
 
+        host = findSuitableHostForMigration(self.apiclient, self.vm_1.id)
+        if host is None:
+            self.skipTest(ERROR_NO_HOST_FOR_MIGRATION)
+
         self.debug("Migrating VM-ID: %s on Host: %s to Host: %s" % (
                                                         self.vm_1.id,
                                                         self.vm_1.hostid,
@@ -3459,28 +3404,13 @@ class TestVMLifeCycleDiffHosts(cloudstackTestCase):
         #    works as expected.
         # 3. Make sure that we are able to access google.com from this user Vm
 
-        self.debug("Checking if the host is available for migration?")
-        hosts = Host.listForMigration(
-                          self.apiclient,
-                          virtualmachineid=self.vm_1.id,
-                          )
-        self.debug("Hosts vm can be migrated to are : %s" %(hosts))
-        self.assertEqual(
-                         isinstance(hosts, list),
-                         True,
-                         "List hosts should return a valid list"
-                         )
-        # Remove the host of current VM from the hosts list
-        hosts[:] = [host for host in hosts if host.id != self.vm_1.hostid]
-        if len(hosts) <= 0:
-            self.skipTest(
-            "No host available for migration. Test requires atleast 2 hosts tagged with host1")
-
-        host = hosts[0]
-
         self.debug("Validating if the network rules work properly or not?")
         self.validate_network_rules()
 
+        host = findSuitableHostForMigration(self.apiclient, self.vm_1.id)
+        if host is None:
+            self.skipTest(ERROR_NO_HOST_FOR_MIGRATION)
+
         self.debug("Migrating VM-ID: %s to Host: %s" % (
                                                         self.vm_1.id,
                                                         host.id

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3b3ae024/tools/marvin/marvin/codes.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/codes.py b/tools/marvin/marvin/codes.py
index 3882f0d..e4a0f6a 100644
--- a/tools/marvin/marvin/codes.py
+++ b/tools/marvin/marvin/codes.py
@@ -51,3 +51,4 @@ BASIC_ZONE = "basic"
 ISOLATED_NETWORK = "ISOLATED"
 SHARED_NETWORK = "SHARED"
 VPC_NETWORK = "VPC"
+ERROR_NO_HOST_FOR_MIGRATION = "Could not find suitable host for migration, please ensure setup has required no. of hosts"

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3b3ae024/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 b2da3ff..d3d634b 100644
--- a/tools/marvin/marvin/integration/lib/common.py
+++ b/tools/marvin/marvin/integration/lib/common.py
@@ -712,18 +712,23 @@ def update_resource_count(apiclient, domainid, accountid=None,
                               )
         return
 
-def find_suitable_host(apiclient, vm):
-        """Returns a suitable host for VM migration"""
+def findSuitableHostForMigration(apiclient, vmid):
+    """Returns a suitable host for VM migration"""
+    suitableHost = None
+    try:
+        hosts = Host.listForMigration(apiclient, virtualmachineid=vmid,
+                )
+    except Exception as e:
+        raise Exception("Exception while getting hosts list suitable for migration: %s" % e)
 
-        hosts = Host.list(apiclient,
-                          virtualmachineid=vm.id,
-                          listall=True)
+    suitablehosts = []
+    if isinstance(hosts, list) and len(hosts) > 0:
+        suitablehosts = [host for host in hosts if (str(host.resourcestate).lower() == "enabled"\
+                and str(host.state).lower() == "up")]
+        if len(suitablehosts)>0:
+            suitableHost = suitablehosts[0]
 
-        if isinstance(hosts, list):
-            assert len(hosts) > 0, "List host should return valid response"
-        else:
-            raise Exception("Exception: List host should return valid response")
-        return hosts[0]
+    return suitableHost
 
 def get_resource_type(resource_id):
         """Returns resource type"""


[02/18] git commit: updated refs/heads/resize-root to 6d6e790

Posted by ml...@apache.org.
CLOUDSTACK-6170


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

Branch: refs/heads/resize-root
Commit: cb26b4c3375cdf4f8ecedf618f98e6b24a2cba6e
Parents: ded7e68
Author: Mike Tutkowski <mi...@solidfire.com>
Authored: Fri Mar 7 22:20:38 2014 -0700
Committer: Mike Tutkowski <mi...@solidfire.com>
Committed: Fri Mar 7 23:52:01 2014 -0700

----------------------------------------------------------------------
 .../src/com/cloud/hypervisor/XenServerGuru.java | 33 ++++++++++----------
 1 file changed, 16 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cb26b4c3/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java
index 529e261..059e6e4 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java
@@ -34,7 +34,6 @@ import com.cloud.host.HostVO;
 import com.cloud.host.dao.HostDao;
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.storage.GuestOSVO;
-import com.cloud.storage.Volume;
 import com.cloud.storage.VolumeVO;
 import com.cloud.storage.dao.GuestOSDao;
 import com.cloud.storage.dao.VolumeDao;
@@ -103,30 +102,30 @@ public class XenServerGuru extends HypervisorGuruBase implements HypervisorGuru
 
         List<VolumeVO> volumes = _volumeDao.findByInstance(vm.getId());
 
+        // it's OK in this case to send a detach command to the host for a root volume as this
+        // will simply lead to the SR that supports the root volume being removed
         if (volumes != null) {
             for (VolumeVO volume : volumes) {
-                if (volume.getVolumeType() == Volume.Type.DATADISK) {
-                    StoragePoolVO storagePool = _storagePoolDao.findById(volume.getPoolId());
+                StoragePoolVO storagePool = _storagePoolDao.findById(volume.getPoolId());
 
-                    // storagePool should be null if we are expunging a volume that was never
-                    // attached to a VM that was started (the "trick" for storagePool to be null
-                    // is that none of the VMs this volume may have been attached to were ever started,
-                    // so the volume was never assigned to a storage pool)
-                    if (storagePool != null && storagePool.isManaged()) {
-                        DataTO volTO = _volFactory.getVolume(volume.getId()).getTO();
-                        DiskTO disk = new DiskTO(volTO, volume.getDeviceId(), volume.getPath(), volume.getVolumeType());
+                // storagePool should be null if we are expunging a volume that was never
+                // attached to a VM that was started (the "trick" for storagePool to be null
+                // is that none of the VMs this volume may have been attached to were ever started,
+                // so the volume was never assigned to a storage pool)
+                if (storagePool != null && storagePool.isManaged()) {
+                    DataTO volTO = _volFactory.getVolume(volume.getId()).getTO();
+                    DiskTO disk = new DiskTO(volTO, volume.getDeviceId(), volume.getPath(), volume.getVolumeType());
 
-                        DettachCommand cmd = new DettachCommand(disk, vm.getInstanceName());
+                    DettachCommand cmd = new DettachCommand(disk, vm.getInstanceName());
 
-                        cmd.setManaged(true);
+                    cmd.setManaged(true);
 
-                        cmd.setStorageHost(storagePool.getHostAddress());
-                        cmd.setStoragePort(storagePool.getPort());
+                    cmd.setStorageHost(storagePool.getHostAddress());
+                    cmd.setStoragePort(storagePool.getPort());
 
-                        cmd.set_iScsiName(volume.get_iScsiName());
+                    cmd.set_iScsiName(volume.get_iScsiName());
 
-                        commands.add(cmd);
-                    }
+                    commands.add(cmd);
                 }
             }
         }


[17/18] git commit: updated refs/heads/resize-root to 6d6e790

Posted by ml...@apache.org.
CLOUDSTACK-6220: Fix cloudstack init scripts so that they
don't use fully qualified path as script name. Fix for
commit 9dd57c22b02afcddb1d6c8ddc3e1b578961454e3


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

Branch: refs/heads/resize-root
Commit: d033ca486bf9bc22a2afe314d00150ec6019c809
Parents: bf9375b
Author: Marcus Sorensen <ma...@betterservers.com>
Authored: Mon Mar 10 15:34:55 2014 -0600
Committer: Marcus Sorensen <ma...@betterservers.com>
Committed: Mon Mar 10 15:34:55 2014 -0600

----------------------------------------------------------------------
 agent/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-agent.in          | 2 +-
 agent/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-agent.in          | 2 +-
 agent/distro/opensuse/sles/SYSCONFDIR/init.d/cloud-agent.in        | 2 +-
 agent/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-agent.in            | 2 +-
 agent/distro/sles/SYSCONFDIR/init.d/cloud-agent.in                 | 2 +-
 packaging/centos63/cloud-agent.rc                                  | 2 +-
 packaging/centos63/cloud-ipallocator.rc                            | 2 +-
 python/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in   | 2 +-
 python/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in   | 2 +-
 python/distro/opensuse/SYSCONFDIR/init.d/cloud-ipallocator.in      | 2 +-
 python/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in     | 2 +-
 python/distro/sles/SYSCONFDIR/init.d/cloud-ipallocator.in          | 2 +-
 python/distro/ubuntu/SYSCONFDIR/init.d/cloud-ipallocator.in        | 2 +-
 .../distro/centos/SYSCONFDIR/rc.d/init.d/cloud-console-proxy.in    | 2 +-
 .../distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-console-proxy.in    | 2 +-
 systemvm/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-console-proxy.in | 2 +-
 systemvm/distro/ubuntu/SYSCONFDIR/init.d/cloud-console-proxy.in    | 2 +-
 17 files changed, 17 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d033ca48/agent/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-agent.in
----------------------------------------------------------------------
diff --git a/agent/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-agent.in b/agent/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-agent.in
index 60e1e04..704ef6b 100755
--- a/agent/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-agent.in
+++ b/agent/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-agent.in
@@ -26,7 +26,7 @@
 
 # set environment variables
 
-SHORTNAME="$0"
+SHORTNAME="basename $0"
 PIDFILE=@PIDDIR@/"$SHORTNAME".pid
 LOCKFILE=@LOCKDIR@/"$SHORTNAME"
 LOGFILE=@AGENTLOG@

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d033ca48/agent/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-agent.in
----------------------------------------------------------------------
diff --git a/agent/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-agent.in b/agent/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-agent.in
index 60e1e04..704ef6b 100755
--- a/agent/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-agent.in
+++ b/agent/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-agent.in
@@ -26,7 +26,7 @@
 
 # set environment variables
 
-SHORTNAME="$0"
+SHORTNAME="basename $0"
 PIDFILE=@PIDDIR@/"$SHORTNAME".pid
 LOCKFILE=@LOCKDIR@/"$SHORTNAME"
 LOGFILE=@AGENTLOG@

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d033ca48/agent/distro/opensuse/sles/SYSCONFDIR/init.d/cloud-agent.in
----------------------------------------------------------------------
diff --git a/agent/distro/opensuse/sles/SYSCONFDIR/init.d/cloud-agent.in b/agent/distro/opensuse/sles/SYSCONFDIR/init.d/cloud-agent.in
index 2422268..e684888 100644
--- a/agent/distro/opensuse/sles/SYSCONFDIR/init.d/cloud-agent.in
+++ b/agent/distro/opensuse/sles/SYSCONFDIR/init.d/cloud-agent.in
@@ -33,7 +33,7 @@
 
 # set environment variables
 
-SHORTNAME="$0"
+SHORTNAME="basename $0"
 PIDFILE=@PIDDIR@/"$SHORTNAME".pid
 LOCKFILE=@LOCKDIR@/"$SHORTNAME"
 LOGFILE=@AGENTLOG@

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d033ca48/agent/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-agent.in
----------------------------------------------------------------------
diff --git a/agent/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-agent.in b/agent/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-agent.in
index 60e1e04..704ef6b 100644
--- a/agent/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-agent.in
+++ b/agent/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-agent.in
@@ -26,7 +26,7 @@
 
 # set environment variables
 
-SHORTNAME="$0"
+SHORTNAME="basename $0"
 PIDFILE=@PIDDIR@/"$SHORTNAME".pid
 LOCKFILE=@LOCKDIR@/"$SHORTNAME"
 LOGFILE=@AGENTLOG@

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d033ca48/agent/distro/sles/SYSCONFDIR/init.d/cloud-agent.in
----------------------------------------------------------------------
diff --git a/agent/distro/sles/SYSCONFDIR/init.d/cloud-agent.in b/agent/distro/sles/SYSCONFDIR/init.d/cloud-agent.in
index 2422268..e684888 100644
--- a/agent/distro/sles/SYSCONFDIR/init.d/cloud-agent.in
+++ b/agent/distro/sles/SYSCONFDIR/init.d/cloud-agent.in
@@ -33,7 +33,7 @@
 
 # set environment variables
 
-SHORTNAME="$0"
+SHORTNAME="basename $0"
 PIDFILE=@PIDDIR@/"$SHORTNAME".pid
 LOCKFILE=@LOCKDIR@/"$SHORTNAME"
 LOGFILE=@AGENTLOG@

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d033ca48/packaging/centos63/cloud-agent.rc
----------------------------------------------------------------------
diff --git a/packaging/centos63/cloud-agent.rc b/packaging/centos63/cloud-agent.rc
index 40c358e..af1c624 100755
--- a/packaging/centos63/cloud-agent.rc
+++ b/packaging/centos63/cloud-agent.rc
@@ -26,7 +26,7 @@
 
 # set environment variables
 
-SHORTNAME="$0"
+SHORTNAME="basename $0"
 PIDFILE=/var/run/"$SHORTNAME".pid
 LOCKFILE=/var/lock/subsys/"$SHORTNAME"
 LOGDIR=/var/log/cloudstack/agent

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d033ca48/packaging/centos63/cloud-ipallocator.rc
----------------------------------------------------------------------
diff --git a/packaging/centos63/cloud-ipallocator.rc b/packaging/centos63/cloud-ipallocator.rc
index 9a24d8d..9d1adb4 100755
--- a/packaging/centos63/cloud-ipallocator.rc
+++ b/packaging/centos63/cloud-ipallocator.rc
@@ -25,7 +25,7 @@
 
 # set environment variables
 
-SHORTNAME="$0"
+SHORTNAME="basename $0"
 PIDFILE=/var/run/"$SHORTNAME".pid
 LOCKFILE=/var/lock/subsys/"$SHORTNAME"
 LOGFILE=/var/log/cloudstack/ipallocator/ipallocator.log

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d033ca48/python/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in
----------------------------------------------------------------------
diff --git a/python/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in b/python/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in
index b6720f5..ae8d215 100755
--- a/python/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in
+++ b/python/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in
@@ -25,7 +25,7 @@
 
 # set environment variables
 
-SHORTNAME="$0"
+SHORTNAME="basename $0"
 PIDFILE=@PIDDIR@/"$SHORTNAME".pid
 LOCKFILE=@LOCKDIR@/"$SHORTNAME"
 LOGFILE=@IPALOCATORLOG@

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d033ca48/python/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in
----------------------------------------------------------------------
diff --git a/python/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in b/python/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in
index aa7e8cf..49fd9b6 100755
--- a/python/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in
+++ b/python/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in
@@ -25,7 +25,7 @@
 
 # set environment variables
 
-SHORTNAME="$0"
+SHORTNAME="basename $0"
 PIDFILE=@PIDDIR@/"$SHORTNAME".pid
 LOCKFILE=@LOCKDIR@/"$SHORTNAME"
 LOGFILE=@AGENTLOG@

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d033ca48/python/distro/opensuse/SYSCONFDIR/init.d/cloud-ipallocator.in
----------------------------------------------------------------------
diff --git a/python/distro/opensuse/SYSCONFDIR/init.d/cloud-ipallocator.in b/python/distro/opensuse/SYSCONFDIR/init.d/cloud-ipallocator.in
index 7aa456d..901d5845 100755
--- a/python/distro/opensuse/SYSCONFDIR/init.d/cloud-ipallocator.in
+++ b/python/distro/opensuse/SYSCONFDIR/init.d/cloud-ipallocator.in
@@ -32,7 +32,7 @@
 
 # set environment variables
 
-SHORTNAME="$0"
+SHORTNAME="basename $0"
 PIDFILE=@PIDDIR@/"$SHORTNAME".pid
 LOCKFILE=@LOCKDIR@/"$SHORTNAME"
 LOGFILE=@AGENTLOG@

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d033ca48/python/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in
----------------------------------------------------------------------
diff --git a/python/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in b/python/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in
index aa7e8cf..49fd9b6 100644
--- a/python/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in
+++ b/python/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in
@@ -25,7 +25,7 @@
 
 # set environment variables
 
-SHORTNAME="$0"
+SHORTNAME="basename $0"
 PIDFILE=@PIDDIR@/"$SHORTNAME".pid
 LOCKFILE=@LOCKDIR@/"$SHORTNAME"
 LOGFILE=@AGENTLOG@

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d033ca48/python/distro/sles/SYSCONFDIR/init.d/cloud-ipallocator.in
----------------------------------------------------------------------
diff --git a/python/distro/sles/SYSCONFDIR/init.d/cloud-ipallocator.in b/python/distro/sles/SYSCONFDIR/init.d/cloud-ipallocator.in
index 7aa456d..901d5845 100755
--- a/python/distro/sles/SYSCONFDIR/init.d/cloud-ipallocator.in
+++ b/python/distro/sles/SYSCONFDIR/init.d/cloud-ipallocator.in
@@ -32,7 +32,7 @@
 
 # set environment variables
 
-SHORTNAME="$0"
+SHORTNAME="basename $0"
 PIDFILE=@PIDDIR@/"$SHORTNAME".pid
 LOCKFILE=@LOCKDIR@/"$SHORTNAME"
 LOGFILE=@AGENTLOG@

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d033ca48/python/distro/ubuntu/SYSCONFDIR/init.d/cloud-ipallocator.in
----------------------------------------------------------------------
diff --git a/python/distro/ubuntu/SYSCONFDIR/init.d/cloud-ipallocator.in b/python/distro/ubuntu/SYSCONFDIR/init.d/cloud-ipallocator.in
index ec84962..5ec6da0 100755
--- a/python/distro/ubuntu/SYSCONFDIR/init.d/cloud-ipallocator.in
+++ b/python/distro/ubuntu/SYSCONFDIR/init.d/cloud-ipallocator.in
@@ -26,7 +26,7 @@
 
 # set environment variables
 
-SHORTNAME="$0"
+SHORTNAME="basename $0"
 PIDFILE=@PIDDIR@/"$SHORTNAME".pid
 LOCKFILE=@LOCKDIR@/"$SHORTNAME"
 LOGFILE=@AGENTLOG@

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d033ca48/systemvm/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-console-proxy.in
----------------------------------------------------------------------
diff --git a/systemvm/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-console-proxy.in b/systemvm/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-console-proxy.in
index 76ee681..e43f641 100644
--- a/systemvm/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-console-proxy.in
+++ b/systemvm/distro/centos/SYSCONFDIR/rc.d/init.d/cloud-console-proxy.in
@@ -26,7 +26,7 @@
 
 # set environment variables
 
-SHORTNAME="$0"
+SHORTNAME="basename $0"
 PIDFILE=@PIDDIR@/"$SHORTNAME".pid
 LOCKFILE=@LOCKDIR@/"$SHORTNAME"
 LOGFILE=@CPLOG@

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d033ca48/systemvm/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-console-proxy.in
----------------------------------------------------------------------
diff --git a/systemvm/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-console-proxy.in b/systemvm/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-console-proxy.in
index 76ee681..e43f641 100644
--- a/systemvm/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-console-proxy.in
+++ b/systemvm/distro/fedora/SYSCONFDIR/rc.d/init.d/cloud-console-proxy.in
@@ -26,7 +26,7 @@
 
 # set environment variables
 
-SHORTNAME="$0"
+SHORTNAME="basename $0"
 PIDFILE=@PIDDIR@/"$SHORTNAME".pid
 LOCKFILE=@LOCKDIR@/"$SHORTNAME"
 LOGFILE=@CPLOG@

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d033ca48/systemvm/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-console-proxy.in
----------------------------------------------------------------------
diff --git a/systemvm/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-console-proxy.in b/systemvm/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-console-proxy.in
index 76ee681..e43f641 100644
--- a/systemvm/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-console-proxy.in
+++ b/systemvm/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-console-proxy.in
@@ -26,7 +26,7 @@
 
 # set environment variables
 
-SHORTNAME="$0"
+SHORTNAME="basename $0"
 PIDFILE=@PIDDIR@/"$SHORTNAME".pid
 LOCKFILE=@LOCKDIR@/"$SHORTNAME"
 LOGFILE=@CPLOG@

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d033ca48/systemvm/distro/ubuntu/SYSCONFDIR/init.d/cloud-console-proxy.in
----------------------------------------------------------------------
diff --git a/systemvm/distro/ubuntu/SYSCONFDIR/init.d/cloud-console-proxy.in b/systemvm/distro/ubuntu/SYSCONFDIR/init.d/cloud-console-proxy.in
index c83f00a..87a653e 100755
--- a/systemvm/distro/ubuntu/SYSCONFDIR/init.d/cloud-console-proxy.in
+++ b/systemvm/distro/ubuntu/SYSCONFDIR/init.d/cloud-console-proxy.in
@@ -27,7 +27,7 @@
 
 # set environment variables
 
-SHORTNAME="$0"
+SHORTNAME="basename $0"
 PIDFILE=@PIDDIR@/"$SHORTNAME".pid
 LOCKFILE=@LOCKDIR@/"$SHORTNAME"
 LOGFILE=@CPLOG@


[07/18] git commit: updated refs/heads/resize-root to 6d6e790

Posted by ml...@apache.org.
findbugs: String for Service type mismatch (plus test for dummy  data)

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

Branch: refs/heads/resize-root
Commit: 1075bed06c32f14152a8c5c7e534955392e5f662
Parents: 07102b4
Author: Daan Hoogland <da...@onecht.net>
Authored: Mon Mar 10 10:44:10 2014 +0100
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Mar 10 10:44:10 2014 +0100

----------------------------------------------------------------------
 .../com/cloud/network/vpc/VpcManagerImpl.java   |  4 +-
 .../cloud/network/vpc/VpcManagerImplTest.java   | 53 ++++++++++++++++++++
 2 files changed, 55 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1075bed0/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 403b95e..762cc6f 100644
--- a/server/src/com/cloud/network/vpc/VpcManagerImpl.java
+++ b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
@@ -424,14 +424,14 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
         List<VpcOfferingServiceMapVO> map = _vpcOffSvcMapDao.listByVpcOffId(vpcOffId);
 
         for (VpcOfferingServiceMapVO instance : map) {
-            String service = instance.getService();
+            Service service = Service.getService(instance.getService());
             Set<Provider> providers;
             providers = serviceProviderMap.get(service);
             if (providers == null) {
                 providers = new HashSet<Provider>();
             }
             providers.add(Provider.getProvider(instance.getProvider()));
-            serviceProviderMap.put(Service.getService(service), providers);
+            serviceProviderMap.put(service, providers);
         }
 
         return serviceProviderMap;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1075bed0/server/test/com/cloud/network/vpc/VpcManagerImplTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/network/vpc/VpcManagerImplTest.java b/server/test/com/cloud/network/vpc/VpcManagerImplTest.java
new file mode 100644
index 0000000..a0237b4
--- /dev/null
+++ b/server/test/com/cloud/network/vpc/VpcManagerImplTest.java
@@ -0,0 +1,53 @@
+package com.cloud.network.vpc;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.cloudstack.context.CallContext;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+
+import static org.mockito.Mockito.when;
+
+import com.cloud.network.Network.Provider;
+import com.cloud.network.Network.Service;
+import com.cloud.network.vpc.dao.VpcOfferingServiceMapDao;
+import com.cloud.user.Account;
+import com.cloud.user.User;
+
+public class VpcManagerImplTest {
+
+    @Mock
+    VpcOfferingServiceMapDao vpcOffSvcMapDao;
+    VpcManagerImpl manager;
+
+    @Before
+    public void setup()
+    {
+        MockitoAnnotations.initMocks(this);
+        manager = new VpcManagerImpl();
+        manager._vpcOffSvcMapDao = vpcOffSvcMapDao;
+    }
+    @Test
+    public void getVpcOffSvcProvidersMapForEmptyServiceTest() {
+        long vpcOffId = 1L;
+        List<VpcOfferingServiceMapVO> list = new ArrayList<VpcOfferingServiceMapVO>();
+        list.add(Mockito.mock(VpcOfferingServiceMapVO.class));
+        when(manager._vpcOffSvcMapDao.listByVpcOffId(vpcOffId)).thenReturn(list);
+
+        Map<Service, Set<Provider>> map = manager.getVpcOffSvcProvidersMap(vpcOffId);
+
+        assertNotNull(map);
+        assertEquals(map.size(),1);
+    }
+
+}


[11/18] git commit: updated refs/heads/resize-root to 6d6e790

Posted by ml...@apache.org.
findbugs: null check before use of pointer

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

Branch: refs/heads/resize-root
Commit: e0d20fb6eb7b9550ad8b543e2df0ad00d8c9965e
Parents: 579cb9c
Author: Daan Hoogland <da...@onecht.net>
Authored: Mon Mar 10 13:08:15 2014 +0100
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Mar 10 13:08:15 2014 +0100

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e0d20fb6/server/src/com/cloud/network/NetworkModelImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkModelImpl.java b/server/src/com/cloud/network/NetworkModelImpl.java
index 9212a89..7b4b2be 100755
--- a/server/src/com/cloud/network/NetworkModelImpl.java
+++ b/server/src/com/cloud/network/NetworkModelImpl.java
@@ -1533,28 +1533,34 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel {
 
     @Override
     public void checkNetworkPermissions(Account owner, Network network) {
+        // dahn 20140310: I was thinking of making this an assert but
+        //                as we hardly ever test with asserts I think
+        //                we better make sure at runtime.
+        if (network == null) {
+            throw new CloudRuntimeException("cannot check permissions on (Network) <null>");
+        }
         // Perform account permission check
         if (network.getGuestType() != Network.GuestType.Shared || (network.getGuestType() == Network.GuestType.Shared && network.getAclType() == ACLType.Account)) {
             AccountVO networkOwner = _accountDao.findById(network.getAccountId());
             if (networkOwner == null)
-                throw new PermissionDeniedException("Unable to use network with id= " + ((network != null) ? ((NetworkVO)network).getUuid() : "") +
+                throw new PermissionDeniedException("Unable to use network with id= " + ((NetworkVO)network).getUuid() +
                     ", network does not have an owner");
             if (owner.getType() != Account.ACCOUNT_TYPE_PROJECT && networkOwner.getType() == Account.ACCOUNT_TYPE_PROJECT) {
                 if (!_projectAccountDao.canAccessProjectAccount(owner.getAccountId(), network.getAccountId())) {
-                    throw new PermissionDeniedException("Unable to use network with id= " + ((network != null) ? ((NetworkVO)network).getUuid() : "") +
+                    throw new PermissionDeniedException("Unable to use network with id= " + ((NetworkVO)network).getUuid() +
                         ", permission denied");
                 }
             } else {
                 List<NetworkVO> networkMap = _networksDao.listBy(owner.getId(), network.getId());
                 if (networkMap == null || networkMap.isEmpty()) {
-                    throw new PermissionDeniedException("Unable to use network with id= " + ((network != null) ? ((NetworkVO)network).getUuid() : "") +
+                    throw new PermissionDeniedException("Unable to use network with id= " + ((NetworkVO)network).getUuid() +
                         ", permission denied");
                 }
             }
 
         } else {
             if (!isNetworkAvailableInDomain(network.getId(), owner.getDomainId())) {
-                throw new PermissionDeniedException("Shared network id=" + ((network != null) ? ((NetworkVO)network).getUuid() : "") + " is not available in domain id=" +
+                throw new PermissionDeniedException("Shared network id=" + ((NetworkVO)network).getUuid() + " is not available in domain id=" +
                     owner.getDomainId());
             }
         }


[05/18] git commit: updated refs/heads/resize-root to 6d6e790

Posted by ml...@apache.org.
CLOUDSTACK-6147: Adding first set of test caess for Dynamic Compute Offering feature

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


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

Branch: refs/heads/resize-root
Commit: 3f7b628c707cd9c30542efd670416be5fbb473f0
Parents: 3b3ae02
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Fri Feb 28 01:46:24 2014 -0500
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Mon Mar 10 11:20:44 2014 +0530

----------------------------------------------------------------------
 .../component/test_dynamic_compute_offering.py  | 409 +++++++++++++++++++
 tools/marvin/marvin/integration/lib/base.py     |  29 +-
 tools/marvin/marvin/integration/lib/common.py   |  14 +
 3 files changed, 451 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3f7b628c/test/integration/component/test_dynamic_compute_offering.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_dynamic_compute_offering.py b/test/integration/component/test_dynamic_compute_offering.py
new file mode 100644
index 0000000..75cf0d6
--- /dev/null
+++ b/test/integration/component/test_dynamic_compute_offering.py
@@ -0,0 +1,409 @@
+# 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 Dynamic Compute Offering Feature
+
+    Test Plan: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Dynamic+ComputeOffering
+
+    Issue Link: https://issues.apache.org/jira/browse/CLOUDSTACK-6147
+
+    Feature Specifications: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Dynamic+Compute+Offering+FS
+"""
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.integration.lib.utils import (cleanup_resources,
+                                          validateList)
+from marvin.integration.lib.base import (ServiceOffering,
+                                         VirtualMachine,
+                                         Account)
+from marvin.integration.lib.common import (get_domain,
+                                           get_zone,
+                                           get_template,
+                                           verifyComputeOfferingCreation)
+
+from nose.plugins.attrib import attr
+from marvin.codes import PASS, ADMIN_ACCOUNT, USER_ACCOUNT
+from ddt import ddt, data
+
+@ddt
+class TestDynamicServiceOffering(cloudstackTestCase):
+    """Test Dynamic Service Offerings
+    """
+
+    @classmethod
+    def setUpClass(cls):
+        cloudstackTestClient = super(TestDynamicServiceOffering,cls).getClsTestClient()
+        cls.api_client = cloudstackTestClient.getApiClient()
+
+        # Fill services from the external config file
+        cls.services = cloudstackTestClient.getConfigParser().parsedDict
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.mode = str(cls.zone.networktype).lower()
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostype"]
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+        cls._cleanup = []
+        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_co = []
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            # Clean up compute offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+
+            # Clean up compute offerings
+            cleanup_resources(self.apiclient, self.cleanup_co)
+
+            self.cleanup_co[:] = []
+            self.cleanup[:] = []
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags=["basic","advanced"])
+    def test_create_normal_compute_offering(self):
+        """ Create normal compute offering with non zero values for cpu,
+            cpu number and memory"""
+
+        # Steps:
+        # 1. Create normal compute offering with non zero values for cpu number,
+        #    cpu speed, memory
+
+        # Validations:
+        # 1. Compute offering should be created
+
+        self.services["service_offering"]["cpunumber"] = 2
+        self.services["service_offering"]["cpuspeed"] = 256
+        self.services["service_offering"]["memory"] = 128
+
+        serviceOffering = ServiceOffering.create(self.api_client,
+                                                 self.services["service_offering"]
+                                                 )
+        self.assertEqual(verifyComputeOfferingCreation(self.apiclient, serviceOffering.id),
+                         PASS, "Compute Offering verification failed")
+
+        self.cleanup_co.append(serviceOffering)
+        return
+
+    @attr(tags=["basic","advanced"])
+    def test_create_dynamic_compute_offering(self):
+        """ Create dynamic compute offering with cpunumber, cpuspeed and memory
+            not specified"""
+
+        # Steps:
+        # 1. Create dynamic compute offering with values for cpu number,
+        #    cpu speed, memory not specified
+
+        # Validations:
+        # 1. Compute offering should be created
+
+        self.services["service_offering"]["cpunumber"] = ""
+        self.services["service_offering"]["cpuspeed"] = ""
+        self.services["service_offering"]["memory"] = ""
+
+        serviceOffering = ServiceOffering.create(self.api_client,
+                                                 self.services["service_offering"]
+                                                 )
+        self.assertEqual(verifyComputeOfferingCreation(self.apiclient, serviceOffering.id),
+                         PASS, "Compute Offering verification failed")
+
+        self.cleanup_co.append(serviceOffering)
+        return
+
+    @attr(tags=["basic","advanced"])
+    def test_create_dynamic_compute_offering_no_cpunumber(self):
+        """ Create dynamic compute offering with only cpunumber unspecified"""
+
+        # Validations:
+        # 1. Compute Offering creation should fail
+
+        self.services["service_offering"]["cpunumber"] = ""
+        self.services["service_offering"]["cpuspeed"] = 256
+        self.services["service_offering"]["memory"] = 128
+
+        try:
+            serviceOffering = ServiceOffering.create(self.api_client,
+                                                 self.services["service_offering"]
+                                                 )
+            self.cleanup_co.append(serviceOffering)
+            self.fail("Compute Offering creation succeded, it should have failed")
+        except Exception:
+            self.debug("Compute Offering Creation failed as expected")
+        return
+
+    @attr(tags=["basic","advanced"])
+    def test_create_dynamic_compute_offering_no_cpuspeed(self):
+        """ Create dynamic compute offering with only cpuspeed unspecified"""
+
+        # Validations:
+        # 1. Compute offering creation should fail
+
+        self.services["service_offering"]["cpunumber"] = 2
+        self.services["service_offering"]["cpuspeed"] = ""
+        self.services["service_offering"]["memory"] = 128
+
+        try:
+            serviceOffering = ServiceOffering.create(self.api_client,
+                                                 self.services["service_offering"]
+                                                 )
+            self.cleanup_co.append(serviceOffering)
+            self.fail("Compute Offering creation succeded, it should have failed")
+        except Exception:
+            self.debug("Compute Offering Creation failed as expected")
+        return
+
+    @attr(tags=["basic","advanced"])
+    def test_create_dynamic_compute_offering_no_memory(self):
+        """ Create dynamic compute offering with only memory unspecified"""
+
+        # Validations:
+        # 1. Compute offering creation should fail
+
+        self.services["service_offering"]["cpunumber"] = 2
+        self.services["service_offering"]["cpuspeed"] = 256
+        self.services["service_offering"]["memory"] = ""
+
+        try:
+            serviceOffering = ServiceOffering.create(self.api_client,
+                                                 self.services["service_offering"]
+                                                 )
+            self.cleanup_co.append(serviceOffering)
+            self.fail("Compute Offering creation succeded, it should have failed")
+        except Exception:
+            self.debug("Compute Offering Creation failed as expected")
+        return
+
+    @data(ADMIN_ACCOUNT, USER_ACCOUNT)
+    @attr(tags=["basic","advanced"])
+    def test_deploy_virtual_machines_static_offering(self, value):
+        """Test deploy VM with static offering"""
+
+        # Steps:
+        # 1. Create admin/user account and create its user api client
+        # 2. Create a static compute offering
+        # 3. Deploy a VM with account api client and static service offering
+        # 4. Repeat step 3 but also pass custom values for cpu number, cpu speed and memory
+        #    while deploying VM
+
+        # Validations:
+        # 1. Step 3 should succeed
+        # 2. Step 4 should fail
+
+        isadmin=True
+        if value == USER_ACCOUNT:
+            isadmin=False
+
+        # Create Account
+        self.account = Account.create(self.apiclient,self.services["account"],domainid=self.domain.id, admin=isadmin)
+        apiclient = self.testClient.createUserApiClient(
+                                    UserName=self.account.name,
+                                    DomainName=self.account.domain)
+        self.cleanup.append(self.account)
+
+        # Create service offering
+        self.services["service_offering"]["cpunumber"] = 2
+        self.services["service_offering"]["cpuspeed"] = 256
+        self.services["service_offering"]["memory"] = 128
+
+        serviceOffering = ServiceOffering.create(self.apiclient,
+                                                 self.services["service_offering"])
+
+        self.cleanup_co.append(serviceOffering)
+
+        # Deploy VM with static service offering
+        try:
+            VirtualMachine.create(apiclient,self.services["virtual_machine"],
+                                                    serviceofferingid=serviceOffering.id,
+                                                    accountid=self.account.name,domainid=self.account.domainid)
+        except Exception as e:
+            self.fail("vm creation failed: %s" % e)
+
+        # Deploy VM with static service offering, also with custom values
+        try:
+            VirtualMachine.create(apiclient,self.services["virtual_machine"],
+                serviceofferingid=serviceOffering.id,
+                customcpunumber=4,
+                customcpuspeed=512,
+                custommemory=256,
+                accountid=self.account.name,domainid=self.account.domainid)
+            self.fail("VM creation should have failed, it succeeded")
+        except Exception as e:
+            self.debug("vm creation failed as expected: %s" % e)
+        return
+
+    @data(ADMIN_ACCOUNT, USER_ACCOUNT)
+    @attr(tags=["basic","advanced"])
+    def test_deploy_virtual_machines_dynamic_offering(self, value):
+        """Test deploy VM with dynamic compute offering"""
+
+        # Steps:
+        # 1. Create admin/user account and create its user api client
+        # 2. Create a dynamic service offering
+        # 3. Deploy a VM with account api client and dynamic service offering
+        #    without providing custom values for cpu number, cpu speed and memory
+        # 4. Deploy a VM with account api client and dynamic service offering providing
+        #    custom values for cpu number, cpu speed and memory
+        # 5. Deploy a VM with account api client and dynamic service offering providing
+        #    custom values only for cpu number
+
+        # Validations:
+        # 1. Step 3 should fail
+        # 2. Step 4 should succeed
+        # 3. Step 5 should fail
+
+        isadmin=True
+        if value == USER_ACCOUNT:
+            isadmin=False
+
+        # Create Account and its api client
+        self.account = Account.create(self.apiclient,self.services["account"],domainid=self.domain.id, admin=isadmin)
+        apiclient = self.testClient.createUserApiClient(
+                                    UserName=self.account.name,
+                                    DomainName=self.account.domain)
+        self.cleanup.append(self.account)
+
+        # Create dynamic service offering
+        self.services["service_offering"]["cpunumber"] = ""
+        self.services["service_offering"]["cpuspeed"] = ""
+        self.services["service_offering"]["memory"] = ""
+
+        serviceOffering = ServiceOffering.create(self.apiclient,
+                                                 self.services["service_offering"])
+
+        self.cleanup_co.append(serviceOffering)
+
+        # Deploy VM with dynamic compute offering without providing custom values for
+        # cpu number, cpu speed and memory
+        try:
+            VirtualMachine.create(apiclient,self.services["virtual_machine"],
+                                                    serviceofferingid=serviceOffering.id,
+                                                    accountid=self.account.name,domainid=self.account.domainid)
+            self.fail("VM creation succeded, it should have failed")
+        except Exception as e:
+            self.debug("vm creation failed as expected with error: %s" % e)
+
+        # Deploy VM with dynamic compute offering providing custom values for
+        # cpu number, cpu speed and memory
+        try:
+            VirtualMachine.create(apiclient,self.services["virtual_machine"],
+                serviceofferingid=serviceOffering.id,
+                customcpunumber=2,
+                customcpuspeed=256,
+                custommemory=128,
+                accountid=self.account.name,domainid=self.account.domainid)
+        except Exception as e:
+            self.fail("vm creation failed: %s" % e)
+
+        # Deploy VM with dynamic compute offering providing custom values for only
+        # cpu number
+        try:
+            VirtualMachine.create(apiclient,self.services["virtual_machine"],
+                serviceofferingid=serviceOffering.id,
+                customcpunumber=2,
+                accountid=self.account.name,domainid=self.account.domainid)
+            self.fail("VM deployment should have failed, it succeded")
+        except Exception as e:
+            self.debug("vm creation failed as expected: %s" % e)
+        return
+
+    @data(ADMIN_ACCOUNT, USER_ACCOUNT)
+    @attr(tags=["basic","advanced"])
+    def test_check_vm_stats(self, value):
+        """Deploy VM with dynamic service offering and check VM stats"""
+
+        # Steps:
+        # 1. Create admin/user account and create its user api client
+        # 2. Create a dynamic service offering
+        # 3. Deploy a VM with account api client and dynamic service offering
+        #    providing custom values for cpu number, cpu speed and memory
+        # 4. List the VM and verify the dynamic parameters are same as passed
+
+        isadmin=True
+        if value == USER_ACCOUNT:
+            isadmin=False
+
+        # Create Account and api client
+        self.account = Account.create(self.apiclient,self.services["account"],domainid=self.domain.id, admin=isadmin)
+        apiclient = self.testClient.createUserApiClient(
+                                    UserName=self.account.name,
+                                    DomainName=self.account.domain)
+        self.cleanup.append(self.account)
+
+        # Create dynamic compute offering
+        self.services["service_offering"]["cpunumber"] = ""
+        self.services["service_offering"]["cpuspeed"] = ""
+        self.services["service_offering"]["memory"] = ""
+
+        serviceOffering = ServiceOffering.create(self.apiclient,
+                                                 self.services["service_offering"])
+
+        self.cleanup_co.append(serviceOffering)
+
+        # Custom values
+        customcpunumber = 2
+        customcpuspeed = 256
+        custommemory = 128
+
+        # Deploy VM with dynamic service offering and the custom values
+        try:
+            virtualMachine = VirtualMachine.create(apiclient,self.services["virtual_machine"],
+                serviceofferingid=serviceOffering.id,
+                customcpunumber=customcpunumber,
+                customcpuspeed=customcpuspeed,
+                custommemory=custommemory,
+                accountid=self.account.name,domainid=self.account.domainid)
+        except Exception as e:
+            self.fail("vm creation failed: %s" % e)
+
+        vmlist = VirtualMachine.list(self.apiclient, id=virtualMachine.id)
+        self.assertEqual(validateList(vmlist)[0], PASS, "vm list validation failed")
+        vm = vmlist[0]
+
+        # Verify the custom values
+        self.assertEqual(str(vm.cpunumber), str(customcpunumber), "vm cpu number %s\
+                 not matching with provided custom cpu number %s" % \
+                 (vm.cpunumber, customcpunumber))
+
+        self.assertEqual(str(vm.cpuspeed), str(customcpuspeed), "vm cpu speed %s\
+                 not matching with provided custom cpu speed %s" % \
+                 (vm.cpuspeed, customcpuspeed))
+
+        self.assertEqual(str(vm.memory), str(custommemory), "vm memory %s\
+                 not matching with provided custom memory %s" % \
+                 (vm.memory, custommemory))
+        return

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3f7b628c/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 0a7ad94..7449d8c 100755
--- a/tools/marvin/marvin/integration/lib/base.py
+++ b/tools/marvin/marvin/integration/lib/base.py
@@ -324,7 +324,8 @@ class VirtualMachine:
                     domainid=None, zoneid=None, networkids=None, serviceofferingid=None,
                     securitygroupids=None, projectid=None, startvm=None,
                     diskofferingid=None, affinitygroupnames=None, affinitygroupids=None, group=None,
-                    hostid=None, keypair=None, ipaddress=None, mode='default', method='GET'):
+                    hostid=None, keypair=None, ipaddress=None, mode='default', method='GET',
+                    customcpunumber=None, customcpuspeed=None, custommemory=None):
         """Create the instance"""
 
         cmd = deployVirtualMachine.deployVirtualMachineCmd()
@@ -412,6 +413,17 @@ class VirtualMachine:
         if "userdata" in services:
             cmd.userdata = base64.urlsafe_b64encode(services["userdata"])
 
+        cmd.details = [{"cpuNumber": "","cpuSpeed":"","memory":""}]
+
+        if customcpunumber:
+            cmd.details[0]["cpuNumber"] = customcpunumber
+
+        if customcpuspeed:
+            cmd.details[0]["cpuSpeed"] = customcpuspeed
+
+        if custommemory:
+            cmd.details[0]["memory"] = custommemory
+
         if group:
             cmd.group = group
 
@@ -636,6 +648,21 @@ class VirtualMachine:
 
         return apiclient.updateVMAffinityGroup(cmd)
 
+    def scale(self, apiclient, serviceOfferingId,
+            customcpunumber=None, customcpuspeed=None, custommemory=None):
+        """Change service offering of the instance"""
+        cmd = scaleVirtualMachine.scaleVirtualMachineCmd()
+        cmd.id = self.id
+        cmd.serviceofferingid = serviceOfferingId
+        cmd.details = [{"cpuNumber": "","cpuSpeed":"","memory":""}]
+        if customcpunumber:
+            cmd.details[0]["cpuNumber"] = customcpunumber
+        if customcpuspeed:
+            cmd.details[0]["cpuSpeed"] = customcpuspeed
+        if custommemory:
+            cmd.details[0]["memory"] = custommemory
+        return apiclient.scaleVirtualMachine(cmd)
+
 
 class Volume:
     """Manage Volume Life cycle

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3f7b628c/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 d3d634b..3b292bf 100644
--- a/tools/marvin/marvin/integration/lib/common.py
+++ b/tools/marvin/marvin/integration/lib/common.py
@@ -985,3 +985,17 @@ def verifyNetworkState(apiclient, networkid, state):
     assert validateList(networks)[0] == PASS, "Networks list validation failed, list is %s" % networks
     assert str(networks[0].state).lower() == state, "network state should be %s, it is %s" % (state, networks[0].state)
     return
+
+def verifyComputeOfferingCreation(apiclient, computeofferingid):
+    """List Compute offerings by ID and verify that the offering exists"""
+
+    cmd = listServiceOfferings.listServiceOfferingsCmd()
+    cmd.id = computeofferingid
+    serviceOfferings = None
+    try:
+        serviceOfferings = apiclient.listServiceOfferings(cmd)
+    except Exception as e:
+       return FAIL
+    if not (isinstance(serviceOfferings, list) and len(serviceOfferings) > 0):
+       return FAIL
+    return PASS


[14/18] git commit: updated refs/heads/resize-root to 6d6e790

Posted by ml...@apache.org.
Fix truncation issue with refresh, add button icons


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

Branch: refs/heads/resize-root
Commit: a1b778fc2c7f0ec84014f9e7329944032fb3c2a7
Parents: d182a51
Author: Brian Federle <br...@citrix.com>
Authored: Mon Mar 10 07:43:28 2014 -0700
Committer: Brian Federle <br...@citrix.com>
Committed: Mon Mar 10 07:43:28 2014 -0700

----------------------------------------------------------------------
 ui/css/cloudstack3.css | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a1b778fc/ui/css/cloudstack3.css
----------------------------------------------------------------------
diff --git a/ui/css/cloudstack3.css b/ui/css/cloudstack3.css
index 11c1c7e..2b88e03 100644
--- a/ui/css/cloudstack3.css
+++ b/ui/css/cloudstack3.css
@@ -3080,7 +3080,7 @@ div.toolbar div.button.refresh span {
 
 div.toolbar div.button.add span,
 .detail-group .button.add span.icon {
-  padding: 0px 0 0px 18px;
+  padding: 0px 0 3px 18px;
   background: url(../images/icons.png) no-repeat -626px -209px;
   /*+placement:shift 0px 0px;*/
   position: relative;


[13/18] git commit: updated refs/heads/resize-root to 6d6e790

Posted by ml...@apache.org.
Bug-Id: CS-19455 Add support for Hyper-v in regression test test_routers.py

Signed-off-by: sanjeevneelarapu <sa...@citrix.com>


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

Branch: refs/heads/resize-root
Commit: 4eece72eb178d468e4b86c371e88d5f1ff4dde93
Parents: 3f7b628
Author: sanjeevneelarapu <sa...@citrix.com>
Authored: Mon Mar 10 17:56:22 2014 +0530
Committer: sanjeevneelarapu <sa...@citrix.com>
Committed: Mon Mar 10 18:12:21 2014 +0530

----------------------------------------------------------------------
 test/integration/component/test_routers.py   | 28 +++++++++++------------
 tools/marvin/marvin/integration/lib/utils.py |  3 ++-
 2 files changed, 16 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4eece72e/test/integration/component/test_routers.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_routers.py b/test/integration/component/test_routers.py
index f8359f0..ced3f52 100644
--- a/test/integration/component/test_routers.py
+++ b/test/integration/component/test_routers.py
@@ -1254,21 +1254,10 @@ class TestRouterStopCreateFW(cloudstackTestCase):
                     str(self.services["fw_rule"]["endport"]),
                     "Check end port of firewall rule"
                     )
-        hosts = list_hosts(
-                           self.apiclient,
-                           id=router.hostid,
-                           )
-        self.assertEqual(
-                        isinstance(hosts, list),
-                        True,
-                        "Check for list hosts response return valid data"
-                        )
-        host = hosts[0]
-        host.user, host.passwd = get_host_credentials(self.config, host.ipaddress)
-
         # For DNS and DHCP check 'dnsmasq' process status
-        if self.apiclient.hypervisor.lower() == 'vmware':
-               result = get_process_status(
+        if (self.apiclient.hypervisor.lower() == 'vmware'
+                         or self.apiclient.hypervisor.lower() == 'hyperv'):
+            result = get_process_status(
                                self.apiclient.connection.mgtSvr,
                                22,
                                self.apiclient.connection.user,
@@ -1278,6 +1267,17 @@ class TestRouterStopCreateFW(cloudstackTestCase):
                                 hypervisor=self.apiclient.hypervisor
                                )
         else:
+            hosts = list_hosts(
+                        self.apiclient,
+                        id=router.hostid,
+                        )
+            self.assertEqual(
+                        isinstance(hosts, list),
+                        True,
+                        "Check for list hosts response return valid data"
+                        )
+            host = hosts[0]
+            host.user, host.passwd = get_host_credentials(self.config, host.ipaddress)
             try:
                 result = get_process_status(
                     host.ipaddress,

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4eece72e/tools/marvin/marvin/integration/lib/utils.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/utils.py b/tools/marvin/marvin/integration/lib/utils.py
index e870158..709fdde 100644
--- a/tools/marvin/marvin/integration/lib/utils.py
+++ b/tools/marvin/marvin/integration/lib/utils.py
@@ -191,7 +191,8 @@ def get_process_status(hostip, port, username, password, linklocalip, process, h
 
     #SSH to the machine
     ssh = SshClient(hostip, port, username, password)
-    if str(hypervisor).lower() == 'vmware':
+    if (str(hypervisor).lower() == 'vmware'
+		or str(hypervisor).lower() == 'hyperv'):
         ssh_command = "ssh -i /var/cloudstack/management/.ssh/id_rsa -ostricthostkeychecking=no "
     else:
         ssh_command = "ssh -i ~/.ssh/id_rsa.cloud -ostricthostkeychecking=no "


[10/18] git commit: updated refs/heads/resize-root to 6d6e790

Posted by ml...@apache.org.
findbugs: output vlanids in errormessage instead of array object pointer

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

Branch: refs/heads/resize-root
Commit: 579cb9c479b67e9385f1235f4f71f2fef81b0bd0
Parents: 0aca7cf
Author: Daan Hoogland <da...@onecht.net>
Authored: Mon Mar 10 13:04:10 2014 +0100
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Mar 10 13:04:10 2014 +0100

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/579cb9c4/server/src/com/cloud/network/IpAddressManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/IpAddressManagerImpl.java b/server/src/com/cloud/network/IpAddressManagerImpl.java
index 8903d1d..ed709e9 100644
--- a/server/src/com/cloud/network/IpAddressManagerImpl.java
+++ b/server/src/com/cloud/network/IpAddressManagerImpl.java
@@ -693,7 +693,7 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
                     errorMessage.append(", vlanId id=" + Arrays.toString(dedicatedVlanDbIds.toArray()));
                 } else if (nonDedicatedVlanDbIds != null && !nonDedicatedVlanDbIds.isEmpty()) {
                     sc.setParameters("vlanId", nonDedicatedVlanDbIds.toArray());
-                    errorMessage.append(", vlanId id=" + nonDedicatedVlanDbIds.toArray());
+                    errorMessage.append(", vlanId id=" + Arrays.toString(nonDedicatedVlanDbIds.toArray()));
                 } else {
                     if (podId != null) {
                         InsufficientAddressCapacityException ex = new InsufficientAddressCapacityException("Insufficient address capacity", Pod.class, podId);


[12/18] git commit: updated refs/heads/resize-root to 6d6e790

Posted by ml...@apache.org.
findbugs: another array pointer in error message

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

Branch: refs/heads/resize-root
Commit: d182a51162ad081f1e24faa7a2bd45246de5e326
Parents: e0d20fb
Author: Daan Hoogland <da...@onecht.net>
Authored: Mon Mar 10 13:21:13 2014 +0100
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Mar 10 13:21:13 2014 +0100

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d182a511/server/src/com/cloud/network/IpAddressManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/IpAddressManagerImpl.java b/server/src/com/cloud/network/IpAddressManagerImpl.java
index ed709e9..15d1458 100644
--- a/server/src/com/cloud/network/IpAddressManagerImpl.java
+++ b/server/src/com/cloud/network/IpAddressManagerImpl.java
@@ -733,7 +733,7 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
                     if (useSystemIps && nonDedicatedVlanDbIds != null && !nonDedicatedVlanDbIds.isEmpty()) {
                         fetchFromDedicatedRange = false;
                         sc.setParameters("vlanId", nonDedicatedVlanDbIds.toArray());
-                        errorMessage.append(", vlanId id=" + nonDedicatedVlanDbIds.toArray());
+                        errorMessage.append(", vlanId id=" + Arrays.toString(nonDedicatedVlanDbIds.toArray()));
                         addrs = _ipAddressDao.lockRows(sc, filter, true);
                     }
                 }


[16/18] git commit: updated refs/heads/resize-root to 6d6e790

Posted by ml...@apache.org.
CLOUDSTACK-6214: apply network rules when plug new guest nic to router for the network in Setup state
Conflicts:
	server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManager.java
	server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java

Conflicts:
	api/src/com/cloud/network/VpcVirtualNetworkApplianceService.java
	server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManager.java
	server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
	server/test/com/cloud/vpc/MockVpcVirtualNetworkApplianceManager.java


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

Branch: refs/heads/resize-root
Commit: bf9375b8b9c437bf314d0459233f17860d85d3f3
Parents: 1d74daf
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Fri Mar 7 15:06:35 2014 -0800
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Mon Mar 10 11:42:24 2014 -0700

----------------------------------------------------------------------
 .../VpcVirtualNetworkApplianceService.java      |  8 +++--
 .../element/VpcVirtualRouterElement.java        | 14 ++++++--
 .../VpcVirtualNetworkApplianceManagerImpl.java  | 34 +++++++++++++++++---
 .../MockVpcVirtualNetworkApplianceManager.java  |  7 ++--
 4 files changed, 51 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf9375b8/api/src/com/cloud/network/VpcVirtualNetworkApplianceService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/VpcVirtualNetworkApplianceService.java b/api/src/com/cloud/network/VpcVirtualNetworkApplianceService.java
index eee62ce..382c460 100644
--- a/api/src/com/cloud/network/VpcVirtualNetworkApplianceService.java
+++ b/api/src/com/cloud/network/VpcVirtualNetworkApplianceService.java
@@ -16,10 +16,13 @@
 // under the License.
 package com.cloud.network;
 
+import java.util.Map;
+
 import com.cloud.exception.ConcurrentOperationException;
 import com.cloud.exception.InsufficientCapacityException;
 import com.cloud.exception.ResourceUnavailableException;
 import com.cloud.network.router.VirtualRouter;
+import com.cloud.vm.VirtualMachineProfile;
 
 public interface VpcVirtualNetworkApplianceService extends VirtualNetworkApplianceService {
 
@@ -27,13 +30,14 @@ public interface VpcVirtualNetworkApplianceService extends VirtualNetworkApplian
      * @param router
      * @param network
      * @param isRedundant
+     * @param params TODO
      * @return
      * @throws ConcurrentOperationException
      * @throws ResourceUnavailableException
      * @throws InsufficientCapacityException
      */
-    boolean addVpcRouterToGuestNetwork(VirtualRouter router, Network network, boolean isRedundant) throws ConcurrentOperationException, ResourceUnavailableException,
-        InsufficientCapacityException;
+    boolean addVpcRouterToGuestNetwork(VirtualRouter router, Network network, boolean isRedundant, Map<VirtualMachineProfile.Param, Object> params)
+            throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
 
     /**
      * @param router

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf9375b8/server/src/com/cloud/network/element/VpcVirtualRouterElement.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/element/VpcVirtualRouterElement.java b/server/src/com/cloud/network/element/VpcVirtualRouterElement.java
index 5695a2c..b433fe4 100644
--- a/server/src/com/cloud/network/element/VpcVirtualRouterElement.java
+++ b/server/src/com/cloud/network/element/VpcVirtualRouterElement.java
@@ -36,6 +36,7 @@ import com.cloud.network.Network;
 import com.cloud.network.Network.Capability;
 import com.cloud.network.Network.Provider;
 import com.cloud.network.Network.Service;
+import com.cloud.network.Network.State;
 import com.cloud.network.NetworkModel;
 import com.cloud.network.PublicIpAddress;
 import com.cloud.network.RemoteAccessVpn;
@@ -179,7 +180,11 @@ public class VpcVirtualRouterElement extends VirtualRouterElement implements Vpc
         DomainRouterVO router = routers.get(0);
         //Add router to guest network if needed
         if (!_networkMgr.isVmPartOfNetwork(router.getId(), network.getId())) {
-            if (!_vpcRouterMgr.addVpcRouterToGuestNetwork(router, network, false)) {
+            Map<VirtualMachineProfile.Param, Object> paramsForRouter = new HashMap<VirtualMachineProfile.Param, Object>(1);
+            if (network.getState() == State.Setup) {
+                paramsForRouter.put(VirtualMachineProfile.Param.ReProgramGuestNetworks, true);
+            }
+            if (!_vpcRouterMgr.addVpcRouterToGuestNetwork(router, network, false, paramsForRouter)) {
                 throw new CloudRuntimeException("Failed to add VPC router " + router + " to guest network " + network);
             } else {
                 s_logger.debug("Successfully added VPC router " + router + " to guest network " + network);
@@ -220,7 +225,12 @@ public class VpcVirtualRouterElement extends VirtualRouterElement implements Vpc
             DomainRouterVO router = routers.get(0);
             //Add router to guest network if needed
             if (!_networkMgr.isVmPartOfNetwork(router.getId(), network.getId())) {
-                if (!_vpcRouterMgr.addVpcRouterToGuestNetwork(router, network, false)) {
+                Map<VirtualMachineProfile.Param, Object> paramsForRouter = new HashMap<VirtualMachineProfile.Param, Object>(1);
+                // need to reprogram guest network if it comes in a setup state
+                if (network.getState() == State.Setup) {
+                    paramsForRouter.put(VirtualMachineProfile.Param.ReProgramGuestNetworks, true);
+                }
+                if (!_vpcRouterMgr.addVpcRouterToGuestNetwork(router, network, false, paramsForRouter)) {
                     throw new CloudRuntimeException("Failed to add VPC router " + router + " to guest network " + network);
                 } else {
                     s_logger.debug("Successfully added VPC router " + router + " to guest network " + network);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf9375b8/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
index bed30df..f7fdd08 100644
--- a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
@@ -36,6 +36,7 @@ import org.springframework.stereotype.Component;
 
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.Command;
+import com.cloud.agent.api.Command.OnError;
 import com.cloud.agent.api.NetworkUsageCommand;
 import com.cloud.agent.api.PlugNicCommand;
 import com.cloud.agent.api.SetupGuestNetworkCommand;
@@ -246,9 +247,8 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
     }
 
     @Override
-    public boolean addVpcRouterToGuestNetwork(VirtualRouter router, Network network, boolean isRedundant) throws ConcurrentOperationException,
-        ResourceUnavailableException, InsufficientCapacityException {
-
+    public boolean addVpcRouterToGuestNetwork(VirtualRouter router, Network network, boolean isRedundant, Map<VirtualMachineProfile.Param, Object> params)
+            throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
         if (network.getTrafficType() != TrafficType.Guest) {
             s_logger.warn("Network " + network + " is not of type " + TrafficType.Guest);
             return false;
@@ -257,16 +257,23 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
         //Add router to the Guest network
         boolean result = true;
         try {
+
+            // 1) add nic to the router
             _routerDao.addRouterToGuestNetwork(router, network);
 
             NicProfile guestNic = _itMgr.addVmToNetwork(router, network, null);
-            //setup guest network
+            //2) setup guest network
             if (guestNic != null) {
                 result = setupVpcGuestNetwork(network, router, true, guestNic);
             } else {
                 s_logger.warn("Failed to add router " + router + " to guest network " + network);
                 result = false;
             }
+            //3) apply networking rules
+            if (result && params.get(Param.ReProgramGuestNetworks) != null
+                    && (Boolean) params.get(Param.ReProgramGuestNetworks) == true) {
+                sendNetworkRulesToRouter(router.getId(), network.getId());
+            }
         } catch (Exception ex) {
             s_logger.warn("Failed to add router " + router + " to network " + network + " due to ", ex);
             result = false;
@@ -885,6 +892,25 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
         }
     }
 
+
+    protected boolean sendNetworkRulesToRouter(long routerId, long networkId)
+            throws ResourceUnavailableException {
+        DomainRouterVO router = _routerDao.findById(routerId);
+        Commands cmds = new Commands(OnError.Continue);
+
+        VirtualRouterProvider vrProvider = _vrProviderDao.findById(router.getElementId());
+        if (vrProvider == null) {
+            throw new CloudRuntimeException("Cannot find related virtual router provider of router: " + router.getHostName());
+        }
+        Provider provider = Network.Provider.getProvider(vrProvider.getType().toString());
+        if (provider == null) {
+            throw new CloudRuntimeException("Cannot find related provider of virtual router provider: " + vrProvider.getType().toString());
+        }
+
+        finalizeNetworkRulesForNetwork(cmds, router, provider, networkId);
+        return sendCommandsToRouter(router, cmds);
+    }
+
     @Override
     public boolean setupPrivateGateway(PrivateGateway gateway, VirtualRouter router) throws ConcurrentOperationException, ResourceUnavailableException {
         boolean result = true;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf9375b8/server/test/com/cloud/vpc/MockVpcVirtualNetworkApplianceManager.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/MockVpcVirtualNetworkApplianceManager.java b/server/test/com/cloud/vpc/MockVpcVirtualNetworkApplianceManager.java
index 4802cff..e0c599d 100644
--- a/server/test/com/cloud/vpc/MockVpcVirtualNetworkApplianceManager.java
+++ b/server/test/com/cloud/vpc/MockVpcVirtualNetworkApplianceManager.java
@@ -23,10 +23,9 @@ import java.util.Map;
 import javax.ejb.Local;
 import javax.naming.ConfigurationException;
 
-import org.springframework.stereotype.Component;
-
 import org.apache.cloudstack.api.command.admin.router.UpgradeRouterCmd;
 import org.apache.cloudstack.api.command.admin.router.UpgradeRouterTemplateCmd;
+import org.springframework.stereotype.Component;
 
 import com.cloud.deploy.DeployDestination;
 import com.cloud.exception.ConcurrentOperationException;
@@ -313,8 +312,8 @@ public class MockVpcVirtualNetworkApplianceManager extends ManagerBase implement
      * @see com.cloud.network.VpcVirtualNetworkApplianceService#addVpcRouterToGuestNetwork(com.cloud.network.router.VirtualRouter, com.cloud.network.Network, boolean)
      */
     @Override
-    public boolean addVpcRouterToGuestNetwork(VirtualRouter router, Network network, boolean isRedundant) throws ConcurrentOperationException,
-        ResourceUnavailableException, InsufficientCapacityException {
+    public boolean addVpcRouterToGuestNetwork(VirtualRouter router, Network network, boolean isRedundant, Map<VirtualMachineProfile.Param, Object> params)
+            throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
         // TODO Auto-generated method stub
         return false;
     }


[18/18] git commit: updated refs/heads/resize-root to 6d6e790

Posted by ml...@apache.org.
Merge branch 'master' into resize-root


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

Branch: refs/heads/resize-root
Commit: 6d6e790d814e8f63fe2d712d11268f94ee5e4d69
Parents: e42502a d033ca4
Author: Marcus Sorensen <ma...@betterservers.com>
Authored: Mon Mar 10 15:37:08 2014 -0600
Committer: Marcus Sorensen <ma...@betterservers.com>
Committed: Mon Mar 10 15:37:08 2014 -0600

----------------------------------------------------------------------
 .../SYSCONFDIR/rc.d/init.d/cloud-agent.in       |   2 +-
 .../SYSCONFDIR/rc.d/init.d/cloud-agent.in       |   2 +-
 .../sles/SYSCONFDIR/init.d/cloud-agent.in       |   2 +-
 .../rhel/SYSCONFDIR/rc.d/init.d/cloud-agent.in  |   2 +-
 .../sles/SYSCONFDIR/init.d/cloud-agent.in       |   2 +-
 api/src/com/cloud/event/EventTypes.java         |   5 +
 .../VpcVirtualNetworkApplianceService.java      |   8 +-
 core/src/com/cloud/info/ConsoleProxyInfo.java   |  19 +-
 .../engine/orchestration/CloudOrchestrator.java |   2 +-
 .../storage/image/TemplateServiceImpl.java      |  13 +-
 packaging/centos63/cloud-agent.rc               |   2 +-
 packaging/centos63/cloud-ipallocator.rc         |   2 +-
 .../src/com/cloud/hypervisor/XenServerGuru.java |  33 +-
 .../driver/CloudStackImageStoreDriverImpl.java  |  12 +-
 .../SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in |   2 +-
 .../SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in |   2 +-
 .../SYSCONFDIR/init.d/cloud-ipallocator.in      |   2 +-
 .../SYSCONFDIR/rc.d/init.d/cloud-ipallocator.in |   2 +-
 .../sles/SYSCONFDIR/init.d/cloud-ipallocator.in |   2 +-
 .../SYSCONFDIR/init.d/cloud-ipallocator.in      |   2 +-
 server/src/com/cloud/api/ApiDispatcher.java     |   7 +
 server/src/com/cloud/api/ApiServer.java         |  11 +-
 .../dispatch/ParamGenericValidationWorker.java  |   4 +-
 server/src/com/cloud/configuration/Config.java  |   4 +-
 .../consoleproxy/ConsoleProxyManagerImpl.java   |  11 +-
 .../src/com/cloud/event/ActionEventUtils.java   |  12 +-
 .../com/cloud/network/IpAddressManagerImpl.java |   4 +-
 .../src/com/cloud/network/NetworkModelImpl.java |  14 +-
 .../element/VpcVirtualRouterElement.java        |  14 +-
 .../VpcVirtualNetworkApplianceManagerImpl.java  |  34 +-
 .../com/cloud/network/vpc/VpcManagerImpl.java   |   4 +-
 server/src/com/cloud/vm/UserVmManagerImpl.java  |   1 -
 .../cloud/network/vpc/VpcManagerImplTest.java   |  66 +++
 .../MockVpcVirtualNetworkApplianceManager.java  |   7 +-
 .../SecondaryStorageManagerImpl.java            |   7 +
 setup/db/db/schema-421to430.sql                 |   4 +
 systemvm/conf/consoleproxy.properties           |   2 +-
 .../rc.d/init.d/cloud-console-proxy.in          |   2 +-
 .../rc.d/init.d/cloud-console-proxy.in          |   2 +-
 .../rc.d/init.d/cloud-console-proxy.in          |   2 +-
 .../SYSCONFDIR/init.d/cloud-console-proxy.in    |   2 +-
 .../component/test_cpu_domain_limits.py         |  11 +-
 test/integration/component/test_cpu_limits.py   |  15 +-
 .../component/test_cpu_project_limits.py        |   7 +-
 .../component/test_dynamic_compute_offering.py  | 409 +++++++++++++++++++
 .../integration/component/test_memory_limits.py |  15 +-
 .../component/test_mm_domain_limits.py          |   7 +-
 .../component/test_mm_project_limits.py         |   7 +-
 test/integration/component/test_routers.py      |  28 +-
 .../component/test_vpc_vm_life_cycle.py         | 108 +----
 tools/marvin/marvin/codes.py                    |   1 +
 tools/marvin/marvin/integration/lib/base.py     |  29 +-
 tools/marvin/marvin/integration/lib/common.py   |  39 +-
 tools/marvin/marvin/integration/lib/utils.py    |   3 +-
 ui/css/cloudstack3.css                          |   2 +-
 55 files changed, 797 insertions(+), 216 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6d6e790d/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------


[06/18] git commit: updated refs/heads/resize-root to 6d6e790

Posted by ml...@apache.org.
findbugs: scope and final to mitgate possible abuse of fields

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

Branch: refs/heads/resize-root
Commit: 07102b400f11284009f283aa23faf2d24d543b21
Parents: 4eece72
Author: Daan Hoogland <da...@onecht.net>
Authored: Mon Mar 10 09:39:35 2014 +0100
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Mar 10 09:39:35 2014 +0100

----------------------------------------------------------------------
 .../src/com/cloud/api/dispatch/ParamGenericValidationWorker.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/07102b40/server/src/com/cloud/api/dispatch/ParamGenericValidationWorker.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/dispatch/ParamGenericValidationWorker.java b/server/src/com/cloud/api/dispatch/ParamGenericValidationWorker.java
index 0c829e8..f456468 100644
--- a/server/src/com/cloud/api/dispatch/ParamGenericValidationWorker.java
+++ b/server/src/com/cloud/api/dispatch/ParamGenericValidationWorker.java
@@ -37,9 +37,9 @@ import org.apache.log4j.Logger;
  */
 public class ParamGenericValidationWorker implements DispatchWorker {
 
-    protected static Logger s_logger = Logger.getLogger(ParamGenericValidationWorker.class.getName());
+    static Logger s_logger = Logger.getLogger(ParamGenericValidationWorker.class.getName());
 
-    protected static List<String> defaultParamNames = new ArrayList<String>();
+    protected static final List<String> defaultParamNames = new ArrayList<String>();
 
     static {
         defaultParamNames.add(ApiConstants.CTX_START_EVENT_ID);


[03/18] git commit: updated refs/heads/resize-root to 6d6e790

Posted by ml...@apache.org.
CLOUDSTACK-6204: removing realhostip dependency

Moving default transport for console proxy, SSVM to http.

See
https://cwiki.apache.org/confluence/display/CLOUDSTACK/Realhost+IP+changes
for more info.

jlk ported Amogh's patch for 4.3 to master - code base is different
enough that patch has multiple issues.

Author: Amogh Vasekar <Amogh Vasekar <am...@citrix.com>
Signed-off-by: John Kinsella <jl...@stratosec.co> 1394398017 -0700


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

Branch: refs/heads/resize-root
Commit: 09c375379ddae2d85ce9549bb6a58860c53bfecd
Parents: cb26b4c
Author: John Kinsella <jl...@stratosec.co>
Authored: Sun Mar 9 13:46:57 2014 -0700
Committer: John Kinsella <jl...@stratosec.co>
Committed: Sun Mar 9 13:46:57 2014 -0700

----------------------------------------------------------------------
 core/src/com/cloud/info/ConsoleProxyInfo.java    | 19 ++++++++++---------
 .../storage/image/TemplateServiceImpl.java       | 13 +++++++++++--
 .../driver/CloudStackImageStoreDriverImpl.java   | 12 ++++++++----
 server/src/com/cloud/configuration/Config.java   |  4 ++--
 .../consoleproxy/ConsoleProxyManagerImpl.java    | 11 +++++++++--
 .../SecondaryStorageManagerImpl.java             |  7 +++++++
 setup/db/db/schema-421to430.sql                  |  4 ++++
 systemvm/conf/consoleproxy.properties            |  2 +-
 8 files changed, 52 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/09c37537/core/src/com/cloud/info/ConsoleProxyInfo.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/info/ConsoleProxyInfo.java b/core/src/com/cloud/info/ConsoleProxyInfo.java
index 9a94474..0e57b75 100644
--- a/core/src/com/cloud/info/ConsoleProxyInfo.java
+++ b/core/src/com/cloud/info/ConsoleProxyInfo.java
@@ -32,16 +32,17 @@ public class ConsoleProxyInfo {
         this.sslEnabled = sslEnabled;
 
         if (sslEnabled) {
-            StringBuffer sb = new StringBuffer(proxyIpAddress);
-            for (int i = 0; i < sb.length(); i++)
-                if (sb.charAt(i) == '.')
-                    sb.setCharAt(i, '-');
-            if (consoleProxyUrlDomain != null && consoleProxyUrlDomain.length() > 0) {
-                sb.append(".");
+            StringBuffer sb = new StringBuffer();
+            if (consoleProxyUrlDomain.startsWith("*")) {
+                sb.append(proxyIpAddress);
+                for (int i = 0; i < proxyIpAddress.length(); i++)
+                    if (sb.charAt(i) == '.')
+                        sb.setCharAt(i, '-');
+                sb.append(consoleProxyUrlDomain.substring(1));//skip the *
+            } else {
+                //LB address
                 sb.append(consoleProxyUrlDomain);
-            } else
-                sb.append(".realhostip.com");
-
+            }
             proxyAddress = sb.toString();
             proxyPort = port;
             this.proxyUrlPort = proxyUrlPort;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/09c37537/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java b/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
index 166b523..4e6ab6b 100644
--- a/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
+++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
@@ -777,12 +777,21 @@ public class TemplateServiceImpl implements TemplateService {
         String scheme = "http";
         boolean _sslCopy = false;
         String sslCfg = _configDao.getValue(Config.SecStorageEncryptCopy.toString());
+        String _ssvmUrlDomain = _configDao.getValue("secstorage.ssl.cert.domain");
         if (sslCfg != null) {
             _sslCopy = Boolean.parseBoolean(sslCfg);
         }
+        if(_sslCopy && (_ssvmUrlDomain == null || _ssvmUrlDomain.isEmpty())){
+            s_logger.warn("Empty secondary storage url domain, ignoring SSL");
+            _sslCopy = false;
+        }
         if (_sslCopy) {
-            hostname = ipAddress.replace(".", "-");
-            hostname = hostname + ".realhostip.com";
+            if(_ssvmUrlDomain.startsWith("*")) {
+                hostname = ipAddress.replace(".", "-");
+                hostname = hostname + _ssvmUrlDomain.substring(1);
+            } else {
+                hostname = _ssvmUrlDomain;
+            }
             scheme = "https";
         }
         return scheme + "://" + hostname + "/copy/SecStorage/" + dir + "/" + path;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/09c37537/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java
----------------------------------------------------------------------
diff --git a/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java b/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java
index d6e1a01..c2e26d5 100644
--- a/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java
+++ b/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java
@@ -93,12 +93,16 @@ public class CloudStackImageStoreDriverImpl extends BaseImageStoreDriverImpl {
         if (sslCfg != null) {
             _sslCopy = Boolean.parseBoolean(sslCfg);
         }
+        if(_sslCopy && (_ssvmUrlDomain == null || _ssvmUrlDomain.isEmpty())){
+            s_logger.warn("Empty secondary storage url domain, ignoring SSL");
+            _sslCopy = false;
+        }
         if (_sslCopy) {
-            hostname = ipAddress.replace(".", "-");
-            if (_ssvmUrlDomain != null && _ssvmUrlDomain.length() > 0) {
-                hostname = hostname + "." + _ssvmUrlDomain;
+            if(_ssvmUrlDomain.startsWith("*")) {
+                hostname = ipAddress.replace(".", "-");
+                hostname = hostname + _ssvmUrlDomain.substring(1);
             } else {
-                hostname = hostname + ".realhostip.com";
+                hostname = _ssvmUrlDomain;
             }
             scheme = "https";
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/09c37537/server/src/com/cloud/configuration/Config.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java
index 98e5d34..f2fe68a 100755
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -439,7 +439,7 @@ public enum Config {
             "Console proxy command port that is used to communicate with management server",
             null),
     ConsoleProxyRestart("Console Proxy", AgentManager.class, Boolean.class, "consoleproxy.restart", "true", "Console proxy restart flag, defaulted to true", null),
-    ConsoleProxyUrlDomain("Console Proxy", AgentManager.class, String.class, "consoleproxy.url.domain", "realhostip.com", "Console proxy url domain", null),
+    ConsoleProxyUrlDomain("Console Proxy", AgentManager.class, String.class, "consoleproxy.url.domain", "", "Console proxy url domain", null),
     ConsoleProxyLoadscanInterval(
             "Console Proxy",
             AgentManager.class,
@@ -782,7 +782,7 @@ public enum Config {
             ManagementServer.class,
             String.class,
             "secstorage.ssl.cert.domain",
-            "realhostip.com",
+            "",
             "SSL certificate used to encrypt copy traffic between zones",
             null),
     SecStorageCapacityStandby(

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/09c37537/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
index 3e4c57e..0512096 100755
--- a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
+++ b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
@@ -233,6 +233,7 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
 
     private int _proxySessionTimeoutValue = DEFAULT_PROXY_SESSION_TIMEOUT;
     private boolean _sslEnabled = true;
+    private String _consoleProxyUrlDomain;
 
     // global load picture at zone basis
     private SystemVmLoadScanner<Long> _loadScanner;
@@ -384,9 +385,9 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
         assert (ksVo != null);
 
         if (_staticPublicIp == null) {
-            return new ConsoleProxyInfo(proxy.isSslEnabled(), proxy.getPublicIpAddress(), _consoleProxyPort, proxy.getPort(), ksVo.getDomainSuffix());
+            return new ConsoleProxyInfo(proxy.isSslEnabled(), proxy.getPublicIpAddress(), _consoleProxyPort, proxy.getPort(), _consoleProxyUrlDomain);
         } else {
-            return new ConsoleProxyInfo(proxy.isSslEnabled(), _staticPublicIp, _consoleProxyPort, _staticPort, ksVo.getDomainSuffix());
+            return new ConsoleProxyInfo(proxy.isSslEnabled(), _staticPublicIp, _consoleProxyPort, _staticPort, _consoleProxyUrlDomain);
         }
     }
 
@@ -1191,6 +1192,12 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
             _sslEnabled = true;
         }
 
+        _consoleProxyUrlDomain = configs.get(Config.ConsoleProxyUrlDomain.key());
+        if( _sslEnabled && (_consoleProxyUrlDomain == null || _consoleProxyUrlDomain.isEmpty())) {
+            s_logger.warn("Empty console proxy domain, explicitly disabling SSL");
+            _sslEnabled = false;
+        }
+
         value = configs.get(Config.ConsoleProxyCapacityScanInterval.key());
         _capacityScanInterval = NumbersUtil.parseLong(value, DEFAULT_CAPACITY_SCAN_INTERVAL);
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/09c37537/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java b/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
index dd0c267..f8edefa 100755
--- a/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
+++ b/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
@@ -807,6 +807,13 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
             _useSSlCopy = true;
         }
 
+        //default to HTTP in case of missing domain
+        String ssvmUrlDomain = _configDao.getValue("secstorage.ssl.cert.domain");
+        if(_useSSlCopy && (ssvmUrlDomain == null || ssvmUrlDomain.isEmpty())){
+            s_logger.warn("Empty secondary storage url domain, explicitly disabling SSL");
+            _useSSlCopy = false;
+        }
+
         _allowedInternalSites = _configDao.getValue("secstorage.allowed.internal.sites");
 
         String value = configs.get("secstorage.capacityscan.interval");

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/09c37537/setup/db/db/schema-421to430.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-421to430.sql b/setup/db/db/schema-421to430.sql
index b49fd96..3f2ad02 100644
--- a/setup/db/db/schema-421to430.sql
+++ b/setup/db/db/schema-421to430.sql
@@ -110,6 +110,10 @@ CREATE TABLE `cloud`.`async_job_join_map` (
   INDEX `i_async_job_join_map__expiration`(`expiration`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
+#realhostip changes, before changing table and adding default value
+UPDATE `cloud`.`configuration` SET value = CONCAT("*.",(SELECT `temptable`.`value` FROM (SELECT * FROM `cloud`.`configuration` WHERE `name`="consoleproxy.url.domain") AS `temptable` WHERE `temptable`.`name`="consoleproxy.url.domain")) WHERE `name`="consoleproxy.url.domain";
+UPDATE `cloud`.`configuration` SET `value` = CONCAT("*.",(SELECT `temptable`.`value` FROM (SELECT * FROM `cloud`.`configuration` WHERE `name`="secstorage.ssl.cert.domain") AS `temptable` WHERE `temptable`.`name`="secstorage.ssl.cert.domain")) WHERE `name`="secstorage.ssl.cert.domain";
+
 ALTER TABLE `cloud`.`configuration` ADD COLUMN `default_value` VARCHAR(4095) COMMENT 'Default value for a configuration parameter';
 ALTER TABLE `cloud`.`configuration` ADD COLUMN `updated` datetime COMMENT 'Time this was updated by the server. null means this row is obsolete.';
 ALTER TABLE `cloud`.`configuration` ADD COLUMN `scope` VARCHAR(255) DEFAULT NULL COMMENT 'Can this parameter be scoped';

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/09c37537/systemvm/conf/consoleproxy.properties
----------------------------------------------------------------------
diff --git a/systemvm/conf/consoleproxy.properties b/systemvm/conf/consoleproxy.properties
index bb452f5..a3cddbc 100644
--- a/systemvm/conf/consoleproxy.properties
+++ b/systemvm/conf/consoleproxy.properties
@@ -16,7 +16,7 @@
 # under the License.
 
 consoleproxy.tcpListenPort=0
-consoleproxy.httpListenPort=8088
+consoleproxy.httpListenPort=80
 consoleproxy.httpCmdListenPort=8001
 consoleproxy.jarDir=./applet/
 consoleproxy.viewerLinger=180


[08/18] git commit: updated refs/heads/resize-root to 6d6e790

Posted by ml...@apache.org.
rat

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

Branch: refs/heads/resize-root
Commit: 2386ad73da43c42ecb019973786a73f0b12d474d
Parents: 1075bed
Author: Daan Hoogland <da...@onecht.net>
Authored: Mon Mar 10 10:54:31 2014 +0100
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Mar 10 10:54:31 2014 +0100

----------------------------------------------------------------------
 .../com/cloud/network/vpc/VpcManagerImplTest.java | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2386ad73/server/test/com/cloud/network/vpc/VpcManagerImplTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/network/vpc/VpcManagerImplTest.java b/server/test/com/cloud/network/vpc/VpcManagerImplTest.java
index a0237b4..189b793 100644
--- a/server/test/com/cloud/network/vpc/VpcManagerImplTest.java
+++ b/server/test/com/cloud/network/vpc/VpcManagerImplTest.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 package com.cloud.network.vpc;
 
 import static org.junit.Assert.assertEquals;


[09/18] git commit: updated refs/heads/resize-root to 6d6e790

Posted by ml...@apache.org.
unneeded imports removed

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

Branch: refs/heads/resize-root
Commit: 0aca7cfab6f9fe70b9ace590da91e9b7661438f7
Parents: 2386ad7
Author: Daan Hoogland <da...@onecht.net>
Authored: Mon Mar 10 10:56:37 2014 +0100
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Mar 10 10:56:37 2014 +0100

----------------------------------------------------------------------
 server/test/com/cloud/network/vpc/VpcManagerImplTest.java | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0aca7cfa/server/test/com/cloud/network/vpc/VpcManagerImplTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/network/vpc/VpcManagerImplTest.java b/server/test/com/cloud/network/vpc/VpcManagerImplTest.java
index 189b793..3918a37 100644
--- a/server/test/com/cloud/network/vpc/VpcManagerImplTest.java
+++ b/server/test/com/cloud/network/vpc/VpcManagerImplTest.java
@@ -20,27 +20,22 @@ package com.cloud.network.vpc;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.mockito.Mockito.when;
 
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.cloudstack.context.CallContext;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mock;
 import org.mockito.Mockito;
 import org.mockito.MockitoAnnotations;
 
-import static org.mockito.Mockito.when;
-
 import com.cloud.network.Network.Provider;
 import com.cloud.network.Network.Service;
 import com.cloud.network.vpc.dao.VpcOfferingServiceMapDao;
-import com.cloud.user.Account;
-import com.cloud.user.User;
 
 public class VpcManagerImplTest {