You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by de...@apache.org on 2014/04/01 10:41:38 UTC

git commit: updated refs/heads/master to 24820d2

Repository: cloudstack
Updated Branches:
  refs/heads/master 06c0486d0 -> 24820d20d


CLOUDSTACK-6288: Changing default ImageFormat to vhdx for hyper-v and allowing registration of vhdx format templates.

Signed-off-by: Devdeep Singh <de...@gmail.com>


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

Branch: refs/heads/master
Commit: 24820d20d3f5f68ba07cd0fd92dc29c3634b5038
Parents: 06c0486
Author: Anshul Gangwar <an...@citrix.com>
Authored: Tue Apr 1 13:38:54 2014 +0530
Committer: Devdeep Singh <de...@gmail.com>
Committed: Tue Apr 1 14:00:24 2014 +0530

----------------------------------------------------------------------
 .../orchestration/VolumeOrchestrator.java       | 21 ++++++++++++++++----
 .../HypervResource/HypervResourceController.cs  |  2 +-
 .../ServerResource/HypervResource/WmiCallsV2.cs |  2 +-
 ui/scripts/templates.js                         |  4 ++++
 4 files changed, 23 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/24820d20/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
index 4ebde04..064ffca 100644
--- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
@@ -30,8 +30,6 @@ import java.util.concurrent.ExecutionException;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
-import com.cloud.vm.UserVmVO;
-import com.cloud.vm.dao.UserVmDao;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.engine.orchestration.service.VolumeOrchestrationService;
@@ -113,10 +111,12 @@ import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.fsm.NoTransitionException;
 import com.cloud.utils.fsm.StateMachine2;
 import com.cloud.vm.DiskProfile;
+import com.cloud.vm.UserVmVO;
 import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachine.State;
 import com.cloud.vm.VirtualMachineProfile;
 import com.cloud.vm.VirtualMachineProfileImpl;
+import com.cloud.vm.dao.UserVmDao;
 
 public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrationService, Configurable {
     private static final Logger s_logger = Logger.getLogger(VolumeOrchestrator.class);
@@ -687,16 +687,29 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
         } else if (hyperType == HypervisorType.Ovm) {
             return ImageFormat.RAW;
         } else if (hyperType == HypervisorType.Hyperv) {
-            return ImageFormat.VHD;
+            return ImageFormat.VHDX;
         } else {
             return null;
         }
     }
 
+    private boolean isSupportedImageFormatForCluster(VolumeInfo volume, HypervisorType rootDiskHyperType) {
+        ImageFormat volumeFormat = volume.getFormat();
+        if (rootDiskHyperType == HypervisorType.Hyperv) {
+            if (volumeFormat.equals(ImageFormat.VHDX) || volumeFormat.equals(ImageFormat.VHD)) {
+                return true;
+            } else {
+                return false;
+            }
+        } else {
+            return volume.getFormat().equals(getSupportedImageFormatForCluster(rootDiskHyperType));
+        }
+    }
+
     private VolumeInfo copyVolume(StoragePool rootDiskPool, VolumeInfo volume, VirtualMachine vm, VirtualMachineTemplate rootDiskTmplt, DataCenter dcVO, Pod pod,
             DiskOffering diskVO, ServiceOffering svo, HypervisorType rootDiskHyperType) throws NoTransitionException {
 
-        if (!volume.getFormat().equals(getSupportedImageFormatForCluster(rootDiskHyperType))) {
+        if (!isSupportedImageFormatForCluster(volume, rootDiskHyperType)) {
             throw new InvalidParameterValueException("Failed to attach volume to VM since volumes format " + volume.getFormat().getFileExtension()
                     + " is not compatible with the vm hypervisor type");
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/24820d20/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
index 40609e4..66b9828 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/HypervResourceController.cs
@@ -1175,7 +1175,7 @@ namespace HypervResource
                     VolumeObjectTO volume = VolumeObjectTO.ParseJson(cmd.data);
                     PrimaryDataStoreTO primary = volume.primaryDataStore;
                     ulong volumeSize = volume.size;
-                    string volumeName = volume.uuid + ".vhd";
+                    string volumeName = volume.uuid + ".vhdx";
                     string volumePath = null;
 
                     if (primary.isLocal)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/24820d20/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
index d5cf7c9..ff8ab90 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/HypervResource/WmiCallsV2.cs
@@ -1777,7 +1777,7 @@ namespace HypervResource
             // Is there a template we can use to fill in the settings?
             var newVirtHDSettings = VirtualHardDiskSettingData.CreateInstance();
             newVirtHDSettings.LateBoundObject["Type"] = 3; // Dynamic
-            newVirtHDSettings.LateBoundObject["Format"] = 2; // VHD
+            newVirtHDSettings.LateBoundObject["Format"] = 3; // VHDX
             newVirtHDSettings.LateBoundObject["Path"] = Path;
             newVirtHDSettings.LateBoundObject["MaxInternalSize"] = MaxInternalSize;
             newVirtHDSettings.LateBoundObject["BlockSize"] = 0; // Use defaults

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/24820d20/ui/scripts/templates.js
----------------------------------------------------------------------
diff --git a/ui/scripts/templates.js b/ui/scripts/templates.js
index 7a45463..67cc2fb 100644
--- a/ui/scripts/templates.js
+++ b/ui/scripts/templates.js
@@ -396,6 +396,10 @@
                                                     id: 'VHD',
                                                     description: 'VHD'
                                                 });
+                                                items.push({
+                                                    id: 'VHDX',
+                                                    description: 'VHDX'
+                                                });
                                             }
                                             args.response.success({
                                                 data: items