Currently the vnc server on the compute nodes binds on 0.0.0.0.
which only works with IPv4 addresses, it breaks connectivity with
IPv6 addressing.
This fixes https://bugzilla.redhat.com/show_bug.cgi?id=
1300678.
Change-Id: Id642d224fb3c62f786453dc684634adca1c2c09d
Co-Authored-By: Giulio Fidente <gfidente@redhat.com>
 
           NovaComputeLibvirtType: {get_param: NovaComputeLibvirtType}
           NovaComputeLibvirtVifDriver: {get_param: NovaComputeLibvirtVifDriver}
           NovaEnableRbdBackend: {get_param: NovaEnableRbdBackend}
+          NovaIPv6: {get_param: NovaIPv6}
           NovaPublicIP: {get_attr: [VipMap, net_ip_map, external]}
           NovaPassword: {get_param: NovaPassword}
           NovaOVSBridge: {get_param: NovaOVSBridge}
 
     default: false
     description: Whether to enable or not the Rbd backend for Nova
     type: boolean
+  NovaIPv6:
+    default: false
+    description: Enable IPv6 features in Nova
+    type: boolean
   NovaPassword:
     description: The password for the nova service account, used by nova-api.
     type: string
               raw_data: {get_file: hieradata/compute.yaml}
               mapped_data:
                 cinder_enable_nfs_backend: {get_input: cinder_enable_nfs_backend}
+                nova::use_ipv6: {get_input: nova_ipv6}
                 nova::debug: {get_input: debug}
                 nova::rabbit_userid: {get_input: rabbit_username}
                 nova::rabbit_password: {get_input: rabbit_password}
         nova_api_host: {get_param: NovaApiHost}
         nova_password: {get_param: NovaPassword}
         nova_enable_rbd_backend: {get_param: NovaEnableRbdBackend}
+        nova_ipv6: {get_param: NovaIPv6}
         cinder_enable_rbd_backend: {get_param: CinderEnableRbdBackend}
         nova_vnc_proxyclient_address: {get_attr: [NetIpMap, net_ip_map, {get_param: [ServiceNetMap, NovaVncProxyNetwork]}]}
         nova_vncproxy_protocol: {get_param: [EndpointMap, NovaVNCProxyPublic, protocol]}
 
 nova::compute::instance_usage_audit_period: 'hour'
 nova::compute::vnc_enabled: true
 
-nova::compute::libvirt::vncserver_listen: '0.0.0.0'
 nova::compute::libvirt::migration_support: true
 
 nova::compute::rbd::libvirt_rbd_secret_uuid: "%{hiera('ceph::profile::params::fsid')}"
 
   package {'nfs-utils': } -> Service['nova-compute']
 }
 
-include ::nova::compute::libvirt
+if str2bool(hiera('nova::use_ipv6', false)) {
+  $vncserver_listen = '::0'
+} else {
+  $vncserver_listen = '0.0.0.0'
+}
+class { '::nova::compute::libvirt' :
+  vncserver_listen => $vncserver_listen,
+}
 if hiera('neutron::core_plugin') == 'midonet.neutron.plugin_v1.MidonetPluginV2' {
   file {'/etc/libvirt/qemu.conf':
     ensure  => present,