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

Java VirtualMachineRuntimeInfo类代码示例

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

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



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

示例1: waitForStopped

import com.vmware.vim25.VirtualMachineRuntimeInfo; //导入依赖的package包/类
public void waitForStopped(String machineName) {
    VirtualMachine machine = getVirtualMachine(machineName);

    // 停止判定処理
    while (true) {
        try {
            Thread.sleep(30 * 1000L);
        } catch (InterruptedException ignore) {
        }

        VirtualMachineRuntimeInfo runtimeInfo = machine.getRuntime();

        if (runtimeInfo.getPowerState() == VirtualMachinePowerState.poweredOff) {
            break;
        }
    }
}
 
开发者ID:primecloud-controller-org,项目名称:primecloud-controller,代码行数:18,代码来源:VmwareProcessClient.java


示例2: doesNetworkNameExist

import com.vmware.vim25.VirtualMachineRuntimeInfo; //导入依赖的package包/类
static boolean doesNetworkNameExist(VirtualMachine vm, 
    String netName) throws Exception 
{
  VirtualMachineRuntimeInfo vmRuntimeInfo = vm.getRuntime();
  EnvironmentBrowser envBrowser = vm.getEnvironmentBrowser();
  ManagedObjectReference hmor = vmRuntimeInfo.getHost();

  HostSystem host = new HostSystem(
      vm.getServerConnection(), hmor);
  ConfigTarget cfg = envBrowser.queryConfigTarget(host);
  VirtualMachineNetworkInfo[] nets = cfg.getNetwork();
  for (int i = 0; nets!=null && i < nets.length; i++) 
  {
    NetworkSummary netSummary = nets[i].getNetwork();
    if (netSummary.isAccessible() && 
        netSummary.getName().equalsIgnoreCase(netName)) 
    {
      return true;
    }
  }
  return false;
}
 
开发者ID:Juniper,项目名称:vijava,代码行数:23,代码来源:VmNicOp.java


示例3: findDatastoreSummary

import com.vmware.vim25.VirtualMachineRuntimeInfo; //导入依赖的package包/类
static DatastoreSummary findDatastoreSummary(VirtualMachine vm, String dsName) throws Exception 
{
  DatastoreSummary dsSum = null;
  VirtualMachineRuntimeInfo vmRuntimeInfo = vm.getRuntime();
  EnvironmentBrowser envBrowser = vm.getEnvironmentBrowser(); 
  ManagedObjectReference hmor = vmRuntimeInfo.getHost();

  if(hmor == null)
  {
    System.out.println("No Datastore found");
    return null;
  }
  
  ConfigTarget configTarget = envBrowser.queryConfigTarget(new HostSystem(vm.getServerConnection(), hmor));
  VirtualMachineDatastoreInfo[] dis = configTarget.getDatastore();
  for (int i=0; dis!=null && i<dis.length; i++) 
  {
    dsSum = dis[i].getDatastore();
    if (dsSum.isAccessible() && dsName.equals(dsSum.getName())) 
    {
      break;
    }
  }
  return dsSum;
}
 
开发者ID:Juniper,项目名称:vijava,代码行数:26,代码来源:VmCdOp.java


示例4: getDefaultDevices

import com.vmware.vim25.VirtualMachineRuntimeInfo; //导入依赖的package包/类
static VirtualDevice[] getDefaultDevices(VirtualMachine vm) 
throws Exception 
{
  VirtualMachineRuntimeInfo vmRuntimeInfo = vm.getRuntime();
  EnvironmentBrowser envBrowser = vm.getEnvironmentBrowser(); 
  ManagedObjectReference hmor = vmRuntimeInfo.getHost();
  VirtualMachineConfigOption cfgOpt = envBrowser.queryConfigOption(null, new HostSystem(vm.getServerConnection(), hmor));
  VirtualDevice[] defaultDevs = null;
  if (cfgOpt != null) 
  {
    defaultDevs = cfgOpt.getDefaultDevice();
    if (defaultDevs == null) 
    {
      throw new Exception("No Datastore found in ComputeResource");
    }
  }
  else
  {
    throw new Exception("No VirtualHardwareInfo found in ComputeResource");
  }
  return defaultDevs;
}
 
开发者ID:Juniper,项目名称:vijava,代码行数:23,代码来源:VmCdOp.java


示例5: getNetworkFromHost

