Skip to content
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

Updated schema, template to support netmask in libvirt network provisioning #950

Merged
merged 3 commits into from
Feb 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions config/Dockerfiles/tests.d/libvirt/03_libvirt-network
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash -xe

# Verify basic provisioning for all supplied providers
# distros.exclude: fedora28 centos7 fedora28
# providers.include: libvirt
# providers.exclude: none

## NOTE: This is a temporary test to run libvirt tests until we fix
## the networking race condition. Tests will only run on centos7.

set -o pipefail

DISTRO=${1}
PROVIDER=${2}

TEST_NAME="${DISTRO}/${PROVIDER}/03_libvirt-network"
DESCRIPTION="Test ${PROVIDER} provider with network provisioning"

echo "Test Name: ${TEST_NAME}"
echo "${DESCRIPTION}"

TARGET="libvirt-network"

pushd docs/source/examples/workspaces/${PROVIDER}

function clean_up {
set +e
linchpin -w . -v destroy ${TARGET}
# remove output file used to gen uhash if it exists
rm storage.txt || true
}
trap clean_up EXIT SIGHUP SIGINT SIGTERM

linchpin -w . -v up ${TARGET}

2 changes: 2 additions & 0 deletions docs/source/examples/workspaces/libvirt/PinFile
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ libvirt-network:
uri: qemu:///system
ip: 192.168.74.100
dhcp_start: 192.168.74.101
forward_mode: nat
dhcp_end: 192.168.74.112
domain: linchpin.net
netmask: 255.255.255.0

libvirt-storage:
topology:
Expand Down
4 changes: 3 additions & 1 deletion linchpin/provision/roles/libvirt/files/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@
"dhcp_end": { "type": "string", "required": false },
"bridge": { "type": "string", "required": false },
"domain": { "type": "string", "required": false },
"forward_mode": { "type": "string", "required": false }
"forward_mode": { "type": "string", "required": false },
"netmask": { "type": "string", "required": false },
"forward_dev": { "type": "string", "required": false }
}
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
<network ipv6='yes'>
<name>{{ res_def['res_name'] | default(res_def['name']) }}</name>
<name>{{ res_def['res_name'] | default(res_def['name']) }}</name>
{% if res_def['bridge'] is defined %}
<bridge name="{{ res_def['bridge'] }}" stp='on' delay='0'/>
{% endif %}/>
<forward mode="{{ res_def['forward_mode'] | default('nat') }}"
{% if res_def['forward_dev'] is defined %}
dev="{{ res_def['forward_dev'] }}"{% endif %}/>
{% endif %}
<forward mode="{{ res_def['forward_mode'] | default('nat') }}"{% if res_def['forward_dev'] is defined %} dev="{{ res_def['forward_dev'] }}"{% endif %}/>
{% if res_def['domain'] is defined %}
<domain name="{{ res_def['domain'] }}" localOnly="yes"/>
{% endif %}
<ip address="{{ res_def['ip'] }}">
<ip address="{{ res_def['ip'] }}" {% if res_def['netmask'] is defined %} netmask="{{ res_def['netmask'] }}" {% endif %}>
{% if res_def['dhcp_start'] is defined %}
<dhcp>
<range start="{{ res_def['dhcp_start'] }}" end="{{ res_def['dhcp_end'] }}"/>
Expand Down