This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch debian9-systemvmtemplate
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit ce3303212b5f9639ee91db52972fc9fd4b9a3c68
Author: Rohit Yadav <[email protected]>
AuthorDate: Sat Dec 16 14:19:28 2017 +0530

    CLOUDSTACK-9953: Resize root disk for VMware when full clone is enabled
    
    Resize for VMware root disk should only be performed during VM start
    when vmware.create.full.clone is true i.e. the disk chain length is one.
    
    Signed-off-by: Rohit Yadav <[email protected]>
---
 .../hypervisor/vmware/resource/VmwareResource.java | 34 ++++++++++------------
 1 file changed, 15 insertions(+), 19 deletions(-)

diff --git 
a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
 
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index c08a612..d869150 100644
--- 
a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ 
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -2178,9 +2178,9 @@ public class VmwareResource implements 
StoragePoolResource, ServerResource, Vmwa
                 hyperHost.setRestartPriorityForVM(vmMo, 
DasVmPriority.HIGH.value());
             }
 
-            //For resizing root disk.
+            // For resizing root disk.
             if (rootDiskTO != null && !hasSnapshot) {
-                resizeRootDisk(vmMo, rootDiskTO, hyperHost, context);
+                resizeRootDiskOnVMStart(vmMo, rootDiskTO, hyperHost, context);
             }
 
             //
@@ -2250,28 +2250,24 @@ public class VmwareResource implements 
StoragePoolResource, ServerResource, Vmwa
         return path + fileType;
     }
 
-    private void resizeRootDisk(VirtualMachineMO vmMo, DiskTO rootDiskTO, 
VmwareHypervisorHost hyperHost, VmwareContext context) throws Exception
-    {
-        Pair<VirtualDisk, String> vdisk = getVirtualDiskInfo(vmMo, 
appendFileType(rootDiskTO.getPath(), ".vmdk"));
+    private void resizeRootDiskOnVMStart(VirtualMachineMO vmMo, DiskTO 
rootDiskTO, VmwareHypervisorHost hyperHost, VmwareContext context) throws 
Exception {
+        final Pair<VirtualDisk, String> vdisk = getVirtualDiskInfo(vmMo, 
appendFileType(rootDiskTO.getPath(), ".vmdk"));
         assert(vdisk != null);
 
-        Long reqSize=((VolumeObjectTO)rootDiskTO.getData()).getSize()/1024;
-        VirtualDisk disk = vdisk.first();
-        if (reqSize > disk.getCapacityInKB())
-        {
-            VirtualMachineDiskInfo diskInfo = 
getMatchingExistingDisk(vmMo.getDiskInfoBuilder(), rootDiskTO, hyperHost, 
context);
+        final Long reqSize = ((VolumeObjectTO)rootDiskTO.getData()).getSize() 
/ 1024;
+        final VirtualDisk disk = vdisk.first();
+        if (reqSize > disk.getCapacityInKB()) {
+            final VirtualMachineDiskInfo diskInfo = 
getMatchingExistingDisk(vmMo.getDiskInfoBuilder(), rootDiskTO, hyperHost, 
context);
             assert (diskInfo != null);
-            String[] diskChain = diskInfo.getDiskChain();
+            final String[] diskChain = diskInfo.getDiskChain();
 
-            if (diskChain != null && diskChain.length>1)
-            {
-                s_logger.error("Unsupported Disk chain length "+ 
diskChain.length);
-                throw new Exception("Unsupported Disk chain length "+ 
diskChain.length);
+            if (diskChain != null && diskChain.length > 1) {
+                s_logger.warn("Disk chain length for the VM is greater than 
one, skipping resizing of root disk.");
+                return;
             }
-            if (diskInfo.getDiskDeviceBusName() == null || 
!diskInfo.getDiskDeviceBusName().toLowerCase().startsWith("scsi"))
-            {
-                s_logger.error("Unsupported root disk device bus "+ 
diskInfo.getDiskDeviceBusName() );
-                throw new Exception("Unsupported root disk device bus "+ 
diskInfo.getDiskDeviceBusName());
+            if (diskInfo.getDiskDeviceBusName() == null || 
!diskInfo.getDiskDeviceBusName().toLowerCase().startsWith("scsi")) {
+                s_logger.warn("Resizing of root disk is only support for scsi 
device/bus, the provide disk's device bus name is " + 
diskInfo.getDiskDeviceBusName());
+                return;
             }
 
             disk.setCapacityInKB(reqSize);

-- 
To stop receiving notification emails like this one, please contact
"[email protected]" <[email protected]>.

Reply via email to