Package com.vmware.vim25

Examples of com.vmware.vim25.VirtualDeviceConfigSpec


        + new Gson().toJson(vmdkDatastorePathChain) + ", datastore: " + morDs.getValue());

    VirtualDevice newDisk = VmwareHelper.prepareDiskDevice(this, null, getScsiDeviceControllerKey(),
      vmdkDatastorePathChain, morDs, -1, 1);
      VirtualMachineConfigSpec reConfigSpec = new VirtualMachineConfigSpec();
      VirtualDeviceConfigSpec deviceConfigSpec = new VirtualDeviceConfigSpec();

      deviceConfigSpec.setDevice(newDisk);
      deviceConfigSpec.setOperation(VirtualDeviceConfigSpecOperation.ADD);

      reConfigSpec.getDeviceChange().add(deviceConfigSpec);

      ManagedObjectReference morTask = _context.getService().reconfigVMTask(_mor, reConfigSpec);
    boolean result = _context.getVimClient().waitForTask(morTask);
View Full Code Here


        + new Gson().toJson(vmdkDatastorePathChain));

    VirtualDevice newDisk = VmwareHelper.prepareDiskDevice(this, controllerKey,
      vmdkDatastorePathChain, -1, 1);
      VirtualMachineConfigSpec reConfigSpec = new VirtualMachineConfigSpec();
      VirtualDeviceConfigSpec deviceConfigSpec = new VirtualDeviceConfigSpec();

      deviceConfigSpec.setDevice(newDisk);
      deviceConfigSpec.setOperation(VirtualDeviceConfigSpecOperation.ADD);

      reConfigSpec.getDeviceChange().add(deviceConfigSpec);

      ManagedObjectReference morTask = _context.getService().reconfigVMTask(_mor, reConfigSpec);
    boolean result = _context.getVimClient().waitForTask(morTask);
View Full Code Here

    }

    List<Pair<String, ManagedObjectReference>> chain = getDiskDatastorePathChain(deviceInfo.first(), true);

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

      deviceConfigSpec.setDevice(deviceInfo.first());
      if(deleteBackingFile) {
            deviceConfigSpec.setFileOperation(VirtualDeviceConfigSpecFileOperation.DESTROY);
        }
      deviceConfigSpec.setOperation(VirtualDeviceConfigSpecOperation.REMOVE);

      reConfigSpec.getDeviceChange().add(deviceConfigSpec);

      ManagedObjectReference morTask = _context.getService().reconfigVMTask(_mor, reConfigSpec);
    boolean result = _context.getVimClient().waitForTask(morTask);
View Full Code Here

    if(disks.length > 0) {
        VirtualMachineConfigSpec reConfigSpec = new VirtualMachineConfigSpec();
        VirtualDeviceConfigSpec[] deviceConfigSpecArray = new VirtualDeviceConfigSpec[disks.length];

      for(int i = 0; i < disks.length; i++) {
        deviceConfigSpecArray[i] = new VirtualDeviceConfigSpec();
        deviceConfigSpecArray[i].setDevice(disks[i]);
        deviceConfigSpecArray[i].setOperation(VirtualDeviceConfigSpecOperation.REMOVE);
      }
        reConfigSpec.getDeviceChange().addAll(Arrays.asList(deviceConfigSpecArray));
View Full Code Here

        backingInfo.setDatastore(morDs);
        cdRom.setBacking(backingInfo);

      VirtualMachineConfigSpec reConfigSpec = new VirtualMachineConfigSpec();
      //VirtualDeviceConfigSpec[] deviceConfigSpecArray = new VirtualDeviceConfigSpec[1];
      VirtualDeviceConfigSpec deviceConfigSpec = new VirtualDeviceConfigSpec();

        deviceConfigSpec.setDevice(cdRom);
        if(newCdRom) {
            deviceConfigSpec.setOperation(VirtualDeviceConfigSpecOperation.ADD);
        } else {
            deviceConfigSpec.setOperation(VirtualDeviceConfigSpecOperation.EDIT);
        }

      //deviceConfigSpecArray[0] = deviceConfigSpec;
      reConfigSpec.getDeviceChange().add(deviceConfigSpec);
View Full Code Here

    backingInfo.setDeviceName("");
    device.setBacking(backingInfo);

      VirtualMachineConfigSpec reConfigSpec = new VirtualMachineConfigSpec();
      //VirtualDeviceConfigSpec[] deviceConfigSpecArray = new VirtualDeviceConfigSpec[1];
      VirtualDeviceConfigSpec deviceConfigSpec = new VirtualDeviceConfigSpec();

      deviceConfigSpec.setDevice(device);
      deviceConfigSpec.setOperation(VirtualDeviceConfigSpecOperation.EDIT);

      //deviceConfigSpecArray[0] = deviceConfigSpec;
      reConfigSpec.getDeviceChange().add(deviceConfigSpec);

        ManagedObjectReference morTask = _context.getService().reconfigVMTask(_mor, reConfigSpec);
View Full Code Here

        throw new Exception("Unable to find just-created blank VM");
   
    boolean bSuccess = false;
    try {
        VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec();
        VirtualDeviceConfigSpec deviceConfigSpec = new VirtualDeviceConfigSpec();

          VirtualDevice device = VmwareHelper.prepareDiskDevice(clonedVmMo, null, -1, disks, morDs, -1, 1);

          deviceConfigSpec.setDevice(device);
          deviceConfigSpec.setOperation(VirtualDeviceConfigSpecOperation.ADD);
          vmConfigSpec.getDeviceChange().add(deviceConfigSpec);
          clonedVmMo.configureVm(vmConfigSpec);
          bSuccess = true;
          return clonedVmMo;
    } finally {
View Full Code Here

        return guestOsDescriptor;
    }

  public void plugDevice(VirtualDevice device) throws Exception {
        VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec();
        VirtualDeviceConfigSpec deviceConfigSpec = new VirtualDeviceConfigSpec();
        deviceConfigSpec.setDevice(device);
        deviceConfigSpec.setOperation(VirtualDeviceConfigSpecOperation.ADD);

        vmConfigSpec.getDeviceChange().add(deviceConfigSpec);
        if(!configureVm(vmConfigSpec)) {
            throw new Exception("Failed to add devices");
        }
View Full Code Here

        }
  }

  public void tearDownDevice(VirtualDevice device) throws Exception {
        VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec();
        VirtualDeviceConfigSpec deviceConfigSpec = new VirtualDeviceConfigSpec();
        deviceConfigSpec.setDevice(device);
        deviceConfigSpec.setOperation(VirtualDeviceConfigSpecOperation.REMOVE);

        vmConfigSpec.getDeviceChange().add(deviceConfigSpec);
        if(!configureVm(vmConfigSpec)) {
            throw new Exception("Failed to detach devices");
        }
View Full Code Here

    if(devices.length > 0) {
        VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec();
          VirtualDeviceConfigSpec[] deviceConfigSpecArray = new VirtualDeviceConfigSpec[devices.length];

          for(int i = 0; i < devices.length; i++) {
            deviceConfigSpecArray[i] = new VirtualDeviceConfigSpec();
            deviceConfigSpecArray[i].setDevice(devices[i]);
            deviceConfigSpecArray[i].setOperation(VirtualDeviceConfigSpecOperation.REMOVE);
            vmConfigSpec.getDeviceChange().add(deviceConfigSpecArray[i]);
          }
View Full Code Here

TOP

Related Classes of com.vmware.vim25.VirtualDeviceConfigSpec

Copyright © 2018 www.massapicom. 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.