如何使用java api查找vmware/vsphere模板
在vsphere java SDK中,有一个显示如何列出虚拟机的浏览器示例类如何使用java api查找vmware/vsphere模板,java,virtual-machine,vmware,vsphere,Java,Virtual Machine,Vmware,Vsphere,在vsphere java SDK中,有一个显示如何列出虚拟机的浏览器示例类 ManagedObjectReference containerView = vimPort.createContainerView(viewManager, folder, Arrays.asList("VirtualMachine"), true); 如何检查此类虚拟机是否为模板? 或者更好的方法是如何查询模板虚拟机,以便在soap响应中仅获取模板?检查VM是否为模板。您可以检查vm_obj.config.tem
ManagedObjectReference containerView =
vimPort.createContainerView(viewManager, folder,
Arrays.asList("VirtualMachine"), true);
如何检查此类虚拟机是否为模板?
或者更好的方法是如何查询模板虚拟机,以便在soap响应中仅获取模板?检查VM是否为模板。您可以检查
vm_obj.config.template
VirtualMachine
管理的对象具有类型为VirtualMachineConfigInfo
的属性config
。在VirtualMachineConfigInfo
中,您可以找到布尔template
属性。我是否必须从vcenter获取所有虚拟机,而不是在java check config.template中,或者,可以使用config.template=true筛选它们并仅获取托管对象引用?您必须迭代所有虚拟机并检查模板属性。因此,对于每个vminfoVirtualMachineConfigInfo vminfo=vm.getConfig()代码>检查vminfo.isTemplate()