cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahu...@apache.org
Subject [49/50] [abbrv] git commit: updated refs/heads/vmsync to cd6aea1
Date Thu, 30 May 2013 00:04:43 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/7bdddd07
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7bdddd07
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7bdddd07

Branch: refs/heads/vmsync
Commit: 7bdddd0726329fcec14db4e9da0a89e9e09e5f5b
Parents: d84bb97 56535a7
Author: Alex Huang <alex.huang@gmail.com>
Authored: Wed May 29 15:45:38 2013 -0700
Committer: Alex Huang <alex.huang@gmail.com>
Committed: Wed May 29 15:45:38 2013 -0700

----------------------------------------------------------------------
 .gitignore                                         |    1 +
 INSTALL.md                                         |   19 +-
 agent/bindir/cloud-setup-agent.in                  |    7 +-
 agent/conf/agent.properties                        |    5 +
 .../com/cloud/agent/api/to/VirtualMachineTO.java   |    9 +
 api/src/com/cloud/event/EventTypes.java            |    3 +-
 api/src/com/cloud/network/NetworkService.java      |    2 +-
 .../cloud/network/vpn/RemoteAccessVpnService.java  |    2 +-
 api/src/org/apache/cloudstack/api/BaseCmd.java     |    2 +-
 .../apache/cloudstack/api/ServerApiException.java  |    3 +-
 .../config/UpdateHypervisorCapabilitiesCmd.java    |    5 +-
 .../user/account/AddAccountToProjectCmd.java       |    2 +-
 .../command/user/address/AssociateIPAddrCmd.java   |    4 +
 .../user/address/DisassociateIPAddrCmd.java        |    8 +-
 .../command/user/autoscale/ListConditionsCmd.java  |    4 +-
 .../user/firewall/CreatePortForwardingRuleCmd.java |    4 +
 .../loadbalancer/ListLoadBalancerRulesCmd.java     |    9 +
 .../command/user/network/CreateNetworkACLCmd.java  |   11 +-
 .../user/snapshot/CreateSnapshotPolicyCmd.java     |    2 +-
 .../command/user/template/CreateTemplateCmd.java   |   17 +-
 .../api/command/user/vm/RestoreVMCmd.java          |    5 +-
 .../api/command/user/volume/UploadVolumeCmd.java   |    8 +-
 .../command/user/vpn/DeleteRemoteAccessVpnCmd.java |    2 +-
 .../cloudstack/api/response/ExceptionResponse.java |   14 +-
 .../api/response/LoadBalancerResponse.java         |    9 +
 .../api/response/ServiceOfferingResponse.java      |   11 +
 api/src/org/apache/cloudstack/jobs/Job.java        |   67 +
 .../classes/resources/messages_ar.properties       |    2 +-
 .../classes/resources/messages_ca.properties       |    1 -
 .../classes/resources/messages_de_DE.properties    |    1 -
 .../classes/resources/messages_es.properties       |    1 -
 .../classes/resources/messages_fr_FR.properties    |    5 +-
 .../classes/resources/messages_it_IT.properties    |  191 ++-
 .../classes/resources/messages_ja.properties       |  108 +-
 .../classes/resources/messages_ko_KR.properties    |    4 +-
 .../classes/resources/messages_nb_NO.properties    |    1 -
 .../classes/resources/messages_pt_BR.properties    |    2 +-
 .../classes/resources/messages_ru_RU.properties    |    4 +-
 .../classes/resources/messages_zh_CN.properties    |   10 +-
 client/tomcatconf/nonossComponentContext.xml.in    |    2 +-
 .../storage/template/HttpTemplateDownloader.java   |    7 +
 debian/cloudstack-management.install               |   23 +-
 debian/control                                     |    2 +-
 debian/rules                                       |    8 +-
 docs/en-US/CloudStack_Nicira_NVP_Guide.xml         |    1 +
 docs/en-US/Release_Notes.xml                       |   47 +-
 docs/en-US/egress-firewall-rule.xml                |    4 +-
 docs/en-US/images/nvp-add-controller.png           |  Bin 0 -> 35928 bytes
 docs/en-US/images/nvp-enable-provider.png          |  Bin 0 -> 32158 bytes
 docs/en-US/images/nvp-network-offering.png         |  Bin 0 -> 104060 bytes
 docs/en-US/images/nvp-physical-network-stt.png     |  Bin 0 -> 27317 bytes
 docs/en-US/images/nvp-vpc-offering-edit.png        |  Bin 0 -> 29279 bytes
 docs/en-US/multiple-ip-nic.xml                     |    3 +-
 docs/en-US/plugin-niciranvp-about.xml              |    2 +-
 docs/en-US/plugin-niciranvp-devicemanagement.xml   |   32 +-
 docs/en-US/plugin-niciranvp-features.xml           |   67 +-
 docs/en-US/plugin-niciranvp-guide.xml              |   31 -
 docs/en-US/plugin-niciranvp-introduction.xml       |    5 +-
 docs/en-US/plugin-niciranvp-networkofferings.xml   |  131 ++
 docs/en-US/plugin-niciranvp-physicalnet.xml        |   37 +
 docs/en-US/plugin-niciranvp-preparations.xml       |   11 +-
 docs/en-US/plugin-niciranvp-provider.xml           |   28 +-
 docs/en-US/plugin-niciranvp-revisions.xml          |   14 +
 docs/en-US/plugin-niciranvp-tables.xml             |  105 +-
 docs/en-US/plugin-niciranvp-usage.xml              |   11 +-
 docs/en-US/plugin-niciranvp-vpc.xml                |   30 +
 docs/en-US/plugin-niciranvp-vpcfeatures.xml        |   28 +
 docs/en-US/plugin-niciranvp-vpcnetworkoffering.xml |   81 +
 docs/en-US/plugin-niciranvp-vpcoffering.xml        |   38 +
 .../src/com/cloud/network/NetworkManager.java      |   24 +-
 .../com/cloud/upgrade/DatabaseUpgradeChecker.java  |    5 +-
 .../src/com/cloud/upgrade/dao/Upgrade302to40.java  |   41 +
 .../src/com/cloud/upgrade/dao/Upgrade410to420.java |  102 ++
 .../src/com/cloud/usage/dao/UsageNetworkDao.java   |    2 +
 .../com/cloud/usage/dao/UsageNetworkDaoImpl.java   |   34 +
 .../allocator/AbstractStoragePoolAllocator.java    |    6 -
 .../cloudstack/framework/jobs/dao/AsyncJobDao.java |    2 +
 .../framework/jobs/dao/AsyncJobDaoImpl.java        |   83 +-
 .../debian/config/etc/init.d/cloud-early-config    |    3 +
 patches/systemvm/debian/config/etc/rc.local        |    3 +
 .../config/opt/cloud/bin/get_template_version.sh   |   26 +
 .../debian/config/opt/cloud/bin/ipassoc.sh         |    6 +-
 .../config/root/redundant_router/backup.sh.templ   |    2 +
 plugins/hypervisors/kvm/pom.xml                    |    9 +
 .../kvm/resource/LibvirtComputingResource.java     |  107 +-
 .../kvm/storage/LibvirtStorageAdaptor.java         |  248 +++-
 .../kvm/resource/LibvirtComputingResourceTest.java |    4 +-
 .../vmware/manager/VmwareStorageManagerImpl.java   |   19 +
 .../hypervisor/vmware/resource/VmwareResource.java |    2 +-
 .../hypervisor/xen/resource/XcpOssResource.java    |   30 +-
 .../xen/resource/XenServer56FP1Resource.java       |    2 +-
 .../cloud/network/element/CiscoVnmcElement.java    |   17 +-
 .../element/JuniperSRXExternalFirewallElement.java |    1 +
 .../cloud/network/resource/JuniperSrxResource.java |   35 +-
 pom.xml                                            |    1 +
 python/lib/cloudutils/globalEnv.py                 |    2 +
 python/lib/cloudutils/networkConfig.py             |   14 +-
 python/lib/cloudutils/serviceConfig.py             |   66 +-
 scripts/storage/qcow2/modifyvlan.sh                |  269 ---
 server/src/com/cloud/api/ApiResponseHelper.java    |   20 +-
 server/src/com/cloud/api/ApiServer.java            |   14 +-
 .../src/com/cloud/api/query/QueryManagerImpl.java  |    4 +-
 .../api/query/dao/ServiceOfferingJoinDaoImpl.java  |    1 +
 .../cloud/api/query/vo/ServiceOfferingJoinVO.java  |   11 +
 .../cloud/api/response/ApiResponseSerializer.java  |   23 +-
 .../src/com/cloud/async/AsyncJobManagerImpl.java   |   11 +-
 server/src/com/cloud/configuration/Config.java     |    5 +-
 .../configuration/ConfigurationManagerImpl.java    |   72 +-
 .../consoleproxy/ConsoleProxyManagerImpl.java      |   17 +-
 .../deploy/DeploymentPlanningManagerImpl.java      |   24 +-
 .../com/cloud/hypervisor/HypervisorGuruBase.java   |    7 +
 .../network/ExternalFirewallDeviceManagerImpl.java |    4 +-
 .../ExternalLoadBalancerDeviceManagerImpl.java     |   13 +
 .../src/com/cloud/network/NetworkManagerImpl.java  |   77 +-
 server/src/com/cloud/network/NetworkModelImpl.java |   31 +-
 .../src/com/cloud/network/NetworkServiceImpl.java  |  102 +-
 .../network/lb/LoadBalancingRulesManagerImpl.java  |   35 +-
 .../com/cloud/network/rules/RulesManagerImpl.java  |   24 +-
 .../src/com/cloud/network/vpc/VpcManagerImpl.java  |   31 +-
 .../network/vpn/RemoteAccessVpnManagerImpl.java    |    4 +-
 .../src/com/cloud/projects/ProjectManagerImpl.java |   34 +-
 .../com/cloud/resource/ResourceManagerImpl.java    |   34 +-
 .../com/cloud/server/ConfigurationServerImpl.java  |   29 +-
 .../src/com/cloud/server/ManagementServerImpl.java |   65 +-
 .../src/com/cloud/storage/VolumeManagerImpl.java   |   12 +-
 .../secondary/SecondaryStorageManagerImpl.java     |   20 +-
 .../storage/snapshot/SnapshotManagerImpl.java      |    7 +-
 .../com/cloud/template/TemplateManagerImpl.java    |    7 +
 server/src/com/cloud/user/AccountManagerImpl.java  |   10 +-
 server/src/com/cloud/user/DomainManagerImpl.java   |   10 +-
 server/src/com/cloud/vm/UserVmManagerImpl.java     |  129 ++-
 .../com/cloud/vm/VirtualMachineManagerImpl.java    |    2 +-
 .../lb/ApplicationLoadBalancerManagerImpl.java     |    2 +-
 .../gslb/GlobalLoadBalancingRulesServiceImpl.java  |    7 +-
 .../com/cloud/network/MockNetworkManagerImpl.java  |   24 +-
 server/test/com/cloud/vm/UserVmManagerTest.java    |   42 +-
 .../test/com/cloud/vpc/MockNetworkManagerImpl.java |   52 +-
 .../test/com/cloud/vpc/NetworkACLServiceTest.java  |    1 +
 .../GlobalLoadBalancingRulesServiceImplTest.java   |   13 +
 setup/db/db/schema-302to40.sql                     |   15 +-
 setup/db/db/schema-40to410.sql                     |   18 +
 setup/db/db/schema-410to420.sql                    |   26 +-
 setup/dev/advancedsg.cfg                           |  185 ++
 .../component/test_advancedsg_networks.py          |  753 ++++++++
 test/integration/component/test_custom_hostname.py |    2 +-
 test/integration/component/test_egress_rules.py    |   20 +-
 .../component/test_high_availability.py            |    1 -
 .../component/test_host_high_availability.py       |  707 ++++----
 test/integration/component/test_project_limits.py  |    8 +-
 .../component/test_project_resources.py            |    4 +-
 test/integration/component/test_project_usage.py   |    2 +-
 test/integration/component/test_security_groups.py |   22 +-
 test/integration/component/test_shared_networks.py |   13 +
 test/integration/component/test_stopped_vm.py      |   10 +-
 test/integration/component/test_storage_motion.py  |    2 -
 test/integration/component/test_tags.py            |    8 +-
 test/integration/component/test_templates.py       |   89 -
 .../integration/component/test_vm_passwdenabled.py |    4 +-
 .../component/test_vpc_host_maintenance.py         |    2 -
 .../component/test_vpc_network_lbrules.py          |   15 -
 .../component/test_vpc_network_pfrules.py          |    8 -
 .../component/test_vpc_network_staticnatrule.py    |    4 -
 test/integration/smoke/test_internal_lb.py         |    2 +
 test/integration/smoke/test_network.py             |  238 ++--
 test/integration/smoke/test_network_acl.py         |    3 +-
 test/integration/smoke/test_nic.py                 |   51 +-
 test/integration/smoke/test_nicdetail.py           |  224 ---
 test/integration/smoke/test_primary_storage.py     |  134 +-
 test/integration/smoke/test_privategw_acl.py       |    3 +
 test/integration/smoke/test_service_offerings.py   |  366 +++-
 test/integration/smoke/test_vm_life_cycle.py       |  239 ---
 test/integration/smoke/test_volumedetail.py        |  239 ---
 test/integration/smoke/test_volumes.py             |   26 +-
 test/setup-test-data.sh                            |  102 --
 tools/cli/cloudmonkey/cachemaker.py                |    2 +-
 tools/devcloud/devcloud-advancedsg.cfg             |  119 ++
 tools/marvin/marvin/TestCaseExecuteEngine.py       |    2 +-
 tools/marvin/marvin/cloudstackConnection.py        |    5 +-
 tools/marvin/marvin/configGenerator.py             |  123 ++
 tools/marvin/marvin/deployDataCenter.py            |   32 +-
 tools/marvin/marvin/sandbox/advancedsg/__init__.py |   18 +
 .../marvin/sandbox/advancedsg/advancedsg_env.py    |  150 ++
 .../marvin/sandbox/advancedsg/setup.properties     |   61 +
 tools/marvin/setup.py                              |    2 +-
 ui/css/cloudstack3.css                             |   28 +-
 ui/images/sprites.png                              |  Bin 192407 -> 193277 bytes
 ui/index.jsp                                       |    2 +-
 ui/modules/modules.js                              |    1 +
 ui/modules/vpc/vpc.css                             |  313 ++++
 ui/modules/vpc/vpc.js                              |  327 ++++
 ui/scripts/configuration.js                        |   26 +-
 ui/scripts/instances.js                            |    8 +
 ui/scripts/network.js                              |   38 +-
 ui/scripts/regions.js                              |  215 +++-
 ui/scripts/sharedFunctions.js                      |    2 +-
 ui/scripts/system.js                               |  173 ++-
 ui/scripts/ui-custom/installWizard.js              |   13 +-
 ui/scripts/ui/dialog.js                            |   92 +-
 ui/scripts/ui/widgets/detailView.js                |   16 +-
 ui/scripts/ui/widgets/listView.js                  |   22 +-
 ui/scripts/ui/widgets/multiEdit.js                 | 1330 ++++++++-------
 ui/scripts/vpc.js                                  |  889 +++++++++-
 ui/scripts/zoneWizard.js                           |    1 -
 usage/src/com/cloud/usage/UsageManagerImpl.java    |   12 +-
 .../utils/exception/CloudRuntimeException.java     |   24 +-
 .../utils/exception/ExceptionProxyObject.java      |   50 +
 utils/src/com/cloud/utils/net/NetUtils.java        |    2 +
 utils/src/com/cloud/utils/ssh/SshHelper.java       |    4 -
 208 files changed, 7672 insertions(+), 3483 deletions(-)
