[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt-users] ruby-libvirt equiv of virsh list --all



On 04/27/2010 03:36 AM, Mick Pollard wrote:
> Hi all,
> 
> I have a working KVM system managed with virsh and virt-install.  
> I am currently playing with ruby-libvirt-0.1.0.  
> I am wanting to build a simple sinatra/ruby app to show the VE's on a node and their state.  
> I have ruby 1.8.5 on CentOS 5.4.  
> 
> I have the basics of it worked out but am a little stuck.  
> Is there a way of retrieving a list of all VM's on a host using ruby-libvirt. ie: virsh list --all ?  
> 
>     @conn.list_defined_domains only shows VE's not started (lists VE names)
>     @conn.list_domains only shows VE's running (lists VE id's)
> 
> What I ultimately would like is to retrieve a full list of the uuid's of all defined VE's(running or not).  

The ruby-libvirt library is just a thin wrapper around the libvirt API's.
In point of fact, if you look at the libvirt API's (and virsh), you'll see
that all virsh does is to take the two lists it gets back from list_defined_domains
and list_domains, and concatenate them.  So in ruby, you would do something similar
to get the whole list, and then you'd have to iterate through each of them, dump
the XML, and get the UUID out of it.

-- 
Chris Lalancette


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]