cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahu...@apache.org
Subject [50/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1
Date Tue, 18 Jun 2013 03:07:15 GMT
Merge from master


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

Branch: refs/heads/vmsync
Commit: e2edae1711f1740639a81c1d64b25d75213949af
Parents: 309f8da fb31a39
Author: Alex Huang <alex.huang@gmail.com>
Authored: Mon Jun 17 19:00:44 2013 -0700
Committer: Alex Huang <alex.huang@gmail.com>
Committed: Mon Jun 17 19:00:44 2013 -0700

----------------------------------------------------------------------
 api/src/com/cloud/network/NetworkModel.java     |    2 +
 api/src/com/cloud/offering/NetworkOffering.java |    2 +
 .../command/admin/cluster/ListClustersCmd.java  |    6 -
 .../api/command/admin/host/ListHostsCmd.java    |    7 -
 .../api/command/admin/ldap/LDAPConfigCmd.java   |   16 +-
 .../admin/network/CreateNetworkOfferingCmd.java |    2 +-
 .../api/command/admin/pod/ListPodsByCmd.java    |    7 -
 .../admin/storage/ListStoragePoolsCmd.java      |    7 -
 .../admin/systemvm/ListSystemVMsCmd.java        |    7 -
 .../api/command/user/iso/ListIsosCmd.java       |    7 -
 .../command/user/network/ListNetworksCmd.java   |    7 -
 .../command/user/snapshot/ListSnapshotsCmd.java |   13 +-
 .../command/user/template/ListTemplatesCmd.java |    8 -
 .../api/command/user/vm/ListVMsCmd.java         |    7 -
 .../api/command/user/volume/ListVolumesCmd.java |    5 -
 .../api/response/FirewallResponse.java          |    8 +-
 .../api/response/SnapshotResponse.java          |    7 +
 .../service/controller/s3/ServiceProvider.java  |    6 +-
 awsapi/web/web.xml                              |   11 +-
 client/tomcatconf/nonossComponentContext.xml.in |    1 +
 .../src/com/cloud/agent/api/ScaleVmCommand.java |   26 +-
 .../virtualnetwork/VirtualRoutingResource.java  |   50 +-
 .../com/cloud/network/HAProxyConfigurator.java  |   22 +-
 docs/en-US/CloudStack_GSoC_Guide.xml            |    3 +-
 docs/en-US/Release_Notes.xml                    |    2 +-
 docs/en-US/add-loadbalancer-rule-vpc.xml        |    8 +-
 docs/en-US/add-remove-nic-ui.xml                |  147 +++
 docs/en-US/configure-package-repository.xml     |    4 +-
 docs/en-US/create-vpn-connection-vpc.xml        |   31 +-
 docs/en-US/create-vpn-gateway-for-vpc.xml       |   30 +-
 docs/en-US/delete-reset-vpn.xml                 |   28 +-
 docs/en-US/gsoc-meng.xml                        |  235 ++++
 docs/en-US/gsoc-shiva.xml                       |   70 ++
 docs/en-US/images/remove-nic.png                |  Bin 0 -> 735 bytes
 docs/en-US/images/set-default-nic.png           |  Bin 0 -> 1012 bytes
 .../management-server-install-db-local.xml      |    8 +
 docs/en-US/networks.xml                         |    1 +
 docs/en-US/pvlan.xml                            |  202 ++-
 docs/en-US/using-multiple-guest-networks.xml    |    1 +
 docs/pot/configure-package-repository.pot       |    4 +-
 .../src/com/cloud/storage/VolumeManager.java    |    2 +
 .../orchestration/CloudOrchestrator.java        |    6 +
 .../cloud/vm/VirtualMachineManagerImplTest.java |   12 +-
 .../com/cloud/capacity/dao/CapacityDaoImpl.java |   24 +-
 .../src/com/cloud/dc/dao/DataCenterDao.java     |    2 +-
 .../src/com/cloud/dc/dao/DataCenterDaoImpl.java |   15 +-
 .../com/cloud/network/dao/IPAddressDaoImpl.java |    1 +
 .../rules/dao/PortForwardingRulesDao.java       |    2 +-
 .../rules/dao/PortForwardingRulesDaoImpl.java   |    9 +-
 .../com/cloud/offerings/NetworkOfferingVO.java  |    4 +
 .../storage/dao/SnapshotPolicyDaoImpl.java      |    1 -
 .../com/cloud/storage/dao/VMTemplateDao.java    |    2 +-
 .../cloud/storage/dao/VMTemplateDaoImpl.java    |   21 +-
 .../com/cloud/upgrade/dao/Upgrade410to420.java  |    1 +
 .../src/com/cloud/usage/dao/UsageDao.java       |    5 +-
 .../src/com/cloud/usage/dao/UsageDaoImpl.java   |   64 +
 .../strategy/AncientSnapshotStrategy.java       |    5 +
 .../HypervisorHostEndPointRpcServer.java        |    2 +-
 .../kvm/resource/LibvirtComputingResource.java  |    4 +-
 .../kvm/resource/LibvirtStorageVolumeDef.java   |    2 +-
 .../hypervisor/kvm/resource/LibvirtVMDef.java   |    2 +-
 .../resource/LibvirtComputingResourceTest.java  |    4 +-
 .../vmware/resource/VmwareResource.java         |   57 +-
 .../vmware/resource/VmwareResourceTest.java     |    7 +-
 .../xen/discoverer/XcpServerDiscoverer.java     |   12 +-
 .../xen/resource/CitrixResourceBase.java        |    8 +-
 .../xen/resource/CitrixResourceBaseTest.java    |   12 +-
 .../guru/BigSwitchVnsGuestNetworkGuru.java      |    2 +-
 .../cloud/network/guru/OvsGuestNetworkGuru.java |    3 +-
 scripts/network/domr/call_dnsmasq.sh            |   29 +
 scripts/network/domr/createipAlias.sh           |   26 +
 scripts/network/domr/deleteipAlias.sh           |   25 +
 server/src/com/cloud/api/ApiResponseHelper.java |   10 +-
 .../com/cloud/api/query/QueryManagerImpl.java   |   73 +-
 .../api/query/dao/StoragePoolJoinDaoImpl.java   |   17 +-
 server/src/com/cloud/configuration/Config.java  |    9 +-
 .../configuration/ConfigurationManagerImpl.java |  127 +-
 .../consoleproxy/ConsoleProxyManagerImpl.java   |    7 +
 .../com/cloud/network/NetworkManagerImpl.java   |   68 +-
 .../src/com/cloud/network/NetworkModelImpl.java |    5 +-
 .../com/cloud/network/NetworkServiceImpl.java   |   55 +-
 .../network/guru/ExternalGuestNetworkGuru.java  |    3 +-
 .../cloud/network/guru/GuestNetworkGuru.java    |   11 +-
 .../VirtualNetworkApplianceManagerImpl.java     |   28 +-
 .../cloud/network/rules/RulesManagerImpl.java   |    2 +-
 .../network/vpc/NetworkACLServiceImpl.java      |    4 +
 .../cloud/server/ConfigurationServerImpl.java   |   25 +
 .../com/cloud/server/ManagementServerImpl.java  |   98 +-
 .../com/cloud/storage/StorageManagerImpl.java   |    3 +
 .../com/cloud/storage/VolumeManagerImpl.java    |    3 +-
 .../storage/download/DownloadMonitorImpl.java   |   20 +-
 .../src/com/cloud/storage/s3/S3ManagerImpl.java |   10 +-
 .../storage/snapshot/SnapshotManagerImpl.java   |   14 +-
 .../storage/snapshot/SnapshotSchedulerImpl.java |    5 +-
 .../cloud/storage/upload/UploadMonitorImpl.java |   14 +-
 server/src/com/cloud/vm/UserVmManagerImpl.java  |   74 +-
 .../configuration/ValidateIpRangeTest.java      |   11 +-
 .../com/cloud/network/MockNetworkModelImpl.java |    5 +
 .../com/cloud/vpc/MockNetworkModelImpl.java     |    5 +
 services/console-proxy/server/js/ajaxkeys.js    |   42 +-
 .../console-proxy/server/scripts/ssvm-check.sh  |  136 --
 .../consoleproxy/ConsoleProxyClientBase.java    |    4 +-
 .../consoleproxy/ConsoleProxyGCThread.java      |    5 +-
 .../consoleproxy/ConsoleProxyVncClient.java     |    5 +-
 .../consoleproxy/vnc/VncClientPacketSender.java |    4 +-
 .../vnc/VncServerPacketReceiver.java            |    4 +-
 .../server/systemvm-descriptor.xml              |    9 +
 .../resource/NfsSecondaryStorageResource.java   |   19 +-
 setup/db/db/schema-2214to30.sql                 |    1 +
 setup/db/db/schema-410to420.sql                 |    3 +
 setup/dev/advanced.cfg                          |   21 +-
 test/integration/component/maint/__init__.py    |   21 +
 .../component/maint/test_high_availability.py   | 1079 ++++++++++++++++
 .../maint/test_host_high_availability.py        |  810 ++++++++++++
 .../maint/test_vpc_host_maintenance.py          |  561 +++++++++
 .../maint/test_vpc_on_host_maintenance.py       |  323 +++++
 test/integration/component/test_accounts.py     |    5 +-
 .../component/test_advancedsg_networks.py       |   20 +-
 .../component/test_custom_hostname.py           |   22 +-
 test/integration/component/test_egress_rules.py |    1 -
 test/integration/component/test_eip_elb.py      |    6 -
 .../component/test_high_availability.py         | 1079 ----------------
 .../component/test_host_high_availability.py    |  811 ------------
 .../component/test_netscaler_configs.py         |   20 +-
 test/integration/component/test_netscaler_lb.py |   81 +-
 .../component/test_netscaler_lb_algo.py         |   56 +-
 .../component/test_netscaler_lb_sticky.py       |    6 +-
 .../component/test_network_offering.py          |    1 -
 .../component/test_project_configs.py           |    2 -
 .../component/test_project_limits.py            |    1 -
 test/integration/component/test_projects.py     |    1 -
 .../component/test_shared_networks.py           |   94 +-
 test/integration/component/test_tags.py         |    2 -
 test/integration/component/test_templates.py    |    1 -
 .../component/test_vm_passwdenabled.py          |    1 -
 test/integration/component/test_vpc.py          |  423 +------
 .../component/test_vpc_host_maintenance.py      |  889 -------------
 test/integration/component/test_vpc_network.py  |  275 ++--
 .../component/test_vpc_network_lbrules.py       |    2 +-
 .../component/test_vpc_network_pfrules.py       |  489 ++++----
 .../integration/component/test_vpc_offerings.py |    2 -
 test/integration/component/test_vpc_routers.py  |    4 -
 .../component/test_vpc_vm_life_cycle.py         | 1181 +++---------------
 .../component/test_vpc_vms_deployment.py        |    1 -
 ...deploy_vms_with_varied_deploymentplanners.py |   25 +-
 test/integration/smoke/test_network.py          |  376 +++---
 .../integration/smoke/test_portable_publicip.py |    1 -
 test/integration/smoke/test_vm_life_cycle.py    |    4 +-
 tools/apidoc/generateadmincommands.xsl          |    6 +-
 tools/apidoc/generatecommand.xsl                |    4 +-
 tools/apidoc/generatedomainadmincommands.xsl    |    4 +-
 tools/apidoc/generatetoc_footer.xsl             |    4 +-
 tools/apidoc/generateusercommands.xsl           |    4 +-
 tools/apidoc/images/cloudstack.png              |  Bin 3893 -> 8575 bytes
 tools/apidoc/images/ins_buttonshadow.gif        |  Bin 1683 -> 0 bytes
 tools/apidoc/images/insdownload_button.gif      |  Bin 2531 -> 0 bytes
 .../apidoc/images/insdownload_button_hover.gif  |  Bin 2569 -> 0 bytes
 tools/apidoc/images/insjoincomm_button.gif      |  Bin 2627 -> 0 bytes
 .../apidoc/images/insjoincomm_button_hover.gif  |  Bin 2620 -> 0 bytes
 tools/apidoc/includes/main.css                  |    2 +-
 tools/appliance/build.sh                        |    6 +-
 tools/cli/cloudmonkey/config.py                 |    2 +-
 tools/cli/cloudmonkey/requester.py              |   47 +-
 tools/marvin/marvin/cloudstackTestClient.py     |    1 +
 ui/index.jsp                                    |    1 -
 ui/scripts/configuration.js                     |    7 +-
 ui/scripts/instances.js                         |   12 +-
 ui/scripts/network.js                           |  135 +-
 ui/scripts/system.js                            |   10 +-
 ui/scripts/ui-custom/projectSelect.js           |    4 +-
 ui/scripts/ui-custom/projects.js                |    4 +-
 ui/scripts/ui/utils.js                          |    2 +-
 ui/scripts/ui/widgets/listView.js               |   26 +-
 ui/scripts/vpc.js                               |   17 +-
 ui/scripts/zoneWizard.js                        |    2 +
 .../cloud/usage/parser/NetworkUsageParser.java  |   11 +-
 .../cloud/usage/parser/VmDiskUsageParser.java   |   59 +-
 utils/src/com/cloud/utils/S3Utils.java          |    4 +-
 utils/src/com/cloud/utils/StringUtils.java      |    6 +-
 utils/src/com/cloud/utils/Ternary.java          |    2 +-
 utils/src/com/cloud/utils/net/NetUtils.java     |   42 +-
 .../src/com/cloud/utils/ssh/SSHKeysHelper.java  |    2 +-
 utils/test/com/cloud/utils/StringUtilsTest.java |    5 +
 utils/test/com/cloud/utils/TernaryTest.java     |   35 +
 .../com/cloud/utils/crypto/RSAHelperTest.java   |   50 +
 .../test/com/cloud/utils/net/NetUtilsTest.java  |   18 +
 .../com/cloud/utils/ssh/SSHKeysHelperTest.java  |   69 +
 187 files changed, 5783 insertions(+), 5834 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
index 1283f2c,0417b18..ac48f75
--- a/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
@@@ -118,10 -114,7 +115,7 @@@ public class ListClustersCmd extends Ba
          this.managedState = managedstate;
      }
  
