當前位置: 首頁>>代碼示例>>Java>>正文


Java VirtualDiskSpec類代碼示例

本文整理匯總了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);
}
 
開發者ID:apache,項目名稱:cloudstack,代碼行數:12,代碼來源:VirtualDiskManagerMO.java

示例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);
}
 
開發者ID:apache,項目名稱:cloudstack,代碼行數:10,代碼來源:VirtualDiskManagerMO.java

示例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;
 
開發者ID:igreenfield,項目名稱:jcloud-vsphere,代碼行數:3,代碼來源:VirtualDiskManagerApi.java

示例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;
}
 
開發者ID:vmware,項目名稱:photon-model,代碼行數:62,代碼來源:InstanceClient.java

示例5: createVirtualDiskTask

import com.vmware.vim25.VirtualDiskSpec; //導入依賴的package包/類
Task createVirtualDiskTask(String name, Datacenter datacenter, VirtualDiskSpec spec) throws FileFault, RuntimeFault, RemoteException; 
開發者ID:igreenfield,項目名稱:jcloud-vsphere,代碼行數:2,代碼來源:VirtualDiskManagerApi.java


注:本文中的com.vmware.vim25.VirtualDiskSpec類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。