• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java VirtualCdrom类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中com.vmware.vim25.VirtualCdrom的典型用法代码示例。如果您正苦于以下问题:Java VirtualCdrom类的具体用法?Java VirtualCdrom怎么用?Java VirtualCdrom使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

VirtualCdrom类属于com.vmware.vim25包,在下文中一共展示了VirtualCdrom类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createCdrom

点赞 3

import com.vmware.vim25.VirtualCdrom; //导入依赖的package包/类
public static VirtualDeviceConfigSpec createCdrom(VirtualDevice ideController, int unitNumber) {
    VirtualCdrom cdrom = new VirtualCdrom();

    cdrom.setControllerKey(ideController.getKey());
    cdrom.setUnitNumber(unitNumber);

    VirtualDeviceConnectInfo info = new VirtualDeviceConnectInfo();
    info.setAllowGuestControl(true);
    info.setConnected(true);
    info.setStartConnected(true);
    cdrom.setConnectable(info);

    VirtualCdromAtapiBackingInfo backing = new VirtualCdromAtapiBackingInfo();
    backing.setDeviceName(String.format("cdrom-%d-%d", ideController.getKey(), unitNumber));
    backing.setUseAutoDetect(false);
    cdrom.setBacking(backing);

    VirtualDeviceConfigSpec spec = new VirtualDeviceConfigSpec();
    spec.setDevice(cdrom);
    spec.setOperation(VirtualDeviceConfigSpecOperation.ADD);

    return spec;
}
 

开发者ID:vmware,
项目名称:photon-model,
代码行数:24,
代码来源:ClientUtils.java

示例2: reconfigureCdrom

点赞 3

import com.vmware.vim25.VirtualCdrom; //导入依赖的package包/类
private VirtualDeviceConfigSpec reconfigureCdrom(VirtualCdrom vcd) {
    VirtualCdrom cdrom = new VirtualCdrom();

    cdrom.setControllerKey(vcd.getControllerKey());
    cdrom.setKey(vcd.getKey());
    cdrom.setUnitNumber(vcd.getUnitNumber());

    VirtualDeviceConnectInfo info = new VirtualDeviceConnectInfo();
    info.setAllowGuestControl(true);
    info.setConnected(true);
    info.setStartConnected(true);
    cdrom.setConnectable(info);

    cdrom.setBacking(vcd.getBacking());

    VirtualDeviceConfigSpec spec = new VirtualDeviceConfigSpec();
    spec.setDevice(cdrom);
    spec.setOperation(VirtualDeviceConfigSpecOperation.EDIT);

    return spec;
}
 

开发者ID:vmware,
项目名称:photon-model,
代码行数:22,
代码来源:InstanceClient.java

示例3: updateDiskLinksAfterProvisionSuccess

点赞 3

import com.vmware.vim25.VirtualCdrom; //导入依赖的package包/类
/**
 * Update the details of the disk into compute state after the provisioning is successful
 */
private void updateDiskLinksAfterProvisionSuccess(ComputeState state, List<VirtualDevice> disks,
        ProvisionContext ctx) {
    ArrayList<String> diskLinks = new ArrayList<>(disks.size());
    // Fill in the disk links from the input to the ComputeState, as it may contain non hdd
    // disk as well. For ex, Floppy or CD-Rom
    ctx.disks.stream().forEach(ds -> diskLinks.add(ds.documentSelfLink));

    // Handle all the HDD disk
    for (VirtualDevice disk : disks) {
        DiskStateExpanded matchedDs = findMatchingDiskState(disk, ctx.disks);

        if (disk.getBacking() instanceof VirtualDeviceFileBackingInfo) {
            handleVirtualDiskUpdate(matchedDs, (VirtualDisk) disk, diskLinks, ctx);
        } else if (disk instanceof VirtualCdrom) {
            handleVirtualDeviceUpdate(matchedDs, DiskType.CDROM, disk, diskLinks, ctx);
        } else if (disk instanceof VirtualFloppy) {
            handleVirtualDeviceUpdate(matchedDs, DiskType.FLOPPY, disk, diskLinks, ctx);
        } else {
            continue;
        }
    }
    state.diskLinks = diskLinks;
}
 

