Search in sources :

Example 11 with ArrayOfVirtualDevice

use of com.vmware.vim25.ArrayOfVirtualDevice in project photon-model by vmware.

the class InstanceClient method cloneVm.

private ManagedObjectReference cloneVm(ManagedObjectReference template) throws Exception {
    ManagedObjectReference folder = getVmFolder();
    List<VirtualMachineDefinedProfileSpec> pbmSpec = getPbmProfileSpec(this.bootDisk);
    ManagedObjectReference datastore = getDataStoreForDisk(this.bootDisk, pbmSpec);
    ManagedObjectReference resourcePool = getResourcePool();
    Map<String, Object> props = this.get.entityProps(template, VimPath.vm_config_hardware_device);
    ArrayOfVirtualDevice devices = (ArrayOfVirtualDevice) props.get(VimPath.vm_config_hardware_device);
    VirtualDisk vd = devices.getVirtualDevice().stream().filter(d -> d instanceof VirtualDisk).map(d -> (VirtualDisk) d).findFirst().orElse(null);
    VirtualMachineRelocateSpec relocSpec = new VirtualMachineRelocateSpec();
    relocSpec.setDatastore(datastore);
    if (pbmSpec != null) {
        pbmSpec.stream().forEach(spec -> {
            relocSpec.getProfile().add(spec);
        });
    }
    relocSpec.setFolder(folder);
    relocSpec.setPool(resourcePool);
    relocSpec.setDiskMoveType(computeDiskMoveType().value());
    VirtualMachineCloneSpec cloneSpec = new VirtualMachineCloneSpec();
    cloneSpec.setLocation(relocSpec);
    // Set the provisioning type of the parent disk.
    VirtualMachineRelocateSpecDiskLocator diskProvisionTypeLocator = setProvisioningType(vd, datastore, pbmSpec);
    if (diskProvisionTypeLocator != null) {
        cloneSpec.getLocation().getDisk().add(diskProvisionTypeLocator);
    }
    cloneSpec.setPowerOn(false);
    cloneSpec.setTemplate(false);
    String displayName = this.ctx.child.name;
    ManagedObjectReference cloneTask = getVimPort().cloneVMTask(template, folder, displayName, cloneSpec);
    TaskInfo info = waitTaskEnd(cloneTask);
    if (info.getState() == TaskInfoState.ERROR) {
        MethodFault fault = info.getError().getFault();
        if (fault instanceof FileAlreadyExists) {
            // a .vmx file already exists, assume someone won the race to create the vm
            return null;
        } else {
            return VimUtils.rethrow(info.getError());
        }
    }
    return (ManagedObjectReference) info.getResult();
}
Also used : ClientUtils.findMatchingVirtualDevice(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.findMatchingVirtualDevice) VirtualMachineConfigSpec(com.vmware.vim25.VirtualMachineConfigSpec) VirtualMachineRelocateSpecDiskLocator(com.vmware.vim25.VirtualMachineRelocateSpecDiskLocator) VirtualDiskSpec(com.vmware.vim25.VirtualDiskSpec) ClientUtils.fillInControllerUnitNumber(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.fillInControllerUnitNumber) ArrayOfVirtualDevice(com.vmware.vim25.ArrayOfVirtualDevice) ClientUtils.findFreeScsiUnit(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.findFreeScsiUnit) VmConfigSpec(com.vmware.vim25.VmConfigSpec) ClientUtils.getFirstIdeController(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.getFirstIdeController) VirtualDeviceConnectInfo(com.vmware.vim25.VirtualDeviceConnectInfo) Utils(com.vmware.xenon.common.Utils) Document(org.w3c.dom.Document) Map(java.util.Map) VirtualDevice(com.vmware.vim25.VirtualDevice) EnumSet(java.util.EnumSet) FinderException(com.vmware.photon.controller.model.adapters.vsphere.util.finders.FinderException) VapiConnection(com.vmware.photon.controller.model.adapters.vsphere.vapi.VapiConnection) ClientUtils.createHdd(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.createHdd) ClientUtils.getFirstScsiController(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.getFirstScsiController) ArrayOfManagedObjectReference(com.vmware.vim25.ArrayOfManagedObjectReference) ClientUtils.nextUnitNumber(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.nextUnitNumber) ClientUtils.getFirstSioController(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.getFirstSioController) ClientUtils.getDatastorePathForDisk(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.getDatastorePathForDisk) VirtualMachineFileInfo(com.vmware.vim25.VirtualMachineFileInfo) VirtualMachineSnapshotInfo(com.vmware.vim25.VirtualMachineSnapshotInfo) DuplicateNameFaultMsg(com.vmware.vim25.DuplicateNameFaultMsg) ArrayUpdateOperation(com.vmware.vim25.ArrayUpdateOperation) UriUtils(com.vmware.xenon.common.UriUtils) ClientUtils.detachDisk(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.detachDisk) VirtualFloppy(com.vmware.vim25.VirtualFloppy) ClientUtils.getStorageIOAllocationInfo(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.getStorageIOAllocationInfo) Finder(com.vmware.photon.controller.model.adapters.vsphere.util.finders.Finder) OvfDeployer(com.vmware.photon.controller.model.adapters.vsphere.ovf.OvfDeployer) VirtualLsiLogicController(com.vmware.vim25.VirtualLsiLogicController) OptionValue(com.vmware.vim25.OptionValue) RuntimeFaultFaultMsg(com.vmware.vim25.RuntimeFaultFaultMsg) ArrayList(java.util.ArrayList) ComputeInstanceRequest(com.vmware.photon.controller.model.adapterapi.ComputeInstanceRequest) VirtualCdrom(com.vmware.vim25.VirtualCdrom) STORAGE_REFERENCE(com.vmware.photon.controller.model.constants.PhotonModelConstants.STORAGE_REFERENCE) OvfRetriever(com.vmware.photon.controller.model.adapters.vsphere.ovf.OvfRetriever) ClientUtils.getDiskProvisioningType(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.getDiskProvisioningType) DISK_DATASTORE_NAME(com.vmware.photon.controller.model.adapters.vsphere.CustomProperties.DISK_DATASTORE_NAME) VirtualMachineRelocateDiskMoveOptions(com.vmware.vim25.VirtualMachineRelocateDiskMoveOptions) InvalidCollectorVersionFaultMsg(com.vmware.vim25.InvalidCollectorVersionFaultMsg) VirtualMachineGuestOsIdentifier(com.vmware.vim25.VirtualMachineGuestOsIdentifier) DiskStatus(com.vmware.photon.controller.model.resources.DiskService.DiskStatus) VirtualDeviceConfigSpec(com.vmware.vim25.VirtualDeviceConfigSpec) VirtualDeviceBackingInfo(com.vmware.vim25.VirtualDeviceBackingInfo) ClientUtils.getDiskMode(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.getDiskMode) PROVIDER_DISK_UNIQUE_ID(com.vmware.photon.controller.model.adapters.vsphere.CustomProperties.PROVIDER_DISK_UNIQUE_ID) ManagedObjectReference(com.vmware.vim25.ManagedObjectReference) ClientUtils.findFreeUnit(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.findFreeUnit) ClientUtils.insertCdrom(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.insertCdrom) MethodFault(com.vmware.vim25.MethodFault) Lock(java.util.concurrent.locks.Lock) VirtualDisk(com.vmware.vim25.VirtualDisk) Paths(java.nio.file.Paths) InvalidNameFaultMsg(com.vmware.vim25.InvalidNameFaultMsg) ClientUtils.insertFloppy(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.insertFloppy) VAppPropertySpec(com.vmware.vim25.VAppPropertySpec) VirtualDiskType(com.vmware.vim25.VirtualDiskType) VirtualEthernetCardMacType(com.vmware.vim25.VirtualEthernetCardMacType) OvfParser(com.vmware.photon.controller.model.adapters.vsphere.ovf.OvfParser) BaseHelper(com.vmware.photon.controller.model.adapters.vsphere.util.connection.BaseHelper) LoggerFactory(org.slf4j.LoggerFactory) ClientUtils.toKb(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.toKb) DiskType(com.vmware.photon.controller.model.resources.DiskService.DiskType) OvfNetworkMapping(com.vmware.vim25.OvfNetworkMapping) VAppPropertyInfo(com.vmware.vim25.VAppPropertyInfo) ClientUtils.getPbmProfileSpec(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.getPbmProfileSpec) Connection(com.vmware.photon.controller.model.adapters.vsphere.util.connection.Connection) URI(java.net.URI) TaskInfo(com.vmware.vim25.TaskInfo) VirtualDiskFlatVer2BackingInfo(com.vmware.vim25.VirtualDiskFlatVer2BackingInfo) VM_PATH_FORMAT(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.VM_PATH_FORMAT) DiskStateExpanded(com.vmware.photon.controller.model.resources.DiskService.DiskStateExpanded) DuplicateName(com.vmware.vim25.DuplicateName) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) ArrayOfVAppPropertyInfo(com.vmware.vim25.ArrayOfVAppPropertyInfo) Collectors(java.util.stream.Collectors) ServiceHost(com.vmware.xenon.common.ServiceHost) Objects(java.util.Objects) Base64(java.util.Base64) List(java.util.List) InvalidPropertyFaultMsg(com.vmware.vim25.InvalidPropertyFaultMsg) VirtualMachineRelocateSpec(com.vmware.vim25.VirtualMachineRelocateSpec) VirtualPCIController(com.vmware.vim25.VirtualPCIController) ClientUtils.createCdrom(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.createCdrom) Entry(java.util.Map.Entry) DiskService(com.vmware.photon.controller.model.resources.DiskService) VimPath(com.vmware.photon.controller.model.adapters.vsphere.util.VimPath) PhotonModelUriUtils(com.vmware.photon.controller.model.util.PhotonModelUriUtils) FileAlreadyExists(com.vmware.vim25.FileAlreadyExists) ClientUtils.makePathToVmdkFile(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.makePathToVmdkFile) HashMap(java.util.HashMap) GetMoRef(com.vmware.photon.controller.model.adapters.vsphere.util.connection.GetMoRef) VirtualMachineCloneSpec(com.vmware.vim25.VirtualMachineCloneSpec) VapiClient(com.vmware.photon.controller.model.adapters.vsphere.vapi.VapiClient) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) CollectionUtils(org.apache.commons.collections.CollectionUtils) ComputeState(com.vmware.photon.controller.model.resources.ComputeService.ComputeState) ClientUtils.getListOfVirtualDisk(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.getListOfVirtualDisk) NetworkDeviceBackingFactory(com.vmware.photon.controller.model.adapters.vsphere.network.NetworkDeviceBackingFactory) ClientUtils.getDatastoreFromStoragePolicy(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.getDatastoreFromStoragePolicy) Logger(org.slf4j.Logger) Element(com.vmware.photon.controller.model.adapters.vsphere.util.finders.Element) ReentrantLock(java.util.concurrent.locks.ReentrantLock) VirtualE1000(com.vmware.vim25.VirtualE1000) Operation(com.vmware.xenon.common.Operation) DISK_CONTROLLER_NUMBER(com.vmware.photon.controller.model.adapters.vsphere.CustomProperties.DISK_CONTROLLER_NUMBER) ClientUtils.createFloppy(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.createFloppy) VirtualSCSIController(com.vmware.vim25.VirtualSCSIController) VimNames(com.vmware.photon.controller.model.adapters.vsphere.util.VimNames) NetworkInterfaceStateWithDetails(com.vmware.photon.controller.model.adapters.vsphere.ProvisionContext.NetworkInterfaceStateWithDetails) DISK_PARENT_DIRECTORY(com.vmware.photon.controller.model.adapters.vsphere.CustomProperties.DISK_PARENT_DIRECTORY) TimeUnit(java.util.concurrent.TimeUnit) VirtualDeviceConfigSpecOperation(com.vmware.vim25.VirtualDeviceConfigSpecOperation) FileEntry(com.vmware.photon.controller.model.resources.DiskService.DiskState.BootConfig.FileEntry) VirtualSCSISharing(com.vmware.vim25.VirtualSCSISharing) LibraryClient(com.vmware.photon.controller.model.adapters.vsphere.vapi.LibraryClient) VirtualMachineDefinedProfileSpec(com.vmware.vim25.VirtualMachineDefinedProfileSpec) ImageState(com.vmware.photon.controller.model.resources.ImageService.ImageState) VirtualEthernetCard(com.vmware.vim25.VirtualEthernetCard) Collections(java.util.Collections) TaskInfoState(com.vmware.vim25.TaskInfoState) OperationJoin(com.vmware.xenon.common.OperationJoin) RESOURCE_GROUP_NAME(com.vmware.photon.controller.model.ComputeProperties.RESOURCE_GROUP_NAME) MethodFault(com.vmware.vim25.MethodFault) ArrayOfVirtualDevice(com.vmware.vim25.ArrayOfVirtualDevice) VirtualMachineDefinedProfileSpec(com.vmware.vim25.VirtualMachineDefinedProfileSpec) VirtualDisk(com.vmware.vim25.VirtualDisk) ClientUtils.getListOfVirtualDisk(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.getListOfVirtualDisk) TaskInfo(com.vmware.vim25.TaskInfo) VirtualMachineRelocateSpec(com.vmware.vim25.VirtualMachineRelocateSpec) VirtualMachineCloneSpec(com.vmware.vim25.VirtualMachineCloneSpec) FileAlreadyExists(com.vmware.vim25.FileAlreadyExists) ArrayOfManagedObjectReference(com.vmware.vim25.ArrayOfManagedObjectReference) ManagedObjectReference(com.vmware.vim25.ManagedObjectReference) VirtualMachineRelocateSpecDiskLocator(com.vmware.vim25.VirtualMachineRelocateSpecDiskLocator)

