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 6a1e1e8
Date Fri, 24 May 2013 01:15:14 GMT
Merged from master


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

Branch: refs/heads/vmsync
Commit: 6a1e1e80fe8b946b6c355504716571645473fe30
Parents: 099778e c7976b6
Author: Alex Huang <alex.huang@gmail.com>
Authored: Thu May 23 18:16:32 2013 -0700
Committer: Alex Huang <alex.huang@gmail.com>
Committed: Thu May 23 18:16:32 2013 -0700

----------------------------------------------------------------------
 .../cloud/configuration/ConfigurationService.java  |   13 +
 api/src/com/cloud/event/EventTypes.java            |    5 +
 api/src/com/cloud/network/IpAddress.java           |    4 +-
 .../cloud/network/NetworkMigrationResponder.java   |   69 ++
 api/src/com/cloud/network/NetworkService.java      |    5 +
 .../apache/cloudstack/api/ApiCommandJobType.java   |    3 +-
 .../org/apache/cloudstack/api/ApiConstants.java    |    2 +
 .../apache/cloudstack/api/ResponseGenerator.java   |    7 +
 .../admin/region/CreatePortableIpRangeCmd.java     |  150 +++
 .../admin/region/DeletePortableIpRangeCmd.java     |   94 ++
 .../admin/region/ListPortableIpRangesCmd.java      |  109 ++
 .../command/user/address/AssociateIPAddrCmd.java   |   36 +-
 .../user/address/DisassociateIPAddrCmd.java        |   12 +-
 .../api/command/user/nat/EnableStaticNatCmd.java   |    6 +
 .../cloudstack/api/response/IPAddressResponse.java |    7 +
 .../api/response/PortableIpRangeResponse.java      |   93 ++
 .../api/response/PortableIpResponse.java           |  106 ++
 .../org/apache/cloudstack/region/PortableIp.java   |   58 ++
 .../apache/cloudstack/region/PortableIpRange.java  |   38 +
 .../com/cloud/bridge/service/EC2MainServlet.java   |    2 +-
 .../com/cloud/bridge/service/EC2RestServlet.java   |  428 ++++++---
 .../cloud/bridge/service/EC2SoapServiceImpl.java   |  259 +++--
 .../service/core/ec2/EC2AddressFilterSet.java      |   16 +-
 .../core/ec2/EC2AvailabilityZonesFilterSet.java    |    9 +-
 .../bridge/service/core/ec2/EC2DescribeImages.java |   10 +
 .../cloud/bridge/service/core/ec2/EC2Engine.java   |  764 ++++++++++-----
 .../bridge/service/core/ec2/EC2GroupFilterSet.java |    9 +-
 .../cloud/bridge/service/core/ec2/EC2Image.java    |   63 +-
 .../bridge/service/core/ec2/EC2ImageFilterSet.java |  168 ++++
 .../service/core/ec2/EC2InstanceFilterSet.java     |    8 +-
 .../service/core/ec2/EC2KeyPairFilterSet.java      |   16 +-
 .../core/ec2/EC2ModifyInstanceAttribute.java       |   64 ++
 .../bridge/service/core/ec2/EC2RegisterImage.java  |    5 +-
 .../service/core/ec2/EC2SnapshotFilterSet.java     |   10 +-
 .../bridge/service/core/ec2/EC2TagsFilterSet.java  |    9 +-
 .../service/core/ec2/EC2VolumeFilterSet.java       |    9 +-
 .../service/exception/EC2ServiceException.java     |  120 ++--
 awsapi/src/com/cloud/stack/CloudStackClient.java   |    5 +-
 client/tomcatconf/applicationContext.xml.in        |    2 +
 client/tomcatconf/commands.properties.in           |    6 +
 .../storage/CreateEntityDownloadURLCommand.java    |    1 -
 .../src/com/cloud/network/DnsMasqConfigurator.java |    2 +-
 debian/rules                                       |    2 +
 docs/en-US/Release_Notes.xml                       |   53 +-
 docs/en-US/added-API-commands-4.2.xml              |   16 +
 docs/en-US/elastic-ip.xml                          |  161 ++--
 docs/en-US/portable-ip.xml                         |   30 +
 .../subsystem/api/storage/AbstractScope.java       |    6 +-
 .../src/com/cloud/network/NetworkManager.java      |   42 +-
 .../src/com/cloud/network/addr/PublicIp.java       |    9 +
 .../src/com/cloud/alert/dao/AlertDaoImpl.java      |    8 +
 .../cloud/configuration/dao/ResourceCountDao.java  |    2 +
 .../configuration/dao/ResourceCountDaoImpl.java    |   16 +
 .../cloud/configuration/dao/ResourceLimitDao.java  |    2 +
 .../configuration/dao/ResourceLimitDaoImpl.java    |   14 +
 .../src/com/cloud/event/dao/EventDaoImpl.java      |    5 +
 .../network/dao/ExternalLoadBalancerDeviceVO.java  |    2 +-
 .../src/com/cloud/network/dao/IPAddressVO.java     |   24 +
 .../engine/cloud/entity/VolumeReservationVO.java   |   22 +-
 .../cloud/entity/dao/VolumeReservationDaoImpl.java |    2 +-
 framework/jobs/pom.xml                             |    1 +
 .../apache/cloudstack/framework/jobs/AsyncJob.java |    1 +
 .../debian/config/etc/init.d/cloud-early-config    |    5 +-
 .../xen/discoverer/XcpServerDiscoverer.java        |    1 +
 .../xen/resource/CitrixResourceBase.java           |   18 +
 .../hypervisor/xen/resource/XcpServerResource.java |    9 +-
 .../xen/resource/XenServer56FP1Resource.java       |   74 +-
 .../motion/XenServerStorageMotionStrategy.java     |   10 +-
 .../xen/resource/CitrixResourceBaseTest.java       |    5 +-
 .../cloud/network/cisco/CiscoVnmcConnection.java   |   22 +-
 .../network/cisco/CiscoVnmcConnectionImpl.java     |  112 +--
 .../cloud/network/resource/CiscoVnmcResource.java  |   20 +-
 .../network/resource/CiscoVnmcResourceTest.java    |   22 +-
 .../internallbvmmgr/InternalLBVMManagerTest.java   |   14 +-
 .../internallbvmmgr/InternalLBVMServiceTest.java   |   51 +-
 .../cloud/network/element/MidoNetElementTest.java  |   44 +-
 .../response/NetscalerLoadBalancerResponse.java    |   21 +
 .../cloud/network/element/NetscalerElement.java    |    4 +
 .../cloud/network/nicira/DestinationNatRule.java   |  105 ++
 .../src/com/cloud/network/nicira/Match.java        |  146 +---
 .../src/com/cloud/network/nicira/NatRule.java      |  363 ++-----
 .../src/com/cloud/network/nicira/NiciraNvpApi.java |   67 +-
 .../com/cloud/network/nicira/SourceNatRule.java    |  123 +++
 .../cloud/network/resource/NiciraNvpResource.java  |   57 +-
 .../test/com/cloud/network/nicira/NatRuleTest.java |   43 +-
 .../network/resource/NiciraNvpResourceTest.java    |  113 ++-
 scripts/vm/hypervisor/xenserver/xcposs/patch       |    2 +
 scripts/vm/hypervisor/xenserver/xcpserver/patch    |    4 +-
 scripts/vm/hypervisor/xenserver/xenserver56/patch  |    4 +-
 .../vm/hypervisor/xenserver/xenserver56fp1/patch   |    4 +-
 scripts/vm/hypervisor/xenserver/xenserver60/patch  |    4 +-
 server/src/com/cloud/api/ApiResponseHelper.java    |   70 ++-
 .../configuration/ConfigurationManagerImpl.java    |  167 ++++
 .../src/com/cloud/network/NetworkManagerImpl.java  |  323 ++++++-
 server/src/com/cloud/network/NetworkModelImpl.java |    8 +-
 .../src/com/cloud/network/NetworkServiceImpl.java  |  105 ++-
 .../network/element/VirtualRouterElement.java      |   69 ++-
 .../router/VirtualNetworkApplianceManager.java     |    1 +
 .../router/VirtualNetworkApplianceManagerImpl.java |   26 +-
 .../com/cloud/network/rules/RulesManagerImpl.java  |   43 +
 .../cloud/network/vpc/NetworkACLServiceImpl.java   |    4 +-
 server/src/com/cloud/resource/DiscovererBase.java  |    1 +
 .../src/com/cloud/server/ManagementServerImpl.java |   85 ++-
 .../src/com/cloud/storage/VolumeManagerImpl.java   |   22 +-
 server/src/com/cloud/user/AccountManagerImpl.java  |   17 +
 server/src/com/cloud/user/DomainManagerImpl.java   |   15 +-
 server/src/com/cloud/vm/UserVmManager.java         |    1 +
 server/src/com/cloud/vm/UserVmManagerImpl.java     |   16 +-
 .../com/cloud/vm/VirtualMachineManagerImpl.java    |   11 +
 .../apache/cloudstack/region/PortableIpDao.java    |   39 +
 .../cloudstack/region/PortableIpDaoImpl.java       |  131 +++
 .../cloudstack/region/PortableIpRangeDao.java      |   30 +
 .../cloudstack/region/PortableIpRangeDaoImpl.java  |   65 ++
 .../cloudstack/region/PortableIpRangeVO.java       |  119 +++
 .../org/apache/cloudstack/region/PortableIpVO.java |  222 +++++
 .../com/cloud/network/MockNetworkManagerImpl.java  |   68 ++-
 .../test/com/cloud/vm/MockUserVmManagerImpl.java   |    6 +
 .../cloud/vpc/MockConfigurationManagerImpl.java    |   25 +
 .../test/com/cloud/vpc/MockNetworkManagerImpl.java |   80 ++-
 .../vpc/MockVpcVirtualNetworkApplianceManager.java |    6 +
 .../networkoffering/ChildTestConfiguration.java    |    7 +
 services/secondary-storage/scripts/ssvm-check.sh   |    4 +-
 setup/db/db/schema-410to420.sql                    |   37 +
 test/integration/component/test_accounts.py        |    2 +-
 test/integration/component/test_custom_hostname.py |  369 +++++++
 .../component/test_high_availability.py            |   28 +-
 .../component/test_host_high_availability.py       |   14 +-
 test/integration/component/test_ldap.py            |  365 +++++++
 test/integration/component/test_project_limits.py  |    5 +-
 test/integration/component/test_projects.py        |   34 +-
 .../integration/component/test_redundant_router.py |  120 ++--
 test/integration/component/test_stopped_vm.py      |   70 +-
 test/integration/component/test_tags.py            |  110 +-
 test/integration/component/test_vpc.py             |  124 ++--
 .../component/test_vpc_host_maintenance.py         |   44 +-
 test/integration/component/test_vpc_network.py     |  108 +-
 .../component/test_vpc_network_lbrules.py          |   18 +-
 .../component/test_vpc_network_pfrules.py          |   18 +-
 .../component/test_vpc_network_staticnatrule.py    |   18 +-
 test/integration/component/test_vpc_offerings.py   |   52 +-
 test/integration/component/test_vpc_routers.py     |   93 +--
 .../component/test_vpc_vm_life_cycle.py            |   98 +-
 .../component/test_vpc_vms_deployment.py           |  154 ++--
 test/integration/component/test_vpn_users.py       |    4 +-
 test/integration/smoke/test_deploy_vm.py           |    3 +
 .../smoke/test_deploy_vm_with_userdata.py          |    8 +-
 ...st_deploy_vms_with_varied_deploymentplanners.py |  414 +++++---
 test/integration/smoke/test_iso.py                 |   10 +-
 test/integration/smoke/test_network.py             |   69 +-
 test/integration/smoke/test_portable_publicip.py   |  236 +++++
 test/integration/smoke/test_public_ip_range.py     |    6 +-
 test/integration/smoke/test_pvlan.py               |    1 +
 test/integration/smoke/test_templates.py           |   11 +-
 test/integration/smoke/test_vm_life_cycle.py       |  145 ++--
 test/integration/smoke/test_vm_snapshots.py        |  618 ++++++------
 tools/apidoc/gen_toc.py                            |    1 +
 tools/marvin/marvin/integration/lib/base.py        |   36 +
 ui/scripts/configuration.js                        |  199 ++++-
 ui/scripts/docs.js                                 |    9 +
 ui/scripts/system.js                               |  389 ++++++++-
 ui/scripts/zoneWizard.js                           |    2 +-
 .../com/cloud/utils/db/GenericSearchBuilder.java   |   18 +-
 .../com/cloud/utils/exception/ErrorContext.java    |   28 +
 utils/src/com/cloud/utils/net/NetUtils.java        |   13 +
 164 files changed, 7852 insertions(+), 2722 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/api/src/com/cloud/configuration/ConfigurationService.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/api/src/com/cloud/network/NetworkMigrationResponder.java
