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
The following commit(s) were added to refs/heads/debian9-systemvmtemplate by
this push:
new 66b1b54 vmware: throw exception only when unable to resize root disk
but user asked
66b1b54 is described below
commit 66b1b54269505732b952fed3f06e41e360078af6
Author: Rohit Yadav <[email protected]>
AuthorDate: Thu Dec 21 19:29:56 2017 +0530
vmware: throw exception only when unable to resize root disk but user asked
Signed-off-by: Rohit Yadav <[email protected]>
---
.../hypervisor/vmware/resource/VmwareResource.java | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 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 d869150..574c9ec 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
@@ -102,6 +102,7 @@ import com.vmware.vim25.VirtualMachineRuntimeInfo;
import com.vmware.vim25.VirtualMachineVideoCard;
import com.vmware.vim25.VmwareDistributedVirtualSwitchVlanIdSpec;
+import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.storage.command.CopyCommand;
import org.apache.cloudstack.storage.command.StorageSubSystemCommand;
import org.apache.cloudstack.storage.resource.NfsSecondaryStorageResource;
@@ -2178,8 +2179,9 @@ public class VmwareResource implements
StoragePoolResource, ServerResource, Vmwa
hyperHost.setRestartPriorityForVM(vmMo,
DasVmPriority.HIGH.value());
}
- // For resizing root disk.
- if (rootDiskTO != null && !hasSnapshot) {
+ // Resizing root disk only when explicit requested by user
+ final Map<String, String> vmDetails =
cmd.getVirtualMachine().getDetails();
+ if (rootDiskTO != null && !hasSnapshot && (vmDetails != null &&
vmDetails.containsKey(ApiConstants.ROOT_DISK_SIZE))) {
resizeRootDiskOnVMStart(vmMo, rootDiskTO, hyperHost, context);
}
@@ -2254,7 +2256,11 @@ public class VmwareResource implements
StoragePoolResource, ServerResource, Vmwa
final Pair<VirtualDisk, String> vdisk = getVirtualDiskInfo(vmMo,
appendFileType(rootDiskTO.getPath(), ".vmdk"));
assert(vdisk != null);
- final Long reqSize = ((VolumeObjectTO)rootDiskTO.getData()).getSize()
/ 1024;
+ Long reqSize = 0L;
+ final VolumeObjectTO volumeTO = ((VolumeObjectTO)rootDiskTO.getData());
+ if (volumeTO != null) {
+ reqSize = volumeTO.getSize() / 1024;
+ }
final VirtualDisk disk = vdisk.first();
if (reqSize > disk.getCapacityInKB()) {
final VirtualMachineDiskInfo diskInfo =
getMatchingExistingDisk(vmMo.getDiskInfoBuilder(), rootDiskTO, hyperHost,
context);
@@ -2262,12 +2268,12 @@ public class VmwareResource implements
StoragePoolResource, ServerResource, Vmwa
final String[] diskChain = diskInfo.getDiskChain();
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;
+ s_logger.warn("Disk chain length for the VM is greater than
one, this is not supported");
+ throw new CloudRuntimeException("Unsupported VM disk chain
length: "+ diskChain.length);
}
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;
+ s_logger.warn("Resizing of root disk is only support for scsi
device/bus, the provide VM's disk device bus name is " +
diskInfo.getDiskDeviceBusName());
+ throw new CloudRuntimeException("Unsupported VM root disk
device bus: "+ diskInfo.getDiskDeviceBusName());
}
disk.setCapacityInKB(reqSize);
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].