createDate under vm config property shows empty in rbvmomi
sugamasuhasini opened this issue · 12 comments
I want to know the VM creation date. I am using vsphere 6.7. when i query createDate under vm config i'm getting blank. I can query other properties like modified, changeVersion etc.
@sugamasuhasini I am able to recreate this. I haven't found the issue yet though. I can get the createDate
to return properly anytime I use another tool or write the code by hand to make the call. Whenever I use rbvmomi though, it shows nil
. I'm thinking it's related to deserialization of that parameter. I'll keep looking.
@jrgarcia Thanks for the update! Is there an equivalent property that gives me when the VM was created?
@sugamasuhasini Not that I'm aware of. You can use modified
and it should show the creation date if it has not been modified since creation. That is nowhere near equivalent though. I'm still looking into this and will keep you updated. Sorry for the delay!
I've found a workaround, but it's unacceptable in my opinion. I'm still looking to see what's happening. To get this working, you can do
vim = method_that_will_connect # however you normally connect with RbVmomi
vm = method_that_will_get_your_vm_object # however you want to get your VirtualMachine object
create_date = vim.propertyCollector.RetrievePropertiesEx(
specSet: [{
propSet: [{
type: vm.class.wsdl_name,
pathSet: ['config.createDate']
}],
objectSet: [obj: vm]
}],
options: {}
).objects.first.propSet.first.val
I cannot figure out why createDate
is not returning on this even though it's clearly available if you specifically ask for that property. I'm still actively looking into it though.
Exactly!! every other property works except for this one :(
Yeah, I have no idea why. I'm getting pretty frustrated trying to figure out the root cause. It's definitely going to get fixed though!
I'm very angry that I somehow missed this, but it should be fixed for you now. Sorry that this took so long. I'm kind of embarrassed that I somehow didn't catch this sooner. 🤦♂
@jrgarcia Tried querying that property on multiple VCs. Still no luck :( is there any tweak need to be done from my end to get that to work?
@sugamasuhasini Sorry! I was out on vacation. Are they all 6.7+ vCenters? You mentioned using 6.7 in your original report, but I want to make sure that's the case.
What happens if you call RbVmomi::VIM.connect(opts)
where opts
contains a key :rev
set to 6.7
? I tried this and it was immediately available on every instance I tested.
@jrgarcia yes they are 6.7 vcenters. I still get blank value :(
@sugamasuhasini Did you try passing in :rev => '6.7'
as one of the options to RbVmomi::VIM.connect
? If that doesn't work, can you verify the version of RbVmomi you are using and what the .rev
property is set to.
@jrgarcia Thanks a lot :) This is working fine for me after including the :rev => '6.7' in the opts.
Appreciate your help in this!!