Make ubuntu_interface configurable again
With some recent changes, the virt-customize command that modifies the ubuntu guest image was broken: the interface name was hardcoded to "ens3" and in some cases it should be set to "enp3s0". This patch makes the value it configurable. Change-Id: If31d9d998931253cbea9ae5310e2c36b6b7e2ce9
This commit is contained in:
parent
8466581e52
commit
7d2eef5654
@ -268,6 +268,17 @@ subparsers:
|
||||
Timeout error is raised if an ubuntu instance is not reachable
|
||||
before it expires
|
||||
ansible_variable: ubuntu_is_reachable_timeout
|
||||
ubuntu-vm-nic-name:
|
||||
type: Value
|
||||
help: |
|
||||
NIC name expected on Ubuntu VM instances.
|
||||
When Openstack spawns these VMs, their NIC (usually they
|
||||
only have one NIC and one VLAN on that NIC) name is usually
|
||||
"ens3", but with some Openstack versions, it is "enp3s0".
|
||||
Defaults to "enp3s0" because it is the value obtained with
|
||||
Openstack versions that use infrared.
|
||||
default: "enp3s0"
|
||||
ansible_variable: ubuntu_nic_name
|
||||
cleanup-containerlist-file:
|
||||
type: Bool
|
||||
help: |
|
||||
|
@ -72,5 +72,5 @@ download_images:
|
||||
--run-command 'systemctl enable iperf3-server@5201'
|
||||
--run-command 'echo "8021q" >> /etc/modules'
|
||||
--run-command
|
||||
'echo "network:\n version: 2\n vlans:\n vlan101:\n dhcp4: true\n dhcp4-overrides:\n use-routes: false\n dhcp6: true\n dhcp6-overrides:\n use-routes: false\n id: 101\n link: ens3\n"
|
||||
'echo "network:\n version: 2\n vlans:\n vlan101:\n dhcp4: true\n dhcp4-overrides:\n use-routes: false\n dhcp6: true\n dhcp6-overrides:\n use-routes: false\n id: 101\n link: {{ ubuntu_nic_name | default('ens3') }}\n"
|
||||
> /etc/netplan/75-tobiko-vlan.yaml'
|
||||
|
@ -31,6 +31,12 @@
|
||||
value: True
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if ubuntu_nic_name is defined %}
|
||||
- section: ubuntu
|
||||
option: interface_name
|
||||
value: "{{ ubuntu_nic_name }}"
|
||||
{% endif %}
|
||||
|
||||
vars:
|
||||
sections: "{{ test_default_conf | combine(test_conf, recursive=True) }}"
|
||||
|
||||
|
@ -59,7 +59,7 @@ def get_images_options():
|
||||
cfg.StrOpt('password',
|
||||
help="Default " + name + " password"),
|
||||
cfg.StrOpt('interface_name',
|
||||
default=None,
|
||||
default=None if name != 'ubuntu' else 'ens3',
|
||||
help="Default " + name + " interface name"),
|
||||
cfg.FloatOpt('connection_timeout',
|
||||
default=None,
|
||||
|
@ -114,26 +114,7 @@ class UbuntuImageFixture(glance.CustomizedGlanceImageFixture):
|
||||
run_commands.append('echo "8021q" >> /etc/modules')
|
||||
return run_commands
|
||||
|
||||
@property
|
||||
def ethernet_device(self) -> str:
|
||||
if self._ethernet_device is None:
|
||||
self._ethernet_device = self._get_ethernet_device()
|
||||
return self._ethernet_device
|
||||
|
||||
@staticmethod
|
||||
def _get_ethernet_device() -> str:
|
||||
"""From OSP17 and above, Ubuntu stack should use a different interface
|
||||
name. This method returns the interface name, depending on the OSP
|
||||
version.
|
||||
"""
|
||||
if_name = CONF.tobiko.ubuntu.interface_name
|
||||
if if_name is not None:
|
||||
return if_name
|
||||
from tobiko import tripleo
|
||||
if tripleo.has_overcloud(min_version='17.0'):
|
||||
return 'enp3s0'
|
||||
else:
|
||||
return 'ens3'
|
||||
ethernet_device = CONF.tobiko.ubuntu.interface_name
|
||||
|
||||
def _get_customized_suffix(self) -> str:
|
||||
return f'{super()._get_customized_suffix()}-{self.ethernet_device}'
|
||||
|
Loading…
Reference in New Issue
Block a user