import com.vmware.vim25.VirtualMachineRuntimeInfo; //导入依赖的package包/类
private static ManagedObjectReference getNetworkFromHost(VMwareClient vmw,
        ManagedObjectReference vmwInstance, String networkName)
        throws Exception {
    logger.debug("networkName: " + networkName);

    VirtualMachineRuntimeInfo vmRuntimeInfo = (VirtualMachineRuntimeInfo) vmw
            .getServiceUtil().getDynamicProperty(vmwInstance, "runtime");
    ManagedObjectReference hostRef = vmRuntimeInfo.getHost();
    List<ManagedObjectReference> networkRefList = (List<ManagedObjectReference>) vmw
            .getServiceUtil().getDynamicProperty(hostRef, "network");
    ManagedObjectReference netCard = null;
    StringBuffer networks = new StringBuffer();
    for (ManagedObjectReference networkRef : networkRefList) {
        String netCardName = (String) vmw.getServiceUtil()
                .getDynamicProperty(networkRef, "name");
        networks.append(netCardName + " ");
        if (netCardName.equalsIgnoreCase(networkName)) {
            netCard = networkRef;
            break;
        }
    }

    if (netCard == null) {
        String hostName = (String) vmw.getServiceUtil()
                .getDynamicProperty(hostRef, "name");
        logger.error("Network " + networkName + " not found on host "
                + hostName);
        logger.debug("available networks are: " + networks.toString());
        throw new Exception("Network card " + networkName
                + " not found on host " + hostName);
    }

    return netCard;
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:35,代码来源:NetworkManager.java


示例6: isStopped

import com.vmware.vim25.VirtualMachineRuntimeInfo; //导入依赖的package包/类
public boolean isStopped() throws Exception {
    VirtualMachineRuntimeInfo vmRuntimeInfo = (VirtualMachineRuntimeInfo) vmw
            .getServiceUtil().getDynamicProperty(vmInstance, "runtime");

    if (vmRuntimeInfo != null) {
        return VirtualMachinePowerState.POWERED_OFF
                .equals(vmRuntimeInfo.getPowerState());
    }
    LOG.warn("Failed to retrieve runtime information from VM "
            + instanceName);
    return false;

}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:14,代码来源:VM.java


示例7: shutdownGuest

import com.vmware.vim25.VirtualMachineRuntimeInfo; //导入依赖的package包/类
public void shutdownGuest(String machineName) {
    // VirtualMachine
    VirtualMachine machine = getVirtualMachine(machineName);

    // パワーオフ状態の場合はスキップ
    VirtualMachineRuntimeInfo runtimeInfo = machine.getRuntime();
    if (runtimeInfo.getPowerState() == VirtualMachinePowerState.poweredOff) {
        return;
    }

    // 仮想マシンのシャットダウン
    try {
        machine.shutdownGuest();
    } catch (RemoteException e) {
        throw new AutoException("EPROCESS-000519", e, machineName);
    }

    if (log.isInfoEnabled()) {
        log.info(MessageUtils.getMessage("IPROCESS-100415", machineName));
    }

    // シャットダウンが完了するまで待機
    waitForStopped(machineName);

    if (log.isInfoEnabled()) {
        log.info(MessageUtils.getMessage("IPROCESS-100416", machineName));
    }
}
 
开发者ID:primecloud-controller-org,项目名称:primecloud-controller,代码行数:29,代码来源:VmwareProcessClient.java


示例8: getRunningHost

import com.vmware.vim25.VirtualMachineRuntimeInfo; //导入依赖的package包/类
public HostMO getRunningHost() throws Exception {
    VirtualMachineRuntimeInfo runtimeInfo = getRuntimeInfo();
    return new HostMO(_context, runtimeInfo.getHost());
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:5,代码来源:VirtualMachineMO.java


示例9: getRuntimeInfo

import com.vmware.vim25.VirtualMachineRuntimeInfo; //导入依赖的package包/类
public VirtualMachineRuntimeInfo getRuntimeInfo() throws Exception {
    return (VirtualMachineRuntimeInfo)_context.getVimClient().getDynamicProperty(_mor, "runtime");
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:4,代码来源:VirtualMachineMO.java


示例10: getVmState

import com.vmware.vim25.VirtualMachineRuntimeInfo; //导入依赖的package包/类
public static PowerState getVmState(VirtualMachineMO vmMo) throws Exception {
    VirtualMachineRuntimeInfo runtimeInfo = vmMo.getRuntimeInfo();
    return convertPowerState(runtimeInfo.getPowerState());
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:5,代码来源:VmwareResource.java


示例11: getVmPowerState

import com.vmware.vim25.VirtualMachineRuntimeInfo; //导入依赖的package包/类
public static PowerState getVmPowerState(VirtualMachineMO vmMo) throws Exception {
    VirtualMachineRuntimeInfo runtimeInfo = vmMo.getRuntimeInfo();
    return convertPowerState(runtimeInfo.getPowerState());
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:5,代码来源:VmwareResource.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java HadoopLocationWizard类代码示例发布时间:2022-05-22
下一篇:
Java LinkedMap类代码示例发布时间: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