----------------------------------------------------------------------


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

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bdddd07/api/src/org/apache/cloudstack/api/BaseCmd.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bdddd07/api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java
index 7aacf45,8728f91..4b61bc8
--- a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java
@@@ -25,12 -25,9 +25,11 @@@ import org.apache.cloudstack.api.BaseCm
  import org.apache.cloudstack.api.Parameter;
  import org.apache.cloudstack.api.ServerApiException;
  import org.apache.cloudstack.api.response.HypervisorCapabilitiesResponse;
- import org.apache.cloudstack.api.response.ServiceOfferingResponse;
 -import org.apache.log4j.Logger;
 +
 +import com.cloud.hypervisor.HypervisorCapabilities;
 +import com.cloud.user.Account;
  
- @APICommand(name = "updateHypervisorCapabilities", description="Updates a hypervisor capabilities.", responseObject=ServiceOfferingResponse.class, since="3.0.0")
+ @APICommand(name = "updateHypervisorCapabilities", description="Updates a hypervisor capabilities.", responseObject=HypervisorCapabilitiesResponse.class, since="3.0.0")
  public class UpdateHypervisorCapabilitiesCmd extends BaseCmd {
      public static final Logger s_logger = Logger.getLogger(UpdateHypervisorCapabilitiesCmd.class.getName());
      private static final String s_name = "updatehypervisorcapabilitiesresponse";
@@@ -86,7 -83,7 +85,7 @@@
          if (result != null){
              HypervisorCapabilitiesResponse response = _responseGenerator.createHypervisorCapabilitiesResponse(result);
              response.setResponseName(getCommandName());
--            this.setResponseObject(response);
++            setResponseObject(response);
          } else {
              throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update hypervisor capabilities");
          }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bdddd07/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bdddd07/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 3fc3061,b99ca63..21f8177
--- a/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java
@@@ -211,8 -191,12 +211,12 @@@ public class AssociateIPAddrCmd extend
  
      @Override
      public String getEventType() {
+         if (isPortable()) {
+             return EventTypes.EVENT_PORTABLE_IP_ASSIGN;
+         } else {
 -            return EventTypes.EVENT_NET_IP_ASSIGN;
 -        }
 +        return EventTypes.EVENT_NET_IP_ASSIGN;
 +    }
+     }
  
      @Override
      public String getEventDescription() {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bdddd07/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java
index dbb8f06,3d431f4..e5707bc
--- a/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java
@@@ -91,7 -90,11 +91,11 @@@ public class DisassociateIPAddrCmd exte
  
      @Override
      public String getEventType() {
+         if (!isPortable(id)) {
 -            return EventTypes.EVENT_NET_IP_RELEASE;
 +        return EventTypes.EVENT_NET_IP_RELEASE;
+         } else {
+             return EventTypes.EVENT_PORTABLE_IP_RELEASE;
+         }
      }
  
      @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bdddd07/api/src/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java
index 9ad7b8e,2b15d2b..f323ffc
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java
@@@ -30,10 -26,12 +30,10 @@@ import org.apache.cloudstack.api.respon
  import org.apache.cloudstack.api.response.ConditionResponse;
  import org.apache.cloudstack.api.response.CounterResponse;
  import org.apache.cloudstack.api.response.ListResponse;
 -import org.apache.log4j.Logger;
  
 -import java.util.ArrayList;
 -import java.util.List;
 +import com.cloud.network.as.Condition;
  
- @APICommand(name = "listConditions", description = "List Conditions for the specific user", responseObject = CounterResponse.class)
+ @APICommand(name = "listConditions", description = "List Conditions for the specific user", responseObject = ConditionResponse.class)
  public class ListConditionsCmd extends BaseListAccountResourcesCmd {
      public static final Logger s_logger = Logger.getLogger(ListConditionsCmd.class.getName());
      private static final String s_name = "listconditionsresponse";
@@@ -70,7 -68,7 +70,7 @@@
  
          response.setResponses(cndnResponses);
          response.setResponseName(getCommandName());
--        this.setResponseObject(response);
++        setResponseObject(response);
      }
  
      // /////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bdddd07/api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java
index 815af7d,549de76..43d7b8c
--- a/api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java
@@@ -199,7 -198,11 +199,11 @@@ public class CreatePortForwardingRuleCm
                      _firewallService.revokeRelatedFirewallRule(getEntityId(), true);
                  }
  
