[Ovirt-devel] [PATCH: server] Added qmf matahari example to ovirt-server.

Arjun Roy arroy at redhat.com
Mon Jul 13 17:57:03 UTC 2009


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




More information about the ovirt-devel mailing list