我使用vijava (5.1)从vCenter获取有关虚拟机的数据。为此,我使用了一个带有一些属性(例如,guest.hostName、runtime.powerState等)的过滤器。我需要获取这些虚拟机的创建时间,根据我所看到的,this info is available in the event logs of the vCenter.
有没有办法获取虚拟机属性的这一部分信息?我使用vSphere-Client搜索了此信息,但我没有-所以我猜唯一的位置是从事件日志-但只是为了确认,这是唯一的方法吗?
谢谢
发布于 2017-05-12 01:55:49
使用vijava api很难获得虚拟机的创建时间。但是,您可以从VirtualMachineConfigInfo获取以下其他信息。
Folder rootFolder = serviceInstance.getRootFolder(); InventoryNavigator inventoryNavigator = new InventoryNavigator(rootFolder); vm = (VirtualMachine) inventoryNavigator.searchManagedEntity(VirtualMachine.class.getSimpleName(), vmName); VirtualMachineConfigInfo vmConfig = vm.getConfig(); System.out.println(vmConfig.getChangeVersion);
https://stackoverflow.com/questions/36590707
复制相似问题