开发者ID:vmware,
项目名称:photon-model,
代码行数:27,
代码来源:VSphereAdapterInstanceService.java

示例4: createAddCdConfigSpec

点赞 3

import com.vmware.vim25.VirtualCdrom; //导入依赖的package包/类
static VirtualDeviceConfigSpec createAddCdConfigSpec(VirtualMachine vm, String dsName, String isoName) throws Exception 
{
  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("[" + dsName +"] "+ vm.getName() 
      + "/" + isoName + ".iso");
  VirtualDevice vd = getIDEController(vm);          
  cdrom.setBacking(cdDeviceBacking);                    
  cdrom.setControllerKey(vd.getKey());
  cdrom.setUnitNumber(vd.getUnitNumber());
  cdrom.setKey(-1);          

  cdSpec.setDevice(cdrom);

  return cdSpec;          
}
 

开发者ID:Juniper,
项目名称:vijava
代码行数:23,
代码来源:VmCdOp.java

示例5: createRemoveCdConfigSpec

点赞 3

import com.vmware.vim25.VirtualCdrom; //导入依赖的package包/类
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;
  }
  else 
  {
    System.out.println("No device available " + cdName);
    return null;
  }
}
 

开发者ID:Juniper,
项目名称:vijava
代码行数:17,
代码来源:VmCdOp.java

示例6: getDisks

点赞 2

import com.vmware.vim25.VirtualCdrom; //导入依赖的package包/类
public List<VirtualDevice> getDisks() {
    ArrayOfVirtualDevice dev = (ArrayOfVirtualDevice) getOrDefault(
            VimPath.vm_config_hardware_device, null);
    if (dev == null) {
        return Collections.emptyList();
    }

    return dev.getVirtualDevice().stream()
            .filter(d -> d instanceof VirtualDisk || d instanceof VirtualCdrom || d
                    instanceof VirtualFloppy)
            .collect(Collectors.toList());
}
 

开发者ID:vmware,
项目名称:photon-model,
代码行数:13,
代码来源:VmOverlay.java

示例7: findMatchingDiskState

点赞 2

import com.vmware.vim25.VirtualCdrom; //导入依赖的package包/类
public static DiskService.DiskStateExpanded findMatchingDiskState(VirtualDevice vd,
        List<DiskService.DiskStateExpanded> disks) {
    // Step 1: Match if there are matching bootOrder number with Unit number of disk
    // Step 2: If not, then find a custom property to match the bootOrder with the unit number
    // Step 3: If no match found then this is the new disk so return null
    if (disks == null || disks.isEmpty()) {
        return null;
    }

    return disks.stream()
            .filter(ds -> {
                if (vd instanceof VirtualDisk && ds.type == DiskService.DiskType.HDD) {
                    return true;
                } else if (vd instanceof VirtualCdrom && ds.type == DiskService.DiskType.CDROM) {
                    return true;
                } else if (vd instanceof VirtualFloppy && ds.type == DiskService.DiskType.FLOPPY) {
                    return true;
                }
                return false;
            })
            .filter(ds -> {
                boolean isFound = (ds.bootOrder != null && (ds.bootOrder - 1) == vd
                        .getUnitNumber());
                if (!isFound) {
                    // Now check custom properties for controller unit number
                    if (ds.customProperties != null && ds.customProperties.get
                            (DISK_CONTROLLER_NUMBER) != null) {
                        int unitNumber = Integer.parseInt(ds.customProperties.get
                                (DISK_CONTROLLER_NUMBER));
                        isFound = unitNumber == vd.getUnitNumber();
                    }
                }
                return isFound;
            }).findFirst().orElse(null);
}
 

开发者ID:vmware,
项目名称:photon-model,
代码行数:36,
代码来源:ClientUtils.java

示例8: getPopulatedCDSpecs

点赞 2

