vsphere.servers.all performance issue and possible bug with fix

24 views
Skip to first unread message

Mick Pollard

unread,
Mar 17, 2013, 5:03:27 AM3/17/13
to ruby...@googlegroups.com
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


Ohad Levy

unread,
Mar 17, 2013, 10:24:55 AM3/17/13
to ruby...@googlegroups.com
Looks like it, i think it should be the other way around ... e.g. {}.merge(filters).

Ohad

Cheers

Mick Pollard
@aussielunix


--
You received this message because you are subscribed to the Google Groups "ruby-fog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-fog+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

aussielunix

unread,
Mar 17, 2013, 5:42:26 PM3/17/13
to ruby...@googlegroups.com
Ohad,

Swapping that merge around worked perfectly.

Thanks !.
I have sent a PR for this.

aussielunix

unread,
Apr 1, 2013, 7:00:51 AM4/1/13
to ruby...@googlegroups.com


On Monday, 18 March 2013 08:42:26 UTC+11, aussielunix wrote:
Ohad,

Swapping that merge around worked perfectly.

Thanks !.
I have sent a PR for this.

For those watching along at home, this was merged in to master and will be in the next release.  https://github.com/fog/fog/pull/1673

Cheers
Mick Pollard
@aussielunix
Reply all
Reply to author
Forward
0 new messages