-     public String getZoneType() {
-         return zoneType;
-     }
 -
 +    
      public Boolean getShowCapacities() {
          return showCapacities;
      }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java
index 18a153c,eaaec30..cf1f5be
--- a/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java
@@@ -75,10 -74,7 +75,7 @@@ public class ListHostsCmd extends BaseL
      @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
              description="the Zone ID for the host")
      private Long zoneId;
 -    
 +
-     @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
-     private String zoneType;
-     
      @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType = UserVmResponse.class,
              required=false, description="lists hosts in the same cluster as this VM and flag hosts with enough CPU/RAm to host this VM")
      private Long virtualMachineId;
@@@ -127,11 -123,7 +124,7 @@@
      public Long getZoneId() {
          return zoneId;
      }
 -    
 +
-     public String getZoneType() {
-         return zoneType;
-     }
-     
      public Long getVirtualMachineId() {
          return virtualMachineId;
      }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPConfigCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPConfigCmd.java
index 9eaecca,2726f84..7f31800
--- a/api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPConfigCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPConfigCmd.java
@@@ -44,10 -43,9 +44,9 @@@ public class LDAPConfigCmd extends Base
      /////////////////////////////////////////////////////
      //////////////// API parameters /////////////////////
      /////////////////////////////////////////////////////
- 
-     @Parameter(name=ApiConstants.LIST_ALL, type=CommandType.STRING,  description="Hostname or ip address of the ldap server eg: my.ldap.com")
-     private String listall;
+     @Parameter(name=ApiConstants.LIST_ALL, type=CommandType.BOOLEAN,  description="If true return current LDAP configuration")
+     private Boolean listAll;
 -    
 +
      @Parameter(name=ApiConstants.HOST_NAME, type=CommandType.STRING,  description="Hostname or ip address of the ldap server eg: my.ldap.com")
      private String hostname;
  
@@@ -79,10 -77,10 +78,10 @@@
      /////////////////// Accessors ///////////////////////
      /////////////////////////////////////////////////////
  
-     public String getListAll() {
-         return listall == null ? "false" : listall;
+     public Boolean getListAll() {
+     	return listAll == null ? Boolean.FALSE : listAll;
      }
 -    
 +
      public String getBindPassword() {
          return bindPassword;
      }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java
index 12bb6d0,85a3c22..367d1e6
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java
@@@ -60,10 -59,7 +60,7 @@@ public class ListStoragePoolsCmd extend
      @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
              description="the Zone ID for the storage pool")
      private Long zoneId;
 -    
 +
-     @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
-     private String zoneType;
-     
      @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = StoragePoolResponse.class,
              description="the ID of the storage pool")
      private Long id;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
index 53e4d14,3219601..a12b8f6
--- a/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
@@@ -119,12 -115,8 +116,8 @@@ public class ListIsosCmd extends BaseLi
          return zoneId;
      }
  
-     public String getZoneType() {
-         return zoneType;
-     }
-     
      public boolean listInReadyState() {
 -        Account account = UserContext.current().getCaller();
 +        Account account = CallContext.current().getCallingAccount();
          // It is account specific if account is admin type and domainId and accountName are not null
          boolean isAccountSpecific = (account == null || isAdmin(account.getType())) && (getAccountName() != null) && (getDomainId() != null);
          // Show only those that are downloaded.

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
index ca169b7,8859ba5..aafe9d8
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
@@@ -29,7 -26,10 +29,8 @@@ import org.apache.cloudstack.api.Parame
  import org.apache.cloudstack.api.response.ListResponse;
  import org.apache.cloudstack.api.response.SnapshotResponse;
  import org.apache.cloudstack.api.response.VolumeResponse;
+ import org.apache.cloudstack.api.response.ZoneResponse;
 -import org.apache.log4j.Logger;
  
 -import com.cloud.async.AsyncJob;
  import com.cloud.storage.Snapshot;
  import com.cloud.utils.Pair;
  
@@@ -60,9 -60,10 +61,10 @@@ public class ListSnapshotsCmd extends B
              description="the ID of the disk volume")
      private Long volumeId;
  
-     @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
-     private String zoneType;
+     @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "list snapshots by zone id")
+     private Long zoneId;
+ 
 -    
 +
      /////////////////////////////////////////////////////
      /////////////////// Accessors ///////////////////////
      /////////////////////////////////////////////////////
@@@ -87,10 -88,10 +89,10 @@@
          return volumeId;
      }
  
-     public String getZoneType() {
-         return zoneType;
+     public Long getZoneId() {
+         return zoneId;
 -    }    
 -
 +    }
 +    
      /////////////////////////////////////////////////////
      /////////////// API Implementation///////////////////
      /////////////////////////////////////////////////////
@@@ -100,8 -101,8 +102,9 @@@
          return s_name;
      }
  
 -    public AsyncJob.Type getInstanceType() {
 -        return AsyncJob.Type.Snapshot;
++    @Override
 +    public ApiCommandJobType getInstanceType() {
 +        return ApiCommandJobType.Snapshot;
      }
  
      @Override
@@@ -117,6 -118,6 +120,6 @@@
          response.setResponses(snapshotResponses, result.second());
          response.setResponseName(getCommandName());
  
--        this.setResponseObject(response);
++        setResponseObject(response);
      }
  }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
index 29d0356,aeb76f5..b764b6d
--- a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
@@@ -97,13 -92,9 +93,9 @@@ public class ListTemplatesCmd extends B
          return zoneId;
      }
  