import com.vmware.vim25.VirtualCdrom; //导入依赖的package包/类
VirtualDeviceConfigSpec getPopulatedCDSpecs(String fileName, ManagedObjectReference dataStoreRef,
                                            List<VirtualDevice> virtualDevicesList,
                                            VirtualDeviceConfigSpecOperation operation,
                                            Integer controllerKey, Integer unitNumber, Integer key,
                                            String parameter, VmInputs vmInputs) {

    VirtualDeviceConfigSpec cdSpecs = new VirtualDeviceConfigSpec();
    if (Operation.ADD.toString().equalsIgnoreCase(parameter)) {
        VirtualCdromIsoBackingInfo cdIsoBacking = new VirtualCdromIsoBackingInfo();
        cdIsoBacking.setDatastore(dataStoreRef);
        cdIsoBacking.setFileName(fileName + TEST_CD_ISO);

        VirtualCdrom cdRom = new VirtualCdrom();
        cdRom.setBacking(cdIsoBacking);
        cdRom.setControllerKey(controllerKey);
        cdRom.setUnitNumber(unitNumber);
        cdRom.setKey(key);

        return getCDSpec(cdSpecs, operation, cdRom);
    } else {
        VirtualCdrom cdRemove = findVirtualDevice(VirtualCdrom.class, virtualDevicesList, vmInputs);
        if (cdRemove != null) {
            return getCDSpec(cdSpecs, operation, cdRemove);
        }
    }
    throw new RuntimeException("No optical device named: [" + vmInputs.getUpdateValue() + "] can be found.");
}
 

开发者ID:CloudSlang,
项目名称:cs-actions,
代码行数:28,
代码来源:VmUtils.java

示例9: getCDSpec

点赞 2

import com.vmware.vim25.VirtualCdrom; //导入依赖的package包/类
private VirtualDeviceConfigSpec getCDSpec(VirtualDeviceConfigSpec cdSpecs, VirtualDeviceConfigSpecOperation operation,
                                          VirtualCdrom cdRom) {
    cdSpecs.setOperation(operation);
    cdSpecs.setDevice(cdRom);

    return cdSpecs;
}
 

开发者ID:CloudSlang,
项目名称:cs-actions,
代码行数:8,
代码来源:VmUtils.java

示例10: getIsoDevice

点赞 2

import com.vmware.vim25.VirtualCdrom; //导入依赖的package包/类
public VirtualDevice getIsoDevice() throws Exception {
    List<VirtualDevice> devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
    if (devices != null && devices.size() > 0) {
        for (VirtualDevice device : devices) {
            if (device instanceof VirtualCdrom) {
                return device;
            }
        }
    }
    return null;
}
 

开发者ID:apache,
项目名称:cloudstack,
代码行数:12,
代码来源:VirtualMachineMO.java

示例11: getListOfVirtualCdRom

点赞 2

import com.vmware.vim25.VirtualCdrom; //导入依赖的package包/类
private List<VirtualDevice> getListOfVirtualCdRom(ArrayOfVirtualDevice devices) {
    return devices.getVirtualDevice().stream()
            .filter(d -> d instanceof VirtualCdrom)
            .collect(Collectors.toList());
}
 

开发者ID:vmware,
项目名称:photon-model,
代码行数:6,
代码来源:InstanceDiskClient.java

示例12: insertCdrom

点赞 1

import com.vmware.vim25.VirtualCdrom; //导入依赖的package包/类
/**
 * Changes to backing of the cdrom to an iso-backed one.
 *
 * @param cdrom
 * @param imagePath
 *            path to iso on disk, sth. like "[datastore] /images/ubuntu-16.04-amd64.iso"
 */
public static void insertCdrom(VirtualCdrom cdrom, String imagePath) {
    VirtualCdromIsoBackingInfo backing = new VirtualCdromIsoBackingInfo();
    backing.setFileName(imagePath);

    cdrom.setBacking(backing);
}
 

开发者ID:vmware,
项目名称:photon-model,
代码行数:14,
代码来源:ClientUtils.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)