Examples of VirtualCdrom


Examples of com.vmware.vim25.VirtualCdrom

 
  static VirtualDeviceConfigSpec createRemoveCdConfigSpec(VirtualMachine vm, String cdName) throws Exception
  {
    VirtualDeviceConfigSpec cdSpec = new VirtualDeviceConfigSpec();
    cdSpec.setOperation(VirtualDeviceConfigSpecOperation.remove);
    VirtualCdrom cdRemove = (VirtualCdrom)findVirtualDevice(vm.getConfig(), cdName);
    if(cdRemove != null)
    {
      cdSpec.setDevice(cdRemove);
      return cdSpec;
    }
View Full Code Here

Examples of com.vmware.vim25.VirtualCdrom

  public static Pair<VirtualDevice, Boolean> prepareIsoDevice(VirtualMachineMO vmMo, String isoDatastorePath, ManagedObjectReference morDs,
    boolean connect, boolean connectAtBoot, int deviceNumber, int contextNumber) throws Exception {

    boolean newCdRom = false;
    VirtualCdrom cdRom = (VirtualCdrom )vmMo.getIsoDevice();
    if(cdRom == null) {
      newCdRom = true;
      cdRom = new VirtualCdrom();

      assert(vmMo.getIDEDeviceControllerKey() >= 0);
      cdRom.setControllerKey(vmMo.getIDEDeviceControllerKey());
      if(deviceNumber < 0)
        deviceNumber = vmMo.getNextIDEDeviceNumber();

      cdRom.setUnitNumber(deviceNumber);
      cdRom.setKey(-contextNumber);
    }

      VirtualDeviceConnectInfo cInfo = new VirtualDeviceConnectInfo();
      cInfo.setConnected(connect);
      cInfo.setStartConnected(connectAtBoot);
      cdRom.setConnectable(cInfo);

        if(isoDatastorePath != null) {
            VirtualCdromIsoBackingInfo backingInfo = new VirtualCdromIsoBackingInfo();
          backingInfo.setFileName(isoDatastorePath);
          backingInfo.setDatastore(morDs);
          cdRom.setBacking(backingInfo);
        } else {
        VirtualCdromRemotePassthroughBackingInfo backingInfo = new VirtualCdromRemotePassthroughBackingInfo();
        backingInfo.setDeviceName("");
        cdRom.setBacking(backingInfo);
        }

    return new Pair<VirtualDevice, Boolean>(cdRom, newCdRom);
  }
View Full Code Here

Examples of com.vmware.vim25.VirtualCdrom

    if(powerState != VirtualMachinePowerState.poweredOff)
    {
      throw new RuntimeException("VM is not yet powered off for adding a CD drive.");
    }
   
    VirtualCdrom cdrom = new VirtualCdrom();
    cdrom.connectable = new VirtualDeviceConnectInfo();
    cdrom.connectable.allowGuestControl = true;
    cdrom.connectable.startConnected = startConnected;

    if (hostDevice != null)
View Full Code Here

Examples of com.vmware.vim25.VirtualCdrom

  {
    VirtualDeviceConfigSpec cdSpec = new VirtualDeviceConfigSpec();

    cdSpec.setOperation(VirtualDeviceConfigSpecOperation.add);        

    VirtualCdrom cdrom =  new VirtualCdrom();
    VirtualCdromIsoBackingInfo cdDeviceBacking = new  VirtualCdromIsoBackingInfo();
    DatastoreSummary ds = findDatastoreSummary(vm, dsName);
    cdDeviceBacking.setDatastore(ds.getDatastore());
//    cdDeviceBacking.setFileName( isoName);
        cdDeviceBacking.setFileName("[" + dsName +"] "+ isoPath);

    VirtualDevice vd = getIDEController(vm);         
    cdrom.setBacking(cdDeviceBacking);                   
    cdrom.setControllerKey(vd.getKey());
    cdrom.setUnitNumber(vd.getUnitNumber());
    cdrom.setKey(-1);         

    cdSpec.setDevice(cdrom);

    return cdSpec;         
  }
View Full Code Here

Examples of com.vmware.vim25.VirtualCdrom

  static public VirtualDeviceConfigSpec createRemoveCdConfigSpec(VirtualMachine vm, String cdName) throws Exception
  {
    VirtualDeviceConfigSpec cdSpec = new VirtualDeviceConfigSpec();
    cdSpec.setOperation(VirtualDeviceConfigSpecOperation.remove);
    VirtualCdrom cdRemove = (VirtualCdrom)findVirtualDevice(vm.getConfig(), cdName);
    if(cdRemove != null)
    {
      cdSpec.setDevice(cdRemove);
      return cdSpec;
    }
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.