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 f737019
Date Mon, 01 Jul 2013 21:25:33 GMT
Another merge from master.  This is just getting laborious


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

Branch: refs/heads/vmsync
Commit: 57bafc8fe9be49831416244751c959dd1194330f
Parents: 1f5c672 16b7509
Author: Alex Huang <alex.huang@gmail.com>
Authored: Mon Jul 1 11:29:57 2013 -0700
Committer: Alex Huang <alex.huang@gmail.com>
Committed: Mon Jul 1 11:29:57 2013 -0700

----------------------------------------------------------------------
 agent/src/com/cloud/agent/VmmAgentShell.java    | 504 ----------
 api/src/com/cloud/agent/api/to/DiskTO.java      |  12 +-
 .../com/cloud/agent/api/to/FirewallRuleTO.java  |   6 +
 api/src/com/cloud/network/NetworkModel.java     |   2 +
 api/src/com/cloud/offering/DiskOffering.java    |  16 +-
 api/src/com/cloud/storage/Storage.java          |   1 +
 api/src/com/cloud/storage/StoragePool.java      |   2 +
 api/src/com/cloud/storage/Volume.java           |   6 +
 .../org/apache/cloudstack/api/ApiConstants.java |   6 +
 .../admin/offering/CreateDiskOfferingCmd.java   |  27 +-
 .../admin/storage/CreateStoragePoolCmd.java     |  24 +
 .../user/template/RegisterTemplateCmd.java      |   2 +-
 .../command/user/volume/CreateVolumeCmd.java    |  14 +
 .../api/response/DiskOfferingResponse.java      |  33 +
 .../api/response/StoragePoolResponse.java       |  11 +
 .../api/response/TemplateZoneResponse.java      |  53 +-
 .../cloudstack/api/response/VolumeResponse.java |  16 +
 .../bridge/service/core/ec2/EC2Engine.java      |  18 +-
 .../classes/resources/messages.properties       |   7 +-
 client/pom.xml                                  |  12 +-
 client/tomcatconf/applicationContext.xml.in     | 161 ++-
 client/tomcatconf/commands.properties.in        |   6 +
 client/tomcatconf/componentContext.xml.in       |  40 +-
 client/tomcatconf/nonossComponentContext.xml.in |  41 +-
 .../tomcatconf/simulatorComponentContext.xml.in |  52 +-
 .../com/cloud/agent/api/AttachVolumeAnswer.java |  16 +-
 .../cloud/agent/api/AttachVolumeCommand.java    | 114 ++-
 .../hyperv/resource/HypervResource.java         | 979 -------------------
 .../storage/resource/StorageProcessor.java      |   2 +-
 .../StorageSubsystemCommandHandlerBase.java     |   2 +-
 .../api/agent/test/AttachVolumeAnswerTest.java  |   6 +-
 .../api/agent/test/AttachVolumeCommandTest.java |  10 +-
 .../agent/test/BackupSnapshotCommandTest.java   |   5 +
 .../api/agent/test/CheckNetworkAnswerTest.java  |   5 +
 .../api/agent/test/SnapshotCommandTest.java     |   4 +
 developer/pom.xml                               |   6 +
 docs/en-US/attaching-volume.xml                 |  57 +-
 docs/en-US/creating-a-plugin.xml                |  29 +
 docs/en-US/creating-my-first-plugin.xml         | 216 ++++
 docs/en-US/creating-new-volumes.xml             |  99 +-
 docs/en-US/detach-move-volumes.xml              |  58 +-
 docs/en-US/networks.xml                         |   1 +
 docs/en-US/plugin-development.xml               |  28 +
 docs/en-US/portable-ip.xml                      |  40 +-
 docs/en-US/storage.xml                          |  15 +-
 docs/en-US/upload-existing-volume-to-vm.xml     | 129 ++-
 docs/en-US/vm-storage-migration.xml             |  27 +-
 .../volume-deletion-garbage-collection.xml      |  29 +-
 docs/en-US/working-with-volumes.xml             |  51 +-
 docs/qig/en-US/Author_Group.xml                 |  32 +
 docs/qig/en-US/Book_Info.xml                    |  52 +
 docs/qig/en-US/Chapter.xml                      |  53 +
 docs/qig/en-US/Environment.xml                  | 258 +++++
 docs/qig/en-US/Management.xml                   |  99 ++
 docs/qig/en-US/Overview.xml                     |  93 ++
 docs/qig/en-US/Preface.xml                      |  33 +
 docs/qig/en-US/Revision_History.xml             |  42 +
 docs/qig/en-US/config.xml                       | 177 ++++
 docs/qig/en-US/kvm.xml                          | 142 +++
 docs/qig/en-US/qig.ent                          |  22 +
 docs/qig/en-US/qig.xml                          |  36 +
 .../engine/subsystem/api/storage/ChapInfo.java  |  26 +
 .../subsystem/api/storage/DataStoreDriver.java  |  14 +-
 .../api/storage/PrimaryDataStoreDriver.java     |   6 +-
 .../api/storage/PrimaryDataStoreParameters.java |  50 +
 .../subsystem/api/storage/VolumeService.java    |   2 +
 .../storage/command/AttachCommand.java          |  71 ++
 .../storage/command/DettachCommand.java         |  17 +
 .../storage/datastore/db/StoragePoolVO.java     |  26 +-
 .../src/com/cloud/storage/VolumeManager.java    |   1 -
 engine/schema/src/com/cloud/dc/VlanVO.java      |   4 +
 .../src/com/cloud/network/dao/IPAddressDao.java |   6 +
 .../com/cloud/network/dao/IPAddressDaoImpl.java |  23 +
 .../com/cloud/network/dao/NetworkDaoImpl.java   |   5 +
 .../src/com/cloud/storage/DiskOfferingVO.java   |  46 +-
 .../schema/src/com/cloud/storage/VolumeVO.java  |  57 +-
 .../cloud/storage/dao/VMTemplateDaoImpl.java    |  17 +-
 .../src/com/cloud/storage/dao/VolumeDao.java    |   2 +
 .../com/cloud/storage/dao/VolumeDaoImpl.java    |  13 +
 .../com/cloud/upgrade/dao/Upgrade2214to30.java  |   4 +-
 .../cache/manager/StorageCacheManagerImpl.java  |   8 +-
 .../motion/AncientDataMotionStrategy.java       |  53 +-
 .../storage/motion/DataMotionServiceImpl.java   |  18 +-
 .../storage/image/TemplateServiceImpl.java      |  11 +-
 .../storage/image/store/ImageStoreImpl.java     |   2 +-
 .../storage/allocator/StorageAllocatorTest.java |   3 +-
 .../cloudstack/storage/test/SnapshotTest.java   |   2 +-
 .../cloudstack/storage/test/VolumeTest.java     |   2 +-
 .../storage/test/VolumeTestVmware.java          |   2 +-
 .../storage/test/volumeServiceTest.java         |   2 +-
 .../test/resource/component.xml                 |   9 -
 .../test/resource/storageContext.xml            |   3 +-
 .../storage/snapshot/SnapshotServiceImpl.java   |  10 +-
 .../allocator/ZoneWideStoragePoolAllocator.java |  25 +-
 .../datastore/DataObjectManagerImpl.java        |  12 +-
 .../storage/datastore/DataStoreManagerImpl.java |  29 +-
 .../datastore/PrimaryDataStoreEntityImpl.java   |   6 +
 .../provider/DataStoreProviderManagerImpl.java  |  36 +-
 .../storage/image/BaseImageStoreDriverImpl.java |  49 +-
 .../datastore/PrimaryDataStoreHelper.java       |   5 +
 .../storage/datastore/PrimaryDataStoreImpl.java |   5 +
 .../cloudstack/storage/volume/VolumeObject.java |  15 +
 .../storage/volume/VolumeServiceImpl.java       | 103 +-
 .../framework/async/AsyncRpcConext.java         |  30 -
 .../framework/async/AsyncRpcContext.java        |  30 +
 .../AsyncSampleEventDrivenStyleCaller.java      |   4 +-
 packaging/centos63/cloud.spec                   |   1 +
 .../kvm/resource/LibvirtComputingResource.java  |  28 +-
 .../kvm/storage/KVMStorageProcessor.java        |   2 +-
 .../resource/LibvirtComputingResourceTest.java  |  14 +
 .../agent/manager/MockAgentManagerImpl.java     |  42 +-
 .../agent/manager/MockStorageManagerImpl.java   |  17 +-
 .../resource/SimulatorStorageProcessor.java     |   2 +-
 .../com/cloud/ucs/manager/AddUcsManagerCmd.java | 126 ---
 .../manager/AssociateUcsProfileToBladeCmd.java  |  96 --
 .../com/cloud/ucs/manager/ListUcsBladeCmd.java  |  87 --
 .../cloud/ucs/manager/ListUcsManagerCmd.java    |  88 --
 .../cloud/ucs/manager/ListUcsProfileCmd.java    |  81 --
 .../com/cloud/ucs/manager/UcsBladeResponse.java |  84 --
 .../src/com/cloud/ucs/manager/UcsManager.java   |   8 +
 .../com/cloud/ucs/manager/UcsManagerImpl.java   |   8 +
 .../cloud/ucs/manager/UcsManagerResponse.java   |  73 --
 .../cloud/ucs/manager/UcsProfileResponse.java   |  37 -
 .../apache/cloudstack/api/AddUcsManagerCmd.java | 128 +++
 .../api/AssociateUcsProfileToBladeCmd.java      |  99 ++
 .../apache/cloudstack/api/ListUcsBladeCmd.java  |  90 ++
 .../cloudstack/api/ListUcsManagerCmd.java       |  90 ++
 .../cloudstack/api/ListUcsProfileCmd.java       |  84 ++
 .../api/response/UcsBladeResponse.java          |  84 ++
 .../api/response/UcsManagerResponse.java        |  73 ++
 .../api/response/UcsProfileResponse.java        |  37 +
 .../manager/VmwareStorageManagerImpl.java       |  16 +-
 .../vmware/resource/VmwareResource.java         | 283 +++++-
 .../resource/VmwareStorageProcessor.java        |   2 +-
 .../motion/VmwareStorageMotionStrategyTest.java |   4 +-
 .../xen/resource/CitrixResourceBase.java        | 392 ++++----
 .../xen/resource/XenServerStorageProcessor.java |  89 +-
 .../resources/components-example.xml            |   2 -
 .../network/resource/NetscalerResource.java     | 121 ++-
 .../src/com/cloud/api/commands/AddSspCmd.java   | 139 ---
 .../com/cloud/api/commands/DeleteSspCmd.java    |  75 --
 .../src/com/cloud/api/response/SspResponse.java |  77 --
 .../com/cloud/network/dao/SspCredentialDao.java |  33 -
 .../cloud/network/dao/SspCredentialDaoImpl.java |  42 -
 .../com/cloud/network/dao/SspCredentialVO.java  |  67 --
 .../src/com/cloud/network/dao/SspTenantDao.java |  34 -
 .../com/cloud/network/dao/SspTenantDaoImpl.java |  48 -
 .../src/com/cloud/network/dao/SspTenantVO.java  |  55 --
 .../src/com/cloud/network/dao/SspUuidDao.java   |  36 -
 .../com/cloud/network/dao/SspUuidDaoImpl.java   | 116 ---
 .../src/com/cloud/network/dao/SspUuidVO.java    |  73 --
 .../com/cloud/network/element/SspClient.java    | 272 ------
 .../com/cloud/network/element/SspElement.java   | 620 ------------
 .../com/cloud/network/element/SspManager.java   |  71 --
 .../com/cloud/network/element/SspService.java   |  46 -
 .../cloud/network/guru/SspGuestNetworkGuru.java | 170 ----
 .../cloudstack/api/commands/AddSspCmd.java      | 139 +++
 .../cloudstack/api/commands/DeleteSspCmd.java   |  75 ++
 .../cloudstack/api/response/SspResponse.java    |  77 ++
 .../network/dao/SspCredentialDao.java           |  33 +
 .../network/dao/SspCredentialDaoImpl.java       |  42 +
 .../cloudstack/network/dao/SspCredentialVO.java |  67 ++
 .../cloudstack/network/dao/SspTenantDao.java    |  34 +
 .../network/dao/SspTenantDaoImpl.java           |  48 +
 .../cloudstack/network/dao/SspTenantVO.java     |  55 ++
 .../cloudstack/network/dao/SspUuidDao.java      |  36 +
 .../cloudstack/network/dao/SspUuidDaoImpl.java  | 116 +++
 .../cloudstack/network/dao/SspUuidVO.java       |  73 ++
 .../cloudstack/network/element/SspClient.java   | 272 ++++++
 .../cloudstack/network/element/SspElement.java  | 622 ++++++++++++
 .../cloudstack/network/element/SspManager.java  |  71 ++
 .../cloudstack/network/element/SspService.java  |  47 +
 .../network/guru/SspGuestNetworkGuru.java       | 172 ++++
 .../cloud/network/element/SspClientTest.java    |  92 --
 .../cloud/network/element/SspElementTest.java   | 152 ---
 .../network/element/SspClientTest.java          |  93 ++
 .../network/element/SspElementTest.java         | 153 +++
 plugins/pom.xml                                 |   7 +-
 .../CloudStackImageStoreLifeCycleImpl.java      |  34 +-
 .../driver/SampleImageStoreDriverImpl.java      |   2 -
 plugins/storage/image/simulator/pom.xml         |  68 ++
 .../driver/SimulatorImageStoreDriverImpl.java   | 106 ++
 .../SimulatorImageStoreLifeCycleImpl.java       | 132 +++
 .../SimulatorImageStoreProviderImpl.java        |  98 ++
 .../CloudStackPrimaryDataStoreDriverImpl.java   |   9 +-
 .../SamplePrimaryDataStoreDriverImpl.java       |  21 +-
 plugins/storage/volume/solidfire/pom.xml        |   7 +-
 .../driver/SolidfirePrimaryDataStoreDriver.java | 480 ++++++++-
 .../SolidFirePrimaryDataStoreLifeCycle.java     | 274 ++++++
 .../SolidfirePrimaryDataStoreProvider.java      |  81 +-
 .../storage/datastore/util/SolidFireUtil.java   | 917 +++++++++++++++++
 server/src/com/cloud/acl/DomainChecker.java     |   8 +-
 .../api/query/dao/DiskOfferingJoinDaoImpl.java  |   3 +
 .../api/query/dao/StoragePoolJoinDaoImpl.java   |   2 +
 .../api/query/dao/TemplateJoinDaoImpl.java      |  80 +-
 .../cloud/api/query/dao/VolumeJoinDaoImpl.java  |   3 +
 .../cloud/api/query/vo/DiskOfferingJoinVO.java  |  33 +
 .../cloud/api/query/vo/StoragePoolJoinVO.java   |  13 +-
 .../com/cloud/api/query/vo/VolumeJoinVO.java    |  21 +-
 server/src/com/cloud/configuration/Config.java  |   2 +-
 .../configuration/ConfigurationManager.java     |   6 +-
 .../configuration/ConfigurationManagerImpl.java | 194 ++--
 .../deploy/DeploymentPlanningManagerImpl.java   |  13 +
 .../com/cloud/hypervisor/guru/HypervGuru.java   |  72 --
 .../hyperv/HypervServerDiscoverer.java          | 243 -----
 .../network/ExternalDeviceUsageManager.java     |  33 +
 .../network/ExternalDeviceUsageManagerImpl.java | 673 +++++++++++++
 .../ExternalLoadBalancerUsageManager.java       |  33 -
 .../ExternalLoadBalancerUsageManagerImpl.java   | 673 -------------
 .../com/cloud/network/NetworkManagerImpl.java   |   5 +
 .../src/com/cloud/network/NetworkModelImpl.java |  21 +
 .../cloud/network/NetworkUsageManagerImpl.java  |  31 +-
 .../lb/LoadBalancingRulesManagerImpl.java       |   6 +-
 .../VirtualNetworkApplianceManagerImpl.java     |  11 +-
 .../com/cloud/resource/ResourceManagerImpl.java |   6 -
 .../cloud/server/ConfigurationServerImpl.java   |   2 +-
 .../src/com/cloud/storage/StorageManager.java   |   9 +-
 .../com/cloud/storage/StorageManagerImpl.java   | 207 ++--
 .../com/cloud/storage/VolumeManagerImpl.java    | 149 ++-
 .../secondary/SecondaryStorageManagerImpl.java  |   5 +-
 .../template/HypervisorTemplateAdapter.java     | 402 ++++----
 .../com/cloud/template/TemplateAdapterBase.java |   4 +-
 .../com/cloud/template/TemplateManagerImpl.java |   2 +-
 server/src/com/cloud/test/DatabaseConfig.java   |   2 +-
 server/src/com/cloud/vm/UserVmManagerImpl.java  |   4 +-
 .../cloudstack/region/PortableIpDaoImpl.java    |   2 +-
 .../GlobalLoadBalancingRulesServiceImpl.java    |   5 +-
 .../com/cloud/network/MockNetworkModelImpl.java |   5 +
 .../network/UpdatePhysicalNetworkTest.java      |   3 +
 .../cloud/vpc/MockConfigurationManagerImpl.java |   3 +-
 .../com/cloud/vpc/MockNetworkModelImpl.java     |   4 +
 setup/db/db/schema-410to420.sql                 |  22 +
 test/integration/component/test_accounts.py     |   2 +-
 .../component/test_advancedsg_networks.py       |   7 +-
 .../component/test_affinity_groups.py           | 135 +--
 test/integration/component/test_assign_vm.py    |   6 +-
 test/integration/component/test_ldap.py         |  11 +-
 .../component/test_netscaler_configs.py         |   8 +-
 .../component/test_shared_networks.py           |   2 +-
 .../component/test_vpc_network_lbrules.py       |   4 +-
 .../component/test_vpc_network_pfrules.py       |   4 +-
 .../component/test_vpc_network_staticnatrule.py |   4 +-
 test/integration/component/test_vpc_routers.py  |  78 +-
 ...deploy_vms_with_varied_deploymentplanners.py |  48 +-
 test/integration/smoke/test_network.py          | 175 ++--
 test/integration/smoke/test_vm_snapshots.py     | 519 +++++-----
 tools/apidoc/gen_toc.py                         |   4 +-
 tools/appliance/build.sh                        |   7 +-
 tools/marvin/marvin/cloudstackConnection.py     |   5 +-
 tools/marvin/marvin/codegenerator.py            |  10 +-
 tools/marvin/marvin/configGenerator.py          |  52 +-
 tools/marvin/marvin/deployDataCenter.py         |  38 +-
 tools/marvin/marvin/jsonHelper.py               |   4 +-
 ui/dictionary.jsp                               |   5 +
 ui/scripts/autoscaler.js                        |   2 +-
 ui/scripts/configuration.js                     | 179 +++-
 ui/scripts/docs.js                              |  16 +
 ui/scripts/sharedFunctions.js                   |   4 +-
 ui/scripts/storage.js                           |  56 +-
 ui/scripts/system.js                            |  19 +-
 utils/src/com/cloud/utils/CleanupDelegate.java  |  22 -
 utils/src/com/cloud/utils/FileUtil.java         |  41 +-
 utils/src/com/cloud/utils/StringUtils.java      |   8 +
 .../cloud/hypervisor/vmware/mo/DatastoreMO.java |   2 +-
 .../vmware/mo/HostDatastoreSystemMO.java        |  20 +-
 .../com/cloud/hypervisor/vmware/mo/HostMO.java  |  15 +-
 .../vmware/mo/HostStorageSystemMO.java          |  51 +
 .../hypervisor/vmware/mo/VirtualMachineMO.java  |  17 +
 268 files changed, 10983 insertions(+), 7582 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57bafc8f/api/src/com/cloud/agent/api/to/FirewallRuleTO.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57bafc8f/api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57bafc8f/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java