Example 12 with ArrayOfVirtualDevice

use of com.vmware.vim25.ArrayOfVirtualDevice in project photon-model by vmware.

the class InstanceClient method deployOvf.

private ManagedObjectReference deployOvf(URI ovfUri) throws Exception {
    OvfDeployer deployer = new OvfDeployer(this.connection);
    CustomProperties cust = CustomProperties.of(this.ctx.child.description);
    URI archiveUri = cust.getUri(OvfParser.PROP_OVF_ARCHIVE_URI);
    if (archiveUri != null) {
        logger.info("Prefer ova {} uri to ovf {}", archiveUri, ovfUri);
        OvfRetriever retriever = deployer.getRetriever();
        ovfUri = retriever.downloadIfOva(archiveUri);
    }
    ManagedObjectReference folder = getVmFolder();
    List<VirtualMachineDefinedProfileSpec> pbmSpec = getPbmProfileSpec(this.bootDisk);
    ManagedObjectReference ds = getDataStoreForDisk(this.bootDisk, pbmSpec);
    ManagedObjectReference resourcePool = getResourcePool();
    String vmName = "pmt-" + deployer.getRetriever().hash(ovfUri);
    GetMoRef get = new GetMoRef(this.connection);
    ManagedObjectReference vm = findTemplateByName(vmName, get);
    if (vm == null) {
        String config = cust.getString(OvfParser.PROP_OVF_CONFIGURATION);
        Lock lock = getLock(vmName);
        lock.lock();
        try {
            vm = findTemplateByName(vmName, get);
            if (vm == null) {
                OvfParser parser = new OvfParser();
                Document ovfDoc = parser.retrieveDescriptor(ovfUri);
                List<OvfNetworkMapping> networks = mapNetworks(parser.extractNetworks(ovfDoc), ovfDoc, this.ctx.nics);
                vm = deployer.deployOvf(ovfUri, getHost(), folder, vmName, networks, ds, Collections.emptyList(), config, resourcePool);
                logger.info("Removing NICs from deployed template: {} ({})", vmName, vm.getValue());
                ArrayOfVirtualDevice devices = get.entityProp(vm, VimPath.vm_config_hardware_device);
                if (devices != null) {
                    VirtualMachineConfigSpec reconfig = new VirtualMachineConfigSpec();
                    for (VirtualDevice device : devices.getVirtualDevice()) {
                        if (device instanceof VirtualEthernetCard) {
                            VirtualDeviceConfigSpec spec = new VirtualDeviceConfigSpec();
                            spec.setDevice(device);
                            spec.setOperation(VirtualDeviceConfigSpecOperation.REMOVE);
                            reconfig.getDeviceChange().add(spec);
                        }
                    }
                    ManagedObjectReference reconfigTask = getVimPort().reconfigVMTask(vm, reconfig);
                    VimUtils.waitTaskEnd(this.connection, reconfigTask);
                }
                ManagedObjectReference snapshotTask = getVimPort().createSnapshotTask(vm, "initial", null, false, false);
                VimUtils.waitTaskEnd(this.connection, snapshotTask);
            }
        } catch (Exception e) {
            logger.warn("Error deploying Ovf for template [" + vmName + "],reason:", e);
            vm = awaitVM(vmName, folder, get);
        } finally {
            lock.unlock();
        }
    }
    if (!isSameDatastore(ds, vm, get)) {
        // make sure the original VM template is ready
        Object snapshot = get.entityProp(vm, VimPath.vm_snapshot);
        if (snapshot == null) {
            vm = awaitVM(vmName, folder, get);
        }
        vm = replicateVMTemplate(resourcePool, ds, pbmSpec, folder, vmName, vm, get);
    }
    return cloneOvfBasedTemplate(vm, ds, folder, resourcePool, pbmSpec);
}
Also used : OvfRetriever(com.vmware.photon.controller.model.adapters.vsphere.ovf.OvfRetriever) OvfNetworkMapping(com.vmware.vim25.OvfNetworkMapping) VirtualDeviceConfigSpec(com.vmware.vim25.VirtualDeviceConfigSpec) OvfDeployer(com.vmware.photon.controller.model.adapters.vsphere.ovf.OvfDeployer) ClientUtils.findMatchingVirtualDevice(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.findMatchingVirtualDevice) ArrayOfVirtualDevice(com.vmware.vim25.ArrayOfVirtualDevice) VirtualDevice(com.vmware.vim25.VirtualDevice) OvfParser(com.vmware.photon.controller.model.adapters.vsphere.ovf.OvfParser) ArrayOfVirtualDevice(com.vmware.vim25.ArrayOfVirtualDevice) VirtualMachineDefinedProfileSpec(com.vmware.vim25.VirtualMachineDefinedProfileSpec) Document(org.w3c.dom.Document) URI(java.net.URI) FinderException(com.vmware.photon.controller.model.adapters.vsphere.util.finders.FinderException) Lock(java.util.concurrent.locks.Lock) ReentrantLock(java.util.concurrent.locks.ReentrantLock) GetMoRef(com.vmware.photon.controller.model.adapters.vsphere.util.connection.GetMoRef) VirtualMachineConfigSpec(com.vmware.vim25.VirtualMachineConfigSpec) VirtualEthernetCard(com.vmware.vim25.VirtualEthernetCard) ArrayOfManagedObjectReference(com.vmware.vim25.ArrayOfManagedObjectReference) ManagedObjectReference(com.vmware.vim25.ManagedObjectReference)

