Package com.vmware.vim25

Examples of com.vmware.vim25.VirtualMachineRelocateSpec


        VirtualDeviceConfigSpec nicSpec =
            new VirtualDeviceConfigSpec();
        nicSpec.setOperation(VirtualDeviceConfigSpecOperation.add);

        VirtualEthernetCard nic =  new VirtualE1000();
        VirtualEthernetCardNetworkBackingInfo nicBacking =
            new VirtualEthernetCardNetworkBackingInfo();
        nicBacking.setDeviceName(netName);

        Description info = new Description();
        info.setLabel(nicName);
        info.setSummary(netName);
        nic.setDeviceInfo(info);
View Full Code Here


        boolean isScsi = true;
       
        switch(type_) {
        case IDE:
            isScsi = false;
            ctrl = new VirtualIDEController();
            break;
        case BUSLOGIC:
            isScsi = true;
            ctrl = new VirtualBusLogicController();
            break;
View Full Code Here

    private VirtualDeviceConfigSpec createScsiSpec(int cKey)
    {
        VirtualDeviceConfigSpec scsiSpec =
            new VirtualDeviceConfigSpec();
        scsiSpec.setOperation(VirtualDeviceConfigSpecOperation.add);
        VirtualLsiLogicController scsiCtrl =
            new VirtualLsiLogicController();
        scsiCtrl.setKey(cKey);
        scsiCtrl.setBusNumber(0);
        scsiCtrl.setSharedBus(VirtualSCSISharing.noSharing);
        scsiSpec.setDevice(scsiCtrl);
        return scsiSpec;
    }
View Full Code Here

            isScsi = true;
            ctrl = new VirtualBusLogicController();
            break;
        case LSILOGIC:
            isScsi = true;
            ctrl = new VirtualLsiLogicController();
            break;
        case LSILOGICSAS:
            isScsi = true;
            ctrl = new VirtualLsiLogicSASController();
            break;
View Full Code Here

            isScsi = true;
            ctrl = new VirtualLsiLogicController();
            break;
        case LSILOGICSAS:
            isScsi = true;
            ctrl = new VirtualLsiLogicSASController();
            break;
        default:
            return null;
        }
View Full Code Here

            specList.add(diskSpec);
            unitNumber ++;
        }

        /* set vm config spec */
        VirtualMachineConfigSpec vmConfigSpec =
            new VirtualMachineConfigSpec();
        vmConfigSpec.setChangeTrackingEnabled(true); /* set ctkEnabled option. */
        vmConfigSpec.setDeviceChange
            (specList.toArray(new VirtualDeviceConfigSpec[0]));

        /* reconfigure vm task */
        try {
            Task task = vm_.reconfigVM_Task(vmConfigSpec);
View Full Code Here

               all disks managed by it. */
            specList.addAll(ctrlm.createAll());
        }

        /* set vm config spec */
        VirtualMachineConfigSpec vmConfigSpec =
            new VirtualMachineConfigSpec();
        vmConfigSpec.setChangeTrackingEnabled(true); /* set ctkEnabled option. */
        vmConfigSpec.setDeviceChange
            (specList.toArray(new VirtualDeviceConfigSpec[0]));

        /* reconfigure vm task */
        try {
            Task task = vm_.reconfigVM_Task(vmConfigSpec);
View Full Code Here

        }
        return false;
    }

  public boolean relocate(ManagedObjectReference morTargetHost) throws Exception {
      VirtualMachineRelocateSpec relocateSpec = new VirtualMachineRelocateSpec();
      relocateSpec.setHost(morTargetHost);

        ManagedObjectReference morTask = _context.getService().relocateVMTask(_mor,
            relocateSpec, null);

        boolean result = _context.getVimClient().waitForTask(morTask);
View Full Code Here

  public boolean createFullClone(String cloneName, ManagedObjectReference morFolder, ManagedObjectReference morResourcePool,
    ManagedObjectReference morDs) throws Exception {

       VirtualMachineCloneSpec cloneSpec = new VirtualMachineCloneSpec();
       VirtualMachineRelocateSpec relocSpec = new VirtualMachineRelocateSpec();
       cloneSpec.setLocation(relocSpec);
       cloneSpec.setPowerOn(false);
       cloneSpec.setTemplate(false);

       relocSpec.setDatastore(morDs);
       relocSpec.setPool(morResourcePool);
        ManagedObjectReference morTask = _context.getService().cloneVMTask(_mor, morFolder, cloneName, cloneSpec);

    boolean result = _context.getVimClient().waitForTask(morTask);
    if(result) {
      _context.waitForTaskProgressDone(morTask);
View Full Code Here

    assert(morFolder != null);
    assert(morResourcePool != null);
    assert(morDs != null);

    VirtualDisk[] independentDisks = getAllIndependentDiskDevice();
        VirtualMachineRelocateSpec rSpec = new VirtualMachineRelocateSpec();
        if(independentDisks.length > 0) {
            List<VirtualMachineRelocateSpecDiskLocator> diskLocator = new ArrayList<VirtualMachineRelocateSpecDiskLocator>(independentDisks.length);
            for(int i = 0; i < independentDisks.length; i++) {
                VirtualMachineRelocateSpecDiskLocator loc = new VirtualMachineRelocateSpecDiskLocator();
              loc.setDatastore(morDs);
              loc.setDiskId(independentDisks[i].getKey());
              loc.setDiskMoveType(VirtualMachineRelocateDiskMoveOptions.MOVE_ALL_DISK_BACKINGS_AND_DISALLOW_SHARING.value());
              diskLocator.add(loc);
            }

            rSpec.setDiskMoveType(VirtualMachineRelocateDiskMoveOptions.CREATE_NEW_CHILD_DISK_BACKING.value());
            rSpec.getDisk().addAll(diskLocator);
        } else {
          rSpec.setDiskMoveType(VirtualMachineRelocateDiskMoveOptions.CREATE_NEW_CHILD_DISK_BACKING.value());
        }
        rSpec.setPool(morResourcePool);

        VirtualMachineCloneSpec cloneSpec = new VirtualMachineCloneSpec();
        cloneSpec.setPowerOn(false);
        cloneSpec.setTemplate(false);
        cloneSpec.setLocation(rSpec);
View Full Code Here

TOP

Related Classes of com.vmware.vim25.VirtualMachineRelocateSpec

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.