index 2b18329,f5750b9..2ee5a30
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java
@@@ -120,11 -131,23 +132,23 @@@ public class CreateStoragePoolCmd exten
      public String getStorageProviderName() {
          return this.storageProviderName;
      }
 -
 +    
      public String getScope() {
 -        return this.scope;
 +       return this.scope;
      }
  
+     public Boolean isManaged() {
+     	return managed;
+     }
+ 
+     public Long getCapacityIops() {
+         return capacityIops;
+     }
+ 
+     public Long getCapacityBytes() {
+         return capacityBytes;
+     }
+ 
      public String getHypervisor() {
          return hypervisor;
      }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57bafc8f/api/src/org/apache/cloudstack/api/command/user/template/RegisterTemplateCmd.java
----------------------------------------------------------------------

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

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57bafc8f/api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57bafc8f/api/src/org/apache/cloudstack/api/response/StoragePoolResponse.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57bafc8f/api/src/org/apache/cloudstack/api/response/VolumeResponse.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57bafc8f/client/tomcatconf/applicationContext.xml.in
----------------------------------------------------------------------
diff --cc client/tomcatconf/applicationContext.xml.in
index 627c655,14255c1..8031911
--- a/client/tomcatconf/applicationContext.xml.in
+++ b/client/tomcatconf/applicationContext.xml.in
@@@ -17,16 -17,14 +17,14 @@@
    under the License.
  -->
  <beans xmlns="http://www.springframework.org/schema/beans"
 -       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 -       xmlns:context="http://www.springframework.org/schema/context"
 -       xsi:schemaLocation="http://www.springframework.org/schema/beans
 +  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 +  xmlns:context="http://www.springframework.org/schema/context"
-   xmlns:tx="http://www.springframework.org/schema/tx" 
-   xmlns:aop="http://www.springframework.org/schema/aop"
 +  xsi:schemaLocation="http://www.springframework.org/schema/beans
                        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
-                       http://www.springframework.org/schema/tx 
-                       http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
-                       http://www.springframework.org/schema/aop
-                       http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
+ 
+ 
+ 
+ 
                        http://www.springframework.org/schema/context
                        http://www.springframework.org/schema/context/spring-context-3.0.xsd">                     
  
@@@ -613,7 -611,96 +607,96 @@@
    <bean id="OvmGuru" class="com.cloud.ovm.hypervisor.OvmGuru">
      <property name="name" value="OvmGuru"/>
    </bean>
 -
 +  
