• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java VirtualDiskFlatVer2BackingInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.vmware.vim25.VirtualDiskFlatVer2BackingInfo的典型用法代码示例。如果您正苦于以下问题:Java VirtualDiskFlatVer2BackingInfo类的具体用法?Java VirtualDiskFlatVer2BackingInfo怎么用?Java VirtualDiskFlatVer2BackingInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



VirtualDiskFlatVer2BackingInfo类属于com.vmware.vim25包,在下文中一共展示了VirtualDiskFlatVer2BackingInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: addHardDisk

import com.vmware.vim25.VirtualDiskFlatVer2BackingInfo; //导入依赖的package包/类
public void addHardDisk(String diskFilePath, VirtualDiskMode diskMode) throws Exception
{
  VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec();

  VirtualDeviceConfigSpec diskSpec = new VirtualDeviceConfigSpec();
  VirtualDeviceConfigSpec[] vdiskSpecArray = {diskSpec};
  vmConfigSpec.setDeviceChange(vdiskSpecArray);
  
  VirtualDiskFlatVer2BackingInfo diskfileBacking = new VirtualDiskFlatVer2BackingInfo();
  diskfileBacking.setFileName(diskFilePath);
  diskfileBacking.setDiskMode(diskMode.toString());

  
  VirtualSCSIController scsiController = getFirstAvailableController(VirtualSCSIController.class);
  int unitNumber = getFirstFreeUnitNumberForController(scsiController);

  VirtualDisk disk = new VirtualDisk();
  disk.setControllerKey(scsiController.key);
  disk.setUnitNumber(unitNumber);
  disk.setBacking(diskfileBacking);
  //Unlike required by API ref, the capacityKB is optional. So skip setCapacityInKB() method.
  disk.setKey(-100);

  diskSpec.setOperation(VirtualDeviceConfigSpecOperation.add);           
  diskSpec.setDevice(disk);                 
  
  Task task = vm.reconfigVM_Task(vmConfigSpec);

  task.waitForTask(200, 100);
}
 
开发者ID:Juniper,项目名称:vijava,代码行数:31,代码来源:VirtualMachineDeviceManager.java


示例2: createDiskSpec

import com.vmware.vim25.VirtualDiskFlatVer2BackingInfo; //导入依赖的package包/类
static VirtualDeviceConfigSpec createDiskSpec(String dsName, 
    int cKey, long diskSizeKB, String diskMode)
{
  VirtualDeviceConfigSpec diskSpec = 
      new VirtualDeviceConfigSpec();
  diskSpec.setOperation(VirtualDeviceConfigSpecOperation.add);
  diskSpec.setFileOperation(
      VirtualDeviceConfigSpecFileOperation.create);
  
  VirtualDisk vd = new VirtualDisk();
  vd.setCapacityInKB(diskSizeKB);
  diskSpec.setDevice(vd);
  vd.setKey(0);
  vd.setUnitNumber(0);
  vd.setControllerKey(cKey);

  VirtualDiskFlatVer2BackingInfo diskfileBacking = 
      new VirtualDiskFlatVer2BackingInfo();
  String fileName = "["+ dsName +"]";
  diskfileBacking.setFileName(fileName);
  diskfileBacking.setDiskMode(diskMode);
  diskfileBacking.setThinProvisioned(true);
  vd.setBacking(diskfileBacking);
  return diskSpec;
}
 
开发者ID:Juniper,项目名称:vijava,代码行数:26,代码来源:CreateVM.java


示例3: createVirtualDisk

import com.vmware.vim25.VirtualDiskFlatVer2BackingInfo; //导入依赖的package包/类
private VirtualDisk createVirtualDisk(String volumeName, int controllerKey, int unitNumber, int key, VmInputs vmInputs,
                                      String parameter) throws Exception {
    VirtualDiskFlatVer2BackingInfo diskFileBacking = new VirtualDiskFlatVer2BackingInfo();
    diskFileBacking.setFileName(volumeName);
    if (Operation.CREATE.toString().equalsIgnoreCase(parameter)) {
        diskFileBacking.setDiskMode(DiskMode.PERSISTENT.toString());
    } else {
        diskFileBacking.setDiskMode(DiskMode.getValue(vmInputs.getVmDiskMode()));
    }

    VirtualDisk disk = new VirtualDisk();
    disk.setBacking(diskFileBacking);
    disk.setControllerKey(controllerKey);
    disk.setUnitNumber(unitNumber);
    disk.setKey(key);
    disk.setCapacityInKB(vmInputs.getLongVmDiskSize() * DISK_AMOUNT_MULTIPLIER);

    return disk;
}
 
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:20,代码来源:VmUtils.java


