use of com.vmware.vim25.VirtualDiskSpec in project CloudStack-archive by CloudStack-extras.
the class VirtualDiskManagerMO method copyVirtualDisk.
public void copyVirtualDisk(String srcName, ManagedObjectReference morSrcDc, String destName, ManagedObjectReference morDestDc, VirtualDiskSpec diskSpec, boolean force) throws Exception {
ManagedObjectReference morTask = _context.getService().copyVirtualDisk_Task(_mor, srcName, morSrcDc, destName, morDestDc, diskSpec, force);
String result = _context.getServiceUtil().waitForTask(morTask);
if (!result.equals("sucess"))
throw new Exception("Unable to copy virtual disk " + srcName + " to " + destName + " due to " + TaskMO.getTaskFailureInfo(_context, morTask));
_context.waitForTaskProgressDone(morTask);
}
use of com.vmware.vim25.VirtualDiskSpec in project CloudStack-archive by CloudStack-extras.
the class VirtualDiskManagerMO method createVirtualDisk.
public void createVirtualDisk(String name, ManagedObjectReference morDc, VirtualDiskSpec diskSpec) throws Exception {
ManagedObjectReference morTask = _context.getService().createVirtualDisk_Task(_mor, name, morDc, diskSpec);
String result = _context.getServiceUtil().waitForTask(morTask);
if (!result.equals("sucess"))
throw new Exception("Unable to create virtual disk " + name + " due to " + TaskMO.getTaskFailureInfo(_context, morTask));
_context.waitForTaskProgressDone(morTask);
}
use of com.vmware.vim25.VirtualDiskSpec in project cloudstack by apache.
the class VirtualDiskManagerMO method copyVirtualDisk.
public void copyVirtualDisk(String srcName, ManagedObjectReference morSrcDc, String destName, ManagedObjectReference morDestDc, VirtualDiskSpec diskSpec, boolean force) throws Exception {
ManagedObjectReference morTask = _context.getService().copyVirtualDiskTask(_mor, srcName, morSrcDc, destName, morDestDc, diskSpec, force);
boolean result = _context.getVimClient().waitForTask(morTask);
if (!result)
throw new Exception("Unable to copy virtual disk " + srcName + " to " + destName + " due to " + TaskMO.getTaskFailureInfo(_context, morTask));
_context.waitForTaskProgressDone(morTask);
}
use of com.vmware.vim25.VirtualDiskSpec in project cloudstack by apache.
the class VirtualDiskManagerMO method createVirtualDisk.
public void createVirtualDisk(String name, ManagedObjectReference morDc, VirtualDiskSpec diskSpec) throws Exception {
ManagedObjectReference morTask = _context.getService().createVirtualDiskTask(_mor, name, morDc, diskSpec);
boolean result = _context.getVimClient().waitForTask(morTask);
if (!result)
throw new Exception("Unable to create virtual disk " + name + " due to " + TaskMO.getTaskFailureInfo(_context, morTask));
_context.waitForTaskProgressDone(morTask);
}
use of com.vmware.vim25.VirtualDiskSpec in project photon-model by vmware.
the class InstanceClient method createFullCloneAndAttach.
private VirtualDeviceConfigSpec createFullCloneAndAttach(String sourcePath, DiskStateExpanded ds, String dir, VirtualDevice scsiController, int unitNumber, List<VirtualMachineDefinedProfileSpec> pbmSpec) throws Exception {
ManagedObjectReference diskManager = this.connection.getServiceContent().getVirtualDiskManager();
String dsDirForDisk = getDatastorePathForDisk(ds, dir);
// put full clone in the vm folder
String destName = makePathToVmdkFile(ds.name, dsDirForDisk);
// all ops are within a datacenter
ManagedObjectReference sourceDc = this.ctx.datacenterMoRef;
ManagedObjectReference destDc = sourceDc;
Boolean force = true;
// spec is not supported, should use null for now
VirtualDiskSpec spec = null;
ManagedObjectReference task = getVimPort().copyVirtualDiskTask(diskManager, sourcePath, sourceDc, destName, destDc, spec, force);
// wait for the disk to be copied
TaskInfo taskInfo = waitTaskEnd(task);
if (taskInfo.getState() == TaskInfoState.ERROR) {
return VimUtils.rethrow(taskInfo.getError());
}
VirtualDiskFlatVer2BackingInfo backing = new VirtualDiskFlatVer2BackingInfo();
backing.setDiskMode(getDiskMode(ds));
VirtualDiskType provisionType = getDiskProvisioningType(ds);
if (provisionType != null) {
backing.setThinProvisioned(provisionType == VirtualDiskType.THIN);
backing.setEagerlyScrub(provisionType == VirtualDiskType.EAGER_ZEROED_THICK);
}
backing.setFileName(destName);
backing.setDatastore(getDataStoreForDisk(ds, pbmSpec));
VirtualDisk disk = new VirtualDisk();
disk.setBacking(backing);
disk.setStorageIOAllocation(getStorageIOAllocationInfo(ds));
disk.setControllerKey(scsiController.getKey());
disk.setUnitNumber(unitNumber);
fillInControllerUnitNumber(ds, unitNumber);
disk.setKey(-1);
VirtualDeviceConfigSpec change = new VirtualDeviceConfigSpec();
change.setDevice(disk);
// Add storage policy spec
if (pbmSpec != null) {
pbmSpec.stream().forEach(sp -> {
change.getProfile().add(sp);
});
}
change.setOperation(VirtualDeviceConfigSpecOperation.ADD);
return change;
}
Aggregations