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 a7732ab0586387eab75e6b9115bf0512fb81f3e5
Author: Rohit Yadav <rohit.ya...@shapeblue.com>
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 <rohit.ya...@shapeblue.com>
---
 .../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 40ffdf4..7f8c2a5 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
@@ -2093,9 +2093,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);
             }
 
             //
@@ -2165,28 +2165,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
"commits@cloudstack.apache.org" <commits@cloudstack.apache.org>.

Reply via email to