大发彩票平台出租搭建

大发彩票平台出租搭建
1148916888.com

带手机版。源码开源。
大发彩票平台出租搭建

根据实体对象的属性获取相关对象时,在虚拟机中,获取的仍然可能是一个托管对象引用,如根据虚拟机的属性runtime获取到的VirtualMachineRuntimeInfo对象,要获取该对象中的主机名,通过getHost()方法获取的是host的一个ManagedObjectReference,这样就需要进一步根据托管对象获取其对应的实体名称。

代码如下:

/**

根据属性检索要查询的对象信息(该方法参考文章【1】):

/**

  • @Title: retrievePropertiesAllObjects
  • @Description: 根据属性检索要查询的对象信息
  • @param listpfs
  • @return
  • @throws Exception
  • @version 1.0
    */
    private List<ObjectContent> retrievePropertiesAllObjects(List<PropertyFilterSpec> listpfs) throws Exception {
    RetrieveOptions propObjectRetrieveOpts = new RetrieveOptions();
    List<ObjectContent> listobjcontent = new ArrayList<>();
    VimPortType vimPortType = this.vmClientSession.getVimPortType();
    ServiceContent serviceContent = this.vmClientSession.getServiceContent();
    try {
    // 检索属性
    RetrieveResult rslts =
    vimPortType.retrievePropertiesEx(serviceContent.getPropertyCollector(), listpfs, propObjectRetrieveOpts);
    if (rslts != null && rslts.getObjects() != null && !rslts.getObjects().isEmpty()) {
    listobjcontent.addAll(rslts.getObjects());
    }
    String token = null;
    if (rslts != null && rslts.getToken() != null) {
    token = rslts.getToken();
    }
    while (token != null && !token.isEmpty()) {
    rslts = vimPortType.continueRetrievePropertiesEx(serviceContent.getPropertyCollector(), token);
    token = null;
    if (rslts != null) {
    token = rslts.getToken();
    if (rslts.getObjects() != null && !rslts.getObjects().isEmpty()) {
    listobjcontent.addAll(rslts.getObjects());
    }
    }
    }
    return listobjcontent;
    } catch (Throwable e) {
    e.printStackTrace();
    }
    }

猜你喜欢

转载自blog.51cto.com/13840452/2133351