[libvirt] makes libvirt code more debian friendly

debian based libvirt does not know interfaces and some node information
This commit is contained in:
Ohad Levy 2012-04-09 16:41:23 +03:00 committed by Ohad Levy
parent 0383957172
commit ed6952fbf7
2 changed files with 5 additions and 3 deletions

View File

@ -12,10 +12,10 @@ module Fog
node_hash[param] = client.send(param) rescue nil
end
node_hash[:uri] = client.uri
xml = client.sys_info
xml = client.sys_info rescue nil
[:uuid, :manufacturer, :product, :serial].each do |attr|
node_hash[attr] = node_attr(attr, xml)
end
end if xml
node_hash[:hostname] = client.hostname
[node_hash]

View File

@ -5,7 +5,9 @@ module Fog
def list_interfaces(filter = { })
data=[]
if filter.keys.empty?
(client.list_interfaces + client.list_defined_interfaces).each do |ifname|
active_networks = client.list_interfaces rescue []
defined_networks = client.list_defined_interfaces rescue []
(active_networks + defined_networks).each do |ifname|
data << interface_to_attributes(client.lookup_interface_by_name(ifname))
end
else