Example 13 with ArrayOfVirtualDevice

use of com.vmware.vim25.ArrayOfVirtualDevice in project photon-model by vmware.

the class InstanceClient method deleteInstance.

public void deleteInstance(ServiceHost serviceHost) throws Exception {
    ManagedObjectReference vm = CustomProperties.of(this.ctx.child).getMoRef(CustomProperties.MOREF);
    if (vm == null) {
        logger.info("No moref associated with the given instance, skipping delete.");
        return;
    }
    ArrayOfVirtualDevice devices = this.get.entityProp(vm, VimPath.vm_config_hardware_device);
    // Handle disks of the VM during VM deletion based on its persistent flag.
    handleVirtualDiskCleanup(serviceHost, vm, devices, this.ctx.disks);
    TaskInfo info;
    // power off
    ManagedObjectReference task = getVimPort().powerOffVMTask(vm);
    info = waitTaskEnd(task);
    ignoreError("Ignore error powering off VM", info);
    // delete vm
    task = getVimPort().destroyTask(vm);
    info = waitTaskEnd(task);
    ignoreError("Ignore error deleting VM", info);
    // Handle CD ROM folder clean up.
    handleVirtualCDRomCleanup(this.ctx.disks);
}
Also used : TaskInfo(com.vmware.vim25.TaskInfo) ArrayOfVirtualDevice(com.vmware.vim25.ArrayOfVirtualDevice) ArrayOfManagedObjectReference(com.vmware.vim25.ArrayOfManagedObjectReference) ManagedObjectReference(com.vmware.vim25.ManagedObjectReference)