+ 
+   <!--=====================================================================================================-->
+   <!--                                                                                                     -->
+   <!--                           Storage Subsystem Components and Helpers                                  -->
+   <!--                                                                                                     -->
+   <!--=====================================================================================================-->
+ 
+   <!--Filesystem types-->
+   <bean id="iSCSI" class="org.apache.cloudstack.storage.datastore.type.ISCSI" />
+   <bean id="networkFileSystem" class="org.apache.cloudstack.storage.datastore.type.NetworkFileSystem" />
+ 
+   <!--Image formats-->
+   <bean id="ISO" class="org.apache.cloudstack.storage.image.format.ISO" />
+   <bean id="OVA" class="org.apache.cloudstack.storage.image.format.OVA" />
+   <bean id="QCOW2" class="org.apache.cloudstack.storage.image.format.QCOW2" />
+   <bean id="VHD" class="org.apache.cloudstack.storage.image.format.VHD" />
+   <bean id="unknown" class="org.apache.cloudstack.storage.image.format.Unknown" />
+ 
+   <!--Data Store Services -->
+   <bean id="snapshotServiceImpl" class="org.apache.cloudstack.storage.snapshot.SnapshotServiceImpl"
+         depends-on="snapshotStateMachineManagerImpl, snapshotDataFactoryImpl, dataStoreManagerImpl, dataMotionServiceImpl, objectInDataStoreManagerImpl"/>
+   <bean id="templateServiceImpl" class="org.apache.cloudstack.storage.image.TemplateServiceImpl"
+         depends-on="dataObjectManagerImpl, dataStoreManagerImpl, dataMotionServiceImpl, objectInDataStoreManagerImpl, defaultEndPointSelector, templateDataFactoryImpl"/>
+   <bean id="volumeServiceImpl" class="org.apache.cloudstack.storage.volume.VolumeServiceImpl"
+         depends-on="snapshotManagerImpl, dataMotionServiceImpl"/>
+ 
+   <bean id="xenserverSnapshotStrategy" class="org.apache.cloudstack.storage.snapshot.XenserverSnapshotStrategy" />
+ 
+   <!--Data Store Factory-->
+   <bean id="templateDataFactoryImpl" class="org.apache.cloudstack.storage.image.TemplateDataFactoryImpl" />
+   <bean id="snapshotDataFactoryImpl" class="org.apache.cloudstack.storage.snapshot.SnapshotDataFactoryImpl"
+         depends-on="dataStoreManagerImpl, snapshotDataStoreDaoImpl, volumeDataFactoryImpl"/>
+   <bean id="volumeDataFactoryImpl" class="org.apache.cloudstack.storage.volume.VolumeDataFactoryImpl" />
+ 
+   <bean id="objectInDataStoreManagerImpl" class="org.apache.cloudstack.storage.datastore.ObjectInDataStoreManagerImpl" />
+   <bean id="dataObjectManagerImpl" class="org.apache.cloudstack.storage.datastore.DataObjectManagerImpl" />
+ 
+   <!--Data Store Helpers-->
+   <bean id="primaryDataStoreHelper" class="org.apache.cloudstack.storage.volume.datastore.PrimaryDataStoreHelper" />
+   <bean id="imageStoreHelper" class="org.apache.cloudstack.storage.image.datastore.ImageStoreHelper" />
+   <bean id="imageFormatHelper" class="org.apache.cloudstack.storage.image.format.ImageFormatHelper" />
+ 
+   <bean id="storageCacheRandomAllocator" class="org.apache.cloudstack.storage.cache.allocator.StorageCacheRandomAllocator" />
+   <bean id="storageCacheManagerImpl" class="org.apache.cloudstack.storage.cache.manager.StorageCacheManagerImpl"  />
+   <bean id="StorageCacheReplacementAlgorithm" class="org.apache.cloudstack.storage.cache.manager.StorageCacheReplacementAlgorithmLRU" />
+ 
+   <bean id="snapshotStateMachineManagerImpl" class="org.apache.cloudstack.storage.snapshot.SnapshotStateMachineManagerImpl" />
+   <bean id="defaultEndPointSelector" class="org.apache.cloudstack.storage.endpoint.DefaultEndPointSelector" />
+ 
+ 
+   <bean id="ancientDataMotionStrategy" class="org.apache.cloudstack.storage.motion.AncientDataMotionStrategy" />
+   <bean id="xenserverStorageMotionStrategy" class="org.apache.cloudstack.storage.motion.XenServerStorageMotionStrategy" />
+ 
+   <!--Data Motion Services-->
+   <bean id="dataMotionServiceImpl" class="org.apache.cloudstack.storage.motion.DataMotionServiceImpl">
+     <property name="strategies">
+       <list>
+         <ref local="ancientDataMotionStrategy"/>
+         <ref local="xenserverStorageMotionStrategy"/>
+       </list>
+     </property>
+   </bean>
+ 
+   <!--
+     Data Store Provider Manager
+   -->
+   <bean id="primaryDataStoreProviderMgr"
+         class="org.apache.cloudstack.storage.datastore.manager.PrimaryDataStoreProviderManagerImpl"/>
+   <bean id="imageStoreProviderMgr" class="org.apache.cloudstack.storage.image.manager.ImageStoreProviderManagerImpl"/>
+ 
+   <bean id="dataStoreManagerImpl" class="org.apache.cloudstack.storage.datastore.DataStoreManagerImpl"
+         depends-on="dataStoreProviderManager">
+     <property name="primaryStoreMgr" ref="primaryDataStoreProviderMgr"/>
+     <property name="imageDataStoreMgr" ref="imageStoreProviderMgr"/>
+   </bean>
+ 
+   <bean id="cloudStackPrimaryDataStoreProviderImpl"
+         class="org.apache.cloudstack.storage.datastore.provider.CloudStackPrimaryDataStoreProviderImpl"/>
+ 
+   <bean id="dataStoreProviderManager"
+         class="org.apache.cloudstack.storage.datastore.provider.DataStoreProviderManagerImpl">
+     <property name="providers">
+       <list>
+         <!--Data Store Providers-->
+         <ref bean="cloudStackPrimaryDataStoreProviderImpl"/>
+       </list>
+     </property>
+   </bean>
+ 
    <!--
      Managers
    -->
@@@ -719,8 -810,9 +802,10 @@@
    <bean id="virtualNetworkApplianceManagerImpl" class="com.cloud.network.router.VirtualNetworkApplianceManagerImpl" />
    <bean id="vpcManagerImpl" class="com.cloud.network.vpc.VpcManagerImpl" />
    <bean id="vpcVirtualNetworkApplianceManagerImpl" class="com.cloud.network.router.VpcVirtualNetworkApplianceManagerImpl" />
 +  <bean id="usageServerMonitor" class="com.cloud.usage.UsageServerMonitor" />
  
+ 
+ 
    <!--
      Misc components
    -->
@@@ -742,46 -829,26 +822,24 @@@
    <bean id="cloudOrchestrator" class="org.apache.cloudstack.platform.orchestration.CloudOrchestrator" />
    <bean id="clusterRestService" class="org.apache.cloudstack.engine.rest.service.api.ClusterRestService" />
    <bean id="consoleProxyServlet" class="com.cloud.servlet.ConsoleProxyServlet" />
 -  <bean id="dataCenterResourceManagerImpl" class="org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceManagerImpl" />
 +  <bean id="dataCenterResourceManagerImpl" class="org.apache.cloudstack.engine.datacenter.entity.DataCenterResourceManagerImpl" />
    <bean id="dataDisk" class="org.apache.cloudstack.engine.subsystem.api.storage.type.DataDisk" />
-   <bean id="dataMotionServiceImpl" class="org.apache.cloudstack.storage.motion.DataMotionServiceImpl" />
-   <bean id="dataObjectManagerImpl" class="org.apache.cloudstack.storage.datastore.DataObjectManagerImpl" />
-   <bean id="dataStoreManagerImpl" class="org.apache.cloudstack.storage.datastore.DataStoreManagerImpl" />
-   <bean id="defaultEndPointSelector" class="org.apache.cloudstack.storage.endpoint.DefaultEndPointSelector" />
-   <bean id="primaryDataStoreProviderManagerImpl" class="org.apache.cloudstack.storage.datastore.manager.PrimaryDataStoreProviderManagerImpl" />
-   <bean id="imageStoreProviderManagerImpl" class="org.apache.cloudstack.storage.image.manager.ImageStoreProviderManagerImpl" />  
+ 
+ 
    <bean id="eventUtils" class="com.cloud.event.EventUtils" />
-   <bean id="iSCSI" class="org.apache.cloudstack.storage.datastore.type.ISCSI" />
-   <bean id="ISO" class="org.apache.cloudstack.storage.image.format.ISO" />
-   <bean id="templateDataFactoryImpl" class="org.apache.cloudstack.storage.image.TemplateDataFactoryImpl" />
-   <bean id="imageStoreHelper" class="org.apache.cloudstack.storage.image.datastore.ImageStoreHelper" />
-   <bean id="imageFormatHelper" class="org.apache.cloudstack.storage.image.format.ImageFormatHelper" />
-   <bean id="templateServiceImpl" class="org.apache.cloudstack.storage.image.TemplateServiceImpl" />
+   <bean id="podRestService" class="org.apache.cloudstack.engine.rest.service.api.PodRestService" />
    <bean id="iso" class="org.apache.cloudstack.engine.subsystem.api.storage.type.Iso" />
-   <bean id="networkFileSystem" class="org.apache.cloudstack.storage.datastore.type.NetworkFileSystem" />
    <bean id="networkRestService" class="org.apache.cloudstack.engine.rest.service.api.NetworkRestService" />
-   <bean id="OVA" class="org.apache.cloudstack.storage.image.format.OVA" />
-   <bean id="objectInDataStoreManagerImpl" class="org.apache.cloudstack.storage.datastore.ObjectInDataStoreManagerImpl" />
-   <bean id="podRestService" class="org.apache.cloudstack.engine.rest.service.api.PodRestService" />
-   <bean id="primaryDataStoreHelper" class="org.apache.cloudstack.storage.volume.datastore.PrimaryDataStoreHelper" />
    <bean id="provisioningServiceImpl" class="org.apache.cloudstack.engine.service.api.ProvisioningServiceImpl" />
-   <bean id="QCOW2" class="org.apache.cloudstack.storage.image.format.QCOW2" />
-   <bean id="registerCompleteServlet" class="com.cloud.servlet.RegisterCompleteServlet" />
    <bean id="rootDisk" class="org.apache.cloudstack.engine.subsystem.api.storage.type.RootDisk" />
-   <bean id="snapshotDataFactoryImpl" class="org.apache.cloudstack.storage.snapshot.SnapshotDataFactoryImpl" />
-   <bean id="snapshotServiceImpl" class="org.apache.cloudstack.storage.snapshot.SnapshotServiceImpl" />
-   <bean id="snapshotStateMachineManagerImpl" class="org.apache.cloudstack.storage.snapshot.SnapshotStateMachineManagerImpl" />
+   <bean id="registerCompleteServlet" class="com.cloud.servlet.RegisterCompleteServlet" />
    <bean id="statsCollector" class="com.cloud.server.StatsCollector" />
    <bean id="storagePoolAutomationImpl" class="com.cloud.storage.StoragePoolAutomationImpl" />
