Examples of VirtualDisk


Examples of com.vmware.vim25.VirtualDisk

    int ideControllerKey = getIDEDeviceControllerKey();
    if(controllerKey < 0) {
            controllerKey = ideControllerKey;
        }

    VirtualDisk newDisk = new VirtualDisk();
    if(diskType == VirtualDiskType.THIN || diskType == VirtualDiskType.PREALLOCATED
      || diskType == VirtualDiskType.EAGER_ZEROED_THICK) {

      VirtualDiskFlatVer2BackingInfo backingInfo = new VirtualDiskFlatVer2BackingInfo();
          backingInfo.setDiskMode(diskMode.PERSISTENT.value());
          if(diskType == VirtualDiskType.THIN) {
                backingInfo.setThinProvisioned(true);
            } else {
                backingInfo.setThinProvisioned(false);
            }

          if(diskType == VirtualDiskType.EAGER_ZEROED_THICK) {
                backingInfo.setEagerlyScrub(true);
            } else {
                backingInfo.setEagerlyScrub(false);
            }

          backingInfo.setDatastore(morDs);
          backingInfo.setFileName(vmdkDatastorePath);
          newDisk.setBacking(backingInfo);
    } else if(diskType == VirtualDiskType.RDM || diskType == VirtualDiskType.RDMP) {
      VirtualDiskRawDiskMappingVer1BackingInfo backingInfo =
        new VirtualDiskRawDiskMappingVer1BackingInfo();
      if(diskType == VirtualDiskType.RDM) {
        backingInfo.setCompatibilityMode("virtualMode");
          } else {
            backingInfo.setCompatibilityMode("physicalMode");
          }
          backingInfo.setDeviceName(rdmDeviceName);
          if(diskType == VirtualDiskType.RDM) {
            backingInfo.setDiskMode(diskMode.PERSISTENT.value());
          }

          backingInfo.setDatastore(morDs);
          backingInfo.setFileName(vmdkDatastorePath);
          newDisk.setBacking(backingInfo);
    }

    int deviceNumber = getNextDeviceNumber(controllerKey);
    if(controllerKey != ideControllerKey && VmwareHelper.isReservedScsiDeviceNumber(deviceNumber))
      deviceNumber++;

    newDisk.setControllerKey(controllerKey);
      newDisk.setKey(-deviceNumber);
      newDisk.setUnitNumber(deviceNumber);
      newDisk.setCapacityInKB(sizeInMb*1024);

      VirtualMachineConfigSpec reConfigSpec = new VirtualMachineConfigSpec();
      VirtualDeviceConfigSpec deviceConfigSpec = new VirtualDeviceConfigSpec();

      deviceConfigSpec.setDevice(newDisk);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.