Closed k05054 closed 3 years ago
Hey @k05054 ,
Can you try adding the parent.name
property when calling vm.discover
and see if that helps?
Hi @dnaeon !
I tried to add parent.name to vm.discover but it didn't work.
[root@mon-test vsphere]# vpoller-client --method vm.discover --vsphere-host vcenter.test --properties parent.name
{"msg": "Cannot collect properties: ", "success": 1}
When i tried to poll
[root@mon-test vsphere]# vpoller-client --method vm.discover --vsphere-host vcenter.test --properties parent
i got :
Helper module raised an exception: "vim.Folder:group-v51" is not JSON serializable
Cannot send result: unicode/str objects only
Hey @dnaeon ! I understand that you have no free time to build a new method. Manybe you can point me a direction where to look ? As far as i understand we encounter this problem when we poll different managed object while discovering VMs. Is there any way to avoid or solve this problem ?
Hey @k05054 ,
Did you mean to have the resource pool name be part of the result as well?
Just pushed one commit, which would include the resourcePool.name
property to the result.
Please test it out and let me know, if this works for you.
Thanks!
Hey @dnaeon ! I tested the upgraded method and it works great ! Many thanks to you ! But i have another question. I that even possible to get resource pool name in the result of vm.discover method ? So i think that might be very useful too. Many people use scripts to discover vms with their resource pool names.
@k05054 ,
For vm.discover
is a bit tricky, since by default VMs are assigned to the default resource pools such as Resources
. The Resources
pool is not something that you see when going to the vSphere frontend for example and might actually cause some confusion for people, since this is an internally used resource pool.
If you want to have this you could also check the vm.discover
method and collect the resourcePool.name
property while iterating through the result of VMs.
@dnaeon Thanks a lot for the advice and explanations about resource pools. I will try to experiment with vm.discover method. Thanks for your help !
Hi ! Is there any way to make
resource.pool.vm.get
orvm.discover
method return resource pool name alongside with discovered vm names ? It proves to be quite useful when you need to assign host group to discovered hosts automatically