mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
feature #3028: show pci devices in onehost show
This commit is contained in:
parent
6d8ea1a337
commit
371a96c5ed
@ -413,11 +413,22 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
|
||||
|
||||
wilds = host.wilds
|
||||
|
||||
begin
|
||||
pcis = [host.to_hash['HOST']['HOST_SHARE']['PCI_DEVICES']['PCI']]
|
||||
pcis = pcis.flatten.compact
|
||||
rescue
|
||||
pcis = nil
|
||||
end
|
||||
|
||||
host.delete_element("TEMPLATE/VM")
|
||||
host.delete_element("TEMPLATE_WILDS")
|
||||
|
||||
puts host.template_str
|
||||
|
||||
if pcis && !pcis.empty?
|
||||
print_pcis(pcis)
|
||||
end
|
||||
|
||||
puts
|
||||
CLIHelper.print_header("WILD VIRTUAL MACHINES", false)
|
||||
puts
|
||||
@ -457,4 +468,43 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
|
||||
onevm_helper.client=@client
|
||||
onevm_helper.list_pool({:filter=>["HOST=#{host.name}"]}, false)
|
||||
end
|
||||
|
||||
def print_pcis(pcis)
|
||||
puts
|
||||
CLIHelper.print_header("PCI DEVICES", false)
|
||||
puts
|
||||
|
||||
table=CLIHelper::ShowTable.new(nil, self) do
|
||||
column :VM, "Used by VM", :size => 4, :left => false do |d|
|
||||
if d["VMID"] == "-1"
|
||||
""
|
||||
else
|
||||
d["VMID"]
|
||||
end
|
||||
end
|
||||
|
||||
column :ADDR, "PCI Address", :size => 7, :left => true do |d|
|
||||
d["SHORT_ADDRESS"]
|
||||
end
|
||||
|
||||
column :TYPE, "Type", :size => 14, :left => true do |d|
|
||||
d["TYPE"]
|
||||
end
|
||||
|
||||
column :CLASS, "Class", :size => 12, :left => true do |d|
|
||||
d["CLASS_NAME"]
|
||||
end
|
||||
|
||||
column :NAME, "Name", :size => 30, :left => true do |d|
|
||||
d["DEVICE_NAME"]
|
||||
end
|
||||
|
||||
column :VENDOR, "Vendor", :size => 8, :left => true do |d|
|
||||
d["VENDOR_NAME"]
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
table.show(pcis)
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user