本文整理匯總了Java中com.vmware.vim25.VirtualDiskSpec類的典型用法代碼示例。如果您正苦於以下問題:Java VirtualDiskSpec類的具體用法?Java VirtualDiskSpec怎麽用?Java VirtualDiskSpec使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
VirtualDiskSpec類屬於com.vmware.vim25包,在下文中一共展示了VirtualDiskSpec類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: copyVirtualDisk
import com.vmware.vim25.VirtualDiskSpec; //導入依賴的package包/類
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);
}
示例2: createVirtualDisk
import com.vmware.vim25.VirtualDiskSpec; //導入依賴的package包/類
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);
}
示例3: copyVirtualDiskTask
import com.vmware.vim25.VirtualDiskSpec; //導入依賴的package包/類
Task copyVirtualDiskTask(String sourceName, Datacenter sourceDatacenter, String destName,
Datacenter destDatacenter, VirtualDiskSpec destSpec, Boolean force) throws FileFault, RuntimeFault, RemoteException;
示例4: createFullCloneAndAttach
import com.vmware.vim25.VirtualDiskSpec; //導入依賴的package包/類
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;
}
示例5: createVirtualDiskTask
import com.vmware.vim25.VirtualDiskSpec; //導入依賴的package包/類
Task createVirtualDiskTask(String name, Datacenter datacenter, VirtualDiskSpec spec) throws FileFault, RuntimeFault, RemoteException;