converting libvirt::network to a type, step 1#25
converting libvirt::network to a type, step 1#25igalic wants to merge 2 commits intothias:masterfrom igalic:network_type
Conversation
|
@msimonin, here we go. I think we should start this off discussing what the interface should look like. |
|
Hi , There are so much options in the xml description... libvirt_network { 'mynetwork'
:ensure => present,
:autostart => true,
:active => true,
:description => "<network ...>...</network>
}To be consistent with libvirt_pool type maybe we should think to add this feature aswell. My 2 cents |
|
What we have now in define libvirt::network (
$ensure = 'present',
$autostart = false,
$bridge = undef,
$forward_mode = undef,
$forward_dev = undef,
$forward_interfaces = [],
$ip = undef,
$ipv6 = undef,
$mac = undef,
) {My main problem with this is the overload of An alternative to this would be to prefix options non-unique to ipv4 or ipv6, and extend the declaration to: libvirt_network { 'mynetwork'
:ensure => present,
:autostart => true,
:active => true,
:bridge => undef,
:mode => undef,
:ipv4_address => undef,
:ipv4_netmask => undef,
:ipv4_dhcp_start => undef,
:ipv4_dhcp_end => undef,
:dhcp_bootp_file => undef,
:dhcp_bootp_server => undef,
:ipv6_address => undef,
:ipv6_netmask => undef,
:ipv6_prefix => undef,
:ipv6_dhcp_start => undef,
:ipv6_dhcp_end => undef,
} |
|
Yes we could split the options with the ipv* prefix. My concern is how concise we will be ? <network>
<name>ovs-net</name>
<forward mode='bridge'/>
<bridge name='ovsbr0'/>
<virtualport type='openvswitch'>
<parameters interfaceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f'/>
</virtualport>
<vlan trunk='yes'>
<tag id='42' nativeMode='untagged'/>
<tag id='47'/>
</vlan>
<portgroup name='dontpanic'>
<vlan>
<tag id='42'/>
</vlan>
</portgroup>
</network>my suggestion is to have something like : libvirt_network { 'mynetwork'
:ensure => present,
:autostart => true,
:active => true,
:source => "puppet:///modules/libvirt/networks/mynetwork.xml"
}M |
|
ugh.. since my OSes don't support OpenSwitcch yet, I haven't even dared looking into that, but I see where you're coming from. |
There was a problem hiding this comment.
This is probably not what you want for the reasons explained in #32 which suffers from the same code. Instead use REXML::Document.new to create a REXML document.
this skeleton is missing all the actual code for creating the XML, since that's tough business, especially when we're not 100% sure what the interfaces should look like ;)
|
i've done loads of work on puppet types & providers recently, so i might come back to this one again in the next week |
|
great :) |
|
I've started looking at converting the network to a type recently. This is probably a good set up for the portgroup section, I'm not sure about sections like ip. |
|
"next week" i absolutely agree, @jaggededgedjustice! |
this skeleton is missing all the actual code for creating the XML, since
that's tough business, especially when we're not 100% sure what the
interfaces should look like ;)