Repository: cloudstack Updated Branches: refs/heads/4.4 e7724e90b -> 90117f09e
CLOUDSTACK-6288: Changing default ImageFormat to vhdx for hyper-v and allowing registration of vhdx format templates. Signed-off-by: Devdeep Singh <devd...@gmail.com> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/90117f09 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/90117f09 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/90117f09 Branch: refs/heads/4.4 Commit: 90117f09e80a936c006bfe6ea1e380f6af591c12 Parents: e7724e9 Author: Anshul Gangwar <anshul.gang...@citrix.com> Authored: Tue Apr 1 13:38:54 2014 +0530 Committer: Devdeep Singh <devd...@gmail.com> Committed: Tue Apr 1 13:40:21 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/90117f09/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/90117f09/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/90117f09/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/90117f09/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