-     public String getZoneType() {
-         return zoneType;
-     }
-     
      public boolean listInReadyState() {
  
 -        Account account = UserContext.current().getCaller();
 +        Account account = CallContext.current().getCallingAccount();
          // It is account specific if account is admin type and domainId and accountName are not null
          boolean isAccountSpecific = (account == null || isAdmin(account.getType())) && (getAccountName() != null) && (getDomainId() != null);
          // Show only those that are downloaded.

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/api/src/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/api/src/org/apache/cloudstack/api/response/FirewallResponse.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/api/src/org/apache/cloudstack/api/response/SnapshotResponse.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/engine/components-api/src/com/cloud/storage/VolumeManager.java
----------------------------------------------------------------------
diff --cc engine/components-api/src/com/cloud/storage/VolumeManager.java
index 36fd75b,0000000..5345aa7
mode 100644,000000..100644
--- a/engine/components-api/src/com/cloud/storage/VolumeManager.java
+++ b/engine/components-api/src/com/cloud/storage/VolumeManager.java
@@@ -1,119 -1,0 +1,121 @@@
 +/*
 + * 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.storage;
 +
 +import java.util.Map;
 +
 +import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd;
 +import org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd;
 +import org.apache.cloudstack.api.command.user.volume.DetachVolumeCmd;
 +import org.apache.cloudstack.api.command.user.volume.MigrateVolumeCmd;
 +import org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd;
 +import org.apache.cloudstack.api.command.user.volume.UploadVolumeCmd;
 +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
 +
 +import com.cloud.agent.api.to.VirtualMachineTO;
 +import com.cloud.deploy.DeployDestination;
 +import com.cloud.exception.ConcurrentOperationException;
 +import com.cloud.exception.InsufficientStorageCapacityException;
 +import com.cloud.exception.ResourceAllocationException;
 +import com.cloud.exception.StorageUnavailableException;
 +import com.cloud.host.Host;
 +import com.cloud.hypervisor.Hypervisor.HypervisorType;
 +import com.cloud.storage.Volume.Type;
 +import com.cloud.user.Account;
 +import com.cloud.vm.DiskProfile;
 +import com.cloud.vm.VMInstanceVO;
 +import com.cloud.vm.VirtualMachine;
 +import com.cloud.vm.VirtualMachineProfile;
 +
 +public interface VolumeManager extends VolumeApiService {
 +
 +    VolumeInfo moveVolume(VolumeInfo volume, long destPoolDcId, Long destPoolPodId,
 +            Long destPoolClusterId, HypervisorType dataDiskHyperType)
 +            throws ConcurrentOperationException;
 +
 +    @Override
 +    VolumeVO uploadVolume(UploadVolumeCmd cmd)
 +            throws ResourceAllocationException;
 +
 +    VolumeVO allocateDuplicateVolume(VolumeVO oldVol, Long templateId);
 +
 +    boolean volumeOnSharedStoragePool(VolumeVO volume);
 +
 +    boolean volumeInactive(Volume volume);
 +
 +    String getVmNameOnVolume(Volume volume);
 +
 +    @Override
 +    VolumeVO allocVolume(CreateVolumeCmd cmd)
 +            throws ResourceAllocationException;
 +
 +    @Override
 +    VolumeVO createVolume(CreateVolumeCmd cmd);
 +
 +    @Override
 +    VolumeVO resizeVolume(ResizeVolumeCmd cmd)
 +            throws ResourceAllocationException;
 +
 +    @Override
 +    boolean deleteVolume(long volumeId, Account caller)
 +            throws ConcurrentOperationException;
 +    
 +    void destroyVolume(VolumeVO volume);
 +
 +    DiskProfile allocateRawVolume(Type type, String name, DiskOfferingVO offering, Long size, VMInstanceVO vm, Account owner);
 +    @Override
 +    Volume attachVolumeToVM(AttachVolumeCmd command);
 +
 +    @Override
 +    Volume detachVolumeFromVM(DetachVolumeCmd cmmd);
 +
 +    void release(VirtualMachineProfile profile);
 +
 +    void cleanupVolumes(long vmId) throws ConcurrentOperationException;
 +
 +    @Override
 +    Volume migrateVolume(MigrateVolumeCmd cmd);
 +
 +    void migrateVolumes(VirtualMachine vm, VirtualMachineTO vmTo, Host srcHost, Host destHost,
 +            Map<Volume, StoragePool> volumeToPool);
 +
 +    boolean storageMigration(
 +            VirtualMachineProfile vm,
 +            StoragePool destPool);
 +
 +    void prepareForMigration(
 +            VirtualMachineProfile vm,
 +            DeployDestination dest);
 +
 +    void prepare(VirtualMachineProfile vm,
 +            DeployDestination dest) throws StorageUnavailableException,
 +            InsufficientStorageCapacityException, ConcurrentOperationException;
 +
 +    boolean canVmRestartOnAnotherServer(long vmId);
 +
 +    DiskProfile allocateTemplatedVolume(Type type, String name,
 +            DiskOfferingVO offering, VMTemplateVO template, VMInstanceVO vm,
 +            Account owner);
 +
 +    String getVmNameFromVolumeId(long volumeId);
 +
 +    String getStoragePoolOfVolume(long volumeId);
++
++    boolean validateVolumeSizeRange(long size);
 +}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java
----------------------------------------------------------------------
diff --cc engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java
index d343df3,96fb1d9..a60ad38
--- a/engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java
@@@ -45,6 -46,6 +45,7 @@@ import com.cloud.network.dao.NetworkVO
  import com.cloud.service.ServiceOfferingVO;
  import com.cloud.service.dao.ServiceOfferingDao;
  import com.cloud.storage.DiskOfferingVO;
++import com.cloud.storage.VolumeManager;
  import com.cloud.storage.dao.DiskOfferingDao;
  import com.cloud.storage.dao.VMTemplateDao;
  import com.cloud.user.dao.AccountDao;
@@@ -88,9 -88,12 +89,12 @@@ public class CloudOrchestrator implemen
  	@Inject
  	protected AccountDao _accountDao = null;
  
+     @Inject
+     VolumeManager _volumeMgr;
+ 
  	public CloudOrchestrator() {
  	}
 -
 +	
      public VirtualMachineEntity createFromScratch(String uuid, String iso, String os, String hypervisor, String hostName, int cpu, int speed, long memory, List<String> networks, List<String> computeTags,
              Map<String, String> details, String owner) {
          return null;
@@@ -250,7 -251,8 +255,8 @@@
  				throw new InvalidParameterValueException("Disk offering "
  						+ diskOffering + " requires size parameter.");
  			}
+             _volumeMgr.validateVolumeSizeRange(size * 1024 * 1024 * 1024);
 -        }
 +		}
  		rootDiskOffering.first(diskOffering);
  		rootDiskOffering.second(size);
  

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/engine/orchestration/test/com/cloud/vm/VirtualMachineManagerImplTest.java
----------------------------------------------------------------------
diff --cc engine/orchestration/test/com/cloud/vm/VirtualMachineManagerImplTest.java
index 607c1e2,0000000..192f99a
mode 100644,000000..100644
--- a/engine/orchestration/test/com/cloud/vm/VirtualMachineManagerImplTest.java
+++ b/engine/orchestration/test/com/cloud/vm/VirtualMachineManagerImplTest.java
@@@ -1,420 -1,0 +1,430 @@@
 +// Licensed to the Apache Software Foundation (ASF) under one
 +// or more contributor license agreements.  See the NOTICE file
 +// distributed with this work for additional information
 +// regarding copyright ownership.  The ASF licenses this file
 +// to you under the Apache License, Version 2.0 (the
 +// "License"); you may not use this file except in compliance
 +// with the License.  You may obtain a copy of the License at
 +//
 +//   http://www.apache.org/licenses/LICENSE-2.0
 +//
 +// Unless required by applicable law or agreed to in writing,
 +// software distributed under the License is distributed on an
 +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 +// KIND, either express or implied.  See the License for the
 +// specific language governing permissions and limitations
 +// under the License.
 +
 +package com.cloud.vm;
 +
 +import static org.mockito.Matchers.any;
 +import static org.mockito.Matchers.anyLong;
 +import static org.mockito.Matchers.isA;
 +import static org.mockito.Mockito.doNothing;
 +import static org.mockito.Mockito.mock;
 +import static org.mockito.Mockito.when;
 +
 +import java.util.HashMap;
 +import java.util.Iterator;
 +import java.util.List;
 +import java.util.Map;
 +
 +import org.junit.Before;
 +import org.junit.Test;
 +import org.mockito.Mock;
 +import org.mockito.MockitoAnnotations;
 +import org.mockito.Spy;
 +
 +import org.apache.cloudstack.api.command.user.vm.RestoreVMCmd;
++import org.apache.cloudstack.config.ConfigDepot;
 +import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 +import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 +
 +import com.cloud.agent.AgentManager;
 +import com.cloud.agent.api.Answer;
 +import com.cloud.agent.api.CheckVirtualMachineAnswer;
 +import com.cloud.agent.api.CheckVirtualMachineCommand;
 +import com.cloud.agent.api.MigrateWithStorageAnswer;
 +import com.cloud.agent.api.MigrateWithStorageCommand;
 +import com.cloud.agent.api.MigrateWithStorageCompleteAnswer;
 +import com.cloud.agent.api.MigrateWithStorageCompleteCommand;
 +import com.cloud.agent.api.MigrateWithStorageReceiveAnswer;
 +import com.cloud.agent.api.MigrateWithStorageReceiveCommand;
 +import com.cloud.agent.api.MigrateWithStorageSendAnswer;
 +import com.cloud.agent.api.MigrateWithStorageSendCommand;
 +import com.cloud.agent.api.PrepareForMigrationAnswer;
 +import com.cloud.agent.api.PrepareForMigrationCommand;
 +import com.cloud.agent.api.ScaleVmAnswer;
 +import com.cloud.agent.api.ScaleVmCommand;
 +import com.cloud.configuration.dao.ConfigurationDao;
 +import com.cloud.dc.dao.ClusterDao;
 +import com.cloud.dc.dao.DataCenterDao;
 +import com.cloud.dc.dao.HostPodDao;
 +import com.cloud.deploy.DeployDestination;
 +import com.cloud.exception.ConcurrentOperationException;
 +import com.cloud.exception.ManagementServerException;
 +import com.cloud.exception.OperationTimedoutException;
 +import com.cloud.exception.ResourceUnavailableException;
 +import com.cloud.exception.VirtualMachineMigrationException;
 +import com.cloud.host.HostVO;
 +import com.cloud.host.dao.HostDao;
 +import com.cloud.hypervisor.Hypervisor.HypervisorType;
 +import com.cloud.hypervisor.HypervisorGuru;
 +import com.cloud.hypervisor.HypervisorGuruManager;
 +import com.cloud.network.NetworkManager;
 +import com.cloud.offering.ServiceOffering;
 +import com.cloud.service.ServiceOfferingVO;
 +import com.cloud.storage.DiskOfferingVO;
 +import com.cloud.storage.StoragePool;
 +import com.cloud.storage.StoragePoolHostVO;
 +import com.cloud.storage.VMTemplateVO;
 +import com.cloud.storage.Volume;
 +import com.cloud.storage.VolumeManager;
 +import com.cloud.storage.VolumeVO;
 +import com.cloud.storage.dao.DiskOfferingDao;
 +import com.cloud.storage.dao.StoragePoolHostDao;
 +import com.cloud.storage.dao.VMTemplateDao;
 +import com.cloud.storage.dao.VolumeDao;
 +import com.cloud.user.Account;
 +import com.cloud.user.AccountVO;
 +import com.cloud.user.UserVO;
 +import com.cloud.user.dao.AccountDao;
 +import com.cloud.user.dao.UserDao;
 +import com.cloud.utils.Pair;
 +import com.cloud.utils.db.EntityManager;
 +import com.cloud.utils.exception.CloudRuntimeException;
 +import com.cloud.vm.VirtualMachine.Event;
 +import com.cloud.vm.VirtualMachine.PowerState;
 +import com.cloud.vm.VirtualMachine.State;
 +import com.cloud.vm.dao.UserVmDao;
 +import com.cloud.vm.dao.VMInstanceDao;
 +import com.cloud.vm.snapshot.VMSnapshotManager;
 +
 +public class VirtualMachineManagerImplTest {
 +
 +        @Spy VirtualMachineManagerImpl _vmMgr = new VirtualMachineManagerImpl();
 +        @Mock
 +        VolumeManager _storageMgr;
 +        @Mock
 +        Account _account;
 +        @Mock
 +        AgentManager _agentMgr;
 +        @Mock
 +        AccountDao _accountDao;
 +        @Mock
 +        ConfigurationDao _configDao;
 +        @Mock
 +        HostDao _hostDao;
 +        @Mock
 +        UserDao _userDao;
 +        @Mock
 +        UserVmDao _vmDao;
 +        @Mock
 +        ItWorkDao _workDao;
 +        @Mock
 +        VMInstanceDao _vmInstanceDao;
 +        @Mock
 +        VMTemplateDao _templateDao;
 +        @Mock
 +        VolumeDao _volsDao;
 +        @Mock
 +        RestoreVMCmd _restoreVMCmd;
 +        @Mock
 +        AccountVO _accountMock;
 +        @Mock
 +        UserVO _userMock;
 +        @Mock
 +        UserVmVO _vmMock;
 +        @Mock
 +        VMInstanceVO _vmInstance;
 +        @Mock
 +        HostVO _host;
 +        @Mock
 +        VMTemplateVO _templateMock;
 +        @Mock
 +        VolumeVO _volumeMock;
 +        @Mock
 +        List<VolumeVO> _rootVols;
 +        @Mock
 +        ItWorkVO _work;
++        @Mock
++    ConfigDepot _configDepot;
++        @Mock
++        HostVO hostVO;
 +
 +    @Mock
 +    EntityManager _entityMgr;
 +
 +        @Mock ClusterDao _clusterDao;
 +        @Mock HostPodDao _podDao;
 +        @Mock DataCenterDao _dcDao;
 +        @Mock DiskOfferingDao _diskOfferingDao;
 +        @Mock PrimaryDataStoreDao _storagePoolDao;
 +        @Mock StoragePoolHostDao _poolHostDao;
 +        @Mock NetworkManager _networkMgr;
 +        @Mock HypervisorGuruManager _hvGuruMgr;
 +        @Mock VMSnapshotManager _vmSnapshotMgr;
 +
 +        // Mock objects for vm migration with storage test.
 +        @Mock DiskOfferingVO _diskOfferingMock;
 +        @Mock StoragePoolVO _srcStoragePoolMock;
 +        @Mock StoragePoolVO _destStoragePoolMock;
 +        @Mock HostVO _srcHostMock;
 +        @Mock HostVO _destHostMock;
 +    @Mock
 +    Map<Volume, StoragePool> _volumeToPoolMock;
 +
 +        @Before
 +        public void setup(){
 +            MockitoAnnotations.initMocks(this);
 +
 +        _vmMgr._entityMgr = _entityMgr;
 +            _vmMgr._volsDao = _volsDao;
 +            _vmMgr._volumeMgr = _storageMgr;
 +            _vmMgr._hostDao = _hostDao;
 +            _vmMgr._nodeId = 1L;
 +/*
 +            _vmMgr._workDao = _workDao;
 +*/
 +            _vmMgr._agentMgr = _agentMgr;
 +            _vmMgr._poolHostDao= _poolHostDao;
 +            _vmMgr._networkMgr = _networkMgr;
 +            _vmMgr._hvGuruMgr = _hvGuruMgr;
 +            _vmMgr._vmSnapshotMgr = _vmSnapshotMgr;
 +            _vmMgr._vmDao = _vmInstanceDao;
++        _vmMgr._configDepot = _configDepot;
 +
 +            when(_vmMock.getId()).thenReturn(314l);
 +            when(_vmInstance.getId()).thenReturn(1L);
 +            when(_vmInstance.getServiceOfferingId()).thenReturn(2L);
 +            when(_vmInstance.getInstanceName()).thenReturn("myVm");
 +            when(_vmInstance.getHostId()).thenReturn(2L);
 +            when(_vmInstance.getType()).thenReturn(VirtualMachine.Type.User);
 +            when(_host.getId()).thenReturn(1L);
 +            when(_hostDao.findById(anyLong())).thenReturn(null);
 +        when(_entityMgr.findById(ServiceOffering.class, anyLong())).thenReturn(getSvcoffering(512));
 +            when(_workDao.persist(_work)).thenReturn(_work);
 +            when(_workDao.update("1", _work)).thenReturn(true);
 +            when(_work.getId()).thenReturn("1");
 +            doNothing().when(_work).setStep(ItWorkVO.Step.Done);
 +            //doNothing().when(_volsDao).detachVolume(anyLong());
 +            //when(_work.setStep(ItWorkVO.Step.Done)).thenReturn("1");
 +
 +        }
 +
 +
 +    @Test(expected=CloudRuntimeException.class)
 +    public void testScaleVM1()  throws Exception {
 +
 +
 +        DeployDestination dest = new DeployDestination(null, null, null, _host);
 +        long l = 1L;
 +
 +        when(_vmInstanceDao.findById(anyLong())).thenReturn(_vmInstance);
 +        _vmMgr.migrateForScale(_vmInstance.getUuid(), l, dest, l);
 +
 +    }
 +
 +    @Test (expected=CloudRuntimeException.class)
 +    public void testScaleVM2()  throws Exception {
 +
 +        DeployDestination dest = new DeployDestination(null, null, null, _host);
 +        long l = 1L;
 +
 +        when(_vmInstanceDao.findById(anyLong())).thenReturn(_vmInstance);
 +        ServiceOfferingVO newServiceOffering = getSvcoffering(512);
++        when(_hostDao.findById(_vmInstance.hostId)).thenReturn(hostVO);
++        when(hostVO.getClusterId()).thenReturn(1L);
++//        when(_configDepot.getConfigValue(Config.MemOverprovisioningFactor.key(), Config.ConfigurationParameterScope.cluster.toString(), 1L)).thenReturn("1.0");
++//        when(_configServer.getConfigValue(Config.CPUOverprovisioningFactor.key(), Config.ConfigurationParameterScope.cluster.toString(), 1L)).thenReturn("1.0");
 +        ScaleVmCommand reconfigureCmd = new ScaleVmCommand("myVmName", newServiceOffering.getCpu(),
-                 newServiceOffering.getSpeed(), newServiceOffering.getRamSize(), newServiceOffering.getRamSize(), newServiceOffering.getLimitCpuUse());
++                newServiceOffering.getSpeed(), newServiceOffering.getSpeed(), newServiceOffering.getRamSize(), newServiceOffering.getRamSize(), newServiceOffering.getLimitCpuUse());
 +        Answer answer = new ScaleVmAnswer(reconfigureCmd, true, "details");
 +        when(_agentMgr.send(2l, reconfigureCmd)).thenReturn(null);
 +        _vmMgr.reConfigureVm(_vmInstance, getSvcoffering(256), false);
 +
 +    }
 +
 +    @Test (expected=CloudRuntimeException.class)
 +    public void testScaleVM3()  throws Exception {
 +
 +        /*VirtualMachineProfile<VMInstanceVO> profile = new VirtualMachineProfileImpl<VMInstanceVO>(vm);
 +
 +        Long srcHostId = vm.getHostId();
 +        Long oldSvcOfferingId = vm.getServiceOfferingId();
 +        if (srcHostId == null) {
 +            throw new CloudRuntimeException("Unable to scale the vm because it doesn't have a host id");
 +        }*/
 +
 +        when(_vmInstance.getHostId()).thenReturn(null);
 +        when(_vmInstanceDao.findById(anyLong())).thenReturn(_vmInstance);
 +        _vmMgr.findHostAndMigrate(_vmInstance.getUuid(), 2l);
 +
 +    }
 +
 +
 +    private ServiceOfferingVO getSvcoffering(int ramSize){
 +
 +        long id  = 4L;
 +        String name = "name";
 +        String displayText = "displayText";
 +        int cpu = 1;
 +        //int ramSize = 256;
 +        int speed = 128;
 +
 +        boolean ha = false;
 +        boolean useLocalStorage = false;
 +
 +        ServiceOfferingVO serviceOffering = new ServiceOfferingVO(name, cpu, ramSize, speed, null, null, ha, displayText, useLocalStorage, false, null, false, null, false);
 +        return serviceOffering;
 +    }
 +
 +    private void initializeMockConfigForMigratingVmWithVolumes() throws OperationTimedoutException,
 +        ResourceUnavailableException {
 +
 +        // Mock the source and destination hosts.
 +        when(_srcHostMock.getId()).thenReturn(5L);
 +        when(_destHostMock.getId()).thenReturn(6L);
 +        when(_hostDao.findById(5L)).thenReturn(_srcHostMock);
 +        when(_hostDao.findById(6L)).thenReturn(_destHostMock);
 +
 +        // Mock the vm being migrated.
 +        when(_vmMock.getId()).thenReturn(1L);
 +        when(_vmMock.getHypervisorType()).thenReturn(HypervisorType.XenServer);
 +        when(_vmMock.getState()).thenReturn(State.Running).thenReturn(State.Running).thenReturn(State.Migrating)
 +            .thenReturn(State.Migrating);
 +        when(_vmMock.getHostId()).thenReturn(5L);
 +        when(_vmInstance.getId()).thenReturn(1L);
 +        when(_vmInstance.getServiceOfferingId()).thenReturn(2L);
 +        when(_vmInstance.getInstanceName()).thenReturn("myVm");
 +        when(_vmInstance.getHostId()).thenReturn(5L);
 +        when(_vmInstance.getType()).thenReturn(VirtualMachine.Type.User);
 +        when(_vmInstance.getState()).thenReturn(State.Running).thenReturn(State.Running).thenReturn(State.Migrating)
 +            .thenReturn(State.Migrating);
 +
 +        // Mock the work item.
 +        when(_workDao.persist(any(ItWorkVO.class))).thenReturn(_work);
 +        when(_workDao.update("1", _work)).thenReturn(true);
 +        when(_work.getId()).thenReturn("1");
 +        doNothing().when(_work).setStep(ItWorkVO.Step.Done);
 +
 +        // Mock the vm guru and the user vm object that gets returned.
 +        _vmMgr._vmGurus = new HashMap<VirtualMachine.Type, VirtualMachineGuru>();
 +
 +        // Mock the iteration over all the volumes of an instance.
 +        Iterator<VolumeVO> volumeIterator = mock(Iterator.class);
 +        when(_volsDao.findUsableVolumesForInstance(anyLong())).thenReturn(_rootVols);
 +        when(_rootVols.iterator()).thenReturn(volumeIterator);
 +        when(volumeIterator.hasNext()).thenReturn(true, false);
 +        when(volumeIterator.next()).thenReturn(_volumeMock);
 +
 +        // Mock the disk offering and pool objects for a volume.
 +        when(_volumeMock.getDiskOfferingId()).thenReturn(5L);
 +        when(_volumeMock.getPoolId()).thenReturn(200L);
 +        when(_diskOfferingDao.findById(anyLong())).thenReturn(_diskOfferingMock);
 +        when(_storagePoolDao.findById(anyLong())).thenReturn(_srcStoragePoolMock);
 +
 +        // Mock the volume to pool mapping.
 +        when(_volumeToPoolMock.get(_volumeMock)).thenReturn(_destStoragePoolMock);
 +        when(_destStoragePoolMock.getId()).thenReturn(201L);
 +        when(_srcStoragePoolMock.getId()).thenReturn(200L);
 +        when(_destStoragePoolMock.isLocal()).thenReturn(false);
 +        when(_diskOfferingMock.getUseLocalStorage()).thenReturn(false);
 +        when(_poolHostDao.findByPoolHost(anyLong(), anyLong())).thenReturn(mock(StoragePoolHostVO.class));
 +
 +        // Mock hypervisor guru.
 +        HypervisorGuru guruMock = mock(HypervisorGuru.class);
 +        when(_hvGuruMgr.getGuru(HypervisorType.XenServer)).thenReturn(guruMock);
 +
 +        when(_srcHostMock.getClusterId()).thenReturn(3L);
 +        when(_destHostMock.getClusterId()).thenReturn(3L);
 +
 +        // Mock the commands and answers to the agent.
 +        PrepareForMigrationAnswer prepAnswerMock = mock(PrepareForMigrationAnswer.class);
 +        when(prepAnswerMock.getResult()).thenReturn(true);
 +        when(_agentMgr.send(anyLong(), isA(PrepareForMigrationCommand.class))).thenReturn(prepAnswerMock);
 +
 +        MigrateWithStorageAnswer migAnswerMock = mock(MigrateWithStorageAnswer.class);
 +        when(migAnswerMock.getResult()).thenReturn(true);
 +        when(_agentMgr.send(anyLong(), isA(MigrateWithStorageCommand.class))).thenReturn(migAnswerMock);
 +
 +        MigrateWithStorageReceiveAnswer migRecAnswerMock = mock(MigrateWithStorageReceiveAnswer.class);
 +        when(migRecAnswerMock.getResult()).thenReturn(true);
 +        when(_agentMgr.send(anyLong(), isA(MigrateWithStorageReceiveCommand.class))).thenReturn(migRecAnswerMock);
 +
 +        MigrateWithStorageSendAnswer migSendAnswerMock = mock(MigrateWithStorageSendAnswer.class);
 +        when(migSendAnswerMock.getResult()).thenReturn(true);
 +        when(_agentMgr.send(anyLong(), isA(MigrateWithStorageSendCommand.class))).thenReturn(migSendAnswerMock);
 +
 +        MigrateWithStorageCompleteAnswer migCompleteAnswerMock = mock(MigrateWithStorageCompleteAnswer.class);
 +        when(migCompleteAnswerMock.getResult()).thenReturn(true);
 +        when(_agentMgr.send(anyLong(), isA(MigrateWithStorageCompleteCommand.class))).thenReturn(migCompleteAnswerMock);
 +
 +        CheckVirtualMachineAnswer checkVmAnswerMock = mock(CheckVirtualMachineAnswer.class);
 +        when(checkVmAnswerMock.getResult()).thenReturn(true);
 +        when(checkVmAnswerMock.getState()).thenReturn(PowerState.PowerOn);
 +        when(_agentMgr.send(anyLong(), isA(CheckVirtualMachineCommand.class))).thenReturn(checkVmAnswerMock);
 +
 +        // Mock the state transitions of vm.
 +        Pair<Long, Long> opaqueMock = new Pair<Long, Long> (_vmMock.getHostId(), _destHostMock.getId());
 +        when(_vmSnapshotMgr.hasActiveVMSnapshotTasks(anyLong())).thenReturn(false);
 +        when(_vmInstanceDao.updateState(State.Running, Event.MigrationRequested, State.Migrating, _vmMock, opaqueMock))
 +            .thenReturn(true);
 +        when(_vmInstanceDao.updateState(State.Migrating, Event.OperationSucceeded, State.Running, _vmMock, opaqueMock))
 +            .thenReturn(true);
 +    }
 +
 +    // Check migration of a vm with its volumes within a cluster.
 +    @Test
 +    public void testMigrateWithVolumeWithinCluster() throws ResourceUnavailableException, ConcurrentOperationException,
 +        ManagementServerException, VirtualMachineMigrationException, OperationTimedoutException {
 +
 +        initializeMockConfigForMigratingVmWithVolumes();
 +        when(_srcHostMock.getClusterId()).thenReturn(3L);
 +        when(_destHostMock.getClusterId()).thenReturn(3L);
 +
 +        _vmMgr.migrateWithStorage(_vmInstance.getUuid(), _srcHostMock.getId(), _destHostMock.getId(), _volumeToPoolMock);
 +    }
 +
 +    // Check migration of a vm with its volumes across a cluster.
 +    @Test
 +    public void testMigrateWithVolumeAcrossCluster() throws ResourceUnavailableException, ConcurrentOperationException,
 +        ManagementServerException, VirtualMachineMigrationException, OperationTimedoutException {
 +
 +        initializeMockConfigForMigratingVmWithVolumes();
 +        when(_srcHostMock.getClusterId()).thenReturn(3L);
 +        when(_destHostMock.getClusterId()).thenReturn(4L);
 +
 +        _vmMgr.migrateWithStorage(_vmInstance.getUuid(), _srcHostMock.getId(), _destHostMock.getId(), _volumeToPoolMock);
 +    }
 +
 +    // Check migration of a vm fails when src and destination pool are not of same type; that is, one is shared and
 +    // other is local.
 +    @Test(expected=CloudRuntimeException.class)
 +    public void testMigrateWithVolumeFail1() throws ResourceUnavailableException, ConcurrentOperationException,
 +        ManagementServerException, VirtualMachineMigrationException, OperationTimedoutException {
 +
 +        initializeMockConfigForMigratingVmWithVolumes();
 +        when(_srcHostMock.getClusterId()).thenReturn(3L);
 +        when(_destHostMock.getClusterId()).thenReturn(3L);
 +
 +        when(_destStoragePoolMock.isLocal()).thenReturn(true);
 +        when(_diskOfferingMock.getUseLocalStorage()).thenReturn(false);
 +
 +        _vmMgr.migrateWithStorage(_vmInstance.getUuid(), _srcHostMock.getId(), _destHostMock.getId(), _volumeToPoolMock);
 +    }
 +
 +    // Check migration of a vm fails when vm is not in Running state.
 +    @Test(expected=ConcurrentOperationException.class)
 +    public void testMigrateWithVolumeFail2() throws ResourceUnavailableException, ConcurrentOperationException,
 +        ManagementServerException, VirtualMachineMigrationException, OperationTimedoutException {
 +
 +        initializeMockConfigForMigratingVmWithVolumes();
 +        when(_srcHostMock.getClusterId()).thenReturn(3L);
 +        when(_destHostMock.getClusterId()).thenReturn(3L);
 +
 +        when(_vmMock.getState()).thenReturn(State.Stopped);
 +
 +        _vmMgr.migrateWithStorage(_vmInstance.getUuid(), _srcHostMock.getId(), _destHostMock.getId(), _volumeToPoolMock);
 +    }
 +}

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

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --cc plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index 072fd60,1af4239..87b3df3
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@@ -1216,25 -1261,24 +1262,24 @@@ public class VmwareResource implements 
                  if (!result.first()) {
                      String msg = "SetNetworkACLAnswer on domain router " + routerIp + " failed. message: " + result.second();
                      s_logger.error(msg);
-                 }
- 
 -                    return new SetNetworkACLAnswer(cmd, false, results);
 +                return new SetNetworkACLAnswer(cmd, false, results);