----------------------------------------------------------------------
diff --cc api/src/com/cloud/network/NetworkMigrationResponder.java
index 0000000,6283cc5..8af222c
mode 000000,100644..100644
--- a/api/src/com/cloud/network/NetworkMigrationResponder.java
+++ b/api/src/com/cloud/network/NetworkMigrationResponder.java
@@@ -1,0 -1,70 +1,69 @@@
+ // 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;
+ 
+ import com.cloud.deploy.DeployDestination;
+ import com.cloud.vm.NicProfile;
+ import com.cloud.vm.ReservationContext;
 -import com.cloud.vm.VirtualMachine;
+ import com.cloud.vm.VirtualMachineProfile;
+ 
+ /**
 - * NetworkGuru and NetworkElements that implement this interface 
++ * NetworkGuru and NetworkElements that implement this interface
+  * will be called during Virtual Machine migration.
+  */
+ public interface NetworkMigrationResponder {
+     /**
+      * Prepare for migration.
+      * 
+      * This method will be called per nic before the vm migration.
+      * @param nic
+      * @param network
+      * @param vm
+      * @param dest
+      * @param context
+      * @return true when operation was successful.
+      */
 -    public boolean prepareMigration(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context);
++    public boolean prepareMigration(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context);
+ 
+     /**
+      * Cancel for migration preparation.
+      * 
 -     * This method will be called per nic when the entire vm migration 
 -     * process failed and need to release the resouces that was 
++     * This method will be called per nic when the entire vm migration
++     * process failed and need to release the resouces that was
+      * allocated at the migration preparation.
+      * @param nic destination nic
+      * @param network destination network
+      * @param vm destination vm profile
+      * @param src The context nic migrates from.
+      * @param dst The context nic migrates to.
+      */
 -    public void rollbackMigration(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, ReservationContext src, ReservationContext dst);
++    public void rollbackMigration(NicProfile nic, Network network, VirtualMachineProfile vm, ReservationContext src, ReservationContext dst);
+ 
+     /**
+      * Commit the migration resource.
+      * 
 -     * This method will be called per nic when the entire vm migration 
 -     * process was successful. This is useful to release the resource of 
++     * This method will be called per nic when the entire vm migration
++     * process was successful. This is useful to release the resource of
+      * source deployment where vm has left.
+      * @param nic source nic
+      * @param network source network
+      * @param vm source vm profile
+      * @param src the context nic migrates from.
+      * @param dst the context nic migrates to.
+      */
 -    public void commitMigration(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, ReservationContext src, ReservationContext dst);
++    public void commitMigration(NicProfile nic, Network network, VirtualMachineProfile vm, ReservationContext src, ReservationContext dst);
+ }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/api/src/com/cloud/network/NetworkService.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/api/src/org/apache/cloudstack/api/ApiCommandJobType.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/ApiCommandJobType.java
index 5de734a,0000000..7b36bfb
mode 100644,000000..100644
--- a/api/src/org/apache/cloudstack/api/ApiCommandJobType.java
+++ b/api/src/org/apache/cloudstack/api/ApiCommandJobType.java
@@@ -1,52 -1,0 +1,53 @@@
 +// 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 org.apache.cloudstack.api;
 +
 +public enum ApiCommandJobType {
 +    None,
 +    VirtualMachine,
 +    DomainRouter,
 +    Volume,
 +    ConsoleProxy,
 +    Snapshot,
 +    Template,
 +    Iso,
 +    SystemVm,
 +    Host,
 +    StoragePool,
 +    IpAddress,
 +    SecurityGroup,
 +    PhysicalNetwork,
 +    TrafficType,
 +    PhysicalNetworkServiceProvider,
 +    FirewallRule,
 +    Account,
 +    User,
 +    PrivateGateway,
 +    StaticRoute,
 +    Counter,
 +    Condition,
 +    AutoScalePolicy,
 +    AutoScaleVmProfile,
 +    AutoScaleVmGroup,
 +    GlobalLoadBalancerRule,
 +    LoadBalancerRule,
 +    AffinityGroup,
 +    InternalLbVm,
-     DedicatedGuestVlanRange
++    DedicatedGuestVlanRange,
++    PortableIpAddress
 +}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/api/src/org/apache/cloudstack/api/ResponseGenerator.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/ResponseGenerator.java
index 2c2ce0b,0732e77..ba01a79
--- a/api/src/org/apache/cloudstack/api/ResponseGenerator.java
+++ b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
@@@ -118,8 -119,11 +118,10 @@@ import org.apache.cloudstack.api.respon
  import org.apache.cloudstack.api.response.*;
  import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
  import org.apache.cloudstack.region.Region;
+ import org.apache.cloudstack.region.PortableIp;
+ import org.apache.cloudstack.region.PortableIpRange;
  import org.apache.cloudstack.usage.Usage;
  
 -import com.cloud.async.AsyncJob;
  import com.cloud.capacity.Capacity;
  import com.cloud.configuration.Configuration;
  import com.cloud.configuration.ResourceCount;
@@@ -435,7 -443,12 +437,12 @@@ public interface ResponseGenerator 
  
      Long getAffinityGroupId(String name, long entityOwnerId);
  
+     PortableIpRangeResponse createPortableIPRangeResponse(PortableIpRange range);
+ 
+     PortableIpResponse createPortableIPResponse(PortableIp portableIp);
+ 
      InternalLoadBalancerElementResponse createInternalLbElementResponse(VirtualRouterProvider result);
 -
 +    
      IsolationMethodResponse createIsolationMethodResponse(IsolationType method);
+ 
  }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/api/src/org/apache/cloudstack/api/command/admin/region/CreatePortableIpRangeCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/region/CreatePortableIpRangeCmd.java
index 0000000,78e4c94..93243e0
mode 000000,100644..100644
--- a/api/src/org/apache/cloudstack/api/command/admin/region/CreatePortableIpRangeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/region/CreatePortableIpRangeCmd.java
@@@ -1,0 -1,156 +1,150 @@@
+ // 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 org.apache.cloudstack.api.command.admin.region;
+ 
 -import javax.inject.Inject;
++import org.apache.log4j.Logger;
+ 
 -import com.cloud.async.AsyncJob;
 -import com.cloud.dc.Vlan;
 -import com.cloud.event.EventTypes;
 -import com.cloud.exception.ConcurrentOperationException;
 -import com.cloud.exception.InsufficientCapacityException;
 -import com.cloud.exception.ResourceAllocationException;