-   <bean id="unknown" class="org.apache.cloudstack.storage.image.format.Unknown" />
    <bean id="usageEventUtils" class="com.cloud.event.UsageEventUtils" />
-   <bean id="VHD" class="org.apache.cloudstack.storage.image.format.VHD" />
 -  <bean id="userContextInitializer" class="com.cloud.user.UserContextInitializer" />
 -  <bean id="vMEntityManagerImpl" class="org.apache.cloudstack.engine.cloud.entity.api.VMEntityManagerImpl" />
 -  <bean id="virtualMachineEntityFactory" class="org.apache.cloudstack.engine.cloud.entity.api.VirtualMachineEntityFactory" />
 +  <bean id="vMEntityManagerImpl" class="org.apache.cloudstack.engine.vm.VMEntityManagerImpl" />
    <bean id="virtualMachineEntityImpl" class="org.apache.cloudstack.engine.cloud.entity.api.VirtualMachineEntityImpl" />
    <bean id="virtualMachineRestService" class="org.apache.cloudstack.engine.rest.service.api.VirtualMachineRestService" />
-   <bean id="volumeDataFactoryImpl" class="org.apache.cloudstack.storage.volume.VolumeDataFactoryImpl" />
    <bean id="volumeRestService" class="org.apache.cloudstack.engine.rest.service.api.VolumeRestService" />
-   <bean id="volumeServiceImpl" class="org.apache.cloudstack.storage.volume.VolumeServiceImpl" />
    <bean id="volumeTypeHelper" class="org.apache.cloudstack.engine.subsystem.api.storage.type.VolumeTypeHelper" />
    <bean id="zoneRestService" class="org.apache.cloudstack.engine.rest.service.api.ZoneRestService" />
    <bean id="cloudZonesStartupProcessor" class="com.cloud.hypervisor.CloudZonesStartupProcessor" />
@@@ -796,17 -870,7 +861,9 @@@
    <bean id="mockNetworkManagerImpl" class="com.cloud.agent.manager.MockNetworkManagerImpl" />
    <bean id="simulatorManagerImpl" class="com.cloud.agent.manager.SimulatorManagerImpl" />
    <bean id="vMSnapshotManagerImpl" class="com.cloud.vm.snapshot.VMSnapshotManagerImpl" />
-   <bean id="volumeManagerImpl" class="com.cloud.storage.VolumeManagerImpl" />
-   <bean id="ClassicalPrimaryDataStoreProvider" class="org.apache.cloudstack.storage.datastore.provider.CloudStackPrimaryDataStoreProviderImpl" />
-   <bean id="cloudStackImageStoreProviderImpl" class="org.apache.cloudstack.storage.datastore.provider.CloudStackImageStoreProviderImpl" />
-   <bean id="s3ImageStoreProviderImpl" class="org.apache.cloudstack.storage.datastore.provider.S3ImageStoreProviderImpl" />
-   <bean id="swiftImageStoreProviderImpl" class="org.apache.cloudstack.storage.datastore.provider.SwiftImageStoreProviderImpl" />  
-   <bean id="ApplicationLoadBalancerService" class="org.apache.cloudstack.network.lb.ApplicationLoadBalancerManagerImpl" />
-   <bean id="InternalLoadBalancerVMManager" class="org.apache.cloudstack.network.lb.InternalLoadBalancerVMManagerImpl" />
-   <bean id="StorageCacheReplacementAlgorithm" class="org.apache.cloudstack.storage.cache.manager.StorageCacheReplacementAlgorithmLRU" />
  
 +  <bean id="VirtualMachinePowerStateSyncImpl" class="com.cloud.vm.VirtualMachinePowerStateSyncImpl" />
 +
  
  <!--=======================================================================================================-->
  <!--                                                                                                       -->
@@@ -875,7 -915,9 +932,9 @@@
    <bean id="BAREMETAL" class="org.apache.cloudstack.storage.image.format.BAREMETAL" />
    <bean id="baremetalDhcpDaoImpl" class="com.cloud.baremetal.database.BaremetalDhcpDaoImpl" />
    <bean id="baremetalPxeDaoImpl" class="com.cloud.baremetal.database.BaremetalPxeDaoImpl" />
 -
 +  
+   <bean id="UcsManager" class="com.cloud.ucs.manager.UcsManagerImpl" />
+ 
    <bean id="AffinityGroupServiceImpl" class="org.apache.cloudstack.affinity.AffinityGroupServiceImpl"/>
    <bean id="DeploymentPlanningManager" class="com.cloud.deploy.DeploymentPlanningManagerImpl">
      <property name="Planners" value="#{deploymentPlanners.Adapters}" />

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57bafc8f/client/tomcatconf/componentContext.xml.in
----------------------------------------------------------------------
diff --cc client/tomcatconf/componentContext.xml.in
index 9ffecbb,1fbec61..2e01874
--- a/client/tomcatconf/componentContext.xml.in
+++ b/client/tomcatconf/componentContext.xml.in
@@@ -91,7 -97,29 +97,29 @@@
  
    It determines whether or not a adapter is activated or how it is loaded in order in its managing provider,
  
 --->
 +--> 
+   <bean id="cloudStackImageStoreProviderImpl"
+         class="org.apache.cloudstack.storage.datastore.provider.CloudStackImageStoreProviderImpl"/>
+   <bean id="s3ImageStoreProviderImpl"
+         class="org.apache.cloudstack.storage.datastore.provider.S3ImageStoreProviderImpl"/>
+   <bean id="swiftImageStoreProviderImpl"
+         class="org.apache.cloudstack.storage.datastore.provider.SwiftImageStoreProviderImpl"/>
+   <bean id="solidFireDataStoreProvider"
+         class="org.apache.cloudstack.storage.datastore.provider.SolidfirePrimaryDataStoreProvider"/>
+ 
+   <!--Storage Providers-->
+   <bean id="dataStoreProviderManager"
+         class="org.apache.cloudstack.storage.datastore.provider.DataStoreProviderManagerImpl">
+     <property name="providers">
+       <list merge="true">
+         <ref bean="cloudStackPrimaryDataStoreProviderImpl"/>
+         <ref local="cloudStackImageStoreProviderImpl"/>
+         <ref local="s3ImageStoreProviderImpl"/>
+         <ref local="swiftImageStoreProviderImpl"/>
+         <ref local="solidFireDataStoreProvider"/>
+       </list>
+     </property>
+   </bean>
  
    <!-- Security adapters -->
    <bean id="userAuthenticators" class="com.cloud.utils.component.AdapterList">

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57bafc8f/client/tomcatconf/nonossComponentContext.xml.in
----------------------------------------------------------------------
diff --cc client/tomcatconf/nonossComponentContext.xml.in
index d4cc06d,ffa6281..fcd5b55
--- a/client/tomcatconf/nonossComponentContext.xml.in
+++ b/client/tomcatconf/nonossComponentContext.xml.in
@@@ -176,8 -181,42 +181,42 @@@
      
    It determines whether or not a adapter is activated or how it is loaded in order in its managing provider,
       
 --->
 +--> 
  
+   <!--Motion Strategies-->
+   <bean id="vmwareStorageMotionStrategy" class="org.apache.cloudstack.storage.motion.VmwareStorageMotionStrategy" />
+   <bean id="dataMotionServiceImpl" class="org.apache.cloudstack.storage.motion.DataMotionServiceImpl">
+     <property name="strategies">
+       <list>
+         <ref bean="ancientDataMotionStrategy"/>
+         <ref bean="xenserverStorageMotionStrategy"/>
+         <ref local="vmwareStorageMotionStrategy"/>
+       </list>
+     </property>
+   </bean>
+ 
+   <bean id="cloudStackImageStoreProviderImpl"
+         class="org.apache.cloudstack.storage.datastore.provider.CloudStackImageStoreProviderImpl"/>
+   <bean id="s3ImageStoreProviderImpl"
+         class="org.apache.cloudstack.storage.datastore.provider.S3ImageStoreProviderImpl"/>
+   <bean id="swiftImageStoreProviderImpl"
+         class="org.apache.cloudstack.storage.datastore.provider.SwiftImageStoreProviderImpl"/>
+   <bean id="solidFireDataStoreProvider"
+         class="org.apache.cloudstack.storage.datastore.provider.SolidfirePrimaryDataStoreProvider"/>
+ 
+   <!--Storage Providers-->
+   <bean id="dataStoreProviderManager"
+         class="org.apache.cloudstack.storage.datastore.provider.DataStoreProviderManagerImpl">
+     <property name="providers">
+       <list merge="true">
+         <ref bean="cloudStackPrimaryDataStoreProviderImpl"/>
+         <ref bean="cloudStackImageStoreProviderImpl"/>
+         <ref bean="s3ImageStoreProviderImpl"/>
+         <ref bean="solidFireDataStoreProvider"/>
+       </list>
+     </property>
+   </bean>
+ 
    <!-- Security adapters -->
    <bean id="userAuthenticators" class="com.cloud.utils.component.AdapterList">
      <property name="Adapters">

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57bafc8f/engine/components-api/src/com/cloud/storage/VolumeManager.java
----------------------------------------------------------------------
diff --cc engine/components-api/src/com/cloud/storage/VolumeManager.java
index 15f24f7,0000000..71741d5
mode 100644,000000..100644
--- a/engine/components-api/src/com/cloud/storage/VolumeManager.java
+++ b/engine/components-api/src/com/cloud/storage/VolumeManager.java
@@@ -1,122 -1,0 +1,121 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one
 + * or more contributor license agreements.  See the NOTICE file
 + * distributed with this work for additional information
 + * regarding copyright ownership.  The ASF licenses this file
 + * to you under the Apache License, Version 2.0 (the
 + * "License"); you may not use this file except in compliance
 + * with the License.  You may obtain a copy of the License at
 + *
 + *   http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing,
 + * software distributed under the License is distributed on an
 + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 + * KIND, either express or implied.  See the License for the
 + * specific language governing permissions and limitations
 + * under the License.
 + */
 +package com.cloud.storage;
 +
 +import java.util.Map;
 +
 +import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd;
 +import org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd;
 +import org.apache.cloudstack.api.command.user.volume.DetachVolumeCmd;
 +import org.apache.cloudstack.api.command.user.volume.MigrateVolumeCmd;
 +import org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd;
 +import org.apache.cloudstack.api.command.user.volume.UploadVolumeCmd;
 +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
 +
 +import com.cloud.agent.api.to.VirtualMachineTO;
 +import com.cloud.deploy.DeployDestination;
 +import com.cloud.exception.ConcurrentOperationException;
 +import com.cloud.exception.InsufficientStorageCapacityException;
 +import com.cloud.exception.ResourceAllocationException;
 +import com.cloud.exception.StorageUnavailableException;
 +import com.cloud.host.Host;
 +import com.cloud.hypervisor.Hypervisor.HypervisorType;
 +import com.cloud.storage.Volume.Type;
 +import com.cloud.user.Account;
 +import com.cloud.vm.DiskProfile;
 +import com.cloud.vm.VMInstanceVO;
 +import com.cloud.vm.VirtualMachine;
 +import com.cloud.vm.VirtualMachineProfile;
 +
 +public interface VolumeManager extends VolumeApiService {
- 
 +    VolumeInfo moveVolume(VolumeInfo volume, long destPoolDcId, Long destPoolPodId,
 +            Long destPoolClusterId, HypervisorType dataDiskHyperType)
 +            throws ConcurrentOperationException;
 +
 +    @Override
 +    VolumeVO uploadVolume(UploadVolumeCmd cmd)
 +            throws ResourceAllocationException;
 +
 +    VolumeVO allocateDuplicateVolume(VolumeVO oldVol, Long templateId);
 +
 +    boolean volumeOnSharedStoragePool(VolumeVO volume);
 +
 +    boolean volumeInactive(Volume volume);
 +
 +    String getVmNameOnVolume(Volume volume);
 +
 +    @Override
 +    VolumeVO allocVolume(CreateVolumeCmd cmd)
 +            throws ResourceAllocationException;
 +
 +    @Override
 +    VolumeVO createVolume(CreateVolumeCmd cmd);
 +
 +    @Override
 +    VolumeVO resizeVolume(ResizeVolumeCmd cmd)
 +            throws ResourceAllocationException;
 +
 +    @Override
 +    boolean deleteVolume(long volumeId, Account caller)
 +            throws ConcurrentOperationException;
 +    
 +    void destroyVolume(VolumeVO volume);
 +
 +    DiskProfile allocateRawVolume(Type type, String name, DiskOfferingVO offering, Long size, VMInstanceVO vm, Account owner);
 +    @Override
 +    Volume attachVolumeToVM(AttachVolumeCmd command);
 +
 +    @Override
 +    Volume detachVolumeFromVM(DetachVolumeCmd cmmd);
 +
 +    void release(VirtualMachineProfile profile);
 +
 +    void cleanupVolumes(long vmId) throws ConcurrentOperationException;
 +
 +    @Override
 +    Volume migrateVolume(MigrateVolumeCmd cmd);
 +
 +    void migrateVolumes(VirtualMachine vm, VirtualMachineTO vmTo, Host srcHost, Host destHost,
 +            Map<Volume, StoragePool> volumeToPool);
 +
 +    boolean storageMigration(
 +            VirtualMachineProfile vm,
 +            StoragePool destPool);
 +
 +    void prepareForMigration(
 +            VirtualMachineProfile vm,
 +            DeployDestination dest);
 +
 +    void prepare(VirtualMachineProfile vm,
 +            DeployDestination dest) throws StorageUnavailableException,
 +            InsufficientStorageCapacityException, ConcurrentOperationException;
 +
 +    boolean canVmRestartOnAnotherServer(long vmId);
 +
 +    DiskProfile allocateTemplatedVolume(Type type, String name,
 +            DiskOfferingVO offering, VMTemplateVO template, VMInstanceVO vm,
 +            Account owner);
 +
 +
 +    String getVmNameFromVolumeId(long volumeId);
 +
 +    String getStoragePoolOfVolume(long volumeId);
 +
 +    boolean validateVolumeSizeRange(long size);
 +}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57bafc8f/engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java