+                 }
              } else {
                  args="";
 -                args += " -d " + "eth" + ethDeviceNum;
 -                args += " -i " + nic.getIp();
 -                args += " -m " + Long.toString(NetUtils.getCidrSize(nic.getNetmask()));
 -                args += " -a " + sb.toString();
 +            args += " -d " + "eth" + ethDeviceNum;
 +            args += " -i " + nic.getIp();
 +            args += " -m " + Long.toString(NetUtils.getCidrSize(nic.getNetmask()));
 +            args += " -a " + sb.toString();
  
                  result = SshHelper.sshExecute(routerIp, DEFAULT_DOMR_SSHPORT, "root", mgr.getSystemVMKeyFile(), null,
 -                        "/opt/cloud/bin/vpc_acl.sh " + args);
 +                    "/opt/cloud/bin/vpc_acl.sh " + args);
  
 -                if (!result.first()) {
 -                    String msg = "SetNetworkACLAnswer on domain router " + routerIp + " failed. message: " + result.second();
 -                    s_logger.error(msg);
 +            if (!result.first()) {
 +                String msg = "SetNetworkACLAnswer on domain router " + routerIp + " failed. message: " + result.second();
 +                s_logger.error(msg);
  
 -                    return new SetNetworkACLAnswer(cmd, false, results);
 -                }
 +                return new SetNetworkACLAnswer(cmd, false, results);
 +            }
              }
  
              return new SetNetworkACLAnswer(cmd, true, results);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/plugins/network-elements/ovs/src/com/cloud/network/guru/OvsGuestNetworkGuru.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/api/query/QueryManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/api/query/QueryManagerImpl.java
