1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[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 node_hash[param] = client.send(param) rescue nil
end end
node_hash[:uri] = client.uri node_hash[:uri] = client.uri
xml = client.sys_info xml = client.sys_info rescue nil
[:uuid, :manufacturer, :product, :serial].each do |attr| [:uuid, :manufacturer, :product, :serial].each do |attr|
node_hash[attr] = node_attr(attr, xml) node_hash[attr] = node_attr(attr, xml)
end end if xml
node_hash[:hostname] = client.hostname node_hash[:hostname] = client.hostname
[node_hash] [node_hash]

View file

@ -5,7 +5,9 @@ module Fog
def list_interfaces(filter = { }) def list_interfaces(filter = { })
data=[] data=[]
if filter.keys.empty? 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)) data << interface_to_attributes(client.lookup_interface_by_name(ifname))
end end
else else