----------------------------------------------------------------------
diff --cc engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java
index e916a5c,300d932..30830b6
--- a/engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java
@@@ -43,32 -43,44 +43,43 @@@ public class ZoneWideStoragePoolAllocat
      PrimaryDataStoreDao _storagePoolDao;
      @Inject
      DataStoreManager dataStoreMgr;
 -
 -    @Override
 +	
 +	@Override
      protected boolean filter(ExcludeList avoid, StoragePool pool, DiskProfile dskCh, DeploymentPlan plan) {
 -        Volume volume = _volumeDao.findById(dskCh.getVolumeId());
 +        Volume volume =  _volumeDao.findById(dskCh.getVolumeId());
          List<Volume> requestVolumes = new ArrayList<Volume>();
          requestVolumes.add(volume);
-         return storageMgr.storagePoolHasEnoughSpace(requestVolumes, pool);
+ 
+         return storageMgr.storagePoolHasEnoughIops(requestVolumes, pool) &&
+                storageMgr.storagePoolHasEnoughSpace(requestVolumes, pool);
 -    }
 -
 +	}
 +	
  	@Override
 -	protected List<StoragePool> select(DiskProfile dskCh,
 -			VirtualMachineProfile<? extends VirtualMachine> vmProfile,
 +    protected List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile vmProfile,
  			DeploymentPlan plan, ExcludeList avoid, int returnUpTo) {
  	    s_logger.debug("ZoneWideStoragePoolAllocator to find storage pool");
  		List<StoragePool> suitablePools = new ArrayList<StoragePool>();
- 		HypervisorType hypervisor = dskCh.getHypervisorType();
- 		if (hypervisor != null) {
-             if (hypervisor != HypervisorType.KVM && hypervisor != HypervisorType.VMware) {
-                 s_logger.debug("Only kvm, VMware hypervisors are enabled to support zone wide storage");
- 				return suitablePools;
+ 
+         List<StoragePoolVO> storagePools = _storagePoolDao.findZoneWideStoragePoolsByTags(plan.getDataCenterId(), dskCh.getTags());
+ 
+         if (storagePools == null) {
+             storagePools = new ArrayList<StoragePoolVO>();
+         }
+ 
+         List<StoragePoolVO> anyHypervisorStoragePools = new ArrayList<StoragePoolVO>();
+ 
+         for (StoragePoolVO storagePool : storagePools) {
+             if (HypervisorType.Any.equals(storagePool.getHypervisor())) {
+                 anyHypervisorStoragePools.add(storagePool);
 -            }
 -        }
 -
 +			}
 +		}
 +		
- 		List<StoragePoolVO> storagePools = _storagePoolDao.findZoneWideStoragePoolsByTags(plan.getDataCenterId(), dskCh.getTags());
          List<StoragePoolVO> storagePoolsByHypervisor = _storagePoolDao.findZoneWideStoragePoolsByHypervisor(plan.getDataCenterId(), dskCh.getHypervisorType());
+ 
          storagePools.retainAll(storagePoolsByHypervisor);
 -
 +	
+         storagePools.addAll(anyHypervisorStoragePools);
+ 
          // add remaining pools in zone, that did not match tags, to avoid set
          List<StoragePoolVO> allPools = _storagePoolDao.findZoneWideStoragePoolsByTags(plan.getDataCenterId(), null);
          allPools.removeAll(storagePools);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57bafc8f/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
----------------------------------------------------------------------
diff --cc engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
index 3f6c4be,89313e4..58e0134
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
@@@ -115,8 -123,8 +124,8 @@@ public class VolumeServiceImpl implemen
  
      public VolumeServiceImpl() {
      }
 -
 +    
-     private class CreateVolumeContext<T> extends AsyncRpcConext<T> {
+     private class CreateVolumeContext<T> extends AsyncRpcContext<T> {
  
          private final DataObject volume;
          private final AsyncCallFuture<VolumeApiResult> future;
@@@ -136,9 -143,19 +145,19 @@@
          public AsyncCallFuture<VolumeApiResult> getFuture() {
              return this.future;
          }
 -
 +        
      }
 -
 +    
+     public ChapInfo getChapInfo(VolumeInfo volumeInfo, DataStore dataStore) {
+         DataStoreDriver dataStoreDriver = dataStore.getDriver();
+ 
+         if (dataStoreDriver instanceof PrimaryDataStoreDriver) {
+             return ((PrimaryDataStoreDriver)dataStoreDriver).getChapInfo(volumeInfo);
+         }
+ 
+         return null;
+     }
+ 
      @Override
      public AsyncCallFuture<VolumeApiResult> createVolumeAsync(VolumeInfo volume, DataStore dataStore) {
          AsyncCallFuture<VolumeApiResult> future = new AsyncCallFuture<VolumeApiResult>();
@@@ -149,11 -166,11 +168,11 @@@
                  future);
          AsyncCallbackDispatcher<VolumeServiceImpl, CreateCmdResult> caller = AsyncCallbackDispatcher.create(this);
          caller.setCallback(caller.getTarget().createVolumeCallback(null, null)).setContext(context);
 -
 +        
-         dataStore.getDriver().createAsync(volumeOnStore, caller);
+         dataStore.getDriver().createAsync(dataStore, volumeOnStore, caller);
          return future;
      }
 -
 +    
      protected Void createVolumeCallback(AsyncCallbackDispatcher<VolumeServiceImpl, CreateCmdResult> callback,
              CreateVolumeContext<VolumeApiResult> context) {
          CreateCmdResult result = callback.getResult();
@@@ -172,14 -189,13 +191,14 @@@
          context.getFuture().complete(volResult);
          return null;
      }
 -
 +    
-     private class DeleteVolumeContext<T> extends AsyncRpcConext<T> {
+     private class DeleteVolumeContext<T> extends AsyncRpcContext<T> {
          private final VolumeObject volume;
          private final AsyncCallFuture<VolumeApiResult> future;
 -
 -        public DeleteVolumeContext(AsyncCompletionCallback<T> callback, VolumeObject volume,
 -                AsyncCallFuture<VolumeApiResult> future) {
 +        /**
 +         * @param callback
 +         */
 +        public DeleteVolumeContext(AsyncCompletionCallback<T> callback, VolumeObject volume, AsyncCallFuture<VolumeApiResult> future) {
              super(callback);
              this.volume = volume;
              this.future = future;
@@@ -234,11 -250,11 +253,11 @@@
          DeleteVolumeContext<VolumeApiResult> context = new DeleteVolumeContext<VolumeApiResult>(null, vo, future);
          AsyncCallbackDispatcher<VolumeServiceImpl, CommandResult> caller = AsyncCallbackDispatcher.create(this);
          caller.setCallback(caller.getTarget().deleteVolumeCallback(null, null)).setContext(context);
 -
 +        
-         volume.getDataStore().getDriver().deleteAsync(volume, caller);
+         volume.getDataStore().getDriver().deleteAsync(volume.getDataStore(), volume, caller);
          return future;
      }
 -
 +    
      public Void deleteVolumeCallback(AsyncCallbackDispatcher<VolumeServiceImpl, CommandResult> callback,
              DeleteVolumeContext<VolumeApiResult> context) {
          CommandResult result = callback.getResult();
@@@ -263,10 -279,10 +282,10 @@@
  
      @Override
      public VolumeEntity getVolumeEntity(long volumeId) {
 -        return null;
 -    }
 +            return null;
 +        }
  
-     class CreateBaseImageContext<T> extends AsyncRpcConext<T> {
+     class CreateBaseImageContext<T> extends AsyncRpcContext<T> {
          private final VolumeInfo volume;
          private final PrimaryDataStore dataStore;
          private final TemplateInfo srcTemplate;
@@@ -282,8 -299,9 +302,9 @@@
              this.future = future;
              this.srcTemplate = srcTemplate;
              this.destObj = destObj;
+             this.templatePoolId = templatePoolId;
          }
 -
 +        
          public VolumeInfo getVolume() {
              return this.volume;
          }
@@@ -299,9 -317,14 +320,14 @@@
          public AsyncCallFuture<VolumeApiResult> getFuture() {
              return this.future;
          }
 -
 +        
+         public long getTemplatePoolId() {
+             return templatePoolId;
+         }
+ 
+ 
      }
 -
 +    
      private TemplateInfo waitForTemplateDownloaded(PrimaryDataStore store, TemplateInfo template) {
          int storagePoolMaxWaitSeconds = NumbersUtil.parseInt(
                  configDao.getValue(Config.StoragePoolMaxWaitSeconds.key()), 3600);
@@@ -325,41 -348,47 +351,47 @@@
      @DB
      protected void createBaseImageAsync(VolumeInfo volume, PrimaryDataStore dataStore, TemplateInfo template,
              AsyncCallFuture<VolumeApiResult> future) {
 -
 +       
          DataObject templateOnPrimaryStoreObj = dataStore.create(template);
+ 
+         VMTemplateStoragePoolVO templatePoolRef = _tmpltPoolDao.findByPoolTemplate(dataStore.getId(), template.getId());
+         if (templatePoolRef == null) {
+             throw new CloudRuntimeException("Failed to find template " + template.getUniqueName()
+                     + " in VMTemplateStoragePool");
+         }
+         long templatePoolRefId = templatePoolRef.getId();
          CreateBaseImageContext<CreateCmdResult> context = new CreateBaseImageContext<CreateCmdResult>(null, volume,
-                 dataStore, template, future, templateOnPrimaryStoreObj);
+                 dataStore, template, future, templateOnPrimaryStoreObj, templatePoolRefId);
          AsyncCallbackDispatcher<VolumeServiceImpl, CopyCommandResult> caller = AsyncCallbackDispatcher.create(this);
          caller.setCallback(caller.getTarget().copyBaseImageCallback(null, null)).setContext(context);
 -
 +        
-         try {
-         templateOnPrimaryStoreObj.processEvent(Event.CreateOnlyRequested);
-         } catch (Exception e) {
-             s_logger.info("Multiple threads are trying to copy template to primary storage, current thread should just wait");
-             try {
-                 templateOnPrimaryStoreObj = waitForTemplateDownloaded(dataStore, template);
-             } catch (Exception e1) {
-                 s_logger.debug("wait for template:" + template.getId() + " downloading finished, but failed");
-                 VolumeApiResult result = new VolumeApiResult(volume);
-                 result.setResult(e1.toString());
-                 future.complete(result);
-                 return;
-             }
-             if (templateOnPrimaryStoreObj == null) {
-                 VolumeApiResult result = new VolumeApiResult(volume);
-                 result.setResult("wait for template:" + template.getId() + " downloading finished, but failed");
-                 future.complete(result);
-                 return;
-             } else {
-                 s_logger.debug("waiting for template:" + template.getId() + " downloading finished, success");
+         int storagePoolMaxWaitSeconds = NumbersUtil.parseInt(
+                 configDao.getValue(Config.StoragePoolMaxWaitSeconds.key()), 3600);
+         templatePoolRef = _tmpltPoolDao.acquireInLockTable(templatePoolRefId, storagePoolMaxWaitSeconds);
+         if (templatePoolRef == null) {
+             templatePoolRef = _tmpltPoolDao.findByPoolTemplate(dataStore.getId(), template.getId());
+             if (templatePoolRef.getState() == ObjectInDataStoreStateMachine.State.Ready ) {
+                 s_logger.info("Unable to acquire lock on VMTemplateStoragePool " + templatePoolRefId + ", But Template " + template.getUniqueName() + " is already copied to primary storage, skip copying");
                  createVolumeFromBaseImageAsync(volume, templateOnPrimaryStoreObj, dataStore, future);
                  return;
              }
+             throw new CloudRuntimeException("Unable to acquire lock on VMTemplateStoragePool: " + templatePoolRefId);
          }
 -
 +     
          try {
+             // lock acquired
+             if (templatePoolRef.getState() == ObjectInDataStoreStateMachine.State.Ready ) {
+                 s_logger.info("Template " + template.getUniqueName() + " is already copied to primary storage, skip copying");
+                 createVolumeFromBaseImageAsync(volume, templateOnPrimaryStoreObj, dataStore, future);
+                 return;
+             }
+             // remove the leftover hanging entry
+             dataStore.delete(templateOnPrimaryStoreObj);
+             // create a new entry to restart copying process
+             templateOnPrimaryStoreObj = dataStore.create(template);
+             templateOnPrimaryStoreObj.processEvent(Event.CreateOnlyRequested);
              motionSrv.copyAsync(template, templateOnPrimaryStoreObj, caller);
-         } catch (Exception e) {
+         } catch (Throwable e) {
              s_logger.debug("failed to create template on storage", e);
              templateOnPrimaryStoreObj.processEvent(Event.OperationFailed);
              VolumeApiResult result = new VolumeApiResult(volume);
@@@ -383,13 -414,14 +417,14 @@@
              future.complete(res);
              return null;
          }
 -
 +        
          templateOnPrimaryStoreObj.processEvent(Event.OperationSuccessed, result.getAnswer());
+         _tmpltPoolDao.releaseFromLockTable(context.getTemplatePoolId());
          createVolumeFromBaseImageAsync(context.volume, templateOnPrimaryStoreObj, context.dataStore, future);
          return null;
      }
 -
 +    
-     private class CreateVolumeFromBaseImageContext<T> extends AsyncRpcConext<T> {
+     private class CreateVolumeFromBaseImageContext<T> extends AsyncRpcContext<T> {
          private final DataObject vo;
          private final AsyncCallFuture<VolumeApiResult> future;
          private final DataObject templateOnStore;
@@@ -543,8 -575,8 +578,8 @@@
          newVol.setPodId(pool.getPodId());
          return volDao.persist(newVol);
      }
 -
 +    
-     private class CopyVolumeContext<T> extends AsyncRpcConext<T> {
+     private class CopyVolumeContext<T> extends AsyncRpcContext<T> {
          final VolumeInfo srcVolume;
          final VolumeInfo destVolume;
          final AsyncCallFuture<VolumeApiResult> future;
@@@ -915,11 -947,11 +950,11 @@@
          AsyncCallbackDispatcher<VolumeServiceImpl, CreateCmdResult> caller = AsyncCallbackDispatcher.create(this);
          caller.setCallback(caller.getTarget().registerVolumeCallback(null, null));
          caller.setContext(context);
 -
 +        
-         store.getDriver().createAsync(volumeOnStore, caller);
+         store.getDriver().createAsync(store, volumeOnStore, caller);
          return future;
      }
 -
 +    
      protected Void registerVolumeCallback(AsyncCallbackDispatcher<VolumeServiceImpl, CreateCmdResult> callback,
              CreateVolumeContext<VolumeApiResult> context) {
          CreateCmdResult result = callback.getResult();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57bafc8f/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 d5cbe97,914017c..35c862c
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@@ -56,7 -56,15 +56,8 @@@ import java.util.regex.Pattern
  import javax.ejb.Local;
  import javax.naming.ConfigurationException;
  
 -import org.apache.cloudstack.storage.command.StorageSubSystemCommand;
 -import org.apache.cloudstack.storage.to.PrimaryDataStoreTO;
 -import org.apache.cloudstack.storage.to.VolumeObjectTO;
 -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 org.apache.log4j.Logger;
+ import org.apache.commons.io.FileUtils;
  import org.libvirt.Connect;
  import org.libvirt.Domain;
  import org.libvirt.DomainBlockStats;
@@@ -4861,24 -4847,18 +4861,18 @@@ ServerResource 
          }
      }
  
-     private Pair<Double, Double> getNicStats(String nicName) {
-         double rx = 0.0;
-         String rxFile = "/sys/class/net/" + nicName + "/statistics/rx_bytes";
-         String rxContent = FileUtil.readFileAsString(rxFile);
-         if (rxContent == null) {
-             s_logger.warn("Failed to read the rx_bytes for " + nicName + " from " + rxFile);
+     static Pair<Double, Double> getNicStats(String nicName) {
+         return new Pair<Double, Double>(readDouble(nicName, "rx_bytes"), readDouble(nicName, "tx_bytes"));
 -    }
 +        }
-         rx = Double.parseDouble(rxContent);
  
-         double tx = 0.0;
-         String txFile = "/sys/class/net/" + nicName + "/statistics/tx_bytes";
-         String txContent = FileUtil.readFileAsString(txFile);
-         if (txContent == null) {
-             s_logger.warn("Failed to read the tx_bytes for " + nicName + " from " + txFile);
+     static double readDouble(String nicName, String fileName) {
+         final String path = "/sys/class/net/" + nicName + "/statistics/" + fileName;
+         try {
+             return Double.parseDouble(FileUtils.readFileToString(new File(path)));
+         } catch (IOException ioe) {
+             s_logger.warn("Failed to read the " + fileName + " for " + nicName + " from " + path, ioe);
+             return 0.0;
          }
-         tx = Double.parseDouble(txContent);
- 
-         return new Pair<Double, Double>(rx, tx);
      }
  
      private Answer execute(NetworkRulesSystemVmCommand cmd) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57bafc8f/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java
----------------------------------------------------------------------
diff --cc plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java
index 0606f38,fee3e0a..25f69fd
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java
@@@ -83,8 -74,20 +83,9 @@@ import com.cloud.utils.Pair
  import com.cloud.utils.StringUtils;
  import com.cloud.utils.Ternary;
  import com.cloud.utils.script.Script;
+ import com.cloud.utils.exception.CloudRuntimeException;
  import com.cloud.vm.VirtualMachine;
  import com.cloud.vm.snapshot.VMSnapshot;
 -import com.vmware.vim25.ManagedObjectReference;
 -import com.vmware.vim25.TaskEvent;
 -import com.vmware.vim25.TaskInfo;
 -import com.vmware.vim25.VirtualDeviceConfigSpec;
 -import com.vmware.vim25.VirtualDeviceConfigSpecOperation;
 -import com.vmware.vim25.VirtualDisk;
 -import com.vmware.vim25.VirtualLsiLogicController;
 -import com.vmware.vim25.VirtualMachineConfigSpec;
 -import com.vmware.vim25.VirtualMachineFileInfo;
 -import com.vmware.vim25.VirtualMachineGuestOsIdentifier;
 -import com.vmware.vim25.VirtualSCSISharing;
  
  public class VmwareStorageManagerImpl implements VmwareStorageManager {
      private static final Logger s_logger = Logger.getLogger(VmwareStorageManagerImpl.class);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57bafc8f/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --cc plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index 0e5997e,286eb48..7c7e0b4
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@@ -43,49 -43,6 +43,60 @@@ import java.util.UUID
  import javax.inject.Inject;
  import javax.naming.ConfigurationException;
  
 +import org.apache.log4j.Logger;
 +import org.apache.log4j.NDC;
 +
 +import com.google.gson.Gson;
 +import com.vmware.vim25.AboutInfo;
 +import com.vmware.vim25.ClusterDasConfigInfo;
 +import com.vmware.vim25.ComputeResourceSummary;
 +import com.vmware.vim25.DatastoreSummary;
 +import com.vmware.vim25.DynamicProperty;
 +import com.vmware.vim25.GuestInfo;
++import com.vmware.vim25.GuestOsDescriptor;
 +import com.vmware.vim25.HostCapability;
 +import com.vmware.vim25.HostFirewallInfo;
 +import com.vmware.vim25.HostFirewallRuleset;
++import com.vmware.vim25.HostHostBusAdapter;
++import com.vmware.vim25.HostInternetScsiHba;
++import com.vmware.vim25.HostInternetScsiHbaAuthenticationProperties;
++import com.vmware.vim25.HostInternetScsiHbaStaticTarget;
++import com.vmware.vim25.HostInternetScsiTargetTransport;
++import com.vmware.vim25.HostScsiDisk;
++import com.vmware.vim25.HostScsiTopology;
++import com.vmware.vim25.HostScsiTopologyInterface;
++import com.vmware.vim25.HostScsiTopologyLun;
++import com.vmware.vim25.HostScsiTopologyTarget;
 +import com.vmware.vim25.ManagedObjectReference;
 +import com.vmware.vim25.ObjectContent;
 +import com.vmware.vim25.OptionValue;
 +import com.vmware.vim25.PerfCounterInfo;
 +import com.vmware.vim25.PerfEntityMetric;
 +import com.vmware.vim25.PerfEntityMetricBase;
 +import com.vmware.vim25.PerfMetricId;
 +import com.vmware.vim25.PerfMetricIntSeries;
 +import com.vmware.vim25.PerfMetricSeries;
 +import com.vmware.vim25.PerfQuerySpec;
 +import com.vmware.vim25.PerfSampleInfo;
 +import com.vmware.vim25.RuntimeFaultFaultMsg;
 +import com.vmware.vim25.ToolsUnavailableFaultMsg;
 +import com.vmware.vim25.VimPortType;
 +import com.vmware.vim25.VirtualDevice;
 +import com.vmware.vim25.VirtualDeviceConfigSpec;
 +import com.vmware.vim25.VirtualDeviceConfigSpecOperation;
 +import com.vmware.vim25.VirtualDisk;
 +import com.vmware.vim25.VirtualEthernetCard;
 +import com.vmware.vim25.VirtualEthernetCardNetworkBackingInfo;
 +import com.vmware.vim25.VirtualLsiLogicController;
 +import com.vmware.vim25.VirtualMachineConfigSpec;
 +import com.vmware.vim25.VirtualMachineFileInfo;
 +import com.vmware.vim25.VirtualMachineGuestOsIdentifier;
 +import com.vmware.vim25.VirtualMachinePowerState;
 +import com.vmware.vim25.VirtualMachineRelocateSpec;
 +import com.vmware.vim25.VirtualMachineRelocateSpecDiskLocator;
 +import com.vmware.vim25.VirtualMachineRuntimeInfo;
 +import com.vmware.vim25.VirtualSCSISharing;
 +
  import org.apache.cloudstack.storage.command.DeleteCommand;
  import org.apache.cloudstack.storage.command.StorageSubSystemCommand;
  import org.apache.cloudstack.storage.to.PrimaryDataStoreTO;
@@@ -255,8 -214,8 +266,10 @@@ import com.cloud.hypervisor.vmware.mo.C
  import com.cloud.hypervisor.vmware.mo.DatacenterMO;
  import com.cloud.hypervisor.vmware.mo.DatastoreMO;
  import com.cloud.hypervisor.vmware.mo.DiskControllerType;
++import com.cloud.hypervisor.vmware.mo.HostDatastoreSystemMO;
  import com.cloud.hypervisor.vmware.mo.HostFirewallSystemMO;
  import com.cloud.hypervisor.vmware.mo.HostMO;
++import com.cloud.hypervisor.vmware.mo.HostStorageSystemMO;
  import com.cloud.hypervisor.vmware.mo.HypervisorHostHelper;
  import com.cloud.hypervisor.vmware.mo.NetworkDetails;
  import com.cloud.hypervisor.vmware.mo.VirtualEthernetCardType;
@@@ -3240,10 -3258,10 +3260,10 @@@ public class VmwareResource implements 
          HashMap<String, VmStatsEntry> vmStatsMap = null;
  
          try {
 -            HashMap<String, State> newStates = getVmStates();
 +            HashMap<String, PowerState> newStates = getVmStates();
  
              List<String> requestedVmNames = cmd.getVmNames();
-             List<String> vmNames = new ArrayList();
+             List<String> vmNames = new ArrayList<String>();
  
              if (requestedVmNames != null) {
                  for (String vmName : requestedVmNames) {
@@@ -3953,6 -4022,198 +4024,200 @@@
          }
      }
  
+     private ManagedObjectReference createVmfsDatastore(VmwareHypervisorHost hyperHost, String datastoreName, String storageIpAddress,
+             int storagePortNumber, String iqn, String chapName, String chapSecret, String mutualChapName, String mutualChapSecret) throws Exception {
+         VmwareContext context = getServiceContext();
+         ManagedObjectReference morCluster = hyperHost.getHyperHostCluster();
+         ClusterMO cluster = new ClusterMO(context, morCluster);
+         List<Pair<ManagedObjectReference, String>> lstHosts = cluster.getClusterHosts();
+ 
+         HostInternetScsiHbaStaticTarget target = new HostInternetScsiHbaStaticTarget();
+ 
+         target.setAddress(storageIpAddress);
+         target.setPort(storagePortNumber);
+         target.setIScsiName(iqn);
+ 
+         HostInternetScsiHbaAuthenticationProperties auth = new HostInternetScsiHbaAuthenticationProperties();
+ 
+         String strAuthType = "chapRequired";
+ 
+         auth.setChapAuthEnabled(true);
+         auth.setChapInherited(false);
+         auth.setChapAuthenticationType(strAuthType);
+         auth.setChapName(chapName);
+         auth.setChapSecret(chapSecret);
+         auth.setMutualChapInherited(false);
+         auth.setMutualChapAuthenticationType(strAuthType);
+         auth.setMutualChapName(mutualChapName);
+         auth.setMutualChapSecret(mutualChapSecret);
+ 
+         target.setAuthenticationProperties(auth);
+ 
+         final List<HostInternetScsiHbaStaticTarget> lstTargets = new ArrayList<HostInternetScsiHbaStaticTarget>();
+ 
+         lstTargets.add(target);
+ 
+         HostDatastoreSystemMO hostDatastoreSystem = null;
+         HostStorageSystemMO hostStorageSystem = null;
+ 
+         final List<Thread> threads = new ArrayList<Thread>();
+         final List<Exception> exceptions = new ArrayList<Exception>();
+ 
+         for (Pair<ManagedObjectReference, String> hostPair : lstHosts) {
+             HostMO host = new HostMO(context, hostPair.first());
+             hostDatastoreSystem = host.getHostDatastoreSystemMO();
+             hostStorageSystem = host.getHostStorageSystemMO();
+ 
+             boolean iScsiHbaConfigured = false;
+ 
+             for (HostHostBusAdapter hba : hostStorageSystem.getStorageDeviceInfo().getHostBusAdapter()) {
+                 if (hba instanceof HostInternetScsiHba) {
+                     // just finding an instance of HostInternetScsiHba means that we have found at least one configured iSCSI HBA
+                     // at least one iSCSI HBA must be configured before a CloudStack user can use this host for iSCSI storage
+                     iScsiHbaConfigured = true;
+ 
+                     final String iScsiHbaDevice = hba.getDevice();
+ 
+                     final HostStorageSystemMO hss = hostStorageSystem;
+ 
+                     threads.add(new Thread() {
++                        @Override
+                         public void run() {
+                             try {
+                                 hss.addInternetScsiStaticTargets(iScsiHbaDevice, lstTargets);
+ 
+                                 hss.rescanHba(iScsiHbaDevice);
+                             }
+                             catch (Exception ex) {
+                                 synchronized (exceptions) {
+                                     exceptions.add(ex);
+                                 }
+                             }
+                         }
+                     });
+                 }
+             }
+ 
+             if (!iScsiHbaConfigured) {
+                 throw new Exception("An iSCSI HBA must be configured before a host can use iSCSI storage.");
+             }
+         }
+ 
+         for (Thread thread : threads) {
+             thread.start();
+         }
+ 
+         for (Thread thread : threads) {
+             thread.join();
+         }
+ 
+         if (exceptions.size() > 0) {
+             throw new Exception(exceptions.get(0).getMessage());
+         }
+ 
+         ManagedObjectReference morDs = hostDatastoreSystem.findDatastore(iqn);
+ 
+         if (morDs != null) {
+             return morDs;
+         }
+ 
+         List<HostScsiDisk> lstHostScsiDisks = hostDatastoreSystem.queryAvailableDisksForVmfs();
+ 
+         HostScsiDisk hostScsiDisk = getHostScsiDisk(hostStorageSystem.getStorageDeviceInfo().getScsiTopology(), lstHostScsiDisks, iqn);
+ 
+         if (hostScsiDisk == null) {
+             throw new Exception("A relevant SCSI disk could not be located to use to create a datastore.");
+         }
+ 
+         return hostDatastoreSystem.createVmfsDatastore(datastoreName, hostScsiDisk);
+     }
+ 
+     // the purpose of this method is to find the HostScsiDisk in the passed-in array that exists (if any) because
+     // we added the static iqn to an iSCSI HBA
+     private static HostScsiDisk getHostScsiDisk(HostScsiTopology hst, List<HostScsiDisk> lstHostScsiDisks, String iqn) {
+         for (HostScsiTopologyInterface adapter : hst.getAdapter()) {
+             if (adapter.getTarget() != null) {
+                 for (HostScsiTopologyTarget target : adapter.getTarget()) {
+                     if (target.getTransport() instanceof HostInternetScsiTargetTransport) {
+                         String iScsiName = ((HostInternetScsiTargetTransport)target.getTransport()).getIScsiName();
+ 
+                         if (iqn.equals(iScsiName)) {
+                             for (HostScsiDisk hostScsiDisk : lstHostScsiDisks) {
+                                 for (HostScsiTopologyLun hstl : target.getLun()) {
+                                     if (hstl.getScsiLun().contains(hostScsiDisk.getUuid())) {
+                                         return hostScsiDisk;
+                                     }
+                                 }
+                             }
+                         }
+                     }
+                 }
+             }
+         }
+ 
+         return null;
+     }
+ 
+     private void deleteVmfsDatastore(VmwareHypervisorHost hyperHost, String volumeUuid,
+             String storageIpAddress, int storagePortNumber, String iqn) throws Exception {
+         // hyperHost.unmountDatastore(volumeUuid);
+ 
+         VmwareContext context = getServiceContext();
+         ManagedObjectReference morCluster = hyperHost.getHyperHostCluster();
+         ClusterMO cluster = new ClusterMO(context, morCluster);
+         List<Pair<ManagedObjectReference, String>> lstHosts = cluster.getClusterHosts();
+ 
+         HostInternetScsiHbaStaticTarget target = new HostInternetScsiHbaStaticTarget();
+ 
+         target.setAddress(storageIpAddress);
+         target.setPort(storagePortNumber);
+         target.setIScsiName(iqn);
+ 
+         final List<HostInternetScsiHbaStaticTarget> lstTargets = new ArrayList<HostInternetScsiHbaStaticTarget>();
+ 
+         lstTargets.add(target);
+ 
+         final List<Thread> threads = new ArrayList<Thread>();
+         final List<Exception> exceptions = new ArrayList<Exception>();
+ 
+         for (Pair<ManagedObjectReference, String> hostPair : lstHosts) {
+             final HostMO host = new HostMO(context, hostPair.first());
+             final HostStorageSystemMO hostStorageSystem = host.getHostStorageSystemMO();
+ 
+             for (HostHostBusAdapter hba : hostStorageSystem.getStorageDeviceInfo().getHostBusAdapter()) {
+                 if (hba instanceof HostInternetScsiHba) {
+                     final String iScsiHbaDevice = hba.getDevice();
+ 
+                     Thread thread = new Thread() {
++                        @Override
+                         public void run() {
+                             try {
+                                 hostStorageSystem.removeInternetScsiStaticTargets(iScsiHbaDevice, lstTargets);
+ 
+                                 hostStorageSystem.rescanHba(iScsiHbaDevice);
+                             }
+                             catch (Exception ex) {
+                                 exceptions.add(ex);
+                             }
+                         }
+                     };
+ 
+                     threads.add(thread);
+ 
+                     thread.start();
+                 }
+             }
+         }
+ 
+         for (Thread thread : threads) {
+             thread.join();
+         }
+ 
+         if (exceptions.size() > 0) {
+             throw new Exception(exceptions.get(0).getMessage());
+         }
+     }
+ 
      protected Answer execute(AttachIsoCommand cmd) {
          if (s_logger.isInfoEnabled()) {
              s_logger.info("Executing resource AttachIsoCommand: " + _gson.toJson(cmd));

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57bafc8f/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57bafc8f/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --cc plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index c947af6,e07df0b..a079fe2
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@@ -262,85 -298,8 +298,9 @@@ import com.cloud.utils.exception.CloudR
  import com.cloud.utils.net.NetUtils;
  import com.cloud.vm.DiskProfile;
  import com.cloud.vm.VirtualMachine;
 +import com.cloud.vm.VirtualMachine.PowerState;
  import com.cloud.vm.VirtualMachine.State;
  import com.cloud.vm.snapshot.VMSnapshot;
- import com.trilead.ssh2.SCPClient;
- import com.xensource.xenapi.Bond;
- import com.xensource.xenapi.Connection;
- import com.xensource.xenapi.Console;
- import com.xensource.xenapi.Host;
- import com.xensource.xenapi.HostCpu;
- import com.xensource.xenapi.HostMetrics;
- import com.xensource.xenapi.Network;
- import com.xensource.xenapi.PBD;
- import com.xensource.xenapi.PIF;
- import com.xensource.xenapi.PIF.Record;
- import com.xensource.xenapi.Pool;
- import com.xensource.xenapi.SR;
- import com.xensource.xenapi.Session;
- import com.xensource.xenapi.Task;
- import com.xensource.xenapi.Types;
- import com.xensource.xenapi.Types.BadAsyncResult;
- import com.xensource.xenapi.Types.BadServerResponse;
- import com.xensource.xenapi.Types.ConsoleProtocol;
- import com.xensource.xenapi.Types.IpConfigurationMode;
- import com.xensource.xenapi.Types.OperationNotAllowed;
- import com.xensource.xenapi.Types.SrFull;
- import com.xensource.xenapi.Types.VbdType;
- import com.xensource.xenapi.Types.VmBadPowerState;
- import com.xensource.xenapi.Types.VmPowerState;
- import com.xensource.xenapi.Types.XenAPIException;
- import com.xensource.xenapi.VBD;
- import com.xensource.xenapi.VBDMetrics;
- import com.xensource.xenapi.VDI;
- import com.xensource.xenapi.VIF;
- import com.xensource.xenapi.VLAN;
- import com.xensource.xenapi.VM;
- import com.xensource.xenapi.VMGuestMetrics;
- import com.xensource.xenapi.XenAPIObject;
- import org.apache.cloudstack.storage.command.StorageSubSystemCommand;
- import org.apache.log4j.Logger;
- import org.apache.xmlrpc.XmlRpcException;
- import org.w3c.dom.Document;
- import org.w3c.dom.Node;
- import org.w3c.dom.NodeList;
- import org.xml.sax.InputSource;
- 
- import javax.ejb.Local;
- import javax.naming.ConfigurationException;
- import javax.xml.parsers.DocumentBuilderFactory;
- import java.beans.BeanInfo;
- import java.beans.IntrospectionException;
- import java.beans.Introspector;
- import java.beans.PropertyDescriptor;
- import java.io.BufferedReader;
- import java.io.File;
- import java.io.FileInputStream;
- import java.io.IOException;
- import java.io.InputStream;
- import java.io.InputStreamReader;
- import java.io.StringReader;
- import java.lang.reflect.InvocationTargetException;
- import java.net.URI;
- import java.net.URISyntaxException;
- import java.net.URL;
- import java.net.URLConnection;
- import java.util.ArrayList;
- import java.util.Arrays;
- import java.util.Collections;
- import java.util.Date;
- import java.util.HashMap;
- import java.util.HashSet;
- import java.util.Iterator;
- import java.util.LinkedList;
- import java.util.List;
- import java.util.Map;
- import java.util.Properties;
- import java.util.Queue;
- import java.util.Random;
- import java.util.Set;
- import java.util.UUID;
  
  /**
   * CitrixResourceBase encapsulates the calls to the XenServer Xapi process
@@@ -3041,16 -3006,13 +3007,13 @@@ public abstract class CitrixResourceBas
                  try {
                      host_uuid = host.getUuid(conn);
                  } catch (BadServerResponse e) {
-                     // TODO Auto-generated catch block
-                     e.printStackTrace();
+                     s_logger.error("Failed to get host uuid for host " + host.toWireString(), e);
                  } catch (XenAPIException e) {
-                     // TODO Auto-generated catch block
-                     e.printStackTrace();
+                     s_logger.error("Failed to get host uuid for host " + host.toWireString(), e);
                  } catch (XmlRpcException e) {
-                     // TODO Auto-generated catch block
-                     e.printStackTrace();
+                     s_logger.error("Failed to get host uuid for host " + host.toWireString(), e);
                  }
 -                vmStates.put(record.nameLabel, new Pair<String, State>(host_uuid, state));
 +                vmStates.put(record.nameLabel, new Pair<String, PowerState>(host_uuid, state));
              }
          }
  
@@@ -5782,31 -5718,24 +5719,24 @@@
  
      private List<Pair<String, Long>> ovsFullSyncStates() {
          Connection conn = getConnection();
-         try {
 -        String result = callHostPlugin(conn, "ovsgre", "ovs_get_vm_log", "host_uuid", _host.uuid);
 -        String [] logs = result != null ?result.split(";"): new String [0];
 -        List<Pair<String, Long>> states = new ArrayList<Pair<String, Long>>();
 -        for (String log: logs){
 -            String [] info = log.split(",");
 -            if (info.length != 5) {
 -                s_logger.warn("Wrong element number in ovs log(" + log +")");
 -                continue;
 -            }
 +            String result = callHostPlugin(conn, "ovsgre", "ovs_get_vm_log", "host_uuid", _host.uuid);
 +            String [] logs = result != null ?result.split(";"): new String [0];
 +            List<Pair<String, Long>> states = new ArrayList<Pair<String, Long>>();
 +            for (String log: logs){
 +                String [] info = log.split(",");
 +                if (info.length != 5) {
 +                    s_logger.warn("Wrong element number in ovs log(" + log +")");
 +                    continue;
 +                }
  
 -            //','.join([bridge, vmName, vmId, seqno, tag])
 -            try {
 -                states.add(new Pair<String,Long>(info[0], Long.parseLong(info[3])));
 -            } catch (NumberFormatException nfe) {
 -                states.add(new Pair<String,Long>(info[0], -1L));
 +                //','.join([bridge, vmName, vmId, seqno, tag])
 +                try {
 +                    states.add(new Pair<String,Long>(info[0], Long.parseLong(info[3])));
 +                } catch (NumberFormatException nfe) {
 +                    states.add(new Pair<String,Long>(info[0], -1L));
 +                }
              }
- 
 -        }
 -        return states;
 +            return states;
-         } catch (Exception e) {
-             e.printStackTrace();
-         }
- 
-         return null;
      }
  
      private OvsSetTagAndFlowAnswer execute(OvsSetTagAndFlowCommand cmd) {
@@@ -5850,13 -5783,19 +5784,19 @@@
              PIF pif = nw.getPif(conn);
              Record pifRec = pif.getRecord(conn);
              s_logger.debug("PIF object:" + pifRec.uuid + "(" + pifRec.device + ")");
 -            return new OvsFetchInterfaceAnswer(cmd, true, "Interface " + pifRec.device + " retrieved successfully",
 +            return new OvsFetchInterfaceAnswer(cmd, true, "Interface " + pifRec.device + " retrieved successfully", 
                      pifRec.IP, pifRec.netmask, pifRec.MAC);
-         } catch (Exception e) {
-             e.printStackTrace();
+         } catch (BadServerResponse e) {
+             s_logger.error("An error occurred while fetching the interface for " +
+                     label + " on host " + _host.ip , e);
+             return new OvsFetchInterfaceAnswer(cmd, false, "EXCEPTION:" + e.getMessage());
+         } catch (XenAPIException e) {
+             s_logger.error("An error occurred while fetching the interface for " +
+                     label + " on host " + _host.ip , e);
+             return new OvsFetchInterfaceAnswer(cmd, false, "EXCEPTION:" + e.getMessage());
+         } catch (XmlRpcException e) {
              s_logger.error("An error occurred while fetching the interface for " +
-                     label + " on host " + _host.ip + ":" + e.toString() + 
-                     "(" + e.getClass() + ")");
+                     label + " on host " + _host.ip, e);
              return new OvsFetchInterfaceAnswer(cmd, false, "EXCEPTION:" + e.getMessage());
          }
      }
@@@ -6455,20 -6400,31 +6401,31 @@@
                  if( result.indexOf("<UUID>") != -1) {
                      pooluuid = result.substring(result.indexOf("<UUID>") + 6, result.indexOf("</UUID>")).trim();
                  }
-                 if( pooluuid == null || pooluuid.length() != 36) {
-                     sr = SR.create(conn, host, deviceConfig, new Long(0), pool.getUuid(), poolId, type, "user", true,
+ 
+                 if (pooluuid == null || pooluuid.length() != 36)
+                 {
+                     sr = SR.create(conn, host, deviceConfig, new Long(0), srNameLabel, srNameLabel, type, "user", true,
                              smConfig);
+ 
+                     created[0] = true; // note that the SR was created (as opposed to introduced)
                  } else {
-                     sr = SR.introduce(conn, pooluuid, pool.getUuid(), poolId,
+                     sr = SR.introduce(conn, pooluuid, srNameLabel, srNameLabel,
                              type, "user", true, smConfig);
-                     Pool.Record pRec = XenServerConnectionPool.getPoolRecord(conn);
+ 
+                     Set<Host> setHosts = Host.getAll(conn);
+ 
+                     for (Host currentHost : setHosts) {
 -                        PBD.Record rec = new PBD.Record();
 +                    PBD.Record rec = new PBD.Record();
+ 
 -                        rec.deviceConfig = deviceConfig;
 +                    rec.deviceConfig = deviceConfig;
-                     rec.host = pRec.master;
+                         rec.host = currentHost;
 -                        rec.SR = sr;
 +                    rec.SR = sr;
+ 
 -                        PBD pbd = PBD.create(conn, rec);
 +                    PBD pbd = PBD.create(conn, rec);
+ 
 -                        pbd.plug(conn);
 -                    }
 +                    pbd.plug(conn);
 +                }
+                 }
                  sr.scan(conn);
                  return sr;
              } catch (XenAPIException e) {


Mime
View raw message