[Ovirt-devel] [PATCH client 06/11] Command to list nodes in a hardware pool

David Lutterkort lutter at redhat.com
Mon Jan 26 21:20:36 UTC 2009


---
 lib/ovirt/command/node.rb |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)
 create mode 100644 lib/ovirt/command/node.rb

diff --git a/lib/ovirt/command/node.rb b/lib/ovirt/command/node.rb
new file mode 100644
index 0000000..0728616
--- /dev/null
+++ b/lib/ovirt/command/node.rb
@@ -0,0 +1,32 @@
+module OVirt::Command::Node
+
+  module List
+    def execute(args)
+      pool = nil
+      begin
+        pool = OVirt::HardwarePool.find_by_path(args["pool"])
+      rescue ActiveResource::ResourceNotFound
+        pool = nil
+      end
+      unless pool
+        puts_error "pool #{args["pool"]} not found"
+        return
+      end
+      puts "Pool #{args["pool"]}: #{pool.hosts.size} host(s)"
+      puts "=" * 75
+      pool.hosts.each do |h|
+        printf "%-36s %s\n", h.hostname, h.state
+        if args["verbose"]
+          printf "    uuid      : %s\n", h.uuid
+          printf "    enabled   : %s\n", h.is_disabled == 0 ? "yes" : "no"
+          printf "    arch      : %s\n", h.arch
+          printf "    hypervisor: %s\n", h.hypervisor_type
+          printf "    memory    : %s\n", h.human_readable_memory
+          printf "    cpus      : %d\n", h.cpus.size
+          puts "-" * 75
+        end
+      end
+    end
+  end
+
+end
-- 
1.6.0.6




More information about the ovirt-devel mailing list