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

Java VirtualDeviceFileBackingInfo类代码示例

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

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



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

示例1: updateDiskStateFromVirtualDevice

import com.vmware.vim25.VirtualDeviceFileBackingInfo; //导入依赖的package包/类
/**
 * Capture virtual cdrom attributes in the disk state for reference.
 */
public static void updateDiskStateFromVirtualDevice(VirtualDevice vd, DiskService.DiskState
        disk, VirtualDeviceBackingInfo backing) {
    fillInControllerUnitNumber(disk, vd.getUnitNumber());
    if (backing != null && backing instanceof VirtualDeviceFileBackingInfo) {
        disk.sourceImageReference = VimUtils
                .datastorePathToUri(((VirtualDeviceFileBackingInfo) backing).getFileName());
    }
    disk.status = DiskService.DiskStatus.ATTACHED;
    CustomProperties.of(disk)
            .put(PROVIDER_DISK_UNIQUE_ID, vd.getDeviceInfo().getLabel());
    if (vd.getConnectable() != null) {
        CustomProperties.of(disk)
                .put(DEVICE_CONNECTED, vd.getConnectable().isConnected())
                .put(DEVICE_STATUS, vd.getConnectable().getStatus());
    }
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:20,代码来源:ClientUtils.java


示例2: updateDiskLinksAfterProvisionSuccess

import com.vmware.vim25.VirtualDeviceFileBackingInfo; //导入依赖的package包/类
/**
 * Update the details of the disk into compute state after the provisioning is successful
 */
private void updateDiskLinksAfterProvisionSuccess(ComputeState state, List<VirtualDevice> disks,
        ProvisionContext ctx) {
    ArrayList<String> diskLinks = new ArrayList<>(disks.size());
    // Fill in the disk links from the input to the ComputeState, as it may contain non hdd
    // disk as well. For ex, Floppy or CD-Rom
    ctx.disks.stream().forEach(ds -> diskLinks.add(ds.documentSelfLink));

    // Handle all the HDD disk
    for (VirtualDevice disk : disks) {
        DiskStateExpanded matchedDs = findMatchingDiskState(disk, ctx.disks);

        if (disk.getBacking() instanceof VirtualDeviceFileBackingInfo) {
            handleVirtualDiskUpdate(matchedDs, (VirtualDisk) disk, diskLinks, ctx);
        } else if (disk instanceof VirtualCdrom) {
            handleVirtualDeviceUpdate(matchedDs, DiskType.CDROM, disk, diskLinks, ctx);
        } else if (disk instanceof VirtualFloppy) {
            handleVirtualDeviceUpdate(matchedDs, DiskType.FLOPPY, disk, diskLinks, ctx);
        } else {
            continue;
        }
    }
    state.diskLinks = diskLinks;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:27,代码来源:VSphereAdapterInstanceService.java


示例3: getDeviceByBackingFileName

import com.vmware.vim25.VirtualDeviceFileBackingInfo; //导入依赖的package包/类
public VirtualDevice getDeviceByBackingFileName(String name)
{
  if(name==null)
  {
    throw new IllegalArgumentException("name must not be null!");
  }
    
  VirtualDevice[] devices = this.getAllVirtualDevices(); 

  for(VirtualDevice device : devices)
  {
    VirtualDeviceBackingInfo bi = device.getBacking();
    if(bi instanceof VirtualDeviceFileBackingInfo)
    {
      String fileName = ((VirtualDeviceFileBackingInfo)bi).getFileName();
      if(name.equals(fileName))
        return device;
    }
   }
   return null;
}
 
开发者ID:Juniper,项目名称:vijava,代码行数:22,代码来源:VirtualMachineDeviceManager.java


示例4: createNewDataDisk

import com.vmware.vim25.VirtualDeviceFileBackingInfo; //导入依赖的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


示例5: handleVirtualDiskUpdate

import com.vmware.vim25.VirtualDeviceFileBackingInfo; //导入依赖的package包/类
/**
 * Process VirtualDisk and update the details in the diskLinks of the provisioned compute
 */
private void handleVirtualDiskUpdate(DiskStateExpanded matchedDs, VirtualDisk disk,
        ArrayList<String> diskLinks, ProvisionContext ctx) {
    VirtualDeviceFileBackingInfo backing = (VirtualDeviceFileBackingInfo) disk.getBacking();
    if (matchedDs == null) {
        // This is the new disk, hence add it to the list
        DiskState ds = new DiskState();
        ds.documentSelfLink = UriUtils.buildUriPath(
                DiskService.FACTORY_LINK, getHost().nextUUID());

        ds.name = disk.getDeviceInfo().getLabel();
        ds.creationTimeMicros = Utils.getNowMicrosUtc();
        ds.type = DiskType.HDD;
        ds.regionId = ctx.parent.description.regionId;
        ds.capacityMBytes = disk.getCapacityInKB() / 1024;
        ds.sourceImageReference = VimUtils.datastorePathToUri(backing.getFileName());
        updateDiskStateFromVirtualDisk(disk, ds);
        if (disk.getStorageIOAllocation() != null) {
            StorageIOAllocationInfo storageInfo = disk.getStorageIOAllocation();
            CustomProperties.of(ds)
                    .put(SHARES, storageInfo.getShares().getShares())
                    .put(LIMIT_IOPS, storageInfo.getLimit())
                    .put(SHARES_LEVEL, storageInfo.getShares().getLevel().value());
        }
        fillInControllerUnitNumber(ds, disk.getUnitNumber());
        createDiskOnDemand(ds);
        diskLinks.add(ds.documentSelfLink);
    } else {
        // This is known disk, hence update with the provisioned attributes.
        matchedDs.sourceImageReference = VimUtils.datastorePathToUri(backing.getFileName());
        updateDiskStateFromVirtualDisk(disk, matchedDs);
        createDiskPatch(matchedDs);
    }
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:37,代码来源:VSphereAdapterInstanceService.java


示例6: attachDisk

import com.vmware.vim25.VirtualDeviceFileBackingInfo; //导入依赖的package包/类
/**
 * TODO: メソッドコメントを記述
 *
 * @param vmwareProcessClient
 * @param instanceNo
 * @param diskNo
 */
public void attachDisk(VmwareProcessClient vmwareProcessClient, Long instanceNo, Long diskNo) {
    VmwareDisk vmwareDisk = vmwareDiskDao.read(diskNo);

    if (BooleanUtils.isTrue(vmwareDisk.getAttached())) {
        // ディスクがアタッチ済みの場合はスキップ
        return;
    }

    VmwareInstance vmwareInstance = vmwareInstanceDao.read(instanceNo);

    //イベントログ出力
    Component component = componentDao.read(vmwareDisk.getComponentNo());
    Instance instance = instanceDao.read(instanceNo);
    Platform platform = platformDao.read(vmwareProcessClient.getPlatformNo());
    if (StringUtils.isEmpty(vmwareDisk.getFileName())) {
        processLogger.debug(component, instance, "VmwareDiskCreate", new Object[] { platform.getPlatformName() });
    } else {
        processLogger.debug(component, instance, "VmwareDiskAttach", new Object[] { platform.getPlatformName(),
                vmwareDisk.getFileName() });
    }

    // ディスクのアタッチ
    VirtualDisk disk = vmwareProcessClient.attachDisk(vmwareInstance.getMachineName(), vmwareDisk.getScsiId(),
            vmwareDisk.getSize(), vmwareDisk.getFileName());

    // ディスク情報の取得
    VirtualDeviceFileBackingInfo backingInfo = VirtualDeviceFileBackingInfo.class.cast(disk.getBacking());
    Datastore datastore = new Datastore(vmwareProcessClient.getVmwareClient().getServiceInstance()
            .getServerConnection(), backingInfo.getDatastore());

    //イベントログ出力
    if (StringUtils.isEmpty(vmwareDisk.getFileName())) {
        processLogger.debug(component, instance, "VmwareDiskCreateFinish",
                new Object[] { platform.getPlatformName(), backingInfo.getFileName(), vmwareDisk.getSize() });
    } else {
        processLogger.debug(component, instance, "VmwareDiskAttachFinish",
                new Object[] { platform.getPlatformName(), vmwareDisk.getFileName(), vmwareDisk.getSize() });
    }

    // データベース更新
    vmwareDisk = vmwareDiskDao.read(diskNo);
    vmwareDisk.setAttached(true);
    vmwareDisk.setDatastore(datastore.getName());
    vmwareDisk.setFileName(backingInfo.getFileName());
    vmwareDiskDao.update(vmwareDisk);
}
 
开发者ID:primecloud-controller-org,项目名称:primecloud-controller,代码行数:54,代码来源:VmwareDiskProcess.java


示例7: updateSiocInfoForWorkerVM

import com.vmware.vim25.VirtualDeviceFileBackingInfo; //导入依赖的package包/类
private ResultWrapper updateSiocInfoForWorkerVM(VMwareUtil.VMwareConnection connection, ManagedObjectReference morVm, String datastoreName,
                                                int limitIopsPerGB) throws Exception {
    int limitIopsTotal = 0;
    List<ManagedObjectReference> tasks = new ArrayList<>();

    VirtualMachineConfigInfo vmci = (VirtualMachineConfigInfo)VMwareUtil.getEntityProps(connection, morVm,
            new String[] { "config" }).get("config");
    List<VirtualDevice> devices = vmci.getHardware().getDevice();

    for (VirtualDevice device : devices) {
        if (device instanceof VirtualDisk) {
            VirtualDisk disk = (VirtualDisk)device;

            if (disk.getBacking() instanceof VirtualDeviceFileBackingInfo) {
                VirtualDeviceFileBackingInfo backingInfo = (VirtualDeviceFileBackingInfo)disk.getBacking();

                if (backingInfo.getFileName().contains(datastoreName)) {
                    boolean diskUpdated = false;

                    StorageIOAllocationInfo sioai = disk.getStorageIOAllocation();

                    long currentLimitIops = sioai.getLimit() !=  null ? sioai.getLimit() : Long.MIN_VALUE;
                    long newLimitIops = getNewLimitIopsBasedOnVolumeSize(disk.getCapacityInBytes(), limitIopsPerGB);

                    limitIopsTotal += newLimitIops;

                    if (currentLimitIops != newLimitIops) {
                        sioai.setLimit(newLimitIops);

                        diskUpdated = true;
                    }

                    if (diskUpdated) {
                        VirtualDeviceConfigSpec vdcs = new VirtualDeviceConfigSpec();

                        vdcs.setDevice(disk);
                        vdcs.setOperation(VirtualDeviceConfigSpecOperation.EDIT);

                        VirtualMachineConfigSpec vmcs = new VirtualMachineConfigSpec();

                        vmcs.getDeviceChange().add(vdcs);

                        try {
                            ManagedObjectReference task = VMwareUtil.reconfigureVm(connection, morVm, vmcs);

                            tasks.add(task);

                            LOGGER.info(getInfoMsgForWorkerVm(newLimitIops));
                        } catch (Exception ex) {
                            throw new Exception("Error: " + ex.getMessage());
                        }
                    }
                }
            }
        }
    }

    return new ResultWrapper(limitIopsTotal, tasks);
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:60,代码来源:SiocManagerImpl.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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