index 6280cbf,f70f5ae..de39793
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@@ -16,23 -16,23 +16,23 @@@
  // under the License.
  package com.cloud.api.query;
  
--import java.util.*;
++import java.util.ArrayList;
++import java.util.Date;
++import java.util.HashSet;
++import java.util.LinkedList;
++import java.util.List;
++import java.util.Map;
++import java.util.Set;
  
  import javax.ejb.Local;
  import javax.inject.Inject;
  
--import com.cloud.api.ApiDBUtils;
--import com.cloud.server.ResourceMetaDataService;
--import com.cloud.server.ResourceTag;
--import com.cloud.server.TaggedResourceService;
--import com.cloud.vm.NicDetailVO;
--import com.cloud.vm.dao.NicDetailDao;
++import org.apache.log4j.Logger;
++import org.springframework.stereotype.Component;
++
  import org.apache.cloudstack.affinity.AffinityGroupResponse;
  import org.apache.cloudstack.affinity.AffinityGroupVMMapVO;
  import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
--import com.cloud.storage.VolumeDetailVO;
--import com.cloud.storage.dao.VolumeDetailsDao;
--
  import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
  import org.apache.cloudstack.api.command.admin.host.ListHostsCmd;
  import org.apache.cloudstack.api.command.admin.internallb.ListInternalLBVMsCmd;
