From 70d33d7a687fc06fbb22674a678703d11717b693 Mon Sep 17 00:00:00 2001 From: sathlan Date: Mon, 16 Mar 2015 15:42:59 -0400 Subject: [PATCH] IPv6 support for migration check. This enables the use of the '::0' IPv6 address for the vncserver_listen parameter. class { 'nova::compute::libvirt': vncserver_listen => '::0', migration_support => true, } Change-Id: Iec69a82c6a7bbf1b0f7364e87e1e3e37a876be9a Closes-Bug: rhbz#1185652 --- manifests/compute/libvirt.pp | 4 ++-- spec/classes/nova_compute_libvirt_spec.rb | 13 ++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/manifests/compute/libvirt.pp b/manifests/compute/libvirt.pp index 7473bdb13..04852ade1 100644 --- a/manifests/compute/libvirt.pp +++ b/manifests/compute/libvirt.pp @@ -132,8 +132,8 @@ class nova::compute::libvirt ( } if $migration_support { - if $vncserver_listen != '0.0.0.0' { - fail('For migration support to work, you MUST set vncserver_listen to \'0.0.0.0\'') + if $vncserver_listen != '0.0.0.0' and $vncserver_listen != '::0' { + fail('For migration support to work, you MUST set vncserver_listen to \'0.0.0.0\' or \'::0\'') } else { class { '::nova::migration::libvirt': } } diff --git a/spec/classes/nova_compute_libvirt_spec.rb b/spec/classes/nova_compute_libvirt_spec.rb index 1e37f80d3..d5d32d2e9 100644 --- a/spec/classes/nova_compute_libvirt_spec.rb +++ b/spec/classes/nova_compute_libvirt_spec.rb @@ -92,6 +92,17 @@ describe 'nova::compute::libvirt' do it { should contain_file_line('/etc/default/libvirt-bin libvirtd opts').with(:line => 'libvirtd_opts="-d -l"') } end + context 'with vncserver_listen set to ::0' do + let :params do + { :vncserver_listen => '::0', + :migration_support => true } + end + + it { should contain_class('nova::migration::libvirt')} + it { should contain_nova_config('DEFAULT/vncserver_listen').with_value('::0')} + it { should contain_file_line('/etc/default/libvirt-bin libvirtd opts').with(:line => 'libvirtd_opts="-d -l"') } + end + context 'with vncserver_listen not set to 0.0.0.0' do let :params do { :vncserver_listen => '127.0.0.1', @@ -99,7 +110,7 @@ describe 'nova::compute::libvirt' do end it { expect { should contain_class('nova::compute::libvirt') }.to \ - raise_error(Puppet::Error, /For migration support to work, you MUST set vncserver_listen to '0.0.0.0'/) } + raise_error(Puppet::Error, /For migration support to work, you MUST set vncserver_listen to '0.0.0.0' or '::0'/) } end context 'with custom libvirt service name on Debian platforms' do