Example 14 with ArrayOfVirtualDevice

use of com.vmware.vim25.ArrayOfVirtualDevice in project photon-model by vmware.

the class InstanceClient method handleVirtualDiskCleanup.

/**
 * For every disk states in the compute based on the persistent flag if it is set as TRUE,
 * then disk will be detached before we delete the vm.
 */
private void handleVirtualDiskCleanup(ServiceHost serviceHost, ManagedObjectReference vm, ArrayOfVirtualDevice devices, List<DiskStateExpanded> disks) throws Exception {
    if (CollectionUtils.isEmpty(disks)) {
        return;
    }
    List<DiskStateExpanded> persistDisks = disks.stream().filter(disk -> disk.type == DiskType.HDD).filter(disk -> disk.persistent != null && disk.persistent).collect(Collectors.toList());
    if (CollectionUtils.isEmpty(persistDisks)) {
        return;
    }
    List<Operation> diskUpdateOps = new ArrayList<>(persistDisks.size());
    for (DiskStateExpanded ds : persistDisks) {
        VirtualDisk vd = (VirtualDisk) findMatchingVirtualDevice(getListOfVirtualDisk(devices), ds);
        if (vd != null) {
            detachDisk(this.connection, vd, vm, getVimPort());
        }
        // Now update the status of the persistent disks to be AVAILABLE
        ds.status = DiskService.DiskStatus.AVAILABLE;
        CustomProperties.of(ds).put(DISK_CONTROLLER_NUMBER, (String) null).put(PROVIDER_DISK_UNIQUE_ID, (String) null);
        ds.id = UriUtils.getLastPathSegment(ds.documentSelfLink);
        diskUpdateOps.add(Operation.createPut(PhotonModelUriUtils.createInventoryUri(serviceHost, ds.documentSelfLink)).setReferer(serviceHost.getUri()).setBody(ds));
        disks.remove(ds);
    }
    // call patch operations on the disk states
    OperationJoin.create(diskUpdateOps).setCompletion((os, errors) -> {
        if (errors != null && !errors.isEmpty()) {
            logger.warn(String.format("Exception in updating persistent disk during deletion of VM." + " Error : %s", Utils.toString(errors)));
        }
    }).sendWith(serviceHost);
}
Also used : ClientUtils.findMatchingVirtualDevice(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.findMatchingVirtualDevice) VirtualMachineConfigSpec(com.vmware.vim25.VirtualMachineConfigSpec) VirtualMachineRelocateSpecDiskLocator(com.vmware.vim25.VirtualMachineRelocateSpecDiskLocator) VirtualDiskSpec(com.vmware.vim25.VirtualDiskSpec) ClientUtils.fillInControllerUnitNumber(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.fillInControllerUnitNumber) ArrayOfVirtualDevice(com.vmware.vim25.ArrayOfVirtualDevice) ClientUtils.findFreeScsiUnit(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.findFreeScsiUnit) VmConfigSpec(com.vmware.vim25.VmConfigSpec) ClientUtils.getFirstIdeController(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.getFirstIdeController) VirtualDeviceConnectInfo(com.vmware.vim25.VirtualDeviceConnectInfo) Utils(com.vmware.xenon.common.Utils) Document(org.w3c.dom.Document) Map(java.util.Map) VirtualDevice(com.vmware.vim25.VirtualDevice) EnumSet(java.util.EnumSet) FinderException(com.vmware.photon.controller.model.adapters.vsphere.util.finders.FinderException) VapiConnection(com.vmware.photon.controller.model.adapters.vsphere.vapi.VapiConnection) ClientUtils.createHdd(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.createHdd) ClientUtils.getFirstScsiController(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.getFirstScsiController) ArrayOfManagedObjectReference(com.vmware.vim25.ArrayOfManagedObjectReference) ClientUtils.nextUnitNumber(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.nextUnitNumber) ClientUtils.getFirstSioController(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.getFirstSioController) ClientUtils.getDatastorePathForDisk(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.getDatastorePathForDisk) VirtualMachineFileInfo(com.vmware.vim25.VirtualMachineFileInfo) VirtualMachineSnapshotInfo(com.vmware.vim25.VirtualMachineSnapshotInfo) DuplicateNameFaultMsg(com.vmware.vim25.DuplicateNameFaultMsg) ArrayUpdateOperation(com.vmware.vim25.ArrayUpdateOperation) UriUtils(com.vmware.xenon.common.UriUtils) ClientUtils.detachDisk(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.detachDisk) VirtualFloppy(com.vmware.vim25.VirtualFloppy) ClientUtils.getStorageIOAllocationInfo(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.getStorageIOAllocationInfo) Finder(com.vmware.photon.controller.model.adapters.vsphere.util.finders.Finder) OvfDeployer(com.vmware.photon.controller.model.adapters.vsphere.ovf.OvfDeployer) VirtualLsiLogicController(com.vmware.vim25.VirtualLsiLogicController) OptionValue(com.vmware.vim25.OptionValue) RuntimeFaultFaultMsg(com.vmware.vim25.RuntimeFaultFaultMsg) ArrayList(java.util.ArrayList) ComputeInstanceRequest(com.vmware.photon.controller.model.adapterapi.ComputeInstanceRequest) VirtualCdrom(com.vmware.vim25.VirtualCdrom) STORAGE_REFERENCE(com.vmware.photon.controller.model.constants.PhotonModelConstants.STORAGE_REFERENCE) OvfRetriever(com.vmware.photon.controller.model.adapters.vsphere.ovf.OvfRetriever) ClientUtils.getDiskProvisioningType(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.getDiskProvisioningType) DISK_DATASTORE_NAME(com.vmware.photon.controller.model.adapters.vsphere.CustomProperties.DISK_DATASTORE_NAME) VirtualMachineRelocateDiskMoveOptions(com.vmware.vim25.VirtualMachineRelocateDiskMoveOptions) InvalidCollectorVersionFaultMsg(com.vmware.vim25.InvalidCollectorVersionFaultMsg) VirtualMachineGuestOsIdentifier(com.vmware.vim25.VirtualMachineGuestOsIdentifier) DiskStatus(com.vmware.photon.controller.model.resources.DiskService.DiskStatus) VirtualDeviceConfigSpec(com.vmware.vim25.VirtualDeviceConfigSpec) VirtualDeviceBackingInfo(com.vmware.vim25.VirtualDeviceBackingInfo) ClientUtils.getDiskMode(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.getDiskMode) PROVIDER_DISK_UNIQUE_ID(com.vmware.photon.controller.model.adapters.vsphere.CustomProperties.PROVIDER_DISK_UNIQUE_ID) ManagedObjectReference(com.vmware.vim25.ManagedObjectReference) ClientUtils.findFreeUnit(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.findFreeUnit) ClientUtils.insertCdrom(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.insertCdrom) MethodFault(com.vmware.vim25.MethodFault) Lock(java.util.concurrent.locks.Lock) VirtualDisk(com.vmware.vim25.VirtualDisk) Paths(java.nio.file.Paths) InvalidNameFaultMsg(com.vmware.vim25.InvalidNameFaultMsg) ClientUtils.insertFloppy(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.insertFloppy) VAppPropertySpec(com.vmware.vim25.VAppPropertySpec) VirtualDiskType(com.vmware.vim25.VirtualDiskType) VirtualEthernetCardMacType(com.vmware.vim25.VirtualEthernetCardMacType) OvfParser(com.vmware.photon.controller.model.adapters.vsphere.ovf.OvfParser) BaseHelper(com.vmware.photon.controller.model.adapters.vsphere.util.connection.BaseHelper) LoggerFactory(org.slf4j.LoggerFactory) ClientUtils.toKb(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.toKb) DiskType(com.vmware.photon.controller.model.resources.DiskService.DiskType) OvfNetworkMapping(com.vmware.vim25.OvfNetworkMapping) VAppPropertyInfo(com.vmware.vim25.VAppPropertyInfo) ClientUtils.getPbmProfileSpec(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.getPbmProfileSpec) Connection(com.vmware.photon.controller.model.adapters.vsphere.util.connection.Connection) URI(java.net.URI) TaskInfo(com.vmware.vim25.TaskInfo) VirtualDiskFlatVer2BackingInfo(com.vmware.vim25.VirtualDiskFlatVer2BackingInfo) VM_PATH_FORMAT(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.VM_PATH_FORMAT) DiskStateExpanded(com.vmware.photon.controller.model.resources.DiskService.DiskStateExpanded) DuplicateName(com.vmware.vim25.DuplicateName) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) ArrayOfVAppPropertyInfo(com.vmware.vim25.ArrayOfVAppPropertyInfo) Collectors(java.util.stream.Collectors) ServiceHost(com.vmware.xenon.common.ServiceHost) Objects(java.util.Objects) Base64(java.util.Base64) List(java.util.List) InvalidPropertyFaultMsg(com.vmware.vim25.InvalidPropertyFaultMsg) VirtualMachineRelocateSpec(com.vmware.vim25.VirtualMachineRelocateSpec) VirtualPCIController(com.vmware.vim25.VirtualPCIController) ClientUtils.createCdrom(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.createCdrom) Entry(java.util.Map.Entry) DiskService(com.vmware.photon.controller.model.resources.DiskService) VimPath(com.vmware.photon.controller.model.adapters.vsphere.util.VimPath) PhotonModelUriUtils(com.vmware.photon.controller.model.util.PhotonModelUriUtils) FileAlreadyExists(com.vmware.vim25.FileAlreadyExists) ClientUtils.makePathToVmdkFile(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.makePathToVmdkFile) HashMap(java.util.HashMap) GetMoRef(com.vmware.photon.controller.model.adapters.vsphere.util.connection.GetMoRef) VirtualMachineCloneSpec(com.vmware.vim25.VirtualMachineCloneSpec) VapiClient(com.vmware.photon.controller.model.adapters.vsphere.vapi.VapiClient) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) CollectionUtils(org.apache.commons.collections.CollectionUtils) ComputeState(com.vmware.photon.controller.model.resources.ComputeService.ComputeState) ClientUtils.getListOfVirtualDisk(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.getListOfVirtualDisk) NetworkDeviceBackingFactory(com.vmware.photon.controller.model.adapters.vsphere.network.NetworkDeviceBackingFactory) ClientUtils.getDatastoreFromStoragePolicy(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.getDatastoreFromStoragePolicy) Logger(org.slf4j.Logger) Element(com.vmware.photon.controller.model.adapters.vsphere.util.finders.Element) ReentrantLock(java.util.concurrent.locks.ReentrantLock) VirtualE1000(com.vmware.vim25.VirtualE1000) Operation(com.vmware.xenon.common.Operation) DISK_CONTROLLER_NUMBER(com.vmware.photon.controller.model.adapters.vsphere.CustomProperties.DISK_CONTROLLER_NUMBER) ClientUtils.createFloppy(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.createFloppy) VirtualSCSIController(com.vmware.vim25.VirtualSCSIController) VimNames(com.vmware.photon.controller.model.adapters.vsphere.util.VimNames) NetworkInterfaceStateWithDetails(com.vmware.photon.controller.model.adapters.vsphere.ProvisionContext.NetworkInterfaceStateWithDetails) DISK_PARENT_DIRECTORY(com.vmware.photon.controller.model.adapters.vsphere.CustomProperties.DISK_PARENT_DIRECTORY) TimeUnit(java.util.concurrent.TimeUnit) VirtualDeviceConfigSpecOperation(com.vmware.vim25.VirtualDeviceConfigSpecOperation) FileEntry(com.vmware.photon.controller.model.resources.DiskService.DiskState.BootConfig.FileEntry) VirtualSCSISharing(com.vmware.vim25.VirtualSCSISharing) LibraryClient(com.vmware.photon.controller.model.adapters.vsphere.vapi.LibraryClient) VirtualMachineDefinedProfileSpec(com.vmware.vim25.VirtualMachineDefinedProfileSpec) ImageState(com.vmware.photon.controller.model.resources.ImageService.ImageState) VirtualEthernetCard(com.vmware.vim25.VirtualEthernetCard) Collections(java.util.Collections) TaskInfoState(com.vmware.vim25.TaskInfoState) OperationJoin(com.vmware.xenon.common.OperationJoin) RESOURCE_GROUP_NAME(com.vmware.photon.controller.model.ComputeProperties.RESOURCE_GROUP_NAME) DiskStateExpanded(com.vmware.photon.controller.model.resources.DiskService.DiskStateExpanded) ArrayList(java.util.ArrayList) ArrayUpdateOperation(com.vmware.vim25.ArrayUpdateOperation) Operation(com.vmware.xenon.common.Operation) VirtualDeviceConfigSpecOperation(com.vmware.vim25.VirtualDeviceConfigSpecOperation) VirtualDisk(com.vmware.vim25.VirtualDisk) ClientUtils.getListOfVirtualDisk(com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.getListOfVirtualDisk)