@@@ -54,11 -54,10 +54,28 @@@ import org.apache.cloudstack.api.comman
  import org.apache.cloudstack.api.command.user.volume.ListResourceDetailsCmd;
  import org.apache.cloudstack.api.command.user.volume.ListVolumesCmd;
  import org.apache.cloudstack.api.command.user.zone.ListZonesByCmd;
--import org.apache.cloudstack.api.response.*;
++import org.apache.cloudstack.api.response.AccountResponse;
++import org.apache.cloudstack.api.response.AsyncJobResponse;
++import org.apache.cloudstack.api.response.DiskOfferingResponse;
++import org.apache.cloudstack.api.response.DomainRouterResponse;
++import org.apache.cloudstack.api.response.EventResponse;
++import org.apache.cloudstack.api.response.HostResponse;
++import org.apache.cloudstack.api.response.InstanceGroupResponse;
++import org.apache.cloudstack.api.response.ListResponse;
++import org.apache.cloudstack.api.response.ProjectAccountResponse;
++import org.apache.cloudstack.api.response.ProjectInvitationResponse;
++import org.apache.cloudstack.api.response.ProjectResponse;
++import org.apache.cloudstack.api.response.ResourceDetailResponse;
++import org.apache.cloudstack.api.response.ResourceTagResponse;
++import org.apache.cloudstack.api.response.SecurityGroupResponse;
++import org.apache.cloudstack.api.response.ServiceOfferingResponse;
++import org.apache.cloudstack.api.response.StoragePoolResponse;
++import org.apache.cloudstack.api.response.UserResponse;
++import org.apache.cloudstack.api.response.UserVmResponse;
++import org.apache.cloudstack.api.response.VolumeResponse;
++import org.apache.cloudstack.api.response.ZoneResponse;
 +import org.apache.cloudstack.context.CallContext;
  import org.apache.cloudstack.query.QueryService;
--import org.apache.log4j.Logger;
--import org.springframework.stereotype.Component;
  
  import com.cloud.api.query.dao.AccountJoinDao;
  import com.cloud.api.query.dao.AffinityGroupJoinDao;
@@@ -119,9 -118,9 +136,14 @@@ import com.cloud.projects.ProjectManage
  import com.cloud.projects.dao.ProjectAccountDao;
  import com.cloud.projects.dao.ProjectDao;
  import com.cloud.server.Criteria;
++import com.cloud.server.ResourceMetaDataService;
++import com.cloud.server.ResourceTag;
++import com.cloud.server.TaggedResourceService;
  import com.cloud.service.ServiceOfferingVO;
  import com.cloud.service.dao.ServiceOfferingDao;
  import com.cloud.storage.Volume;
++import com.cloud.storage.VolumeDetailVO;
++import com.cloud.storage.dao.VolumeDetailsDao;
  import com.cloud.user.Account;
  import com.cloud.user.AccountManager;
  import com.cloud.user.AccountVO;
@@@ -136,9 -136,9 +158,11 @@@ import com.cloud.utils.db.SearchCriteri
  import com.cloud.utils.db.SearchCriteria.Func;
  import com.cloud.utils.db.SearchCriteria.Op;
  import com.cloud.vm.DomainRouterVO;
++import com.cloud.vm.NicDetailVO;
  import com.cloud.vm.UserVmVO;
  import com.cloud.vm.VirtualMachine;
  import com.cloud.vm.dao.DomainRouterDao;
++import com.cloud.vm.dao.NicDetailDao;
  import com.cloud.vm.dao.UserVmDao;
  
  @Component
@@@ -636,8 -636,7 +660,7 @@@ public class QueryManagerImpl extends M
          c.addCriteria(Criteria.ID, cmd.getId());
          c.addCriteria(Criteria.NAME, cmd.getInstanceName());
          c.addCriteria(Criteria.STATE, cmd.getState());
 -        c.addCriteria(Criteria.DATACENTERID, cmd.getZoneId());        
 +        c.addCriteria(Criteria.DATACENTERID, cmd.getZoneId());
-         c.addCriteria(Criteria.DATACENTERTYPE, cmd.getZoneType());
          c.addCriteria(Criteria.GROUPID, cmd.getGroupId());
          c.addCriteria(Criteria.FOR_VIRTUAL_NETWORK, cmd.getForVirtualNetwork());
          c.addCriteria(Criteria.NETWORKID, cmd.getNetworkId());
@@@ -686,8 -685,7 +709,7 @@@
          Object name = c.getCriteria(Criteria.NAME);
          Object state = c.getCriteria(Criteria.STATE);
          Object notState = c.getCriteria(Criteria.NOTSTATE);
 -        Object zoneId = c.getCriteria(Criteria.DATACENTERID);        
 +        Object zoneId = c.getCriteria(Criteria.DATACENTERID);
-         Object zoneType = c.getCriteria(Criteria.DATACENTERTYPE);
          Object pod = c.getCriteria(Criteria.PODID);
          Object hostId = c.getCriteria(Criteria.HOSTID);
          Object hostName = c.getCriteria(Criteria.HOSTNAME);
@@@ -709,8 -707,7 +731,7 @@@
          sb.and("stateEQ", sb.entity().getState(), SearchCriteria.Op.EQ);
          sb.and("stateNEQ", sb.entity().getState(), SearchCriteria.Op.NEQ);
          sb.and("stateNIN", sb.entity().getState(), SearchCriteria.Op.NIN);
 -        sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);       
 +        sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
-         sb.and("dataCenterType", sb.entity().getDataCenterType(), SearchCriteria.Op.EQ);
          sb.and("podId", sb.entity().getPodId(), SearchCriteria.Op.EQ);
          sb.and("hypervisorType", sb.entity().getHypervisorType(), SearchCriteria.Op.EQ);
          sb.and("hostIdEQ", sb.entity().getHostId(), SearchCriteria.Op.EQ);
@@@ -824,11 -821,7 +845,7 @@@
                  sc.setParameters("stateNEQ", "Destroyed");
              }
          }
 -               
 +        
-         if (zoneType != null) {
-         	sc.setParameters("dataCenterType", zoneType);
-         }
-         
          if (pod != null) {
              sc.setParameters("podId", pod);
  
@@@ -1422,8 -1415,7 +1439,7 @@@
  
      public Pair<List<HostJoinVO>, Integer> searchForServersInternal(ListHostsCmd cmd) {
  
 -        Long zoneId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(), cmd.getZoneId());        
 +        Long zoneId = _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(), cmd.getZoneId());
-         String zoneType = cmd.getZoneType();
          Object name = cmd.getHostName();
          Object type = cmd.getType();
          Object state = cmd.getState();
@@@ -1444,8 -1436,7 +1460,7 @@@
          sb.and("name", sb.entity().getName(), SearchCriteria.Op.LIKE);
          sb.and("type", sb.entity().getType(), SearchCriteria.Op.LIKE);
          sb.and("status", sb.entity().getStatus(), SearchCriteria.Op.EQ);
 -        sb.and("dataCenterId", sb.entity().getZoneId(), SearchCriteria.Op.EQ);        
 +        sb.and("dataCenterId", sb.entity().getZoneId(), SearchCriteria.Op.EQ);
-         sb.and("dataCenterType", sb.entity().getZoneType(), SearchCriteria.Op.EQ);
          sb.and("podId", sb.entity().getPodId(), SearchCriteria.Op.EQ);
          sb.and("clusterId", sb.entity().getClusterId(), SearchCriteria.Op.EQ);
          sb.and("resourceState", sb.entity().getResourceState(), SearchCriteria.Op.EQ);
@@@ -1489,10 -1480,7 +1504,7 @@@
          }
          if (zoneId != null) {
              sc.setParameters("dataCenterId", zoneId);
 -        }      
 +        }
-         if (zoneType != null) {
-         	sc.setParameters("dataCenterType", zoneType);
-         }
          if (pod != null) {
              sc.setParameters("podId", pod);
          }
@@@ -1549,8 -1537,7 +1561,7 @@@
          String type = cmd.getType();
          Map<String, String> tags = cmd.getTags();
  
 -        Long zoneId = cmd.getZoneId();        
 +        Long zoneId = cmd.getZoneId();
-         String zoneType = cmd.getZoneType();
          Long podId = null;
          if (_accountMgr.isAdmin(caller.getType())) {
              podId = cmd.getPodId();
@@@ -1577,8 -1564,7 +1588,7 @@@
          sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
          sb.and("volumeType", sb.entity().getVolumeType(), SearchCriteria.Op.LIKE);
          sb.and("instanceId", sb.entity().getVmId(), SearchCriteria.Op.EQ);
 -        sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);       
 +        sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