+ import org.apache.cloudstack.api.APICommand;
++import org.apache.cloudstack.api.ApiCommandJobType;
+ import org.apache.cloudstack.api.ApiConstants;
+ import org.apache.cloudstack.api.ApiErrorCode;
+ import org.apache.cloudstack.api.BaseAsyncCreateCmd;
+ import org.apache.cloudstack.api.Parameter;
+ import org.apache.cloudstack.api.ServerApiException;
+ import org.apache.cloudstack.api.response.PortableIpRangeResponse;
+ import org.apache.cloudstack.api.response.RegionResponse;
 -import org.apache.cloudstack.api.response.VlanIpRangeResponse;
+ import org.apache.cloudstack.region.PortableIpRange;
 -import org.apache.cloudstack.region.Region;
 -import org.apache.cloudstack.region.RegionService;
 -import org.apache.log4j.Logger;
+ 
++import com.cloud.event.EventTypes;
++import com.cloud.exception.ConcurrentOperationException;
++import com.cloud.exception.ResourceAllocationException;
+ import com.cloud.user.Account;
+ 
+ @APICommand(name = "createPortableIpRange", responseObject=PortableIpRangeResponse.class, description="adds a range of portable public IP's to a region", since="4.2.0")
+ public class CreatePortableIpRangeCmd extends BaseAsyncCreateCmd {
+ 
+     public static final Logger s_logger = Logger.getLogger(CreatePortableIpRangeCmd.class.getName());
+ 
+     private static final String s_name = "createportableiprangeresponse";
+ 
+     /////////////////////////////////////////////////////
+     //////////////// API parameters /////////////////////
+     /////////////////////////////////////////////////////
+ 
+     @Parameter(name=ApiConstants.REGION_ID, type=CommandType.INTEGER, entityType = RegionResponse.class, required=true, description="Id of the Region")
+     private Integer regionId;
+ 
+     @Parameter(name=ApiConstants.START_IP, type=CommandType.STRING, required=true, description="the beginning IP address in the portable IP range")
+     private String startIp;
+ 
+     @Parameter(name=ApiConstants.END_IP, type=CommandType.STRING, required=true, description="the ending IP address in the portable IP range")
+     private String endIp;
+ 
+     @Parameter(name=ApiConstants.GATEWAY, type=CommandType.STRING, required=true, description="the gateway for the portable IP range")
+     private String gateway;
+ 
+     @Parameter(name=ApiConstants.NETMASK, type=CommandType.STRING, required=true, description="the netmask of the portable IP range")
+     private String netmask;
+ 
+     @Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="VLAN id, if not specified defaulted to untagged")
+     private String vlan;
+ 
+     /////////////////////////////////////////////////////
+     /////////////////// Accessors ///////////////////////
+     /////////////////////////////////////////////////////
+ 
+     public Integer getRegionId() {
+         return regionId;
+     }
+ 
+     public String getStartIp() {
+         return startIp;
+     }
+ 
+     public String getEndIp() {
+         return endIp;
+     }
+ 
+     public String getVlan() {
+         return vlan;
+     }
+ 
+     public String getGateway() {
+         return gateway;
+     }
+ 
+     public String getNetmask() {
+         return netmask;
+     }
+ 
+     /////////////////////////////////////////////////////
+     /////////////// API Implementation///////////////////
+     /////////////////////////////////////////////////////
+ 
+     @Override
+     public String getCommandName() {
+         return s_name;
+     }
+ 
+     @Override
+     public long getEntityOwnerId() {
+         return Account.ACCOUNT_ID_SYSTEM;
+     }
+ 
+     @Override
+     public void execute(){
+         PortableIpRange portableIpRange = _entityMgr.findById(PortableIpRange.class, getEntityId());
+         PortableIpRangeResponse response = null;
+         if (portableIpRange != null) {
+             response = _responseGenerator.createPortableIPRangeResponse(portableIpRange);
+         }
+         response.setResponseName(getCommandName());
 -        this.setResponseObject(response);
++        setResponseObject(response);
+     }
+ 
+     @Override
+     public void create() throws ResourceAllocationException {
+         try {
+             PortableIpRange portableIpRange = _configService.createPortableIpRange(this);
+             if (portableIpRange != null) {
 -                this.setEntityId(portableIpRange.getId());
 -                this.setEntityUuid(portableIpRange.getUuid());
++                setEntityId(portableIpRange.getId());
++                setEntityUuid(portableIpRange.getUuid());
+             } else {
+                 throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create portable public IP range");
+             }
+         } catch (ConcurrentOperationException ex) {
+             s_logger.warn("Exception: ", ex);
+             throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
+         }
+     }
+ 
+     @Override
+     public String getEventType() {
+         return EventTypes.EVENT_PORTABLE_IP_RANGE_CREATE;
+     }
+ 
+     @Override
+     public String getEventDescription() {
+         return "creating a portable public ip range in region: " + getRegionId();
+     }
+ 
+     @Override
 -    public AsyncJob.Type getInstanceType() {
 -        return AsyncJob.Type.PortableIpAddress;
++    public ApiCommandJobType getInstanceType() {
++        return ApiCommandJobType.PortableIpAddress;
+     }
+ }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/api/src/org/apache/cloudstack/api/command/admin/region/DeletePortableIpRangeCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/region/DeletePortableIpRangeCmd.java
index 0000000,856e8ef..9aa98fa
mode 000000,100644..100644
--- a/api/src/org/apache/cloudstack/api/command/admin/region/DeletePortableIpRangeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/region/DeletePortableIpRangeCmd.java
@@@ -1,0 -1,93 +1,94 @@@
+ // 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 org.apache.cloudstack.api.command.admin.region;
+ 
 -import javax.inject.Inject;
++import org.apache.log4j.Logger;
+ 
 -import com.cloud.async.AsyncJob;
 -import com.cloud.event.EventTypes;
 -import org.apache.cloudstack.api.*;
++import org.apache.cloudstack.api.APICommand;
++import org.apache.cloudstack.api.ApiCommandJobType;
++import org.apache.cloudstack.api.ApiConstants;
++import org.apache.cloudstack.api.ApiErrorCode;
++import org.apache.cloudstack.api.BaseAsyncCmd;
++import org.apache.cloudstack.api.Parameter;
++import org.apache.cloudstack.api.ServerApiException;
+ import org.apache.cloudstack.api.response.PortableIpRangeResponse;
 -import org.apache.cloudstack.api.response.RegionResponse;
+ import org.apache.cloudstack.api.response.SuccessResponse;
 -import org.apache.cloudstack.region.Region;
 -import org.apache.cloudstack.region.RegionService;
 -import org.apache.log4j.Logger;