+                 try {
 -                    _rulesService.revokePortForwardingRule(getEntityId(), true);
 +                _rulesService.revokePortForwardingRule(getEntityId(), true);
+                 } catch (Exception ex){
+                     //Ignore e.g. failed to apply rules to device error
+                 }
  
                  throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to apply port forwarding rule");
              }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bdddd07/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java
index 3f9f93d,21d5b2a..1a206ba
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java
@@@ -29,8 -27,10 +29,9 @@@ import org.apache.cloudstack.api.respon
  import org.apache.cloudstack.api.response.IPAddressResponse;
  import org.apache.cloudstack.api.response.ListResponse;
  import org.apache.cloudstack.api.response.LoadBalancerResponse;
+ import org.apache.cloudstack.api.response.NetworkResponse;
  import org.apache.cloudstack.api.response.UserVmResponse;
  import org.apache.cloudstack.api.response.ZoneResponse;
 -import org.apache.log4j.Logger;
  
  import com.cloud.network.rules.LoadBalancer;
  import com.cloud.utils.Pair;
@@@ -63,7 -63,11 +64,11 @@@ public class ListLoadBalancerRulesCmd e
      @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class,
              description = "the availability zone ID")
      private Long zoneId;
 -    
 +
+     @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class,
+             description = "list by network id the rule belongs to")
+     private Long networkId;
+ 
      // ///////////////////////////////////////////////////
      // ///////////////// Accessors ///////////////////////
      // ///////////////////////////////////////////////////
@@@ -87,7 -91,11 +92,11 @@@
      public Long getZoneId() {
          return zoneId;
      }
 -    
 +
+     public Long getNetworkId() {
+         return networkId;
+     }
+ 
      // ///////////////////////////////////////////////////
      // ///////////// API Implementation///////////////////
      // ///////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bdddd07/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java
index 18e6743,3a56fe4..113e89c
--- a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java
@@@ -19,8 -19,8 +19,9 @@@ package org.apache.cloudstack.api.comma
  import java.util.ArrayList;
  import java.util.List;
  
 -import com.cloud.network.vpc.NetworkACL;
 -import com.cloud.network.vpc.NetworkACLItem;
++import org.apache.commons.lang.StringUtils;
 +import org.apache.log4j.Logger;
 +
  import org.apache.cloudstack.api.APICommand;
  import org.apache.cloudstack.api.ApiConstants;
  import org.apache.cloudstack.api.ApiErrorCode;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bdddd07/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bdddd07/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
