G`Day all,
We have several thousand VMs within our vsphere infra and I have been writing some automation using fog.
I have:
* ruby 1.9.3-p125 ( also tried 1.9.2-p290 and 1.8.7-p352)
* vsphere API version 4.1
* fog 1.10.0
Ohad pointed me down the 'models' path instead of the 'requests' path and I have managed to get my head around most of it so far.
It's quite nice and easy when just passing objects around however I have been unable to get connection.servers.all to recognise any filters.
With the size of our vsphere infra searching over everything is out of the question.
I have a hack for this but don't quite understand the consequences of my hack.
I am fairly new to ruby but my playing around here shows that merging is not happening as expected.
Why does it merge ? Is there a need to set :folder, :datacenter etc elsewhere
eg:
If I pass filter = { :datacenter => 'syd07, :folder => 'foo/bar }
to connection.servers.all and :folder and :datacenter are not set already inside the object then the empty values 'win' the merge.
pp filters
...
...
...
:datacenter=>nil,
:folder=>nil,
:cluster=>nil,
:network=>nil,
:resource_pool=>nil}
If I drop the filters.merge and just pass filters "load service.list_virtual_machines(filters)" then I am able to set a datacenter and folder to limit my search to and it responds in a few seconds.
If this is a bug then I shall file a ticket.
Cheers
Mick Pollard
@aussielunix