Arjun Roy
2009-Jul-13 17:57 UTC
[Ovirt-devel] [PATCH: server] Added qmf matahari example to ovirt-server.
Just a quick script modeled after the libvirt-qpid example that dumps all connected ovirt-node hardware info to standard out, for debug purposes. --- src/qmf-matahari.example.rb | 50 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 50 insertions(+), 0 deletions(-) create mode 100644 src/qmf-matahari.example.rb diff --git a/src/qmf-matahari.example.rb b/src/qmf-matahari.example.rb new file mode 100644 index 0000000..0934ac9 --- /dev/null +++ b/src/qmf-matahari.example.rb @@ -0,0 +1,50 @@ +#!/usr/bin/ruby + +$: << File.join(File.dirname(__FILE__), "./dutils") + +require "rubygems" +require "qpid" +require "dutils" + +get_credentials('qpidd') + +server, port = get_srv('qpidd', 'tcp') +raise "Unable to determine qpid server from DNS SRV record" if not server + +srv = "amqp://#{server}:#{port}" +puts "Connecting to #{srv}.." +s = Qpid::Qmf::Session.new() +b = s.add_broker(srv, :mechanism => 'GSSAPI') + +while true: + hosts = s.objects(:class => "host") + hosts.each do |host| + puts "host: #{host.hostname}" + for (key, val) in host.properties + puts " property: #{key}, #{val}" + end + + # List cpus for current host + cpus = s.objects(:class => "cpu", 'host' => host.object_id) + cpus.each do |cpu| + puts " cpu:" + for (key, val) in cpu.properties + puts " property: #{key}, #{val}" + end + end # cpus.each + + # List nics for current host + nics = s.objects(:class => "nic", 'host' => host.object_id) + nics.each do |nic| + puts " nic: " + for (key, val) in nic.properties + puts " property: #{key}, #{val}" + end + end + + end # hosts.each + + puts '----------------------------' + sleep(5) + +end -- 1.6.2.5
Ian Main
2009-Jul-13 19:48 UTC
[Ovirt-devel] [PATCH: server] Added qmf matahari example to ovirt-server.
On Mon, 13 Jul 2009 13:57:03 -0400 Arjun Roy <arroy at redhat.com> wrote:> Just a quick script modeled after the libvirt-qpid example that dumps all > connected ovirt-node hardware info to standard out, for debug purposes.I think I'd change the name to matahari-list (I'd like to change the libvirt-qmf-example name too), and maybe not make it loop.. I can just make these changes and push if you like. Ian
Seemingly Similar Threads
- [PATCH] Rename qmf-libvirt-example to libvirt-list.rb
- [PATCH server] Update daemons to use new QMF.
- [PATCH server] Starting of new ovirt QMF API.
- [PATCH] Let ovirt-test use DNS SRV to get qpidd server.
- [PATCH matahari] Moving QMF functionality into a transport layer.