本文整理汇总了Java中com.vmware.vim25.VirtualDeviceConnectInfo.setStartConnected方法的典型用法代码示例。如果您正苦于以下问题:Java VirtualDeviceConnectInfo.setStartConnected方法的具体用法?Java VirtualDeviceConnectInfo.setStartConnected怎么用?Java VirtualDeviceConnectInfo.setStartConnected使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vmware.vim25.VirtualDeviceConnectInfo
的用法示例。
在下文中一共展示了VirtualDeviceConnectInfo.setStartConnected方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: replaceNetworkAdapter
import com.vmware.vim25.VirtualDeviceConnectInfo; //导入方法依赖的package包/类
private static void replaceNetworkAdapter(
VirtualMachineConfigSpec vmConfigSpec, VirtualDevice oldNIC,
ManagedObjectReference newNetworkRef, String newNetworkName)
throws Exception {
logger.debug("new network: " + newNetworkName);
VirtualEthernetCardNetworkBackingInfo nicBacking = new VirtualEthernetCardNetworkBackingInfo();
nicBacking.setDeviceName(newNetworkName);
nicBacking.setNetwork(newNetworkRef);
nicBacking.setUseAutoDetect(true);
oldNIC.setBacking(nicBacking);
VirtualDeviceConnectInfo info = new VirtualDeviceConnectInfo();
info.setConnected(true);
info.setStartConnected(true);
info.setAllowGuestControl(true);
oldNIC.setConnectable(info);
// oldNIC.getConnectable().setConnected(true);
// oldNIC.getConnectable().setStartConnected(true);
VirtualDeviceConfigSpec vmDeviceSpec = new VirtualDeviceConfigSpec();
vmDeviceSpec.setOperation(VirtualDeviceConfigSpecOperation.EDIT);
vmDeviceSpec.setDevice(oldNIC);
vmConfigSpec.getDeviceChange().add(vmDeviceSpec);
}
示例2: createCdrom
import com.vmware.vim25.VirtualDeviceConnectInfo; //导入方法依赖的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;
}
示例3: createFloppy
import com.vmware.vim25.VirtualDeviceConnectInfo; //导入方法依赖的package包/类
public static VirtualDeviceConfigSpec createFloppy(VirtualDevice sioController, int unitNumber) {
VirtualFloppy floppy = new VirtualFloppy();
floppy.setControllerKey(sioController.getKey());
floppy.setUnitNumber(unitNumber);
VirtualDeviceConnectInfo info = new VirtualDeviceConnectInfo();
info.setAllowGuestControl(true);
info.setConnected(true);
info.setStartConnected(true);
floppy.setConnectable(info);
VirtualFloppyDeviceBackingInfo backing = new VirtualFloppyDeviceBackingInfo();
backing.setDeviceName(String.format("floppy-%d", unitNumber));
floppy.setBacking(backing);
VirtualDeviceConfigSpec spec = new VirtualDeviceConfigSpec();
spec.setDevice(floppy);
spec.setOperation(VirtualDeviceConfigSpecOperation.ADD);
return spec;
}
示例4: reconfigureCdrom
import com.vmware.vim25.VirtualDeviceConnectInfo; //导入方法依赖的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;
}
示例5: connectNIC
import com.vmware.vim25.VirtualDeviceConnectInfo; //导入方法依赖的package包/类
private static void connectNIC(VirtualMachineConfigSpec vmConfigSpec,
VirtualDevice oldNIC, String vmNetworkName) throws Exception {
logger.debug("networkName: " + vmNetworkName);
VirtualDeviceConnectInfo info = new VirtualDeviceConnectInfo();
info.setConnected(true);
info.setStartConnected(true);
info.setAllowGuestControl(true);
oldNIC.setConnectable(info);
VirtualDeviceConfigSpec vmDeviceSpec = new VirtualDeviceConfigSpec();
vmDeviceSpec.setOperation(VirtualDeviceConfigSpecOperation.EDIT);
vmDeviceSpec.setDevice(oldNIC);
vmConfigSpec.getDeviceChange().add(vmDeviceSpec);
}
示例6: reuseDisk
import com.vmware.vim25.VirtualDeviceConnectInfo; //导入方法依赖的package包/类
protected VirtualDisk reuseDisk(VirtualMachine machine, Integer scsiId, String fileName) {
// SCSIコントローラを取得
VirtualSCSIController scsiController = getSCSIController(machine);
// 仮想マシン自体のディスクを取得
VirtualDisk machineDisk = getVirtualDisk(machine, 0);
VirtualDiskFlatVer2BackingInfo machieBackingInfo = VirtualDiskFlatVer2BackingInfo.class.cast(machineDisk
.getBacking());
// VirtualDisk
VirtualDisk disk = new VirtualDisk();
disk.setUnitNumber(scsiId);
disk.setControllerKey(scsiController.getKey());
// VirtualDiskFlatVer2BackingInfo
VirtualDiskFlatVer2BackingInfo backingInfo = new VirtualDiskFlatVer2BackingInfo();
backingInfo.setFileName(fileName);
backingInfo.setDiskMode("persistent");
backingInfo.setSplit(false);
backingInfo.setEagerlyScrub(false);
backingInfo.setThinProvisioned(machieBackingInfo.getThinProvisioned());
backingInfo.setWriteThrough(false);
disk.setBacking(backingInfo);
// VirtualDeviceConnectInfo
VirtualDeviceConnectInfo connectInfo = new VirtualDeviceConnectInfo();
connectInfo.setAllowGuestControl(false);
connectInfo.setStartConnected(true);
connectInfo.setConnected(true);
disk.setConnectable(connectInfo);
return disk;
}
示例7: getVirtualDeviceConnectInfo
import com.vmware.vim25.VirtualDeviceConnectInfo; //导入方法依赖的package包/类
@Nonnull
private static VirtualDeviceConnectInfo getVirtualDeviceConnectInfo(boolean connected, boolean connectOnStart) {
VirtualDeviceConnectInfo connectInfo = new VirtualDeviceConnectInfo();
connectInfo.setAllowGuestControl(true);
connectInfo.setConnected(connected);
connectInfo.setStartConnected(connectOnStart);
return connectInfo;
}
示例8: newDisk
import com.vmware.vim25.VirtualDeviceConnectInfo; //导入方法依赖的package包/类
protected VirtualDisk newDisk(VirtualMachine machine, Integer scsiId, Integer size) {
// SCSIコントローラを取得
VirtualSCSIController scsiController = getSCSIController(machine);
// 仮想マシン自体のディスクを取得
VirtualDisk machineDisk = getVirtualDisk(machine, 0);
VirtualDiskFlatVer2BackingInfo machieBackingInfo = VirtualDiskFlatVer2BackingInfo.class.cast(machineDisk
.getBacking());
// VirtualDisk
VirtualDisk disk = new VirtualDisk();
disk.setUnitNumber(scsiId);
disk.setCapacityInKB(size * 1024L * 1024L);
disk.setControllerKey(scsiController.getKey());
// VirtualDiskFlatVer2BackingInfo
VirtualDiskFlatVer2BackingInfo backingInfo = new VirtualDiskFlatVer2BackingInfo();
backingInfo.setDatastore(null);
backingInfo.setFileName("");
backingInfo.setDiskMode("persistent");
backingInfo.setSplit(false);
backingInfo.setEagerlyScrub(false);
backingInfo.setThinProvisioned(machieBackingInfo.getThinProvisioned());
backingInfo.setWriteThrough(false);
disk.setBacking(backingInfo);
// VirtualDeviceConnectInfo
VirtualDeviceConnectInfo connectInfo = new VirtualDeviceConnectInfo();
connectInfo.setAllowGuestControl(false);
connectInfo.setStartConnected(true);
connectInfo.setConnected(true);
disk.setConnectable(connectInfo);
return disk;
}
示例9: prepareDiskDevice
import com.vmware.vim25.VirtualDeviceConnectInfo; //导入方法依赖的package包/类
public static VirtualDevice prepareDiskDevice(VirtualMachineMO vmMo, int controllerKey, String vmdkDatastorePath, int sizeInMb, ManagedObjectReference morDs,
int deviceNumber, int contextNumber) throws Exception {
VirtualDisk disk = new VirtualDisk();
VirtualDiskFlatVer2BackingInfo backingInfo = new VirtualDiskFlatVer2BackingInfo();
backingInfo.setDiskMode(VirtualDiskMode.PERSISTENT.value());
backingInfo.setThinProvisioned(true);
backingInfo.setEagerlyScrub(false);
backingInfo.setDatastore(morDs);
backingInfo.setFileName(vmdkDatastorePath);
disk.setBacking(backingInfo);
int ideControllerKey = vmMo.getIDEDeviceControllerKey();
if (controllerKey < 0)
controllerKey = ideControllerKey;
if (deviceNumber < 0) {
deviceNumber = vmMo.getNextDeviceNumber(controllerKey);
}
disk.setControllerKey(controllerKey);
disk.setKey(-contextNumber);
disk.setUnitNumber(deviceNumber);
disk.setCapacityInKB(sizeInMb * 1024);
VirtualDeviceConnectInfo connectInfo = new VirtualDeviceConnectInfo();
connectInfo.setConnected(true);
connectInfo.setStartConnected(true);
disk.setConnectable(connectInfo);
return disk;
}