-         sb.and("dataCenterType", sb.entity().getDataCenterType(), SearchCriteria.Op.EQ);
          sb.and("podId", sb.entity().getPodId(), SearchCriteria.Op.EQ);
          // Only return volumes that are not destroyed
          sb.and("state", sb.entity().getState(), SearchCriteria.Op.NEQ);
@@@ -1637,10 -1623,7 +1647,7 @@@
          }
          if (zoneId != null) {
              sc.setParameters("dataCenterId", zoneId);
 -        }        
 +        }
-         if (zoneType != null) {
-         	sc.setParameters("dataCenterType", zoneType);
-         }
          if (podId != null) {
              sc.setParameters("podId", podId);
          }
@@@ -1886,8 -1869,7 +1893,7 @@@
  
      private Pair<List<StoragePoolJoinVO>, Integer> searchForStoragePoolsInternal(ListStoragePoolsCmd cmd) {
  
 -        Long zoneId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(), cmd.getZoneId());       
 +        Long zoneId = _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(), cmd.getZoneId());
-         String zoneType = cmd.getZoneType();
          Object id = cmd.getId();
          Object name = cmd.getStoragePoolName();
          Object path = cmd.getPath();
@@@ -1906,8 -1888,7 +1912,7 @@@
          sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
          sb.and("name", sb.entity().getName(), SearchCriteria.Op.LIKE);
          sb.and("path", sb.entity().getPath(), SearchCriteria.Op.EQ);
 -        sb.and("dataCenterId", sb.entity().getZoneId(), SearchCriteria.Op.EQ);        
 +        sb.and("dataCenterId", sb.entity().getZoneId(), SearchCriteria.Op.EQ);
-         sb.and("dataCenterType", sb.entity().getZoneType(), SearchCriteria.Op.EQ);
          sb.and("podId", sb.entity().getPodId(), SearchCriteria.Op.EQ);
          sb.and("clusterId", sb.entity().getClusterId(), SearchCriteria.Op.EQ);
          sb.and("hostAddress", sb.entity().getHostAddress(), SearchCriteria.Op.EQ);
@@@ -1937,10 -1918,7 +1942,7 @@@
          }
          if (zoneId != null) {
              sc.setParameters("dataCenterId", zoneId);
 -        }        
 +        }
-         if (zoneType != null) {
-         	sc.setParameters("dataCenterType", zoneType);
-         }
          if (pod != null) {
              sc.setParameters("podId", pod);
          }
@@@ -2500,6 -2478,6 +2502,7 @@@
      }
  
  
++    @Override
      public List<ResourceDetailResponse> listResource(ListResourceDetailsCmd cmd){
  
          String key = cmd.getKey();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/configuration/Config.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index c7947c3,6dac26c..ac80383
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@@ -195,8 -188,10 +194,9 @@@ import com.cloud.user.AccountManager
  import com.cloud.user.AccountVO;
  import com.cloud.user.ResourceLimitService;
  import com.cloud.user.User;
 -import com.cloud.user.UserContext;
  import com.cloud.user.dao.AccountDao;
  import com.cloud.utils.NumbersUtil;
+ import com.cloud.utils.Pair;
  import com.cloud.utils.StringUtils;
  import com.cloud.utils.component.ManagerBase;
  import com.cloud.utils.crypt.DBEncryptionUtil;
@@@ -2537,13 -2527,19 +2537,19 @@@ public class ConfigurationManagerImpl e
          }
          Transaction txn = Transaction.currentTxn();
          txn.start();
- 
+         if (sameSubnet == null || sameSubnet.first() == false) {
+             s_logger.info("adding a new subnet to the network "+network.getId());
+         }
+         else {
+             // if it is same subnet the user might not send the vlan and the netmask details. so we are
+             //figuring out while validation and setting them here.
+             newVlanGateway = sameSubnet.second().first();
+             newVlanNetmask = sameSubnet.second().second();
+         }
 -        Vlan vlan = createVlanAndPublicIpRange(zoneId, networkId, physicalNetworkId, forVirtualNetwork, podId, startIP, 
 +        Vlan vlan = createVlanAndPublicIpRange(zoneId, networkId, physicalNetworkId, forVirtualNetwork, podId, startIP,
                  endIP, newVlanGateway, newVlanNetmask, vlanId, vlanOwner, startIPv6, endIPv6, ip6Gateway, ip6Cidr);
          //create an entry in the nic_secondary table. This will be the new gateway that will be configured on the corresponding routervm.
-         if (sameSubnet == false) {
-            s_logger.info("adding a new subnet to the network "+network.getId());
-         }
+ 
  
          txn.commit();
  
@@@ -2560,31 -2584,23 +2594,23 @@@
                  if (ipv4) {
                      vlanGateway = vlan.getVlanGateway();
                      vlanNetmask = vlan.getVlanNetmask();
-                     // Check if ip addresses are in network range
-                     if (!NetUtils.sameSubnet(startIP, vlanGateway, vlanNetmask)) {
-                         if (!NetUtils.sameSubnet(endIP, vlanGateway, vlanNetmask)) {
-                                 // check if the the new subnet is not a superset of the existing subnets.
-                                 if (NetUtils.isNetworkAWithinNetworkB(NetUtils.getCidrFromGatewayAndNetmask(vlanGateway,vlanNetmask), NetUtils.ipAndNetMaskToCidr(startIP, newVlanNetmask))){
-                                     throw new InvalidParameterValueException ("The new subnet is a superset of the existing subnet");
-                                 }
-                                 // check if the new subnet is not a subset of the existing subnet.
-                                 if (NetUtils.isNetworkAWithinNetworkB(NetUtils.ipAndNetMaskToCidr(startIP, newVlanNetmask), NetUtils.getCidrFromGatewayAndNetmask(vlanGateway,vlanNetmask))){
-                                     throw  new InvalidParameterValueException("The new subnet is a subset of the existing subnet");
-                                 }
-                         }
-                     } else if (NetUtils.sameSubnet(endIP, vlanGateway, vlanNetmask)){
-                         // trying to add to the same subnet.
-                         sameSubnet = true;
-                         if (newVlanGateway == null) {
-                             newVlanGateway = vlanGateway;
-                         }
-                         if (!newVlanGateway.equals(vlanGateway)){
-                             throw new InvalidParameterValueException("The gateway of the ip range is not same as the gateway of the subnet.");
+                     //check if subset or super set or neither.
+                     int val = checkIfSubsetOrSuperset(newVlanGateway, newVlanNetmask, vlan, startIP, endIP);
+                     if (val == 1) {
+                         // this means that new cidr is a superset of the existing subnet.
+                         throw new InvalidParameterValueException("The subnet you are trying to add is a superset of the existing subnet having gateway"+vlan.getVlanGateway()+" and netmask  "+vlan.getVlanNetmask());
+                     }
+                     else if (val == 0) {
+                         //this implies the user is trying to add a new subnet which is not a superset or subset of this subnet.
+                         //checking with the other subnets.
+                         continue;
 -                    }
 +                        }
-                         break;
+                     else if (val == 2) {
+                         //this means he is trying to add to the same subnet.
+                         throw new InvalidParameterValueException("The subnet you are trying to add is a subset of the existing subnet having gateway"+vlan.getVlanGateway()+" and netmask  "+vlan.getVlanNetmask());
                      }
-                     else {
-                         throw new InvalidParameterValueException("Start ip and End ip is not in vlan range!");
+                     else if (val == 3) {
+                         sameSubnet =true;
                      }
                  }
                  if (ipv6) {
@@@ -2599,13 -2615,25 +2625,25 @@@
                      _networkModel.checkIp6Parameters(startIPv6, endIPv6, ip6Gateway, ip6Cidr);
                  }
              }
-             if (sameSubnet == false) {
-                 if (newVlanGateway ==null)  {
-                     throw  new MissingParameterValueException("The gateway for the new subnet is not specified.");
 -        }
 +                }
+         if (newVlanGateway==null && newVlanNetmask ==null && sameSubnet == false) {
+             throw new InvalidParameterValueException("The ip range dose not belong to any of the existing subnets, Provide the netmask and gateway if you want to add new subnet");
+         }
+         Pair<String,String> vlanDetails=null;
+ 
+         if (sameSubnet){
+              vlanDetails = new Pair<String, String>(vlanGateway, vlanNetmask);
+         }
+         else {
+              vlanDetails = new Pair<String, String>(newVlanGateway, newVlanNetmask);
 -        }
 +            }
+         //check if the gatewayip is the part of the ip range being added.
+         if (NetUtils.ipRangesOverlap(startIP, endIP, vlanDetails.first(), vlanDetails.first())) {
+             throw new InvalidParameterValueException("The gateway ip should not be the part of the ip range being added.");
          }
-         return  sameSubnet;
+ 
+         Pair<Boolean,Pair<String,String>> result = new Pair<Boolean,Pair<String,String>>(sameSubnet, vlanDetails);
+         return  result;
      }
  
      @Override
@@@ -3951,7 -4005,12 +3986,12 @@@
                  }
              }
          }
 -        
 +
+         if (serviceProviderMap != null && serviceProviderMap.containsKey(Service.Lb) && !internalLb && !publicLb) {
+             //if not specified, default public lb to true
+             publicLb = true;
+         }
+ 
          NetworkOfferingVO offering = new NetworkOfferingVO(name, displayText, trafficType, systemOnly, specifyVlan,
                  networkRate, multicastRate, isDefault, availability, tags, type, conserveMode, dedicatedLb,
                  sharedSourceNat, redundantRouter, elasticIp, elasticLb, specifyIpRanges, inline, isPersistent, associatePublicIp, publicLb, internalLb);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