index cb83705,6aa60ac..b9834d5
--- a/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
@@@ -34,20 -38,13 +34,19 @@@ import org.apache.cloudstack.api.respon
  import org.apache.cloudstack.api.response.TemplateResponse;
  import org.apache.cloudstack.api.response.UserVmResponse;
  import org.apache.cloudstack.api.response.VolumeResponse;
 -import org.apache.log4j.Logger;
  
 -import java.util.Collection;
 -import java.util.List;
 -import java.util.Map;
 +import com.cloud.event.EventTypes;
 +import com.cloud.exception.InvalidParameterValueException;
 +import com.cloud.exception.PermissionDeniedException;
 +import com.cloud.exception.ResourceAllocationException;
 +import com.cloud.projects.Project;
 +import com.cloud.storage.Snapshot;
 +import com.cloud.storage.Volume;
 +import com.cloud.template.VirtualMachineTemplate;
 +import com.cloud.user.Account;
 +import com.cloud.user.UserContext;
  
- @APICommand(name = "createTemplate", responseObject = StoragePoolResponse.class, description = "Creates a template of a virtual machine. " + "The virtual machine must be in a STOPPED state. "
+ @APICommand(name = "createTemplate", responseObject = TemplateResponse.class, description = "Creates a template of a virtual machine. " + "The virtual machine must be in a STOPPED state. "
          + "A template created from this command is automatically designated as a private template visible to the account that created it.")
          public class CreateTemplateCmd extends BaseAsyncCreateCmd {
      public static final Logger s_logger = Logger.getLogger(CreateTemplateCmd.class.getName());
@@@ -235,16 -232,16 +234,16 @@@
      }
  
      private boolean isBareMetal() {
--        return (this.getVmId() != null && this.getUrl() != null);
++        return (getVmId() != null && getUrl() != null);
      }
  
      @Override
      public void create() throws ResourceAllocationException {
          VirtualMachineTemplate template = null;
--        template = this._templateService.createPrivateTemplateRecord(this, _accountService.getAccount(getEntityOwnerId()));
++        template = _templateService.createPrivateTemplateRecord(this, _accountService.getAccount(getEntityOwnerId()));
          if (template != null) {
--            this.setEntityId(template.getId());
--            this.setEntityUuid(template.getUuid());
++            setEntityId(template.getId());
++            setEntityUuid(template.getUuid());
          } else {
              throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,
              "Failed to create a template");
@@@ -256,7 -253,7 +255,7 @@@
      public void execute() {
          UserContext.current().setEventDetails("Template Id: "+getEntityId()+((getSnapshotId() == null) ? " from volume Id: " + getVolumeId() : " from snapshot Id: " + getSnapshotId()));
          VirtualMachineTemplate template = null;
--        template = this._templateService.createPrivateTemplate(this);
++        template = _templateService.createPrivateTemplate(this);
  
          if (template != null){
              List<TemplateResponse> templateResponses;
@@@ -270,7 -267,7 +269,7 @@@
                  response = templateResponses.get(0);
              }
              response.setResponseName(getCommandName());
--            this.setResponseObject(response);
++            setResponseObject(response);
          } else {
              throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create private template");
          }

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

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bdddd07/api/src/org/apache/cloudstack/api/command/user/volume/UploadVolumeCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/volume/UploadVolumeCmd.java
index bd64c1c,fea3e04..a74763c
--- a/api/src/org/apache/cloudstack/api/command/user/volume/UploadVolumeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/volume/UploadVolumeCmd.java
@@@ -24,9 -22,12 +24,11 @@@ import org.apache.cloudstack.api.ApiErr
  import org.apache.cloudstack.api.BaseAsyncCmd;
  import org.apache.cloudstack.api.Parameter;
  import org.apache.cloudstack.api.ServerApiException;
+ import org.apache.cloudstack.api.BaseCmd.CommandType;
  import org.apache.cloudstack.api.response.DomainResponse;
+ import org.apache.cloudstack.api.response.ProjectResponse;
  import org.apache.cloudstack.api.response.VolumeResponse;
  import org.apache.cloudstack.api.response.ZoneResponse;
 -import org.apache.log4j.Logger;
  
  import com.cloud.event.EventTypes;
  import com.cloud.exception.ConcurrentOperationException;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bdddd07/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteRemoteAccessVpnCmd.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bdddd07/api/src/org/apache/cloudstack/api/response/ExceptionResponse.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/response/ExceptionResponse.java
index e0bde45,830cf00..80fc923
--- a/api/src/org/apache/cloudstack/api/response/ExceptionResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/ExceptionResponse.java
@@@ -17,17 -17,18 +17,19 @@@
  package org.apache.cloudstack.api.response;
  
  import java.util.ArrayList;
+ import java.util.List;
  
 +import com.google.gson.annotations.SerializedName;
 +
  import org.apache.cloudstack.api.BaseResponse;
  
  import com.cloud.serializer.Param;
+ import com.cloud.utils.exception.ExceptionProxyObject;
 -import com.google.gson.annotations.SerializedName;
  
  public class ExceptionResponse extends BaseResponse {
  
      @SerializedName("uuidList") @Param(description="List of uuids associated with this error")
-     private ArrayList<String> idList;
 -    private List<ExceptionProxyObject> idList;
++    private final List<ExceptionProxyObject> idList;
  
      @SerializedName("errorcode") @Param(description="numeric code associated with this error")
      private Integer errorCode;
@@@ -64,7 -69,7 +70,7 @@@
      }
  
      public void setCSErrorCode(int cserrcode) {
--        this.csErrorCode = cserrcode;
++        csErrorCode = cserrcode;
      }
  
      @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bdddd07/api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java
index d15fc04,0f18097..acc1ef3
--- a/api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java
@@@ -58,10 -57,14 +58,14 @@@ public class LoadBalancerResponse exten
      @SerializedName(ApiConstants.ALGORITHM)
      @Param(description = "the load balancer algorithm (source, roundrobin, leastconn)")
      private String algorithm;
 -    
 +
+     @SerializedName(ApiConstants.NETWORK_ID)
+     @Param(description = "the id of the guest network the lb rule belongs to")
+     private String networkId;
+ 
      @SerializedName(ApiConstants.CIDR_LIST) @Param(description="the cidr list to forward traffic from")
      private String cidrList;
 -    
 +
      @SerializedName(ApiConstants.ACCOUNT)
      @Param(description = "the account of the load balancer rule")
      private String accountName;
@@@ -90,7 -93,8 +94,8 @@@
  
      @SerializedName(ApiConstants.TAGS)  @Param(description="the list of resource tags associated with load balancer", responseObject = ResourceTagResponse.class)
      private List<ResourceTagResponse> tags;
 -    
 +
+ 
      public void setId(String id) {
          this.id = id;
      }
@@@ -161,5 -165,9 +166,9 @@@
      public void setTags(List<ResourceTagResponse> tags) {
          this.tags = tags;
      }
 -    
 +
+     public void setNetworkId(String networkId) {
+         this.networkId = networkId;
+     }
+ 
  }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bdddd07/api/src/org/apache/cloudstack/api/response/ServiceOfferingResponse.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bdddd07/api/src/org/apache/cloudstack/jobs/Job.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/jobs/Job.java
index 0000000,0000000..d238da3
new file mode 100644
--- /dev/null
+++ b/api/src/org/apache/cloudstack/jobs/Job.java
@@@ -1,0 -1,0 +1,67 @@@
++// 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.jobs;
++
++import java.util.Date;
++
++import org.apache.cloudstack.api.Identity;
++import org.apache.cloudstack.api.InternalIdentity;
++
++public interface Job extends Identity, InternalIdentity {
++
++
++
++    String getType();
++
++    String getDispatcher();
++
++    int getPendingSignals();
++
++    long getUserId();
++
++    long getAccountId();
++
++    String getCmd();
++
++    int getCmdVersion();
++
++    String getCmdInfo();
++
++    int getStatus();
++
++    int getProcessStatus();
++
++    int getResultCode();
++
++    String getResult();
++
++    Long getInitMsid();
++
++    Long getExecutingMsid();
++
++    Long getCompleteMsid();
++
++    Date getCreated();
++
++    Date getLastUpdated();
++
++    Date getLastPolled();
++
++    String getInstanceType();
++
++    Long getInstanceId();
++}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bdddd07/engine/components-api/src/com/cloud/network/NetworkManager.java
----------------------------------------------------------------------
diff --cc engine/components-api/src/com/cloud/network/NetworkManager.java
index 24e4224,0000000..06db2e6
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,396 -1,0 +1,388 @@@
 +// 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 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;
 +
++    IpAddress allocatePortableIp(Account ipOwner, Account caller, long dcId, Long networkId, Long vpcID)
++            throws ConcurrentOperationException, ResourceAllocationException, InsufficientAddressCapacityException;
++
++    boolean releasePortableIpAddress(long addrId);
++
 +    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;
- 
++    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/7bdddd07/engine/storage/src/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bdddd07/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDao.java
----------------------------------------------------------------------
diff --cc framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDao.java
index ba28495,0000000..4c442c8
mode 100644,000000..100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDao.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDao.java
@@@ -1,35 -1,0 +1,37 @@@
 +// 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.dao;
 +
 +import java.util.Date;
 +import java.util.List;
 +
 +import org.apache.cloudstack.framework.jobs.AsyncJobVO;
 +
 +import com.cloud.utils.db.GenericDao;
 +
 +public interface AsyncJobDao extends GenericDao<AsyncJobVO, Long> {
 +	AsyncJobVO findInstancePendingAsyncJob(String instanceType, long instanceId);
 +	List<AsyncJobVO> findInstancePendingAsyncJobs(String instanceType, Long accountId);
 +	
 +	AsyncJobVO findPseudoJob(long threadId, long msid);
 +	void cleanupPseduoJobs(long msid);
 +	
 +	List<AsyncJobVO> getExpiredJobs(Date cutTime, int limit);
++	List<AsyncJobVO> getExpiredUnfinishedJobs(Date cutTime, int limit);
 +	void resetJobProcess(long msid, int jobResultCode, String jobResultMessage);
++	List<AsyncJobVO> getExpiredCompletedJobs(Date cutTime, int limit);
 +}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bdddd07/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java
----------------------------------------------------------------------
diff --cc framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java
index 9559b9c,0000000..276323c
mode 100644,000000..100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/dao/AsyncJobDaoImpl.java
@@@ -1,156 -1,0 +1,197 @@@
 +// 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.dao;
 +
 +import java.sql.PreparedStatement;
 +import java.sql.SQLException;
 +import java.util.Date;
 +import java.util.List;
 +
 +import org.apache.log4j.Logger;
 +
 +import org.apache.cloudstack.framework.jobs.AsyncJobConstants;
 +import org.apache.cloudstack.framework.jobs.AsyncJobVO;
 +
 +import com.cloud.utils.db.DB;
 +import com.cloud.utils.db.Filter;
 +import com.cloud.utils.db.GenericDaoBase;
 +import com.cloud.utils.db.SearchBuilder;
 +import com.cloud.utils.db.SearchCriteria;
- import com.cloud.utils.db.Transaction;
 +import com.cloud.utils.db.SearchCriteria.Op;
++import com.cloud.utils.db.Transaction;
 +
 +public class AsyncJobDaoImpl extends GenericDaoBase<AsyncJobVO, Long> implements AsyncJobDao {
 +    private static final Logger s_logger = Logger.getLogger(AsyncJobDaoImpl.class.getName());
 +	
- 	private final SearchBuilder<AsyncJobVO> pendingAsyncJobSearch;	
- 	private final SearchBuilder<AsyncJobVO> pendingAsyncJobsSearch;	
- 	private final SearchBuilder<AsyncJobVO> expiringAsyncJobSearch;	
++	private final SearchBuilder<AsyncJobVO> pendingAsyncJobSearch;
++	private final SearchBuilder<AsyncJobVO> pendingAsyncJobsSearch;
++    private final SearchBuilder<AsyncJobVO> expiringAsyncJobSearch;
 +	private final SearchBuilder<AsyncJobVO> pseudoJobSearch;
 +	private final SearchBuilder<AsyncJobVO> pseudoJobCleanupSearch;
++	private final SearchBuilder<AsyncJobVO> expiringUnfinishedAsyncJobSearch;
++	private final SearchBuilder<AsyncJobVO> expiringCompletedAsyncJobSearch;
++
 +	
 +	public AsyncJobDaoImpl() {
 +		pendingAsyncJobSearch = createSearchBuilder();
- 		pendingAsyncJobSearch.and("instanceType", pendingAsyncJobSearch.entity().getInstanceType(), 
++		pendingAsyncJobSearch.and("instanceType", pendingAsyncJobSearch.entity().getInstanceType(),
 +			SearchCriteria.Op.EQ);
- 		pendingAsyncJobSearch.and("instanceId", pendingAsyncJobSearch.entity().getInstanceId(), 
++		pendingAsyncJobSearch.and("instanceId", pendingAsyncJobSearch.entity().getInstanceId(),
 +			SearchCriteria.Op.EQ);
- 		pendingAsyncJobSearch.and("status", pendingAsyncJobSearch.entity().getStatus(), 
++		pendingAsyncJobSearch.and("status", pendingAsyncJobSearch.entity().getStatus(),
 +				SearchCriteria.Op.EQ);
 +		pendingAsyncJobSearch.done();
 +		
++        expiringAsyncJobSearch = createSearchBuilder();
++        expiringAsyncJobSearch.and("created", expiringAsyncJobSearch.entity().getCreated(), SearchCriteria.Op.LTEQ);
++        expiringAsyncJobSearch.done();
++
 +		pendingAsyncJobsSearch = createSearchBuilder();
- 		pendingAsyncJobsSearch.and("instanceType", pendingAsyncJobsSearch.entity().getInstanceType(), 
++		pendingAsyncJobsSearch.and("instanceType", pendingAsyncJobsSearch.entity().getInstanceType(),
 +			SearchCriteria.Op.EQ);
- 		pendingAsyncJobsSearch.and("accountId", pendingAsyncJobsSearch.entity().getAccountId(), 
++		pendingAsyncJobsSearch.and("accountId", pendingAsyncJobsSearch.entity().getAccountId(),
 +			SearchCriteria.Op.EQ);
- 		pendingAsyncJobsSearch.and("status", pendingAsyncJobsSearch.entity().getStatus(), 
++		pendingAsyncJobsSearch.and("status", pendingAsyncJobsSearch.entity().getStatus(),
 +				SearchCriteria.Op.EQ);
 +		pendingAsyncJobsSearch.done();
 +		
- 		expiringAsyncJobSearch = createSearchBuilder();
- 		expiringAsyncJobSearch.and("created", expiringAsyncJobSearch.entity().getCreated(), 
++		expiringUnfinishedAsyncJobSearch = createSearchBuilder();
++		expiringUnfinishedAsyncJobSearch.and("created", expiringUnfinishedAsyncJobSearch.entity().getCreated(),
++			SearchCriteria.Op.LTEQ);
++		expiringUnfinishedAsyncJobSearch.and("completeMsId", expiringUnfinishedAsyncJobSearch.entity().getCompleteMsid(), SearchCriteria.Op.NULL);
++		expiringUnfinishedAsyncJobSearch.and("jobStatus", expiringUnfinishedAsyncJobSearch.entity().getStatus(), SearchCriteria.Op.EQ);
++		expiringUnfinishedAsyncJobSearch.done();
++		
++		expiringCompletedAsyncJobSearch = createSearchBuilder();
++		expiringCompletedAsyncJobSearch.and("created", expiringCompletedAsyncJobSearch.entity().getCreated(),
 +			SearchCriteria.Op.LTEQ);
- 		expiringAsyncJobSearch.done();
++        expiringCompletedAsyncJobSearch.and("completeMsId", expiringCompletedAsyncJobSearch.entity().getCompleteMsid(), SearchCriteria.Op.NNULL);
++        expiringCompletedAsyncJobSearch.and("jobStatus", expiringCompletedAsyncJobSearch.entity().getStatus(), SearchCriteria.Op.NEQ);
++        expiringCompletedAsyncJobSearch.done();
 +		
 +		pseudoJobSearch = createSearchBuilder();
 +		pseudoJobSearch.and("jobDispatcher", pseudoJobSearch.entity().getDispatcher(), Op.EQ);
 +		pseudoJobSearch.and("instanceType", pseudoJobSearch.entity().getInstanceType(), Op.EQ);
 +		pseudoJobSearch.and("instanceId", pseudoJobSearch.entity().getInstanceId(), Op.EQ);
 +		pseudoJobSearch.done();
 +		
 +		pseudoJobCleanupSearch = createSearchBuilder();
 +		pseudoJobCleanupSearch.and("initMsid", pseudoJobCleanupSearch.entity().getInitMsid(), Op.EQ);
 +		pseudoJobCleanupSearch.done();
++		
 +	}
 +	
- 	public AsyncJobVO findInstancePendingAsyncJob(String instanceType, long instanceId) {
++	@Override
++    public AsyncJobVO findInstancePendingAsyncJob(String instanceType, long instanceId) {
 +        SearchCriteria<AsyncJobVO> sc = pendingAsyncJobSearch.create();
 +        sc.setParameters("instanceType", instanceType);
 +        sc.setParameters("instanceId", instanceId);
 +        sc.setParameters("status", AsyncJobConstants.STATUS_IN_PROGRESS);
 +        
 +        List<AsyncJobVO> l = listIncludingRemovedBy(sc);
 +        if(l != null && l.size() > 0) {
 +        	if(l.size() > 1) {
 +        		s_logger.warn("Instance " + instanceType + "-" + instanceId + " has multiple pending async-job");
 +        	}
 +        	
 +        	return l.get(0);
 +        }
 +        return null;
 +	}
 +	
- 	public List<AsyncJobVO> findInstancePendingAsyncJobs(String instanceType, Long accountId) {
++	@Override
++    public List<AsyncJobVO> findInstancePendingAsyncJobs(String instanceType, Long accountId) {
 +		SearchCriteria<AsyncJobVO> sc = pendingAsyncJobsSearch.create();
 +        sc.setParameters("instanceType", instanceType);
 +        
 +        if (accountId != null) {
 +            sc.setParameters("accountId", accountId);
 +        }
 +        sc.setParameters("status", AsyncJobConstants.STATUS_IN_PROGRESS);
 +        
 +        return listBy(sc);
 +	}
 +	
- 	public AsyncJobVO findPseudoJob(long threadId, long msid) {
++	@Override
++    public AsyncJobVO findPseudoJob(long threadId, long msid) {
 +		SearchCriteria<AsyncJobVO> sc = pseudoJobSearch.create();
 +		sc.setParameters("jobDispatcher", AsyncJobConstants.JOB_DISPATCHER_PSEUDO);
 +		sc.setParameters("instanceType", AsyncJobConstants.PSEUDO_JOB_INSTANCE_TYPE);
 +		sc.setParameters("instanceId", threadId);
 +		
 +		List<AsyncJobVO> result = listBy(sc);
 +		if(result != null && result.size() > 0) {
 +			assert(result.size() == 1);
 +			return result.get(0);
 +		}
 +		
 +		return null;
 +	}
 +	
- 	public void cleanupPseduoJobs(long msid) {
++	@Override
++    public void cleanupPseduoJobs(long msid) {
 +		SearchCriteria<AsyncJobVO> sc = pseudoJobCleanupSearch.create();
 +		sc.setParameters("initMsid", msid);
 +		this.expunge(sc);
 +	}
 +	
- 	public List<AsyncJobVO> getExpiredJobs(Date cutTime, int limit) {
- 		SearchCriteria<AsyncJobVO> sc = expiringAsyncJobSearch.create();
++    @Override
++    public List<AsyncJobVO> getExpiredJobs(Date cutTime, int limit) {
++        SearchCriteria<AsyncJobVO> sc = expiringAsyncJobSearch.create();
++        sc.setParameters("created", cutTime);
++        Filter filter = new Filter(AsyncJobVO.class, "created", true, 0L, (long)limit);
++        return listIncludingRemovedBy(sc, filter);
++    }
++    
++    @Override
++	public List<AsyncJobVO> getExpiredUnfinishedJobs(Date cutTime, int limit) {
++		SearchCriteria<AsyncJobVO> sc = expiringUnfinishedAsyncJobSearch.create();
++		sc.setParameters("created", cutTime);
++		sc.setParameters("jobStatus", 0);
++		Filter filter = new Filter(AsyncJobVO.class, "created", true, 0L, (long)limit);
++		return listIncludingRemovedBy(sc, filter);
++	}
++	
++	@Override
++	public List<AsyncJobVO> getExpiredCompletedJobs(Date cutTime, int limit) {
++		SearchCriteria<AsyncJobVO> sc = expiringCompletedAsyncJobSearch.create();
 +		sc.setParameters("created", cutTime);
++		sc.setParameters("jobStatus", 0);
 +		Filter filter = new Filter(AsyncJobVO.class, "created", true, 0L, (long)limit);
 +		return listIncludingRemovedBy(sc, filter);
 +	}
 +
- 	@DB
++	@Override
++    @DB
 +	public void resetJobProcess(long msid, int jobResultCode, String jobResultMessage) {
- 		String sql = "UPDATE async_job SET job_status=" + AsyncJobConstants.STATUS_FAILED + ", job_result_code=" + jobResultCode 
++		String sql = "UPDATE async_job SET job_status=" + AsyncJobConstants.STATUS_FAILED + ", job_result_code=" + jobResultCode
 +			+ ", job_result='" + jobResultMessage + "' where job_status=0 AND (job_complete_msid=? OR (job_complete_msid IS NULL AND job_init_msid=?))";
 +		
 +        Transaction txn = Transaction.currentTxn();
 +        PreparedStatement pstmt = null;
 +        try {
 +            pstmt = txn.prepareAutoCloseStatement(sql);
 +            pstmt.setLong(1, msid);
 +            pstmt.setLong(2, msid);
 +            pstmt.execute();
 +        } catch (SQLException e) {
 +        	s_logger.warn("Unable to reset job status for management server " + msid, e);
 +        } catch (Throwable e) {
 +        	s_logger.warn("Unable to reset job status for management server " + msid, e);
 +        }
 +	}
 +}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bdddd07/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
----------------------------------------------------------------------
diff --cc plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index f235219,f979cfe..f30505d
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@@ -39,11 -39,11 +39,11 @@@ import java.util.Collections
  import java.util.Comparator;
  import java.util.Date;
  import java.util.HashMap;
++import java.util.HashSet;
  import java.util.List;
  import java.util.Map;
--import java.util.Set;
--import java.util.HashSet;
  import java.util.Properties;
++import java.util.Set;
  import java.util.UUID;
  import java.util.concurrent.ConcurrentHashMap;
  import java.util.concurrent.ExecutionException;
@@@ -57,10 -57,10 +57,6 @@@ import javax.ejb.Local
  import javax.naming.ConfigurationException;
  
  import org.apache.log4j.Logger;
--import org.apache.cloudstack.utils.qemu.QemuImg.PhysicalDiskFormat;
--import org.apache.cloudstack.utils.qemu.QemuImg;
--import org.apache.cloudstack.utils.qemu.QemuImgFile;
--import org.apache.cloudstack.utils.qemu.QemuImgException;
  import org.libvirt.Connect;
  import org.libvirt.Domain;
  import org.libvirt.DomainInfo;
@@@ -69,6 -69,6 +65,11 @@@ import org.libvirt.DomainSnapshot
  import org.libvirt.LibvirtException;
  import org.libvirt.NodeInfo;
  
++import org.apache.cloudstack.utils.qemu.QemuImg;
++import org.apache.cloudstack.utils.qemu.QemuImg.PhysicalDiskFormat;
++import org.apache.cloudstack.utils.qemu.QemuImgException;
++import org.apache.cloudstack.utils.qemu.QemuImgFile;
++
  import com.cloud.agent.api.Answer;
  import com.cloud.agent.api.AttachIsoCommand;
  import com.cloud.agent.api.AttachVolumeAnswer;
@@@ -167,8 -167,8 +168,8 @@@ import com.cloud.agent.api.storage.Crea
  import com.cloud.agent.api.storage.DestroyCommand;
  import com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer;
  import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
--import com.cloud.agent.api.storage.ResizeVolumeCommand;
  import com.cloud.agent.api.storage.ResizeVolumeAnswer;
++import com.cloud.agent.api.storage.ResizeVolumeCommand;
  import com.cloud.agent.api.to.IpAddressTO;
  import com.cloud.agent.api.to.NicTO;
  import com.cloud.agent.api.to.StorageFilerTO;
@@@ -195,8 -195,8 +196,8 @@@ import com.cloud.hypervisor.kvm.resourc
  import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef;
  import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef.hostNicType;
  import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.SerialDef;
--import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.VirtioSerialDef;
  import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.TermPolicy;
++import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.VirtioSerialDef;
  import com.cloud.hypervisor.kvm.storage.KVMPhysicalDisk;
  import com.cloud.hypervisor.kvm.storage.KVMStoragePool;
  import com.cloud.hypervisor.kvm.storage.KVMStoragePoolManager;
@@@ -218,9 -218,9 +219,9 @@@ import com.cloud.storage.template.Proce
  import com.cloud.storage.template.QCOW2Processor;
  import com.cloud.storage.template.TemplateInfo;
  import com.cloud.storage.template.TemplateLocation;
++import com.cloud.utils.FileUtil;
  import com.cloud.utils.NumbersUtil;
  import com.cloud.utils.Pair;
--import com.cloud.utils.FileUtil;
  import com.cloud.utils.PropertiesUtil;
  import com.cloud.utils.exception.CloudRuntimeException;
  import com.cloud.utils.net.NetUtils;
@@@ -985,7 -984,7 +986,7 @@@ ServerResource 
  
          if (! f.isDirectory()){
              s_logger.debug("failing to get physical interface from bridge"
--                           + bridgeName + ", does " + f.getAbsolutePath() 
++                           + bridgeName + ", does " + f.getAbsolutePath()
                             + "exist?");
              return "";
          }
@@@ -1055,7 -1054,7 +1056,7 @@@
          return vnetId;
      }
  
--    private void passCmdLine(String vmName, String cmdLine) 
++    private void passCmdLine(String vmName, String cmdLine)
              throws InternalErrorException {
          final Script command = new Script(_patchViaSocketPath, _timeout, s_logger);
          String result;
@@@ -1363,7 -1369,7 +1371,7 @@@
              disksize = dskch.getSize();
  
              if (cmd.getTemplateUrl() != null) {
--                if(primaryPool.getType() == StoragePoolType.CLVM) { 
++                if(primaryPool.getType() == StoragePoolType.CLVM) {
                      vol = templateToPrimaryDownload(cmd.getTemplateUrl(),primaryPool);
                  } else {
                      BaseVol = primaryPool.getPhysicalDisk(cmd.getTemplateUrl());
@@@ -1452,7 -1458,7 +1460,7 @@@
          return null;
      }
  
--    /* uses a local script now, eventually support for virStorageVolResize() will maybe work on 
++    /* uses a local script now, eventually support for virStorageVolResize() will maybe work on
         qcow2 and lvm and we can do this in libvirt calls */
      public Answer execute(ResizeVolumeCommand cmd) {
          String volid = cmd.getPath();
@@@ -1469,16 -1475,16 +1477,16 @@@
              String type = getResizeScriptType(pool, vol);
  
              if (type == null) {
--                return new ResizeVolumeAnswer(cmd, false, "Unsupported volume format: pool type '" 
++                return new ResizeVolumeAnswer(cmd, false, "Unsupported volume format: pool type '"
                                  + pool.getType() + "' and volume format '" + vol.getFormat() + "'");
              } else if (type.equals("QCOW2") && shrinkOk) {
                  return new ResizeVolumeAnswer(cmd, false, "Unable to shrink volumes of type " + type);
              }
  
--            s_logger.debug("got to the stage where we execute the volume resize, params:" 
++            s_logger.debug("got to the stage where we execute the volume resize, params:"
                             + path + "," + currentSize + "," + newSize + "," + type + "," + vmInstanceName + "," + shrinkOk);
              final Script resizecmd = new Script(_resizeVolumePath,
--                        _cmdsTimeout, s_logger); 
++                        _cmdsTimeout, s_logger);
              resizecmd.add("-s",String.valueOf(newSize));
              resizecmd.add("-c",String.valueOf(currentSize));
              resizecmd.add("-p",path);
@@@ -1503,7 -1509,7 +1511,7 @@@
              return new ResizeVolumeAnswer(cmd, false, error);
          }
          
--    } 
++    }
  
      public Answer execute(DestroyCommand cmd) {
          VolumeTO vol = cmd.getVolume();
@@@ -1529,7 -1535,7 +1537,7 @@@
          if(pifparts.length == 2) {
              return pifparts[1];
          } else {
--            s_logger.debug("failed to get vlan id from bridge " + brName 
++            s_logger.debug("failed to get vlan id from bridge " + brName
                             + "attached to physical interface" + pif);
              return "";
          }
@@@ -1771,7 -1777,7 +1779,7 @@@
              for (InterfaceDef pluggedNic : pluggedNics) {
                  String pluggedVlanBr = pluggedNic.getBrName();
                  String pluggedVlanId = getVlanIdFromBridge(pluggedVlanBr);
--                if (pubVlan.equalsIgnoreCase(Vlan.UNTAGGED) 
++                if (pubVlan.equalsIgnoreCase(Vlan.UNTAGGED)
                          && pluggedVlanBr.equalsIgnoreCase(_publicBridgeName)) {
                      break;
                  } else if (pluggedVlanBr.equalsIgnoreCase(_linkLocalBridgeName)){
@@@ -1818,7 -1824,7 +1826,7 @@@
              for (InterfaceDef pluggedNic : pluggedNics) {
                  String pluggedVlan = pluggedNic.getBrName();
                  if (pluggedVlan.equalsIgnoreCase(_linkLocalBridgeName)) {
--                    vlanToNicNum.put("LinkLocal",devNum); 
++                    vlanToNicNum.put("LinkLocal",devNum);
                  } else if (pluggedVlan.equalsIgnoreCase(_publicBridgeName)
                          || pluggedVlan.equalsIgnoreCase(_privBridgeName)
                          || pluggedVlan.equalsIgnoreCase(_guestBridgeName)) {
@@@ -1864,8 -1870,8 +1872,8 @@@
                  if (nic.getBrName().equalsIgnoreCase(_linkLocalBridgeName)) {
                      vlanAllocatedToVM.put("LinkLocal", nicPos);
                  } else {
--                    if (nic.getBrName().equalsIgnoreCase(_publicBridgeName) 
--                            || nic.getBrName().equalsIgnoreCase(_privBridgeName) 
++                    if (nic.getBrName().equalsIgnoreCase(_publicBridgeName)
++                            || nic.getBrName().equalsIgnoreCase(_privBridgeName)
                              || nic.getBrName().equalsIgnoreCase(_guestBridgeName)) {
                          vlanAllocatedToVM.put(Vlan.UNTAGGED, nicPos);
                      } else {
@@@ -2620,9 -2626,8 +2628,11 @@@
          Domain vms = null;
          while (retry-- > 0) {
              try {
 -                vms = conn.domainLookupByName(vmName);
 -                State s = convertToState(vms.getInfo().state);
 +                vms = conn.domainLookupByUUID(UUID.nameUUIDFromBytes(vmName
 +                        .getBytes()));
 +                PowerState s = convertToState(vms.getInfo().state);
++//                vms = conn.domainLookupByName(vmName);
++//                State s = convertToState(vms.getInfo().state);
                  return s;
              } catch (final LibvirtException e) {
                  s_logger.warn("Can't get vm state " + vmName + e.getMessage()
@@@ -3186,8 -3192,8 +3197,8 @@@
  
          if (vmTO.getMinRam() != vmTO.getMaxRam()){
              grd.setMemBalloning(true);
--            grd.setCurrentMem((long)vmTO.getMinRam()/1024);
--            grd.setMemorySize((long)vmTO.getMaxRam()/1024);
++            grd.setCurrentMem(vmTO.getMinRam()/1024);
++            grd.setMemorySize(vmTO.getMaxRam()/1024);
          }
          else{
              grd.setMemorySize(vmTO.getMaxRam() / 1024);
@@@ -3946,23 -3939,27 +3953,27 @@@
          return la;
      }
  
 -    private HashMap<String, State> getAllVms() {
 -        final HashMap<String, State> vmStates = new HashMap<String, State>();
 +    private HashMap<String, PowerState> getAllVms() {
 +        final HashMap<String, PowerState> vmStates = new HashMap<String, PowerState>();
          Connect conn = null;
  
+         if (_hypervisorType == HypervisorType.LXC) {
 -            try {
 -                conn = LibvirtConnection.getConnectionByType(HypervisorType.LXC.toString());
 -                vmStates.putAll(getAllVms(conn));
 -            } catch (LibvirtException e) {
 -                s_logger.debug("Failed to get connection: " + e.getMessage());
 -            }
 +        try {
 +            conn = LibvirtConnection.getConnectionByType(HypervisorType.LXC.toString());
 +            vmStates.putAll(getAllVms(conn));
 +        } catch (LibvirtException e) {
 +            s_logger.debug("Failed to get connection: " + e.getMessage());
 +        }
+         }
  
+         if (_hypervisorType == HypervisorType.KVM) {
 -            try {
 -                conn = LibvirtConnection.getConnectionByType(HypervisorType.KVM.toString());
 -                vmStates.putAll(getAllVms(conn));
 -            } catch (LibvirtException e) {
 -                s_logger.debug("Failed to get connection: " + e.getMessage());
 -            }
 +        try {
 +            conn = LibvirtConnection.getConnectionByType(HypervisorType.KVM.toString());
 +            vmStates.putAll(getAllVms(conn));
 +        } catch (LibvirtException e) {
 +            s_logger.debug("Failed to get connection: " + e.getMessage());
 +        }
+         }
  
          return vmStates;
      }
@@@ -4015,11 -4012,10 +4026,10 @@@
          for (int i = 0; i < vms.length; i++) {
              try {
  
-                 dm = conn.domainLookupByUUID(UUID.nameUUIDFromBytes(vms[i]
-                         .getBytes()));
+                 dm = conn.domainLookupByName(vms[i]);
  
                  DomainInfo.DomainState ps = dm.getInfo().state;
 -                final State state = convertToState(ps);
 +                final PowerState state = convertToState(ps);
                  String vmName = dm.getName();
                  s_logger.trace("VM " + vmName + ": powerstate = " + ps
                          + "; vm state=" + state.toString());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bdddd07/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bdddd07/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java
----------------------------------------------------------------------
diff --cc plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java
index 4d21ad2,9118bad..799e449
--- a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java
+++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java
@@@ -148,7 -150,9 +150,9 @@@ public class CiscoVnmcElement extends A
      PhysicalNetworkDao _physicalNetworkDao;
      @Inject
      PhysicalNetworkServiceProviderDao _physicalNetworkServiceProviderDao;
 -    @Inject
 +    @Inject 
+     IPAddressDao _ipAddressDao;
+     @Inject
      HostDetailsDao _hostDetailsDao;
      @Inject
      HostDao _hostDao;
@@@ -342,23 -346,34 +346,34 @@@
              }
  
              // due to VNMC limitation of not allowing source NAT ip as the outside ip of firewall,
-             // an additional public ip needs to acquired for assigning as firewall outside ip
+             // an additional public ip needs to acquired for assigning as firewall outside ip.
+             // In case there are already additional ip addresses available (network restart) use one
+             // of them such that it is not the source NAT ip
              IpAddress outsideIp = null;
+             List<IPAddressVO> publicIps = _ipAddressDao.listByAssociatedNetwork(network.getId(), null);
+             for (IPAddressVO ip : publicIps) {
+                 if (!ip.isSourceNat()) {
+                     outsideIp = ip;
+                     break;
+                 }
+             }
+             if (outsideIp == null) { // none available, acquire one
 -                try {
 -                    Account caller = UserContext.current().getCaller();
 -                    long callerUserId = UserContext.current().getCallerUserId();
 -                    outsideIp = _networkMgr.allocateIp(owner, false, caller, callerUserId, zone);
 -                } catch (ResourceAllocationException e) {
 -                    s_logger.error("Unable to allocate additional public Ip address. Exception details " + e);
 -                    return false;
 -                }
 +            try {
 +                Account caller = UserContext.current().getCaller();
 +                long callerUserId = UserContext.current().getCallerUserId();
 +                outsideIp = _networkMgr.allocateIp(owner, false, caller, callerUserId, zone);
 +            } catch (ResourceAllocationException e) {
 +                s_logger.error("Unable to allocate additional public Ip address. Exception details " + e);
 +                return false;
 +            }
  
 -                try {
 -                    outsideIp = _networkMgr.associateIPToGuestNetwork(outsideIp.getId(), network.getId(), true);
 -                } catch (ResourceAllocationException e) {
 -                    s_logger.error("Unable to assign allocated additional public Ip " + outsideIp.getAddress().addr() + " to network with vlan " + vlanId + ". Exception details " + e);
 -                    return false;
 -                }
 +            try {
 +                outsideIp = _networkMgr.associateIPToGuestNetwork(outsideIp.getId(), network.getId(), true);
 +            } catch (ResourceAllocationException e) {
 +                s_logger.error("Unable to assign allocated additional public Ip " + outsideIp.getAddress().addr() + " to network with vlan " + vlanId + ". Exception details " + e);
 +                return false;
 +            }
+             }
  
              // create logical edge firewall in VNMC
              String gatewayNetmask = NetUtils.getCidrNetmask(network.getCidr());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bdddd07/plugins/network-elements/juniper-srx/src/com/cloud/network/element/JuniperSRXExternalFirewallElement.java
----------------------------------------------------------------------


Mime
View raw message