示例4: getDiskCurrentTopBackingFileInChain

import com.vmware.vim25.VirtualDiskFlatVer2BackingInfo; //导入依赖的package包/类
public String getDiskCurrentTopBackingFileInChain(String deviceBusName) throws Exception {
    List<VirtualDevice> devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
    if (devices != null && devices.size() > 0) {
        for (VirtualDevice device : devices) {
            if (device instanceof VirtualDisk) {
                s_logger.info("Test against disk device, controller key: " + device.getControllerKey() + ", unit number: " + device.getUnitNumber());

                VirtualDeviceBackingInfo backingInfo = ((VirtualDisk)device).getBacking();
                if (backingInfo instanceof VirtualDiskFlatVer2BackingInfo) {
                    VirtualDiskFlatVer2BackingInfo diskBackingInfo = (VirtualDiskFlatVer2BackingInfo)backingInfo;

                    String deviceNumbering = getDeviceBusName(devices, device);
                    if (deviceNumbering.equals(deviceBusName))
                        return diskBackingInfo.getFileName();
                }
            }
        }
    }

    return null;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:22,代码来源:VirtualMachineMO.java


示例5: getDiskInfoBuilder

import com.vmware.vim25.VirtualDiskFlatVer2BackingInfo; //导入依赖的package包/类
public VirtualMachineDiskInfoBuilder getDiskInfoBuilder() throws Exception {
    VirtualMachineDiskInfoBuilder builder = new VirtualMachineDiskInfoBuilder();

    List<VirtualDevice> devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");

    if (devices != null && devices.size() > 0) {
        for (VirtualDevice device : devices) {
            if (device instanceof VirtualDisk) {
                VirtualDeviceBackingInfo backingInfo = ((VirtualDisk)device).getBacking();
                if (backingInfo instanceof VirtualDiskFlatVer2BackingInfo) {
                    VirtualDiskFlatVer2BackingInfo diskBackingInfo = (VirtualDiskFlatVer2BackingInfo)backingInfo;

                    while (diskBackingInfo != null) {
                        String deviceBusName = getDeviceBusName(devices, device);
                        builder.addDisk(deviceBusName, diskBackingInfo.getFileName());
                        diskBackingInfo = diskBackingInfo.getParent();
                    }
                }
            }
        }
    }

    return builder;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:25,代码来源:VirtualMachineMO.java


示例6: getAllDiskDatastores

import com.vmware.vim25.VirtualDiskFlatVer2BackingInfo; //导入依赖的package包/类
public List<Pair<Integer, ManagedObjectReference>> getAllDiskDatastores() throws Exception {
    List<Pair<Integer, ManagedObjectReference>> disks = new ArrayList<Pair<Integer, ManagedObjectReference>>();

    List<VirtualDevice> devices = _context.getVimClient().getDynamicProperty(_mor, "config.hardware.device");
    if (devices != null && devices.size() > 0) {
        for (VirtualDevice device : devices) {
            if (device instanceof VirtualDisk) {
                VirtualDeviceBackingInfo backingInfo = ((VirtualDisk)device).getBacking();
                if (backingInfo instanceof VirtualDiskFlatVer2BackingInfo) {
                    VirtualDiskFlatVer2BackingInfo diskBackingInfo = (VirtualDiskFlatVer2BackingInfo)backingInfo;
                    disks.add(new Pair<Integer, ManagedObjectReference>(new Integer(device.getKey()), diskBackingInfo.getDatastore()));
                }
            }
        }
    }

    return disks;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:19,代码来源:VirtualMachineMO.java


示例7: getAllIndependentDiskDevice

import com.vmware.vim25.VirtualDiskFlatVer2BackingInfo; //导入依赖的package包/类
public VirtualDisk[] getAllIndependentDiskDevice() throws Exception {
    List<VirtualDisk> independentDisks = new ArrayList<VirtualDisk>();
    VirtualDisk[] allDisks = getAllDiskDevice();
    if (allDisks.length > 0) {
        for (VirtualDisk disk : allDisks) {
            String diskMode = "";
            if (disk.getBacking() instanceof VirtualDiskFlatVer1BackingInfo) {
                diskMode = ((VirtualDiskFlatVer1BackingInfo)disk.getBacking()).getDiskMode();
            } else if (disk.getBacking() instanceof VirtualDiskFlatVer2BackingInfo) {
                diskMode = ((VirtualDiskFlatVer2BackingInfo)disk.getBacking()).getDiskMode();
            } else if (disk.getBacking() instanceof VirtualDiskRawDiskMappingVer1BackingInfo) {
                diskMode = ((VirtualDiskRawDiskMappingVer1BackingInfo)disk.getBacking()).getDiskMode();
            } else if (disk.getBacking() instanceof VirtualDiskSparseVer1BackingInfo) {
                diskMode = ((VirtualDiskSparseVer1BackingInfo)disk.getBacking()).getDiskMode();
            } else if (disk.getBacking() instanceof VirtualDiskSparseVer2BackingInfo) {
                diskMode = ((VirtualDiskSparseVer2BackingInfo)disk.getBacking()).getDiskMode();
            }

            if (diskMode.indexOf("independent") != -1) {
                independentDisks.add(disk);
            }
        }
    }

    return independentDisks.toArray(new VirtualDisk[0]);
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:27,代码来源:VirtualMachineMO.java


示例8: setParentBackingInfo

import com.vmware.vim25.VirtualDiskFlatVer2BackingInfo; //导入依赖的package包/类
private static void setParentBackingInfo(VirtualDiskFlatVer2BackingInfo backingInfo, ManagedObjectReference morDs, String[] parentDatastorePathList) {

        VirtualDiskFlatVer2BackingInfo parentBacking = new VirtualDiskFlatVer2BackingInfo();
        parentBacking.setDatastore(morDs);
        parentBacking.setDiskMode(VirtualDiskMode.PERSISTENT.value());

        if (parentDatastorePathList.length > 1) {
            String[] nextDatastorePathList = new String[parentDatastorePathList.length - 1];
            for (int i = 0; i < parentDatastorePathList.length - 1; i++)
                nextDatastorePathList[i] = parentDatastorePathList[i + 1];
            setParentBackingInfo(parentBacking, morDs, nextDatastorePathList);
        }
        parentBacking.setFileName(parentDatastorePathList[0]);

        backingInfo.setParent(parentBacking);
    }
 
开发者ID:apache,项目名称:cloudstack,代码行数:17,代码来源:VmwareHelper.java


示例9: getDiskInfoBuilder

import com.vmware.vim25.VirtualDiskFlatVer2BackingInfo; //导入依赖的package包/类
public static VirtualMachineDiskInfoBuilder getDiskInfoBuilder(List<VirtualDevice> devices) throws Exception {
    VirtualMachineDiskInfoBuilder builder = new VirtualMachineDiskInfoBuilder();

    if (devices != null) {
        for (VirtualDevice device : devices) {
            if (device instanceof VirtualDisk) {
                VirtualDisk virtualDisk = (VirtualDisk)device;
                VirtualDeviceBackingInfo backingInfo = virtualDisk.getBacking();

                if (backingInfo instanceof VirtualDiskFlatVer2BackingInfo) {
                    VirtualDiskFlatVer2BackingInfo diskBackingInfo = (VirtualDiskFlatVer2BackingInfo)backingInfo;

                    String deviceBusName = VMwareUtil.getDeviceBusName(devices, virtualDisk);

                    while (diskBackingInfo != null) {
                        builder.addDisk(deviceBusName, diskBackingInfo.getFileName());

                        diskBackingInfo = diskBackingInfo.getParent();
                    }
                }
            }
        }
    }

    return builder;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:27,代码来源:VMwareUtil.java


示例10: createNewDataDisk

import com.vmware.vim25.VirtualDiskFlatVer2BackingInfo; //导入依赖的package包/类
private VirtualDeviceConfigSpec createNewDataDisk(VirtualDisk vdSystemDisk,
        long newDiskSpace, int deviceKey, int unitNumber) throws Exception {

    logger.info("reconfigureDisks() create data disk space with "
            + newDiskSpace + " KB");

    ManagedObjectReference vmDatastore = ((VirtualDeviceFileBackingInfo) vdSystemDisk
            .getBacking()).getDatastore();
    String vmDatastoreName = (String) vmw.getServiceUtil()
            .getDynamicProperty(vmDatastore, "summary.name");

    VirtualDisk vdDataDisk = new VirtualDisk();
    VirtualDiskFlatVer2BackingInfo diskfileBacking = new VirtualDiskFlatVer2BackingInfo();
    diskfileBacking.setFileName("[" + vmDatastoreName + "]");
    diskfileBacking.setDiskMode("persistent");

    vdDataDisk.setKey(deviceKey);
    vdDataDisk.setControllerKey(vdSystemDisk.getControllerKey());
    vdDataDisk.setUnitNumber(new Integer(unitNumber));
    vdDataDisk.setBacking(diskfileBacking);
    vdDataDisk.setCapacityInKB(newDiskSpace);

    VirtualDeviceConfigSpec vmDeviceSpec = new VirtualDeviceConfigSpec();
    vmDeviceSpec.setOperation(VirtualDeviceConfigSpecOperation.ADD);
    vmDeviceSpec
            .setFileOperation(VirtualDeviceConfigSpecFileOperation.CREATE);
    vmDeviceSpec.setDevice(vdDataDisk);

    return vmDeviceSpec;
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:31,代码来源:DiskManager.java


示例11: createHdd

import com.vmware.vim25.VirtualDiskFlatVer2BackingInfo; //导入依赖的package包/类
/**
 * Creates HDD virtual disk
 */
public static VirtualDeviceConfigSpec createHdd(Integer controllerKey, int unitNumber,
        DiskService.DiskStateExpanded ds, String diskName, ManagedObjectReference datastore,
        List<VirtualMachineDefinedProfileSpec> pbmSpec, boolean isCreateFile)
        throws FinderException, InvalidPropertyFaultMsg, RuntimeFaultFaultMsg {

    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(diskName);
    backing.setDatastore(datastore);

    VirtualDisk disk = new VirtualDisk();
    disk.setCapacityInKB(toKb(ds.capacityMBytes));
    disk.setBacking(backing);
    disk.setStorageIOAllocation(getStorageIOAllocationInfo(ds));
    disk.setControllerKey(controllerKey);
    disk.setUnitNumber(unitNumber);
    fillInControllerUnitNumber(ds, unitNumber);
    disk.setKey(-1);

    VirtualDeviceConfigSpec change = new VirtualDeviceConfigSpec();
    change.setDevice(disk);
    if (pbmSpec != null) {
        // Add storage policy spec
        pbmSpec.stream().forEach(sp -> {
            change.getProfile().add(sp);
        });
    }
    change.setOperation(VirtualDeviceConfigSpecOperation.ADD);
    if (isCreateFile) {
        change.setFileOperation(VirtualDeviceConfigSpecFileOperation.CREATE);
    }

    return change;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:43,代码来源:ClientUtils.java


示例12: resizeHdd

import com.vmware.vim25.VirtualDiskFlatVer2BackingInfo; //导入依赖的package包/类
private VirtualDeviceConfigSpec resizeHdd(VirtualDisk sysdisk, DiskStateExpanded ds)
        throws FinderException, InvalidPropertyFaultMsg, RuntimeFaultFaultMsg {

    VirtualDiskFlatVer2BackingInfo oldbacking = (VirtualDiskFlatVer2BackingInfo) sysdisk
            .getBacking();
    VirtualDiskFlatVer2BackingInfo backing = new VirtualDiskFlatVer2BackingInfo();
    backing.setDiskMode(getDiskMode(ds));
    backing.setThinProvisioned(oldbacking.isThinProvisioned());
    backing.setEagerlyScrub(oldbacking.isEagerlyScrub());
    backing.setFileName(oldbacking.getFileName());

    VirtualDisk disk = new VirtualDisk();
    if (toKb(ds.capacityMBytes) > sysdisk.getCapacityInKB()) {
        disk.setCapacityInKB(toKb(ds.capacityMBytes));
    } else {
        disk.setCapacityInKB(sysdisk.getCapacityInKB());
    }
    disk.setBacking(backing);
    disk.setStorageIOAllocation(getStorageIOAllocationInfo(ds));
    disk.setControllerKey(sysdisk.getControllerKey());
    disk.setUnitNumber(sysdisk.getUnitNumber());
    fillInControllerUnitNumber(ds, sysdisk.getUnitNumber());
    disk.setKey(sysdisk.getKey());

    VirtualDeviceConfigSpec change = new VirtualDeviceConfigSpec();
    change.setDevice(disk);
    change.setOperation(VirtualDeviceConfigSpecOperation.EDIT);

    return change;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:31,代码来源:InstanceClient.java


示例13: verifyDiskProperties

import com.vmware.vim25.VirtualDiskFlatVer2BackingInfo; //导入依赖的package包/类
protected void verifyDiskProperties(ComputeService.ComputeState vm, GetMoRef get)
        throws InvalidPropertyFaultMsg, RuntimeFaultFaultMsg {
    VirtualDisk vd = fetchVirtualDisk(vm, get);
    assertEquals(SharesLevel.HIGH.value(), vd.getStorageIOAllocation().getShares()
            .getLevel().value());
    int shares = 2000;
    assertEquals(shares, vd.getStorageIOAllocation().getShares().getShares());
    Long limitIops = 100L;
    assertEquals(limitIops, vd.getStorageIOAllocation().getLimit());
    VirtualDiskFlatVer2BackingInfo backing = (VirtualDiskFlatVer2BackingInfo) vd.getBacking();
    assertTrue(backing.isThinProvisioned());
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:13,代码来源:TestVSphereCloneTaskBase.java


示例14: reuseDisk

import com.vmware.vim25.VirtualDiskFlatVer2BackingInfo; //导入依赖的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;
}
 
开发者ID:primecloud-controller-org,项目名称:primecloud-controller,代码行数:34,代码来源:VmwareProcessClient.java


示例15: createHardDisk

import com.vmware.vim25.VirtualDiskFlatVer2BackingInfo; //导入依赖的package包/类
public void createHardDisk(int diskSizeMB, VirtualDiskType type, VirtualDiskMode mode) throws Exception
{
  VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec();
  VirtualDeviceConfigSpec diskSpec = new VirtualDeviceConfigSpec();      
  
  VirtualDiskFlatVer2BackingInfo diskfileBacking = new VirtualDiskFlatVer2BackingInfo();
  diskfileBacking.setFileName("");
  diskfileBacking.setDiskMode(mode.toString());
  diskfileBacking.setThinProvisioned(type==VirtualDiskType.thin);

  VirtualSCSIController scsiController = getFirstAvailableController(VirtualSCSIController.class);
  int unitNumber = getFirstFreeUnitNumberForController(scsiController);
  VirtualDisk disk = new VirtualDisk();
  disk.setControllerKey(scsiController.key);
  disk.setUnitNumber(unitNumber);
  disk.setBacking(diskfileBacking);
  disk.setCapacityInKB(1024 * diskSizeMB);
  disk.setKey(-1);
  
  diskSpec.setOperation(VirtualDeviceConfigSpecOperation.add);           
  diskSpec.setFileOperation(VirtualDeviceConfigSpecFileOperation.create);           
  diskSpec.setDevice(disk);
  VirtualDeviceConfigSpec vdiskSpec = diskSpec;
  VirtualDeviceConfigSpec [] vdiskSpecArray = {vdiskSpec};         

  vmConfigSpec.setDeviceChange(vdiskSpecArray);
  Task task = vm.reconfigVM_Task(vmConfigSpec);

  task.waitForTask(200, 100);
}
 
开发者ID:Juniper,项目名称:vijava,代码行数:31,代码来源:VirtualMachineDeviceManager.java


示例16: getVmdkFileBaseName

import com.vmware.vim25.VirtualDiskFlatVer2BackingInfo; //导入依赖的package包/类
public String getVmdkFileBaseName(VirtualDisk disk) throws Exception {
    String vmdkFileBaseName = null;
    VirtualDeviceBackingInfo backingInfo = disk.getBacking();
    if(backingInfo instanceof VirtualDiskFlatVer2BackingInfo) {
        VirtualDiskFlatVer2BackingInfo diskBackingInfo = (VirtualDiskFlatVer2BackingInfo)backingInfo;
        DatastoreFile dsBackingFile = new DatastoreFile(diskBackingInfo.getFileName());
        vmdkFileBaseName = dsBackingFile.getFileBaseName();
    }
    return vmdkFileBaseName;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:11,代码来源:VirtualMachineMO.java


示例17: verifyDiskProperties

import com.vmware.vim25.VirtualDiskFlatVer2BackingInfo; //导入依赖的package包/类
protected void verifyDiskProperties(ComputeService.ComputeState vm, GetMoRef get)
        throws InvalidPropertyFaultMsg, RuntimeFaultFaultMsg {
    VirtualDisk vd = fetchVirtualDisk(vm, get);
    assertEquals(SharesLevel.CUSTOM.value(), vd.getStorageIOAllocation().getShares().getLevel().value());
    Long limitIops = 50L;
    assertEquals(limitIops, vd.getStorageIOAllocation().getLimit());
    VirtualDiskFlatVer2BackingInfo backing = (VirtualDiskFlatVer2BackingInfo) vd.getBacking();
    assertTrue(backing.isThinProvisioned());
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:10,代码来源:TestVSphereLibraryProvisionTaskBase.java


示例18: getIndependentVirtualDiskKeys

import com.vmware.vim25.VirtualDiskFlatVer2BackingInfo; //导入依赖的package包/类
private static ArrayList<Integer> getIndependentVirtualDiskKeys(VirtualMachine vm) throws Exception {
   ArrayList<Integer> diskKeys = Lists.newArrayList();

   VirtualDevice[] devices = (VirtualDevice[]) vm.getPropertyByPath("config.hardware.device");

   for (int i = 0; i < devices.length; i++) {
      if (devices[i] instanceof VirtualDisk) {
         VirtualDisk vDisk = (VirtualDisk) devices[i];
         String diskMode = "";
         VirtualDeviceBackingInfo vdbi = vDisk.getBacking();

         if (vdbi instanceof VirtualDiskFlatVer1BackingInfo) {
            diskMode = ((VirtualDiskFlatVer1BackingInfo) vdbi).getDiskMode();
         } else if (vdbi instanceof VirtualDiskFlatVer2BackingInfo) {
            diskMode = ((VirtualDiskFlatVer2BackingInfo) vdbi).getDiskMode();
         } else if (vdbi instanceof VirtualDiskRawDiskMappingVer1BackingInfo) {
            diskMode = ((VirtualDiskRawDiskMappingVer1BackingInfo) vdbi).getDiskMode();
         } else if (vdbi instanceof VirtualDiskSparseVer1BackingInfo) {
            diskMode = ((VirtualDiskSparseVer1BackingInfo) vdbi).getDiskMode();
         } else if (vdbi instanceof VirtualDiskSparseVer2BackingInfo) {
            diskMode = ((VirtualDiskSparseVer2BackingInfo) vdbi).getDiskMode();
         }

         if (diskMode.indexOf("independent") != -1) {
            diskKeys.add(vDisk.getKey());
         }
      }
   }
   return diskKeys;
}
 
开发者ID:igreenfield,项目名称:jcloud-vsphere,代码行数:31,代码来源:MasterToVirtualMachineCloneSpec.java


示例19: newDisk

import com.vmware.vim25.VirtualDiskFlatVer2BackingInfo; //导入依赖的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;
}
 
开发者ID:primecloud-controller-org,项目名称:primecloud-controller,代码行数:36,代码来源:VmwareProcessClient.java


示例20: prepareDiskDevice

import com.vmware.vim25.VirtualDiskFlatVer2BackingInfo; //导入依赖的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;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:33,代码来源:VmwareHelper.java



注:本文中的com.vmware.vim25.VirtualDiskFlatVer2BackingInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ReadableColor类代码示例发布时间:2022-05-22
下一篇:
Java GroupManager类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap