Revision 25691fff
Added by Dmitri Dolguikh over 9 years ago
modules/dhcp/providers/server/virsh.rb | ||
---|---|---|
end
|
||
|
||
network = IPAddr.new(gateway).mask(netmask).to_s
|
||
subnet = Proxy::DHCP::Subnet.new(self, network, netmask)
|
||
Proxy::DHCP::Subnet.new(self, network, netmask)
|
||
end
|
||
rescue Exception => e
|
||
msg = "DHCP virsh provider error: unable to retrive virsh info: #{e}"
|
||
... | ... | |
begin
|
||
doc = REXML::Document.new xml = dump_xml
|
||
REXML::XPath.each(doc, "//network/ip[not(@family) or @family='ipv4']/dhcp/host") do |e|
|
||
Proxy::DHCP::Reservation.new(:subnet => subnet,
|
||
:ip => e.attributes["ip"],
|
||
:mac => e.attributes["mac"],
|
||
:hostname => e.attributes["name"])
|
||
Proxy::DHCP::Reservation.new(:subnet => subnet, :ip => e.attributes["ip"],
|
||
:mac => e.attributes["mac"], :hostname => e.attributes["name"])
|
||
end
|
||
rescue Exception => e
|
||
msg = "DHCP virsh provider error: unable to retrive virsh info: #{e}"
|
||
... | ... | |
xml = "'<host mac=\"#{mac}\" ip=\"#{ip}\"/>'"
|
||
end
|
||
|
||
virsh "net-update", net, command, "ip-dhcp-host",
|
||
"--xml", xml, "--live", "--config"
|
||
virsh "net-update", net, command, "ip-dhcp-host", "--xml", xml, "--live", "--config"
|
||
rescue Proxy::Virsh::Error => e
|
||
raise Proxy::DHCP::Error, "Failed to update DHCP: #{e}"
|
||
end
|
Also available in: Unified diff
fixes #7660: fixes first bunch of rubocop warnings