index 59e3901,7362cf1..07c3952
--- a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
+++ b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
@@@ -939,9 -943,16 +939,16 @@@ public class ConsoleProxyManagerImpl ex
          ZoneHostInfo zoneHostInfo = zoneHostInfoMap.get(dataCenterId);
          if (zoneHostInfo != null && isZoneHostReady(zoneHostInfo)) {
              VMTemplateVO template = _templateDao.findSystemVMTemplate(dataCenterId);
 -            HostVO secondaryStorageHost = this.templateMgr.getSecondaryStorageHost(dataCenterId);
 +            HostVO secondaryStorageHost = templateMgr.getSecondaryStorageHost(dataCenterId);
              boolean templateReady = false;
 -            
 +
+             if (secondaryStorageHost == null) {
+                 if (s_logger.isDebugEnabled()) {
+                     s_logger.debug("No secondary storage available in zone " + dataCenterId + ", wait until it is ready to launch secondary storage vm");
+                 }
+                 return false;
+             }
+ 
              if (template != null && secondaryStorageHost != null) {
                  VMTemplateHostVO templateHostRef = _vmTemplateHostDao.findByHostTemplate(secondaryStorageHost.getId(), template.getId());
                  templateReady = (templateHostRef != null) && (templateHostRef.getDownloadState() == Status.DOWNLOADED);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/network/NetworkManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/network/NetworkManagerImpl.java
index d197eba,274e794..dc26380
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@@ -1320,21 -1331,9 +1332,9 @@@ public class NetworkManagerImpl extend
              offering.setState(NetworkOffering.State.Enabled);
              _networkOfferingDao.update(offering.getId(), offering);
          }
 -        
 +
-         Map<Network.Service, Set<Network.Provider>> defaultINetworkOfferingProvidersForVpcNetwork = new HashMap<Network.Service, Set<Network.Provider>>();
-         defaultProviders.clear();
-         defaultProviders.add(Network.Provider.VPCVirtualRouter);
-         defaultINetworkOfferingProvidersForVpcNetwork.put(Service.Dhcp, defaultProviders);
-         defaultINetworkOfferingProvidersForVpcNetwork.put(Service.Dns, defaultProviders);
-         defaultINetworkOfferingProvidersForVpcNetwork.put(Service.UserData, defaultProviders);
-         defaultINetworkOfferingProvidersForVpcNetwork.put(Service.Firewall, defaultProviders);
-         defaultINetworkOfferingProvidersForVpcNetwork.put(Service.Gateway, defaultProviders);
-         defaultINetworkOfferingProvidersForVpcNetwork.put(Service.Lb, defaultProviders);
-         defaultINetworkOfferingProvidersForVpcNetwork.put(Service.SourceNat, defaultProviders);
-         defaultINetworkOfferingProvidersForVpcNetwork.put(Service.StaticNat, defaultProviders);
-         defaultINetworkOfferingProvidersForVpcNetwork.put(Service.PortForwarding, defaultProviders);
-         defaultINetworkOfferingProvidersForVpcNetwork.put(Service.Vpn, defaultProviders);
  
+         //#4 - default isolated offering with Source nat service
          if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService) == null) {
              offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService,
                      "Offering for Isolated networks with Source Nat service enabled", TrafficType.Guest,
@@@ -1372,7 -1374,34 +1375,34 @@@
              offering.setState(NetworkOffering.State.Enabled);
              _networkOfferingDao.update(offering.getId(), offering);
          }
 -        
 +
+         //#8 - network offering with internal lb service
+         Map<Network.Service, Set<Network.Provider>> internalLbOffProviders =
+                 new HashMap<Network.Service, Set<Network.Provider>>();
+         Set<Network.Provider> defaultVpcProvider = new HashSet<Network.Provider>();
+         defaultVpcProvider.add(Network.Provider.VPCVirtualRouter);
+         
+         Set<Network.Provider> defaultInternalLbProvider = new HashSet<Network.Provider>();
+         defaultInternalLbProvider.add(Network.Provider.InternalLbVm);
+ 
+         internalLbOffProviders.put(Service.Dhcp, defaultVpcProvider);
+         internalLbOffProviders.put(Service.Dns, defaultVpcProvider);
+         internalLbOffProviders.put(Service.UserData, defaultVpcProvider);
+         internalLbOffProviders.put(Service.NetworkACL, defaultVpcProvider);
+         internalLbOffProviders.put(Service.Gateway, defaultVpcProvider);
+         internalLbOffProviders.put(Service.Lb, defaultInternalLbProvider);
+         internalLbOffProviders.put(Service.SourceNat, defaultVpcProvider);
+         
+         if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB) == null) {
+             offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB,
+                     "Offering for Isolated VPC networks with Internal Lb support", TrafficType.Guest,
+                     null, false, Availability.Optional, null, internalLbOffProviders,
+                     true, Network.GuestType.Isolated, false, null, false, null, false, false, null);
+             offering.setState(NetworkOffering.State.Enabled);
+             offering.setInternalLb(true);
+             _networkOfferingDao.update(offering.getId(), offering);
+         }
+ 
          Map<Network.Service, Set<Network.Provider>> netscalerServiceProviders = new HashMap<Network.Service, Set<Network.Provider>>();
          Set<Network.Provider> vrProvider = new HashSet<Network.Provider>();
          vrProvider.add(Provider.VirtualRouter);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/network/NetworkServiceImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/network/NetworkServiceImpl.java
index 44c2873,aace68d..1897ef6
--- a/server/src/com/cloud/network/NetworkServiceImpl.java
+++ b/server/src/com/cloud/network/NetworkServiceImpl.java
@@@ -118,10 -131,9 +118,9 @@@ import com.cloud.network.element.VpcVir
  import com.cloud.network.guru.NetworkGuru;
  import com.cloud.network.rules.FirewallRule.Purpose;
  import com.cloud.network.rules.FirewallRuleVO;
--import com.cloud.network.rules.PortForwardingRuleVO;
  import com.cloud.network.rules.RulesManager;
  import com.cloud.network.rules.dao.PortForwardingRulesDao;
 +import com.cloud.network.vpc.NetworkACL;
  import com.cloud.network.vpc.PrivateIpVO;
  import com.cloud.network.vpc.Vpc;
  import com.cloud.network.vpc.VpcManager;
@@@ -777,11 -789,16 +776,16 @@@ public class NetworkServiceImpl extend
          if (dc.getNetworkType() == NetworkType.Advanced && network.getGuestType() == Network.GuestType.Isolated) {
              //check PF or static NAT is configured on this ip address
              String secondaryIp = secIpVO.getIp4Address();
-             List<PortForwardingRuleVO> pfRuleList = _portForwardingDao.listByDestIpAddr(secondaryIp);
-             if (pfRuleList.size() != 0) {
+             List<FirewallRuleVO> fwRulesList =  _firewallDao.listByNetworkAndPurpose(network.getId(), Purpose.PortForwarding);
+ 
+             if (fwRulesList.size() != 0) {
+                 for (FirewallRuleVO rule: fwRulesList) {
+                     if (_portForwardingDao.findByIdAndIp(rule.getId(), secondaryIp) != null) {
 -                        s_logger.debug("VM nic IP " + secondaryIp + " is associated with the port forwarding rule");
 -                        throw new InvalidParameterValueException("Can't remove the secondary ip " + secondaryIp + " is associate with the port forwarding rule");
 -                    }
 +                s_logger.debug("VM nic IP " + secondaryIp + " is associated with the port forwarding rule");
 +                throw new InvalidParameterValueException("Can't remove the secondary ip " + secondaryIp + " is associate with the port forwarding rule");
 +            }
+                 }
+             }
              //check if the secondary ip associated with any static nat rule
              IPAddressVO publicIpVO = _ipAddressDao.findByVmIp(secondaryIp);
              if (publicIpVO != null) {
@@@ -1336,8 -1355,7 +1340,7 @@@
          Long id = cmd.getId();
          String keyword = cmd.getKeyword();
          Long zoneId = cmd.getZoneId();
-         String zoneType = cmd.getZoneType();
 -        Account caller = UserContext.current().getCaller();
 +        Account caller = CallContext.current().getCallingAccount();
          Long domainId = cmd.getDomainId();
          String accountName = cmd.getAccountName();
          String guestIpType = cmd.getGuestIpType();
@@@ -1484,8 -1502,8 +1487,8 @@@
              if (!permittedAccounts.isEmpty()) {
                  //get account level networks
                  networksToReturn.addAll(listAccountSpecificNetworks(
 -                        buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, 
 +                        buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType,
-                                 physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags, zoneType), searchFilter,
+                                 physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags), searchFilter,
                          permittedAccounts));
                  //get domain level networks
                  if (domainId != null) {
@@@ -1498,13 -1516,13 +1501,13 @@@
              } else {
                  //add account specific networks
                  networksToReturn.addAll(listAccountSpecificNetworksByDomainPath(
 -                        buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, 
 +                        buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType,
-                                 physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags, zoneType), searchFilter, path,
+                                 physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags), searchFilter, path,
                          isRecursive));
                  //add domain specific networks of domain + parent domains
                  networksToReturn.addAll(listDomainSpecificNetworksByDomainPath(
 -                        buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, 
 +                        buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType,
-                                 physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags, zoneType), searchFilter, path,
+                                 physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags), searchFilter, path,
                                  isRecursive));
                  //add networks of subdomains
                  if (domainId == null) {
@@@ -2666,9 -2680,10 +2665,10 @@@
                          vnetString = vnetString+vnetRange.first().toString()+"-"+value.toString()+";";
                      }
                 }
-                 vnetString = vnetString+"*";
-                 vnetString = vnetString.replace(";*","");
+                if (vnetString.length() > 0 && vnetString.charAt(vnetString.length()-1)==';') {
+                    vnetString = vnetString.substring(0, vnetString.length()-1);
+                }
 -               network.setVnet(vnetString);
 +                network.setVnet(vnetString);
              }
  
              for (Pair<Integer, Integer> vnetToAdd : vnetsToAdd) {
@@@ -2774,12 -2789,15 +2774,15 @@@
          _datacneter_vnet.deleteRange(txn, network.getDataCenterId(), network.getId(), start, end);
  
          String vnetString="";
-         for (Pair<Integer,Integer> vnetRange : existingRanges ){
+         if (existingRanges.isEmpty()) {
+             network.setVnet(null);
+         } else {
+             for (Pair<Integer,Integer> vnetRange : existingRanges ) {
 -                vnetString=vnetString+vnetRange.first().toString()+"-"+vnetRange.second().toString()+";";
 -            }
 +            vnetString=vnetString+vnetRange.first().toString()+"-"+vnetRange.second().toString()+";";
 +        }
-         vnetString = vnetString+"*";
-         vnetString = vnetString.replace(";*","");
+             vnetString = vnetString.substring(0, vnetString.length()-1);
 -            network.setVnet(vnetString);
 +        network.setVnet(vnetString);
+         }
          _physicalNetworkDao.update(network.getId(), network);
          txn.commit();
          _physicalNetworkDao.releaseFromLockTable(network.getId());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/network/guru/GuestNetworkGuru.java
----------------------------------------------------------------------


Mime
View raw message