-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
converting libvirt::network to a type, step 1 #25
base: master
Are you sure you want to change the base?
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. |
require 'rexml/document' | ||
require 'tempfile' | ||
|
||
include REXML |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 ;)