Ruby 如何获得vsphere虚拟机&x27;s的创建时间
如何使用ruby SDK获得vSphere VM的创建时间?我可以获得VM实例,但似乎没有显示VM创建时间的属性Ruby 如何获得vsphere虚拟机&x27;s的创建时间,ruby,sdk,vsphere,Ruby,Sdk,Vsphere,如何使用ruby SDK获得vSphere VM的创建时间?我可以获得VM实例,但似乎没有显示VM创建时间的属性 api_client = VSphereAutomation::ApiClient.new(configuration) VSphereAutomation::CIS::SessionApi.new(api_client).create('') vm_api = VSphereAutomation::VCenter::VMApi.new(api_client) vms = vm_ap
api_client = VSphereAutomation::ApiClient.new(configuration)
VSphereAutomation::CIS::SessionApi.new(api_client).create('')
vm_api = VSphereAutomation::VCenter::VMApi.new(api_client)
vms = vm_api.list({filter_power_states: ["POWERED_ON"]})
...
# this will get a specific VM information but nothing about creation time.
vm_api.get('vm-34122')
输出通过托管对象中的新属性来自vSphere Web Services API,该属性嵌套在中,可由
createDate
引用。完整属性路径:vm.config.createdate
值得注意的是,此信息在vSphere的REST(例如vSphere Automation)API中不可用,因此您需要使用rbvmomi来访问它。此外,如果您碰巧提取了非敏感日期,这可能是因为在vSphere 6.7中的API中引入此属性之前创建了VM。返回一个错误消息。看起来它有一个属性映射和散列来查看所有属性,但我找不到任何提供创建/更新时间的内容。该详细信息可能无法保存。@akerr在UI中,它确实显示了此类信息,因此它必须从某处获取这些信息,这就是我最初的问题。您知道该属性在rbvmomi下的哪个api下列出吗?我在虚拟机部分看不到这一点。也许你在讨论这个问题?我发现
vm
是VirtualMachine对象。