-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IPv6: dhcp/provisioner: make ipv6 aware
If the admin network is IPv6 setup the ISC DHCPD server to configure and use the IPv6 daemon. For this use a seperate set of ipv6 files to list hosts and subnets as ipv6 hosts and subnets will fail if v4 dhcp tries to load them. Also make sure tftp is listening on both IPv4 and v6. To make this all happen the Network class in the Barclamp::Inventory library now tracks the ip_version of the network. Which is used to make decisions through the DHCP and provisioner cookbooks. To support backwards compatibilty with ipv4 config naming in the DHCP barclamp a DhcpHelper was added to return config names in an IPv4 or IPv6 way. The same pattern was used throughout the barclamp in the early versions of this patch so it's been refectered to the helper. Finally, when dealing with some IPv6 addresses in URIs the address needs to be wrapped. As such the network barclamp has grown a NetworkHelper module to start gathering network related helper method's, it's first is a wrap_ip function. Which will wrap an address if it happens to an IPv6 address. This makes this available to us anywhere in crowbar, so long as the network barclamp has been applied, and as a core barclamp to crowbar, should be always.
- Loading branch information
1 parent
30f1733
commit b5904df
Showing
20 changed files
with
215 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module DhcpHelper | ||
def self.config_filename(base, ip_version, extension = ".conf") | ||
if ip_version == "4" | ||
extra = "" | ||
else | ||
extra = ip_version | ||
end | ||
"#{base}#{extra}#{extension}" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# File managed by Crowbar | ||
<% if node[:provisioner][:enable_pxe] -%> | ||
|
||
subnet6 <%= @network["subnet"] %>/<%= @network["netmask"]%> { | ||
option subnet-mask <%= @network["netmask"] %>; | ||
<% @options.each do |option| -%> | ||
<%= option %>; | ||
<% end -%> | ||
<% @pools.each do |pool| -%> | ||
pool6 { | ||
range6 <%=@network["ranges"][pool]["start"]%> <%=@network["ranges"][pool]["end"]%>; | ||
<% @pool_options[pool].each do |opt| -%> | ||
<%=opt%><%=if opt[-1,1] != '}' then ';' else '' end%> | ||
<% end if @pool_options[pool] -%> | ||
} | ||
<% end -%> | ||
} | ||
|
||
<% end -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module NetworkHelper | ||
def self.wrap_ip(address) | ||
require "ipaddr" | ||
if IPAddr.new(address).ipv6? | ||
"[#{address}]" | ||
else | ||
address.to_s | ||
end | ||
rescue | ||
address.to_s | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.