Hi, Thanks to your advice, I was able to make it work using nokogiri. I am now trying to attach new devices (shared folders) via my custom function: ===== def attach_device(uuid , device) puts "CAlled with uuid #{uuid}" client.lookup_domain_by_uuid(uuid).update_device(device.to_s, 0) end ===== "device.to_s" returns a correct xml for <filesystem>. I then have the following error: >CAlled with uuid 8cc185ef-4bf1-4b78-9caa-cd14c70cd1b3 >/home/teto/fog/lib/fog/libvirt/requests/compute/attach_device.rb:38:in `update_device': Call to virDomainUpdateDeviceFlags failed: >Operation not supported: persistent update of device 'filesystem' is not supported (Libvirt::Error) Does that mean I need to undefine my domain and then recreate it if I want to keep the update persistent ? Regards Matt 2014/1/9 Chris Lalancette <clalancette@xxxxxxxxx>: > On Thu, Jan 9, 2014 at 11:04 AM, Teto <mattator@xxxxxxxxx> wrote: >> Hi, >> >> I would like to list devices (for instance I would like to retrieve >> the <filesystem> part in <devices><filesystem >> type="mount">...</filesystem></devices>) embedded in a domain via the >> ruby bindings ? > > The steps are roughly: > 1. require 'libvirt' > 2. Connect to libvirt using the open method > 3. Find the domain you care about using lookup_domain_by_name > 4. Get the XML for the domain > 5. Parse the domain XML using nokogiri or similar > > It would look something like this (the details will be somewhat > different depending on which connection URI and domain you are using): > > require 'libvirt' > > conn = Libvirt::open('qemu:///system') > > dom = conn.lookup_domain_by_name('f19') > > xml_doc = Nokogiri::XML(dom.xml_desc) > > devs = xml_doc.xpath('/domain/devices') > > After that last line, you'll have the ability to iterate over the > devices, and do whatever you want with them. Hope this helps! > > Chris -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list