Aggregations

ArrayOfVirtualDevice (com.vmware.vim25.ArrayOfVirtualDevice)14 ManagedObjectReference (com.vmware.vim25.ManagedObjectReference)12 VirtualDisk (com.vmware.vim25.VirtualDisk)11 URI (java.net.URI)10 HashMap (java.util.HashMap)10 VimNames (com.vmware.photon.controller.model.adapters.vsphere.util.VimNames)9 ComputeState (com.vmware.photon.controller.model.resources.ComputeService.ComputeState)9 DiskService (com.vmware.photon.controller.model.resources.DiskService)9 InvalidPropertyFaultMsg (com.vmware.vim25.InvalidPropertyFaultMsg)9 RuntimeFaultFaultMsg (com.vmware.vim25.RuntimeFaultFaultMsg)9 VirtualDevice (com.vmware.vim25.VirtualDevice)9 VirtualDiskType (com.vmware.vim25.VirtualDiskType)9 Operation (com.vmware.xenon.common.Operation)9 UriUtils (com.vmware.xenon.common.UriUtils)9 Utils (com.vmware.xenon.common.Utils)9 ClientUtils.findMatchingVirtualDevice (com.vmware.photon.controller.model.adapters.vsphere.ClientUtils.findMatchingVirtualDevice)8 FinderException (com.vmware.photon.controller.model.adapters.vsphere.util.finders.FinderException)8 DiskStateExpanded (com.vmware.photon.controller.model.resources.DiskService.DiskStateExpanded)8 TaskInfo (com.vmware.vim25.TaskInfo)8 VirtualDeviceConfigSpec (com.vmware.vim25.VirtualDeviceConfigSpec)8