use of com.vmware.vim25.VirtualCdrom in project photon-model by vmware.
the class ClientUtils method insertCdrom.
/**
* 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);
}
use of com.vmware.vim25.VirtualCdrom in project photon-model by vmware.
the class ClientUtils method handleVirtualDeviceUpdate.
/**
* Process VirtualCdRom and update the details in the diskLinks of the provisioned compute
*/
public static Operation handleVirtualDeviceUpdate(String endpointLink, DiskStateExpanded matchedDs, DiskType type, VirtualDevice disk, List<String> diskLinks, String regionId, Service service, boolean isBacking, String dcLink) {
Operation operation;
if (matchedDs == null) {
DiskService.DiskState ds = createNewDiskState(type, disk, regionId, service);
addEndpointLinks(ds, endpointLink);
if (isBacking) {
updateDiskStateFromVirtualDevice(disk, ds, disk.getBacking(), dcLink);
} else {
updateDiskStateFromVirtualDevice(disk, ds, null, dcLink);
}
operation = createDisk(ds, service);
diskLinks.add(ds.documentSelfLink);
} else {
updateDiskStateFromVirtualDevice(disk, matchedDs, null, dcLink);
if (matchedDs.persistent == null) {
matchedDs.persistent = Boolean.FALSE;
}
addEndpointLinks(matchedDs, endpointLink);
operation = createDiskPatch(matchedDs, service);
}
return operation;
}
use of com.vmware.vim25.VirtualCdrom in project cloudstack by apache.
the class VmwareHelper method prepareIsoDevice.
public static Pair<VirtualDevice, Boolean> prepareIsoDevice(VirtualMachineMO vmMo, String isoDatastorePath, ManagedObjectReference morDs, boolean connect, boolean connectAtBoot, int deviceNumber, int contextNumber) throws Exception {
boolean newCdRom = false;
VirtualCdrom cdRom = (VirtualCdrom) vmMo.getIsoDevice();
if (cdRom == null) {
newCdRom = true;
cdRom = new VirtualCdrom();
assert (vmMo.getIDEDeviceControllerKey() >= 0);
cdRom.setControllerKey(vmMo.getIDEDeviceControllerKey());
if (deviceNumber < 0)
deviceNumber = vmMo.getNextIDEDeviceNumber();
cdRom.setUnitNumber(deviceNumber);
cdRom.setKey(-contextNumber);
}
VirtualDeviceConnectInfo cInfo = new VirtualDeviceConnectInfo();
cInfo.setConnected(connect);
cInfo.setStartConnected(connectAtBoot);
cdRom.setConnectable(cInfo);
if (isoDatastorePath != null) {
VirtualCdromIsoBackingInfo backingInfo = new VirtualCdromIsoBackingInfo();
backingInfo.setFileName(isoDatastorePath);
backingInfo.setDatastore(morDs);
cdRom.setBacking(backingInfo);
} else {
VirtualCdromRemotePassthroughBackingInfo backingInfo = new VirtualCdromRemotePassthroughBackingInfo();
backingInfo.setDeviceName("");
cdRom.setBacking(backingInfo);
}
return new Pair<VirtualDevice, Boolean>(cdRom, newCdRom);
}
Aggregations