+ 
++import com.cloud.event.EventTypes;
+ import com.cloud.user.Account;
+ 
+ @APICommand(name = "deletePortableIpRange", description="deletes a range of portable public IP's associated with a region", responseObject=SuccessResponse.class)
+ public class DeletePortableIpRangeCmd extends BaseAsyncCmd {
+     public static final Logger s_logger = Logger.getLogger(DeletePortableIpRangeCmd.class.getName());
+ 
+     private static final String s_name = "deleteportablepublicipresponse";
+ 
+     /////////////////////////////////////////////////////
+     //////////////// API parameters /////////////////////
+     /////////////////////////////////////////////////////
+     @Parameter(name=ApiConstants.ID, type=CommandType.UUID, required=true, entityType = PortableIpRangeResponse.class, description="Id of the portable ip range")
+     private Long id;
+ 
+     /////////////////////////////////////////////////////
+     /////////////////// Accessors ///////////////////////
+     /////////////////////////////////////////////////////
+ 
+     public Long getId() {
+         return id;
+     }
+ 
+     /////////////////////////////////////////////////////
+     /////////////// API Implementation///////////////////
+     /////////////////////////////////////////////////////
+ 
+     @Override
+     public String getCommandName() {
+         return s_name;
+     }
+ 
+     @Override
+     public long getEntityOwnerId() {
+         return Account.ACCOUNT_ID_SYSTEM;
+     }
+ 
+     @Override
+     public void execute(){
+         boolean result = _configService.deletePortableIpRange(this);
+         if (result) {
+             SuccessResponse response = new SuccessResponse(getCommandName());
 -            this.setResponseObject(response);
++            setResponseObject(response);
+         } else {
+             throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete portable ip range");
+         }
+     }
+ 
+     @Override
+     public String getEventType() {
+         return EventTypes.EVENT_PORTABLE_IP_RANGE_DELETE;
+     }
+ 
+     @Override
+     public String getEventDescription() {
+         return "deleting a portable public ip range";
+     }
+ 
+     @Override
 -    public AsyncJob.Type getInstanceType() {
 -        return AsyncJob.Type.PortableIpAddress;
++    public ApiCommandJobType getInstanceType() {
++        return ApiCommandJobType.PortableIpAddress;
+     }
+ }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java
index 2b35650,f37e820..3fc3061
--- a/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java
@@@ -16,25 -16,7 +16,27 @@@
  // under the License.
  package org.apache.cloudstack.api.command.user.address;
  
 -import com.cloud.async.AsyncJob;
 +import java.util.List;
 +
 +import org.apache.log4j.Logger;
 +
 +import org.apache.cloudstack.api.APICommand;
 +import org.apache.cloudstack.api.ApiCommandJobType;
 +import org.apache.cloudstack.api.ApiConstants;
 +import org.apache.cloudstack.api.ApiErrorCode;
 +import org.apache.cloudstack.api.BaseAsyncCmd;
 +import org.apache.cloudstack.api.BaseAsyncCreateCmd;
++import org.apache.cloudstack.api.BaseCmd;
 +import org.apache.cloudstack.api.Parameter;
 +import org.apache.cloudstack.api.ServerApiException;
 +import org.apache.cloudstack.api.response.DomainResponse;
 +import org.apache.cloudstack.api.response.IPAddressResponse;
 +import org.apache.cloudstack.api.response.NetworkResponse;
 +import org.apache.cloudstack.api.response.ProjectResponse;
++import org.apache.cloudstack.api.response.RegionResponse;
 +import org.apache.cloudstack.api.response.VpcResponse;
 +import org.apache.cloudstack.api.response.ZoneResponse;
 +
  import com.cloud.dc.DataCenter;
  import com.cloud.dc.DataCenter.NetworkType;
  import com.cloud.event.EventTypes;
@@@ -214,11 -216,17 +236,17 @@@ public class AssociateIPAddrCmd extend
      @Override
      public void create() throws ResourceAllocationException{
          try {
-             IpAddress ip =  _networkService.allocateIP(_accountService.getAccount(getEntityOwnerId()),  getZoneId(), getNetworkId());
+             IpAddress ip = null;
+ 
+             if (!isPortable()) {
+                 ip = _networkService.allocateIP(_accountService.getAccount(getEntityOwnerId()),  getZoneId(), getNetworkId());
+             } else {
+                 ip = _networkService.allocatePortableIP(_accountService.getAccount(getEntityOwnerId()), 1, getZoneId(), getNetworkId(), getVpcId());
+             }
  
              if (ip != null) {
--                this.setEntityId(ip.getId());
--                this.setEntityUuid(ip.getUuid());
++                setEntityId(ip.getId());
++                setEntityUuid(ip.getUuid());
              } else {
                  throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to allocate ip address");
              }
@@@ -248,7 -256,7 +276,7 @@@
          if (result != null) {
              IPAddressResponse ipResponse = _responseGenerator.createIPAddressResponse(result);
              ipResponse.setResponseName(getCommandName());
--            this.setResponseObject(ipResponse);
++            setResponseObject(ipResponse);
          } else {
              throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign ip address");
          }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/api/src/org/apache/cloudstack/api/response/IPAddressResponse.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/client/tomcatconf/applicationContext.xml.in
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/engine/components-api/src/com/cloud/network/NetworkManager.java
----------------------------------------------------------------------
diff --cc engine/components-api/src/com/cloud/network/NetworkManager.java
index 98f2b67,0000000..24e4224
mode 100755,000000..100755
--- a/engine/components-api/src/com/cloud/network/NetworkManager.java
+++ b/engine/components-api/src/com/cloud/network/NetworkManager.java
@@@ -1,356 -1,0 +1,396 @@@
 +// 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;
 +
 +import java.util.List;
 +import java.util.Map;
 +
- import com.cloud.network.element.DhcpServiceProvider;
 +import org.apache.cloudstack.acl.ControlledEntity.ACLType;
 +
 +import com.cloud.dc.DataCenter;
 +import com.cloud.dc.Pod;
 +import com.cloud.dc.Vlan.VlanType;
 +import com.cloud.deploy.DataCenterDeployment;
 +import com.cloud.deploy.DeployDestination;
 +import com.cloud.deploy.DeploymentPlan;
 +import com.cloud.exception.ConcurrentOperationException;
 +import com.cloud.exception.InsufficientAddressCapacityException;
 +import com.cloud.exception.InsufficientCapacityException;
 +import com.cloud.exception.InsufficientVirtualNetworkCapcityException;
 +import com.cloud.exception.ResourceAllocationException;
 +import com.cloud.exception.ResourceUnavailableException;
 +import com.cloud.network.Network.Provider;
 +import com.cloud.network.Network.Service;
 +import com.cloud.network.addr.PublicIp;
 +import com.cloud.network.dao.IPAddressVO;
 +import com.cloud.network.dao.NetworkVO;
++import com.cloud.network.element.DhcpServiceProvider;
 +import com.cloud.network.element.LoadBalancingServiceProvider;
 +import com.cloud.network.element.StaticNatServiceProvider;
 +import com.cloud.network.element.UserDataServiceProvider;
 +import com.cloud.network.guru.NetworkGuru;
 +import com.cloud.network.rules.FirewallRule;
 +import com.cloud.network.rules.LoadBalancerContainer.Scheme;
 +import com.cloud.network.rules.StaticNat;
 +import com.cloud.offering.NetworkOffering;
 +import com.cloud.offerings.NetworkOfferingVO;
 +import com.cloud.user.Account;
 +import com.cloud.user.User;
 +import com.cloud.utils.Pair;
 +import com.cloud.vm.Nic;
 +import com.cloud.vm.NicProfile;
 +import com.cloud.vm.NicVO;
 +import com.cloud.vm.ReservationContext;
 +import com.cloud.vm.VirtualMachine;
 +import com.cloud.vm.VirtualMachine.Type;
 +import com.cloud.vm.VirtualMachineProfile;
 +
 +/**
 + * NetworkManager manages the network for the different end users.
 + * 
 + */
 +public interface NetworkManager  {
 +    /**
 +     * Assigns a new public ip address.
 +     * 
 +     * @param dcId
 +     * @param podId
 +     *            TODO
 +     * @param owner
 +     * @param type
 +     * @param networkId
 +     * @param requestedIp
 +     *            TODO
 +     * @param allocatedBy
 +     *            TODO
 +     * @return
 +     * @throws InsufficientAddressCapacityException
 +     */
 +
 +    PublicIp assignPublicIpAddress(long dcId, Long podId, Account owner, VlanType type, Long networkId, String requestedIp,
 +            boolean isSystem) throws InsufficientAddressCapacityException;
 +
 +
 +    /**
 +     * Do all of the work of releasing public ip addresses. Note that if this method fails, there can be side effects.
 +     * 
 +     * @param userId
 +     * @param caller
 +     *            TODO
 +     * @param IpAddress
 +     * @return true if it did; false if it didn't
 +     */
 +    public boolean disassociatePublicIpAddress(long id, long userId, Account caller);
 +
 +    List<NetworkVO> setupNetwork(Account owner, NetworkOffering offering, DeploymentPlan plan, String name, String displayText, boolean isDefault)
 +            throws ConcurrentOperationException;
 +
 +    List<NetworkVO> setupNetwork(Account owner, NetworkOffering offering, Network predefined, DeploymentPlan plan, String name, String displayText, boolean errorIfAlreadySetup, Long domainId,
 +            ACLType aclType, Boolean subdomainAccess, Long vpcId, Boolean isDisplayNetworkEnabled) throws ConcurrentOperationException;
 +
 +    void allocate(VirtualMachineProfile vm, List<Pair<NetworkVO, NicProfile>> networks) throws InsufficientCapacityException, ConcurrentOperationException;
 +
 +    void prepare(VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) throws InsufficientCapacityException, ConcurrentOperationException,
 +            ResourceUnavailableException;
 +
 +    void release(VirtualMachineProfile vmProfile, boolean forced) throws
 +			ConcurrentOperationException, ResourceUnavailableException;
 +
 +    void cleanupNics(VirtualMachineProfile vm);
 +
 +    void expungeNics(VirtualMachineProfile vm);
 +
 +    List<NicProfile> getNicProfiles(VirtualMachine vm);
 +
 +    boolean applyRules(List<? extends FirewallRule> rules, FirewallRule.Purpose purpose, NetworkRuleApplier applier, boolean continueOnError) throws ResourceUnavailableException;
 +
 +    Pair<NetworkGuru, NetworkVO> implementNetwork(long networkId, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException,
 +            InsufficientCapacityException;
 +
++    /**
++     * prepares vm nic change for migration
++     * 
++     * This method will be called in migration transaction before the vm migration.
++     * @param vm
++     * @param dest
++     */
 +    void prepareNicForMigration(VirtualMachineProfile vm, DeployDestination dest);
 +
++    /**
++     * commit vm nic change for migration
++     * 
++     * This method will be called in migration transaction after the successful
++     * vm migration.
++     * @param src
++     * @param dst
++     */
++    void commitNicForMigration(VirtualMachineProfile src, VirtualMachineProfile dst);
++
++    /**
++     * rollback vm nic change for migration
++     * 
++     * This method will be called in migaration transaction after vm migration
++     * failure.
++     * @param src
++     * @param dst
++     */
++    void rollbackNicForMigration(VirtualMachineProfile src, VirtualMachineProfile dst);
++
 +    boolean shutdownNetwork(long networkId, ReservationContext context, boolean cleanupElements);
 +
 +    boolean destroyNetwork(long networkId, ReservationContext context);
 +
 +    Network createGuestNetwork(long networkOfferingId, String name, String displayText, String gateway, String cidr,
 +            String vlanId, String networkDomain, Account owner, Long domainId, PhysicalNetwork physicalNetwork,
 +                               long zoneId, ACLType aclType, Boolean subdomainAccess, Long vpcId, String ip6Gateway, String ip6Cidr,
 +                               Boolean displayNetworkEnabled, String isolatedPvlan)
 +                    throws ConcurrentOperationException, InsufficientCapacityException, ResourceAllocationException;
 +
 +    /**
 +     * @throws ResourceAllocationException TODO
 +     * @throws InsufficientCapacityException
 +     *             Associates an ip address list to an account. The list of ip addresses are all addresses associated
 +     *             with the
 +     *             given vlan id.
 +     * @param userId
 +     * @param accountId
 +     * @param zoneId
 +     * @param vlanId
 +     * @throws InsufficientAddressCapacityException
 +     * @throws
 +     */
 +    boolean associateIpAddressListToAccount(long userId, long accountId, long zoneId, Long vlanId, Network guestNetwork) throws InsufficientCapacityException, ConcurrentOperationException,
 +            ResourceUnavailableException, ResourceAllocationException;
 +
 +    UserDataServiceProvider getPasswordResetProvider(Network network);
 +
 +    UserDataServiceProvider getSSHKeyResetProvider(Network network);
 +
 +    boolean applyIpAssociations(Network network, boolean continueOnError) throws ResourceUnavailableException;
 +    
 +    boolean applyIpAssociations(Network network, boolean rulesRevoked, boolean continueOnError, List<? extends PublicIpAddress> publicIps) throws ResourceUnavailableException;
 +
 +    boolean startNetwork(long networkId, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
 +
 +    IPAddressVO markIpAsUnavailable(long addrId);
 +
 +    public String acquireGuestIpAddress(Network network, String requestedIp);
 +
 +    boolean applyStaticNats(List<? extends StaticNat> staticNats, boolean continueOnError) throws ResourceUnavailableException;
 +
 +    boolean reallocate(VirtualMachineProfile vm,
 +            DataCenterDeployment dest) throws InsufficientCapacityException, ConcurrentOperationException;
 +
 +    IpAddress assignSystemIp(long networkId, Account owner,
 +            boolean forElasticLb, boolean forElasticIp)
 +            throws InsufficientAddressCapacityException;
 +
 +    boolean handleSystemIpRelease(IpAddress ip);
 +
 +    void allocateDirectIp(NicProfile nic, DataCenter dc,
 +            VirtualMachineProfile vm,
 +            Network network, String requestedIpv4, String requestedIpv6)
 +            throws InsufficientVirtualNetworkCapcityException,
 +            InsufficientAddressCapacityException;
 +
 +    /**
 +     * @param owner
 +     * @param guestNetwork
 +     * @return
 +     * @throws ConcurrentOperationException
 +     * @throws InsufficientAddressCapacityException
 +     */
 +    PublicIp assignSourceNatIpAddressToGuestNetwork(Account owner, Network guestNetwork) throws InsufficientAddressCapacityException, ConcurrentOperationException;
 +
 +
 +    /**
 +     * @param requested
 +     * @param network
 +     * @param isDefaultNic
 +     * @param deviceId
 +     * @param vm
 +     * @return
 +     * @throws InsufficientVirtualNetworkCapcityException
 +     * @throws InsufficientAddressCapacityException
 +     * @throws ConcurrentOperationException
 +     */
 +    Pair<NicProfile,Integer> allocateNic(NicProfile requested, Network network, Boolean isDefaultNic, int deviceId,
 +            VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapcityException,
 +            InsufficientAddressCapacityException, ConcurrentOperationException;
 +
 +
 +    /**
 +     * @param vmProfile
 +     * @param dest
 +     * @param context
 +     * @param nicId
 +     * @param network
 +     * @return
 +     * @throws InsufficientVirtualNetworkCapcityException
 +     * @throws InsufficientAddressCapacityException
 +     * @throws ConcurrentOperationException
 +     * @throws InsufficientCapacityException
 +     * @throws ResourceUnavailableException
 +     */
 +    NicProfile prepareNic(VirtualMachineProfile vmProfile, DeployDestination dest,
 +            ReservationContext context, long nicId, NetworkVO network) throws InsufficientVirtualNetworkCapcityException,
 +            InsufficientAddressCapacityException, ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
 +
 +
 +    /**
 +     * @param vm
 +     * @param nic TODO
 +     */
 +    void removeNic(VirtualMachineProfile vm, Nic nic);
 +
 +
 +    /**
 +     * @param ipAddrId
 +     * @param networkId
 +     * @param releaseOnFailure TODO
 +     */
 +    IPAddressVO associateIPToGuestNetwork(long ipAddrId, long networkId, boolean releaseOnFailure) throws ResourceAllocationException, ResourceUnavailableException,
 +        InsufficientAddressCapacityException, ConcurrentOperationException;
 +
++    IPAddressVO associatePortableIPToGuestNetwork(long ipAddrId, long networkId, boolean releaseOnFailure) throws ResourceAllocationException, ResourceUnavailableException,
++            InsufficientAddressCapacityException, ConcurrentOperationException;
++
++    IPAddressVO disassociatePortableIPToGuestNetwork(long ipAddrId, long networkId) throws ResourceAllocationException, ResourceUnavailableException,
++            InsufficientAddressCapacityException, ConcurrentOperationException;
++
++    boolean isPortableIpTransferableFromNetwork(long ipAddrId, long networkId);
++
++    void transferPortableIP(long ipAddrId, long currentNetworkId, long newNetworkId)  throws ResourceAllocationException, ResourceUnavailableException,
++            InsufficientAddressCapacityException, ConcurrentOperationException;;
 +
 +    /**
 +     * @param network
 +     * @param provider
 +     * @return
 +     */
 +    boolean setupDns(Network network, Provider provider);
 +
 +
 +    /**
 +     * @param vmProfile
 +     * @param nic TODO
 +     * @throws ConcurrentOperationException
 +     * @throws ResourceUnavailableException
 +     */
 +    void releaseNic(VirtualMachineProfile vmProfile, Nic nic)
 +            throws ConcurrentOperationException, ResourceUnavailableException;
 +
 +
 +    /**
 +     * @param network
 +     * @param requested
 +     * @param context
 +     * @param vmProfile
 +     * @param prepare TODO
 +     * @return
 +     * @throws InsufficientVirtualNetworkCapcityException
 +     * @throws InsufficientAddressCapacityException
 +     * @throws ConcurrentOperationException
 +     * @throws InsufficientCapacityException
 +     * @throws ResourceUnavailableException
 +     */
 +    NicProfile createNicForVm(Network network, NicProfile requested, ReservationContext context, VirtualMachineProfile vmProfile, boolean prepare) throws InsufficientVirtualNetworkCapcityException,
 +            InsufficientAddressCapacityException, ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
 +
 +
 +    PublicIp assignVpnGatewayIpAddress(long dcId, Account owner, long vpcId) throws InsufficientAddressCapacityException, ConcurrentOperationException;
 +
 +
 +    /**
 +     * @param addr
 +     */
 +    void markPublicIpAsAllocated(IPAddressVO addr);
 +
 +
 +    /**
 +     * @param owner
 +     * @param guestNtwkId
 +     * @param vpcId
 +     * @param dcId
 +     * @param isSourceNat
 +     * @return
 +     * @throws ConcurrentOperationException
 +     * @throws InsufficientAddressCapacityException
 +     */
 +    PublicIp assignDedicateIpAddress(Account owner, Long guestNtwkId, Long vpcId, long dcId, boolean isSourceNat) throws ConcurrentOperationException, InsufficientAddressCapacityException;
 +
 +    NetworkProfile convertNetworkToNetworkProfile(long networkId);
 +
 +    /**
 +     * @return
 +     */
 +    int getNetworkLockTimeout();
 +
 +
 +    boolean cleanupIpResources(long addrId, long userId, Account caller);
 +
 +
 +    boolean restartNetwork(Long networkId, Account callerAccount,
 +            User callerUser, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
 +
 +
 +    boolean shutdownNetworkElementsAndResources(ReservationContext context,
 +            boolean b, NetworkVO network);
 +
 +
 +	void implementNetworkElementsAndResources(DeployDestination dest,
 +			ReservationContext context, NetworkVO network,
 +			NetworkOfferingVO findById) throws ConcurrentOperationException, InsufficientAddressCapacityException, ResourceUnavailableException, InsufficientCapacityException;
 +
 +
 +	IpAddress allocateIp(Account ipOwner, boolean isSystem, Account caller, long callerId,
 +			DataCenter zone) throws ConcurrentOperationException, ResourceAllocationException, InsufficientAddressCapacityException;
 +
 +
++    IpAddress allocatePortableIp(Account ipOwner, Account caller, long dcId, Long networkId, Long vpcID)
++            throws ConcurrentOperationException, ResourceAllocationException, InsufficientAddressCapacityException;
++
 +	Map<String, String> finalizeServicesAndProvidersForNetwork(NetworkOffering offering,
 +			Long physicalNetworkId);
 +
 +
 +    List<Provider> getProvidersForServiceInNetwork(Network network, Service service);
 +
 +    StaticNatServiceProvider getStaticNatProviderForNetwork(Network network);
 +    boolean isNetworkInlineMode(Network network);
 +
 +    int getRuleCountForIp(Long addressId, FirewallRule.Purpose purpose, FirewallRule.State state);
 +
 +    LoadBalancingServiceProvider getLoadBalancingProviderForNetwork(Network network, Scheme lbScheme);
 +
 +
 +    boolean isSecondaryIpSetForNic(long nicId);
 +
 +     public String allocateGuestIP(Account ipOwner, boolean isSystem, long zoneId, Long networkId, String requestedIp)
 +     throws InsufficientAddressCapacityException;
 +
 +
 +    List<? extends Nic> listVmNics(Long vmId, Long nicId);
 +    String allocatePublicIpForGuestNic(Long networkId, DataCenter dc, Pod pod, Account caller, String requestedIp) throws InsufficientAddressCapacityException;
 +    boolean removeVmSecondaryIpsOfNic(long nicId);
 +
 +    NicVO savePlaceholderNic(Network network, String ip4Address, Type vmType);
 +
 +    DhcpServiceProvider getDhcpServiceProvider(Network network);
 +
 +    PublicIp assignPublicIpAddressFromVlans(long dcId, Long podId, Account owner, VlanType type, List<Long> vlanDbIds, Long networkId, String requestedIp, boolean isSystem) throws InsufficientAddressCapacityException;
 +}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/engine/components-api/src/com/cloud/network/addr/PublicIp.java
----------------------------------------------------------------------
diff --cc engine/components-api/src/com/cloud/network/addr/PublicIp.java
index c753b49,0000000..b18c691
mode 100644,000000..100644
--- a/engine/components-api/src/com/cloud/network/addr/PublicIp.java
+++ b/engine/components-api/src/com/cloud/network/addr/PublicIp.java
@@@ -1,226 -1,0 +1,235 @@@
 +// 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.addr;
 +
 +import java.util.Date;
 +
 +import com.cloud.dc.VlanVO;
 +import com.cloud.network.PublicIpAddress;
 +import com.cloud.network.dao.IPAddressVO;
 +import com.cloud.utils.net.Ip;
 +import com.cloud.utils.net.NetUtils;
 +
 +/**
 + */
 +public class PublicIp implements PublicIpAddress {
 +    IPAddressVO _addr;
 +    VlanVO _vlan;
 +    String macAddress;
 +
 +    public PublicIp(IPAddressVO addr, VlanVO vlan, long macAddress) {
 +        _addr = addr;
 +        _vlan = vlan;
 +        this.macAddress = NetUtils.long2Mac(macAddress);
 +    }
 +
 +    public static PublicIp createFromAddrAndVlan(IPAddressVO addr, VlanVO vlan) {
 +    	return new PublicIp(addr, vlan, NetUtils.createSequenceBasedMacAddress(addr.getMacAddress()));
 +    }
 +    
 +    @Override
 +    public Ip getAddress() {
 +        return _addr.getAddress();
 +    }
 +
 +    @Override
 +    public String getNetmask() {
 +        return _vlan.getVlanNetmask();
 +    }
 +
 +    @Override
 +    public String getGateway() {
 +        return _vlan.getVlanGateway();
 +    }
 +
 +    @Override
 +    public String getVlanTag() {
 +        return _vlan.getVlanTag();
 +    }
 +
 +    @Override
 +    public long getDataCenterId() {
 +        return _addr.getDataCenterId();
 +    }
 +
 +    @Override
 +    public boolean readyToUse() {
 +        return _addr.getAllocatedTime() != null && _addr.getState() == State.Allocated;
 +    }
 +
 +    @Override
 +    public boolean isSourceNat() {
 +        return _addr.isSourceNat();
 +    }
 +
 +    @Override
 +    public boolean isOneToOneNat() {
 +        return _addr.isOneToOneNat();
 +    }
 +
 +    @Override
 +    public Long getAssociatedWithVmId() {
 +        return _addr.getAssociatedWithVmId();
 +    }
 +
 +    @Override
 +    public Date getAllocatedTime() {
 +        return _addr.getAllocatedTime();
 +    }
 +
 +    @Override
 +    public long getAccountId() {
 +        return _addr.getAccountId();
 +    }
 +
 +    @Override
 +    public long getDomainId() {
 +        return _addr.getDomainId();
 +    }
 +
 +    @Override
 +    public long getVlanId() {
 +        return _vlan.getId();
 +    }
 +
 +    @Override
 +    public State getState() {
 +        return _addr.getState();
 +    }
 +
 +    public IPAddressVO ip() {
 +        return _addr;
 +    }
 +
 +    public VlanVO vlan() {
 +        return _vlan;
 +    }
 +
 +    @Override
 +    public String getMacAddress() {
 +        return macAddress;
 +    }
 +
 +    @Override
 +    public Long getAssociatedWithNetworkId() {
 +        return _addr.getAssociatedWithNetworkId();
 +    }
 +
 +    @Override
 +    public Long getNetworkId() {
 +        return _vlan.getNetworkId();
 +    }
 +
 +    @Override
 +    public String getVlanGateway() {
 +        return _vlan.getVlanGateway();
 +    }
 +
 +    @Override
 +    public String getVlanNetmask() {
 +        return _vlan.getVlanNetmask();
 +    }
 +
 +    @Override
 +    public String getIpRange() {
 +        return _vlan.getIpRange();
 +    }
 +
 +    @Override
 +    public VlanType getVlanType() {
 +        return _vlan.getVlanType();
 +    }
 +
 +    @Override
 +    public long getId() {
 +        return _addr.getId();
 +    }
 +
 +
 +    @Override
 +    public String getUuid() {
 +        return _addr.getUuid();
 +    }
 +
 +    @Override
 +    public String toString() {
 +        return _addr.getAddress().toString();
 +    }
 +
 +    @Override
 +    public Long getPhysicalNetworkId() {
 +        return _vlan.getPhysicalNetworkId();
 +    }
 +
 +	@Override
 +	public void setState(State state) {
 +		_addr.setState(state);
 +	}
 +
 +	@Override
 +	public Long getAllocatedToAccountId() {
 +		return _addr.getAllocatedToAccountId();
 +	}
 +
 +	@Override
 +	public Long getAllocatedInDomainId() {
 +		return _addr.getAllocatedInDomainId();
 +	}
 +
 +	@Override
 +    public boolean getSystem() {
 +        return _addr.getSystem();
 +    }
 +	
 +    @Override
 +    public Long getVpcId() {
 +       return _addr.getVpcId();
 +    }
 +
 +    @Override
 +    public String getIp6Gateway() {
 +        return _vlan.getIp6Gateway();
 +    }
 +
 +    @Override
 +    public String getIp6Cidr() {
 +        return _vlan.getIp6Cidr();
 +    }
 +
 +    @Override
 +    public String getIp6Range() {
 +        return _vlan.getIp6Range();
 +    }
 +
 +    @Override
 +    public String getVmIp() {
 +        return _addr.getVmIp();
 +    }
 +
++    @Override
++    public boolean isPortable() {
++        return _addr.isPortable();
++    }
++
++    public void setPortable(boolean portable) {
++        _addr.setPortable(portable);
++    }
++
 +    public Long getIpMacAddress() {
 +        return  _addr.getMacAddress();
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/VolumeReservationVO.java
----------------------------------------------------------------------
diff --cc engine/schema/src/org/apache/cloudstack/engine/cloud/entity/VolumeReservationVO.java
index ecb0e68,0000000..39ca010
mode 100644,000000..100644
--- a/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/VolumeReservationVO.java
+++ b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/VolumeReservationVO.java
@@@ -1,100 -1,0 +1,84 @@@
 +// 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 org.apache.cloudstack.engine.cloud.entity;
 +
- import java.util.Date;
- import java.util.Map;
- 
 +import javax.persistence.Column;
 +import javax.persistence.Entity;
 +import javax.persistence.GeneratedValue;
 +import javax.persistence.GenerationType;
 +import javax.persistence.Id;
 +import javax.persistence.Table;
- import javax.persistence.Transient;
- 
- import org.apache.cloudstack.api.Identity;
 +import org.apache.cloudstack.api.InternalIdentity;
 +
- import com.cloud.utils.db.GenericDao;
- 
 +@Entity
 +@Table(name = "volume_reservation")
 +public class VolumeReservationVO implements InternalIdentity{
 +
 +    @Id
 +    @GeneratedValue(strategy = GenerationType.IDENTITY)
 +    @Column(name = "id")
 +    private long id;
 +
 +    @Column(name = "vm_reservation_id")
-     private Long vmReservationId;
++    private long vmReservationId;
 +
 +    @Column(name = "vm_id")
 +    private long vmId;
 +
 +    @Column(name="volume_id")
 +    private long volumeId;
 +
 +    @Column(name="pool_id")
 +    private long poolId;
 +
-     // VolumeId -> poolId
-     @Transient
-     Map<String, String> volumeReservationMap;
- 
 +    /**
 +     * There should never be a public constructor for this class. Since it's
 +     * only here to define the table for the DAO class.
 +     */
 +    protected VolumeReservationVO() {
 +    }
 +
-     public VolumeReservationVO(long vmId, long volumeId, long poolId, Long vmReservationId) {
++    public VolumeReservationVO(long vmId, long volumeId, long poolId, long vmReservationId) {
 +        this.vmId = vmId;
 +        this.volumeId = volumeId;
 +        this.poolId = poolId;
 +        this.vmReservationId = vmReservationId;
 +    }
 +
 +
 +    public long getId() {
 +        return id;
 +    }
 +
 +    public long getVmId() {
 +        return vmId;
 +    }
 +
-     public Long geVmReservationId() {
++    public long getVmReservationId() {
 +        return vmReservationId;
 +    }
 +
 +    public long getVolumeId() {
 +        return volumeId;
 +    }
 +
 +    public Long getPoolId() {
 +        return poolId;
 +    }
 +
 +
-     public Map<String,String> getVolumeReservation(){
-         return volumeReservationMap;
-     }
- 
 +}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VolumeReservationDaoImpl.java
----------------------------------------------------------------------
diff --cc engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VolumeReservationDaoImpl.java
index 689628e,0000000..413219c
mode 100644,000000..100644
--- a/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VolumeReservationDaoImpl.java
+++ b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VolumeReservationDaoImpl.java
@@@ -1,69 -1,0 +1,69 @@@
 +// 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 org.apache.cloudstack.engine.cloud.entity.dao;
 +
 +
 +import java.util.List;
 +
 +import javax.annotation.PostConstruct;
 +import javax.ejb.Local;
 +import javax.inject.Inject;
 +
 +import org.apache.cloudstack.engine.cloud.entity.VMReservationVO;
 +import org.apache.cloudstack.engine.cloud.entity.VolumeReservationVO;
 +
 +import org.springframework.stereotype.Component;
 +
 +import com.cloud.host.dao.HostTagsDaoImpl;
 +import com.cloud.utils.db.GenericDaoBase;
 +import com.cloud.utils.db.SearchBuilder;
 +import com.cloud.utils.db.SearchCriteria;
 +
 +@Component
 +@Local(value = { VolumeReservationDao.class })
 +public class VolumeReservationDaoImpl extends GenericDaoBase<VolumeReservationVO, Long> implements VolumeReservationDao {
 +
 +    protected SearchBuilder<VolumeReservationVO> VmIdSearch;
 +    protected SearchBuilder<VolumeReservationVO> VmReservationIdSearch;
 +
 +    public VolumeReservationDaoImpl() {
 +    }
 +
 +    @PostConstruct
 +    public void init() {
 +        VmIdSearch = createSearchBuilder();
 +        VmIdSearch.and("vmId", VmIdSearch.entity().getVmId(), SearchCriteria.Op.EQ);
 +        VmIdSearch.done();
 +
 +        VmReservationIdSearch = createSearchBuilder();
-         VmReservationIdSearch.and("vmReservationId", VmReservationIdSearch.entity().geVmReservationId(), SearchCriteria.Op.EQ);
++        VmReservationIdSearch.and("vmReservationId", VmReservationIdSearch.entity().getVmReservationId(), SearchCriteria.Op.EQ);
 +        VmReservationIdSearch.done();
 +    }
 +
 +    @Override
 +    public VolumeReservationVO findByVmId(long vmId) {
 +        SearchCriteria<VolumeReservationVO> sc = VmIdSearch.create("vmId", vmId);
 +        return findOneBy(sc);
 +    }
 +
 +    @Override
 +    public List<VolumeReservationVO> listVolumeReservation(long vmReservationId) {
 +        SearchCriteria<VolumeReservationVO> sc = VmReservationIdSearch.create("vmReservationId", vmReservationId);
 +        return listBy(sc);
 +    }
 +
 +}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/framework/jobs/pom.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/framework/jobs/src/org/apache/cloudstack/framework/jobs/AsyncJob.java
----------------------------------------------------------------------
diff --cc framework/jobs/src/org/apache/cloudstack/framework/jobs/AsyncJob.java
index b9ef36c,0000000..fc3eed3
mode 100644,000000..100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/AsyncJob.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/AsyncJob.java
@@@ -1,115 -1,0 +1,116 @@@
 +// 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 org.apache.cloudstack.framework.jobs;
 +
 +import java.util.Date;
 +
 +import org.apache.cloudstack.api.Identity;
 +import org.apache.cloudstack.api.InternalIdentity;
 +
 +
 +public interface AsyncJob extends Identity, InternalIdentity {
 +
 +    public static interface Topics {
 +        public static final String JOB_HEARTBEAT = "job.heartbeat";
 +        public static final String JOB_STATE = "job.state";
 +    }
 +	
 +	public enum JournalType {
 +		SUCCESS, FAILURE
 +	};
 +	
 +    String getType();
 +    
 +    String getDispatcher();
 +
 +    int getPendingSignals();
 +    public enum Type {
 +        None,
 +        VirtualMachine,
 +        DomainRouter,
 +        Volume,
 +        ConsoleProxy,
 +        Snapshot,
 +        Template,
 +        Iso,
 +        SystemVm,
 +        Host,
 +        StoragePool,
 +        IpAddress,
++        PortableIpAddress,
 +        SecurityGroup,
 +        PhysicalNetwork,
 +        TrafficType,
 +        PhysicalNetworkServiceProvider,
 +        FirewallRule,
 +        Account,
 +        User,
 +        PrivateGateway,
 +        StaticRoute,
 +        Counter,
 +        Condition,
 +        AutoScalePolicy,
 +        AutoScaleVmProfile,
 +        AutoScaleVmGroup,
 +        GlobalLoadBalancerRule,
 +        LoadBalancerRule,
 +        AffinityGroup,
 +        InternalLbVm,
 +        DedicatedGuestVlanRange
 +    }
 +    
 +    long getUserId();
 +
 +    long getAccountId();
 +
 +    String getCmd();
 +
 +    int getCmdVersion();
 +
 +    String getCmdInfo();
 +    
 +    int getStatus();
 +
 +    int getProcessStatus();
 +
 +    int getResultCode();
 +
 +    String getResult();
 +
 +    Long getInitMsid();
 +    void setInitMsid(Long msid);
 +
 +    Long getExecutingMsid();
 +    
 +    Long getCompleteMsid();
 +    void setCompleteMsid(Long msid);
 +
 +    Date getCreated();
 +
 +    Date getLastUpdated();
 +
 +    Date getLastPolled();
 +
 +    Date getRemoved();
 +
 +    String getInstanceType();
 +
 +    Long getInstanceId();
 +
 +    SyncQueueItem getSyncSource();
 +    void setSyncSource(SyncQueueItem item);
 +}

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

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/InternalLBVMManagerTest.java
----------------------------------------------------------------------
diff --cc plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/InternalLBVMManagerTest.java
index 5f37e9d,a19a82e..6857ef0
--- a/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/InternalLBVMManagerTest.java
+++ b/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/InternalLBVMManagerTest.java
@@@ -56,10 -55,10 +56,8 @@@ import com.cloud.network.rules.Firewall
  import com.cloud.network.rules.LoadBalancerContainer.Scheme;
  import com.cloud.service.ServiceOfferingVO;
  import com.cloud.service.dao.ServiceOfferingDao;
--import com.cloud.user.Account;
  import com.cloud.user.AccountManager;
  import com.cloud.user.AccountVO;
--import com.cloud.user.User;
  import com.cloud.utils.component.ComponentContext;
  import com.cloud.utils.exception.CloudRuntimeException;
  import com.cloud.utils.net.Ip;
@@@ -157,12 -155,12 +155,12 @@@ public class InternalLBVMManagerTest ex
          Mockito.when(_dcDao.findById(Mockito.anyLong())).thenReturn(dc);
          
          
--        try {
-             Mockito.when(_itMgr.expunge("1234", Mockito.any(User.class), Mockito.any(Account.class))).thenReturn(true);
-         } catch (ResourceUnavailableException e) {
-             // TODO Auto-generated catch block
-             e.printStackTrace();
-         }
 -            Mockito.when(_itMgr.expunge(Mockito.any(DomainRouterVO.class), Mockito.any(User.class), Mockito.any(Account.class))).thenReturn(true);
 -        } catch (ResourceUnavailableException e) {
 -            // TODO Auto-generated catch block
 -            e.printStackTrace();
 -        } 
++//        try {
++//            Mockito.when(_itMgr.expunge("1234", Mockito.any(User.class), Mockito.any(Account.class))).thenReturn(true);
++//        } catch (ResourceUnavailableException e) {
++//            // TODO Auto-generated catch block
++//            e.printStackTrace();
++//        }
          
          Mockito.when(_domainRouterDao.findById(validVmId)).thenReturn(vm);
          Mockito.when(_domainRouterDao.findById(invalidVmId)).thenReturn(null);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/InternalLBVMServiceTest.java
----------------------------------------------------------------------
diff --cc plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/InternalLBVMServiceTest.java
index ab9af7b,5a1d56f..1afb008
--- a/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/InternalLBVMServiceTest.java
+++ b/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/InternalLBVMServiceTest.java
@@@ -17,7 -17,7 +17,6 @@@
  package org.apache.cloudstack.internallbvmmgr;
  
  import java.lang.reflect.Field;
--import java.util.Map;
  
  import javax.inject.Inject;
  
@@@ -30,13 -31,11 +29,11 @@@ import org.mockito.Mockito
  import org.springframework.test.context.ContextConfiguration;
  import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
  
 -import com.cloud.deploy.DeploymentPlan;
 +import org.apache.cloudstack.network.lb.InternalLoadBalancerVMService;
 +
  import com.cloud.exception.ConcurrentOperationException;
  import com.cloud.exception.InsufficientCapacityException;
  import com.cloud.exception.InvalidParameterValueException;
--import com.cloud.exception.OperationTimedoutException;
  import com.cloud.exception.ResourceUnavailableException;
  import com.cloud.exception.StorageUnavailableException;
  import com.cloud.hypervisor.Hypervisor.HypervisorType;
@@@ -44,13 -43,11 +41,11 @@@ import com.cloud.network.router.Virtual
  import com.cloud.network.router.VirtualRouter.Role;
  import com.cloud.service.ServiceOfferingVO;
  import com.cloud.service.dao.ServiceOfferingDao;
--import com.cloud.user.Account;
  import com.cloud.user.AccountManager;
  import com.cloud.user.AccountVO;
--import com.cloud.user.User;
 +import com.cloud.user.UserContext;
  import com.cloud.user.UserVO;
 +import com.cloud.user.dao.AccountDao;
  import com.cloud.utils.component.ComponentContext;
  import com.cloud.vm.DomainRouterVO;
  import com.cloud.vm.VirtualMachine;
@@@ -112,29 -110,29 +107,29 @@@ public class InternalLBVMServiceTest ex
          Mockito.when(_domainRouterDao.findById(nonExistingVmId)).thenReturn(null);
          Mockito.when(_domainRouterDao.findById(nonInternalLbVmId)).thenReturn(nonInternalLbVm);
          
--        try {
-             Mockito.when(_itMgr.start(null,
-                     Mockito.any(Map.class), Mockito.any(User.class), Mockito.any(Account.class), Mockito.any(DeploymentPlan.class))).thenReturn(validVm);
-         } catch (InsufficientCapacityException e) {
-             // TODO Auto-generated catch block
-             e.printStackTrace();
-         } catch (ResourceUnavailableException e) {
-             // TODO Auto-generated catch block
-             e.printStackTrace();
-         }
-         
-         try {
-             Mockito.when(_itMgr.advanceStop(null, Mockito.any(Boolean.class), Mockito.any(User.class), Mockito.any(Account.class))).thenReturn(true);
-         } catch (ResourceUnavailableException e) {
-             // TODO Auto-generated catch block
-             e.printStackTrace();
-         } catch (OperationTimedoutException e) {
-             // TODO Auto-generated catch block
-             e.printStackTrace();
-         } catch (ConcurrentOperationException e) {
-             // TODO Auto-generated catch block
-             e.printStackTrace();
-         }
 -            Mockito.when(_itMgr.start(Mockito.any(DomainRouterVO.class),
 -                    Mockito.any(Map.class), Mockito.any(User.class), Mockito.any(Account.class), Mockito.any(DeploymentPlan.class))).thenReturn(validVm);
 -        } catch (InsufficientCapacityException e) {
 -            // TODO Auto-generated catch block
 -            e.printStackTrace();
 -        } catch (ResourceUnavailableException e) {
 -            // TODO Auto-generated catch block
 -            e.printStackTrace();
 -        }
 -        
 -        try {
 -            Mockito.when(_itMgr.advanceStop(Mockito.any(DomainRouterVO.class), Mockito.any(Boolean.class), Mockito.any(User.class), Mockito.any(Account.class))).thenReturn(true);
 -        } catch (ResourceUnavailableException e) {
 -            // TODO Auto-generated catch block
 -            e.printStackTrace();
 -        } catch (OperationTimedoutException e) {
 -            // TODO Auto-generated catch block
 -            e.printStackTrace();
 -        } catch (ConcurrentOperationException e) {
 -            // TODO Auto-generated catch block
 -            e.printStackTrace();
 -        }
++//        try {
++////            Mockito.when(_itMgr.start(null,
++////                    Mockito.any(Map.class), Mockito.any(User.class), Mockito.any(Account.class), Mockito.any(DeploymentPlan.class))).thenReturn(validVm);
++//        } catch (InsufficientCapacityException e) {
++//            // TODO Auto-generated catch block
++//            e.printStackTrace();
++//        } catch (ResourceUnavailableException e) {
++//            // TODO Auto-generated catch block
++//            e.printStackTrace();
++//        }
++//
++//        try {
++////            Mockito.when(_itMgr.advanceStop(null, Mockito.any(Boolean.class), Mockito.any(User.class), Mockito.any(Account.class))).thenReturn(true);
++//        } catch (ResourceUnavailableException e) {
++//            // TODO Auto-generated catch block
++//            e.printStackTrace();
++//        } catch (OperationTimedoutException e) {
++//            // TODO Auto-generated catch block
++//            e.printStackTrace();
++//        } catch (ConcurrentOperationException e) {
++//            // TODO Auto-generated catch block
++//            e.printStackTrace();
++//        }
  
      }
      

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/plugins/network-elements/midonet/test/com/cloud/network/element/MidoNetElementTest.java
----------------------------------------------------------------------
diff --cc plugins/network-elements/midonet/test/com/cloud/network/element/MidoNetElementTest.java
index de07ba8,a7d96b0..0976368
--- a/plugins/network-elements/midonet/test/com/cloud/network/element/MidoNetElementTest.java
+++ b/plugins/network-elements/midonet/test/com/cloud/network/element/MidoNetElementTest.java
@@@ -16,27 -16,27 +16,41 @@@
   * specific language governing permissions and limitations
   * under the License.
   */
 -
  package com.cloud.network.element;
  
- import com.cloud.network.element.MidoNetElement;
--import com.cloud.user.AccountVO;
--import com.cloud.user.dao.AccountDao;
++import static org.mockito.Matchers.any;
++import static org.mockito.Matchers.anyInt;
++import static org.mockito.Matchers.anyLong;
++import static org.mockito.Matchers.anyString;
++import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
++import static org.mockito.Mockito.mock;
++import static org.mockito.Mockito.when;
++
++import java.util.ArrayList;
++import java.util.UUID;
++
  import junit.framework.TestCase;
--import static org.junit.Assert.assertEquals;
--import static org.mockito.Mockito.*;
++
  import com.midokura.midonet.client.MidonetApi;
--import com.midokura.midonet.client.resource.*;
--import com.sun.jersey.core.util.MultivaluedMapImpl;
--import com.cloud.network.*;
--import com.cloud.vm.*;
--import com.cloud.network.rules.StaticNat;
--import com.cloud.network.element.MidoNetElement;
++import com.midokura.midonet.client.resource.Bridge;
++import com.midokura.midonet.client.resource.BridgePort;
++import com.midokura.midonet.client.resource.DhcpHost;
++import com.midokura.midonet.client.resource.DhcpSubnet;
++import com.midokura.midonet.client.resource.Port;
++import com.midokura.midonet.client.resource.ResourceCollection;
++import com.midokura.midonet.client.resource.Router;
++import com.midokura.midonet.client.resource.RouterPort;
++
  import com.cloud.exception.ConcurrentOperationException;
  import com.cloud.exception.InsufficientCapacityException;
  import com.cloud.exception.ResourceUnavailableException;
--import sun.security.util.Resources_es;
--
--import java.util.*;
++import com.cloud.network.Network;
++import com.cloud.network.Networks;
++import com.cloud.user.AccountVO;
++import com.cloud.user.dao.AccountDao;
++import com.cloud.vm.NicProfile;
++import com.cloud.vm.VirtualMachine;
++import com.cloud.vm.VirtualMachineProfile;
  
  
  public class MidoNetElementTest extends TestCase {
@@@ -97,8 -97,8 +111,8 @@@
  
          //mockVm
          @SuppressWarnings("unchecked")
 -        VirtualMachineProfile<? extends VirtualMachine> mockVm =
 -                (VirtualMachineProfile<? extends VirtualMachine>)mock(VirtualMachineProfile.class);
 +        VirtualMachineProfile mockVm =
-                 (VirtualMachineProfile)mock(VirtualMachineProfile.class);
++                mock(VirtualMachineProfile.class);
          when(mockVm.getType()).thenReturn(VirtualMachine.Type.User);
  
          MidoNetElement elem = new MidoNetElement();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a1e1e80/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/api/ApiResponseHelper.java
index 65f8f91,fc1c6a0..10e47d3
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@@ -3819,7 -3830,70 +3825,70 @@@ public class ApiResponseHelper implemen
          }
      }
  
+     @Override
+     public PortableIpRangeResponse createPortableIPRangeResponse(PortableIpRange ipRange) {
+         PortableIpRangeResponse response = new PortableIpRangeResponse();
+         response.setId(ipRange.getUuid());
+         String ipRangeStr = ipRange.getIpRange();
+         if (ipRangeStr != null) {
+             String[] range = ipRangeStr.split("-");
+             response.setStartIp(range[0]);
+             response.setEndIp(range[1]);
+         }
+         response.setVlan(ipRange.getVlanTag());
+         response.setGateway(ipRange.getGateway());
+         response.setNetmask(ipRange.getNetmask());
+         response.setRegionId(ipRange.getRegionId());
+         return response;
+     }
+ 
+     @Override
+     public PortableIpResponse createPortableIPResponse(PortableIp portableIp) {
+         PortableIpResponse response = new PortableIpResponse();
+         response.setAddress(portableIp.getAddress());
+         Long accountId =  portableIp.getAllocatedInDomainId();
+         if (accountId != null) {
+             Account account = ApiDBUtils.findAccountById(accountId);
+             response.setAllocatedToAccountId(account.getAccountName());
+             Domain domain = ApiDBUtils.findDomainById(account.getDomainId());
+             response.setAllocatedInDomainId(domain.getUuid());
+         }
+ 
+         response.setAllocatedTime(portableIp.getAllocatedTime());
+ 
+         if (portableIp.getAssociatedDataCenterId() != null) {
+             DataCenter zone = ApiDBUtils.findZoneById(portableIp.getAssociatedDataCenterId());
+             if (zone != null) {
+                 response.setAssociatedDataCenterId(zone.getUuid());
+             }
+         }
+ 
+         if (portableIp.getPhysicalNetworkId() != null) {
+             PhysicalNetwork pnw = ApiDBUtils.findPhysicalNetworkById(portableIp.getPhysicalNetworkId());
+             if (pnw != null) {
+                 response.setPhysicalNetworkId(pnw.getUuid());
+             }
+         }
+ 
+         if (portableIp.getAssociatedWithNetworkId() != null) {
+             Network ntwk = ApiDBUtils.findNetworkById(portableIp.getAssociatedWithNetworkId());
+             if (ntwk != null) {
+                 response.setAssociatedWithNetworkId(ntwk.getUuid());
+             }
+         }
+ 
+         if (portableIp.getAssociatedWithVpcId() != null) {
+             Vpc vpc = ApiDBUtils.findVpcById(portableIp.getAssociatedWithVpcId());
+             if (vpc != null) {
+                 response.setAssociatedWithVpcId(vpc.getUuid());
+             }
+         }
+ 
+         response.setState(portableIp.getState().name());
+ 
+         return response;
+     }
 -
 +    
      @Override
      public InternalLoadBalancerElementResponse createInternalLbElementResponse(VirtualRouterProvider result) {
          if (result.getType() != VirtualRouterProvider.VirtualRouterProviderType.InternalLbVm) {


Mime
View raw message