Merge "Add option to ignore config drive interfaces info"
This commit is contained in:
commit
be5682d796
17
glean/cmd.py
17
glean/cmd.py
|
@ -1286,16 +1286,33 @@ def write_network_info_from_config_drive(args):
|
|||
If there is no meta_data.json in config-drive, it means that there
|
||||
is no config drive mounted- which means we know nothing.
|
||||
|
||||
Can set 'glean_ignore_interfaces' in nova metadata to ignore the
|
||||
interface configuration specified by the config drive. This will
|
||||
cause it to fallback to using dhcp configuration.
|
||||
|
||||
Returns False on any issue, which will cause the writing of
|
||||
DHCP network files.
|
||||
"""
|
||||
|
||||
config_drive = os.path.join(args.root, 'mnt/config')
|
||||
meta_data_path = '%s/openstack/latest/meta_data.json' % config_drive
|
||||
meta_data = {}
|
||||
if os.path.exists(meta_data_path):
|
||||
meta_data = json.load(open(meta_data_path))
|
||||
|
||||
network_info = get_network_info(args)
|
||||
|
||||
dns = {}
|
||||
if not args.skip_dns:
|
||||
dns = write_dns_info(get_dns_from_config_drive(network_info))
|
||||
interfaces = get_config_drive_interfaces(network_info)
|
||||
if 'meta' in meta_data and 'glean_ignore_interfaces' in meta_data['meta']:
|
||||
# Force DHCP to be used ignoring the interface information.
|
||||
# Some clouds have neutron configured in such a way that we get
|
||||
# interface config drive data that is at odds with the networking
|
||||
# in the cloud. Note we set interfaces to {} so that fallback dhcp
|
||||
# configuration can happen in write_static_network_info().
|
||||
interfaces = {}
|
||||
sys_interfaces = get_sys_interfaces(args.interface, args)
|
||||
|
||||
write_static_network_info(interfaces, sys_interfaces, dns, args)
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"admin_pass": "PBzEwRC8ZgVW",
|
||||
"availability_zone": "nova",
|
||||
"devices": [],
|
||||
"hostname": "centos-7-ovh-bhs1-0002156591.novalocal",
|
||||
"keys": [
|
||||
{
|
||||
"data": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDLsTZJ8hXTmzjKxYh/7V07mIy8xl2HL+9BaUlt6A6TMsL3LSvaVQNSgmXX5g0XfPWSCKmkZb1O28q49jQI2n7n7+sHkxn0dJDxj1N2oNrzNY7pDuPrdtCijczLFdievygXNhXNkQ2WIqHXDquN/jfLLJ9L0jxtxtsUMbiL2xxZEZcaf/K5MqyPhscpqiVNE1MjE4xgPbIbv8gCKtPpYIIrktOMb4JbV7rhOp5DcSP5gXtLhOF5fbBpZ+szqrTVUcBX0oTYr3iRfOje9WPsTZIk9vBfBtF416mCNxMSRc7KhSW727AnUu85hS0xiP0MRAf69KemG1OE1pW+LtDIAEYp mordred@camelot\n",
|
||||
"name": "test-monty-key",
|
||||
"type": "ssh"
|
||||
}
|
||||
],
|
||||
"launch_index": 0,
|
||||
"meta": {
|
||||
"groups": "ovh-bhs1,centos-7,centos-7",
|
||||
"nodepool_image_name": "centos-7",
|
||||
"nodepool_node_id": "0002156591",
|
||||
"nodepool_node_label": "centos-7",
|
||||
"nodepool_provider_name": "ovh-bhs1",
|
||||
"glean_ignore_interfaces": "true"
|
||||
},
|
||||
"name": "centos-7-ovh-bhs1-0002156591",
|
||||
"project_id": "some_project",
|
||||
"public_keys": {
|
||||
"mordred": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDLsTZJ8hXTmzjKxYh/7V07mIy8xl2HL+9BaUlt6A6TMsL3LSvaVQNSgmXX5g0XfPWSCKmkZb1O28q49jQI2n7n7+sHkxn0dJDxj1N2oNrzNY7pDuPrdtCijczLFdievygXNhXNkQ2WIqHXDquN/jfLLJ9L0jxtxtsUMbiL2xxZEZcaf/K5MqyPhscpqiVNE1MjE4xgPbIbv8gCKtPpYIIrktOMb4JbV7rhOp5DcSP5gXtLhOF5fbBpZ+szqrTVUcBX0oTYr3iRfOje9WPsTZIk9vBfBtF416mCNxMSRc7KhSW727AnUu85hS0xiP0MRAf69KemG1OE1pW+LtDIAEYp mordred@camelot\n"
|
||||
},
|
||||
"random_seed": "YPPvhdhxMKysu5EiBaaZpyDv2DIhMkRJp6XscFvCaI1Bvu1CD1mBg0jwURdVN5T0tbhYH74c8WcatRjyocZXMxUQgUeYd1METz3Fh2+aiJa2HRSCLdDcXzE8kD9VadqEAD/rOiUhjMToDepA6VAKzFTYcbnBNKRgshAFHmBfx0TCOtmM7A7CVsKhAfcMcf2ySYQ0PnS2emRrU21/vv/bj//nb2XxHKPrm7tLLDzqHCd+bg5WQsJ5NkDeuILpyHMGnWUyeNs6jg4z47Cq6grG4orM2G58SW3UbzXPs8waqZrYsfpZMMOj8CUqiAO44vptqOpYb3LlcsSRJHoBfVRY+BlTMkKIDwS3vEoSEX97OwMFDx5x4NXziuoZ4UyVzzAbnLeJHPospKcQC7A0JweazmEJpzTjlYyvC/yNFX8Wrwnohg+I22UghsNI/VVtjwzphUACi1nbttSzlkFkajPJjBAE66UHRp2VRCejLAzjT5TuM276rljQFIW73g9TjD3zf9FFfCYLBgie3pkNFXplLCUbLCUUtvUGJOfaN3N9sBO+P3FFAyuF6P9Jo5QKK2uMVLlE9rS3xOF9q4qtHAvXPSX2ikWQEkklz1UVCNHd5p2nT6C71kCBsT6d2/yOLXTLNAWDf8qpw8poVWlhwSj52mGY/uXYB15+PartkUFOoJA=",
|
||||
"uuid": "7398a9a5-2a6a-477d-a0ff-1948ed2e211d"
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"links": [
|
||||
{
|
||||
"ethernet_mac_address": "fa:16:3e:c8:65:a0",
|
||||
"id": "tap3c54ff58-02",
|
||||
"mtu": 1500,
|
||||
"type": "ovs",
|
||||
"vif_id": "3c54ff58-02b5-499e-bed0-03530f89e624"
|
||||
}
|
||||
],
|
||||
"networks": [
|
||||
{
|
||||
"id": "network0",
|
||||
"ip_address": "158.69.65.118",
|
||||
"link": "tap3c54ff58-02",
|
||||
"netmask": "255.255.224.0",
|
||||
"network_id": "764d0ecb-f8a5-47d9-b034-53b5b61666a7",
|
||||
"routes": [
|
||||
{
|
||||
"gateway": "158.69.64.1",
|
||||
"netmask": "0.0.0.0",
|
||||
"network": "0.0.0.0"
|
||||
}
|
||||
],
|
||||
"type": "ipv4"
|
||||
}
|
||||
],
|
||||
"services": [
|
||||
{
|
||||
"address": "213.186.33.99",
|
||||
"type": "dns"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
0
|
|
@ -0,0 +1 @@
|
|||
fa:16:3e:c8:65:a0
|
|
@ -0,0 +1 @@
|
|||
1
|
|
@ -0,0 +1,8 @@
|
|||
### Write /etc/sysconfig/network-scripts/ifcfg-eth0
|
||||
# Automatically generated, do not edit
|
||||
DEVICE=eth0
|
||||
BOOTPROTO=dhcp
|
||||
HWADDR=fa:16:3e:c8:65:a0
|
||||
ONBOOT=yes
|
||||
NM_CONTROLLED=no
|
||||
TYPE=Ethernet
|
|
@ -0,0 +1,7 @@
|
|||
### Write /etc/network/interfaces
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
source /etc/network/interfaces.d/*.cfg
|
||||
### Write /etc/network/interfaces.d/eth0.cfg
|
||||
auto eth0
|
||||
iface eth0 inet dhcp
|
|
@ -0,0 +1,8 @@
|
|||
### Write /etc/sysconfig/network-scripts/ifcfg-eth0
|
||||
# Automatically generated, do not edit
|
||||
DEVICE=eth0
|
||||
BOOTPROTO=dhcp
|
||||
HWADDR=fa:16:3e:c8:65:a0
|
||||
ONBOOT=yes
|
||||
NM_CONTROLLED=no
|
||||
TYPE=Ethernet
|
|
@ -0,0 +1,4 @@
|
|||
### Write /etc/conf.d/net.eth0
|
||||
# Automatically generated, do not edit
|
||||
config_eth0="dhcp"
|
||||
mac_eth0="fa:16:3e:c8:65:a0"
|
|
@ -0,0 +1,3 @@
|
|||
### Write /root/.ssh/authorized_keys
|
||||
# Injected key mordred by keypair extension
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDLsTZJ8hXTmzjKxYh/7V07mIy8xl2HL+9BaUlt6A6TMsL3LSvaVQNSgmXX5g0XfPWSCKmkZb1O28q49jQI2n7n7+sHkxn0dJDxj1N2oNrzNY7pDuPrdtCijczLFdievygXNhXNkQ2WIqHXDquN/jfLLJ9L0jxtxtsUMbiL2xxZEZcaf/K5MqyPhscpqiVNE1MjE4xgPbIbv8gCKtPpYIIrktOMb4JbV7rhOp5DcSP5gXtLhOF5fbBpZ+szqrTVUcBX0oTYr3iRfOje9WPsTZIk9vBfBtF416mCNxMSRc7KhSW727AnUu85hS0xiP0MRAf69KemG1OE1pW+LtDIAEYp mordred@camelot
|
|
@ -0,0 +1,10 @@
|
|||
### Write /etc/systemd/network/eth0.network
|
||||
# Automatically generated, do not edit
|
||||
[Match]
|
||||
MACAddress=fa:16:3e:c8:65:a0
|
||||
Name=eth0
|
||||
|
||||
[Network]
|
||||
DHCP=ipv4
|
||||
IPv6AcceptRA=no
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
### Write /etc/sysconfig/network/ifcfg-eth0
|
||||
# Automatically generated, do not edit
|
||||
BOOTPROTO=dhcp
|
||||
LLADDR=fa:16:3e:c8:65:a0
|
||||
STARTMODE=auto
|
|
@ -0,0 +1,8 @@
|
|||
### Write /etc/sysconfig/network-scripts/ifcfg-eth0
|
||||
# Automatically generated, do not edit
|
||||
DEVICE=eth0
|
||||
BOOTPROTO=dhcp
|
||||
HWADDR=fa:16:3e:c8:65:a0
|
||||
ONBOOT=yes
|
||||
NM_CONTROLLED=no
|
||||
TYPE=Ethernet
|
|
@ -0,0 +1,7 @@
|
|||
### Write /etc/network/interfaces
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
source /etc/network/interfaces.d/*.cfg
|
||||
### Write /etc/network/interfaces.d/eth0.cfg
|
||||
auto eth0
|
||||
iface eth0 inet dhcp
|
|
@ -31,11 +31,12 @@ sample_data_path = os.path.join(
|
|||
|
||||
distros = ['Ubuntu', 'Debian', 'Fedora', 'RedHat', 'CentOS', 'Gentoo',
|
||||
'openSUSE', 'networkd']
|
||||
styles = ['hp', 'rax', 'rax-iad', 'liberty', 'nokey']
|
||||
styles = ['hp', 'rax', 'rax-iad', 'liberty', 'nokey', 'ovh']
|
||||
ips = {'hp': '127.0.1.1',
|
||||
'rax': '23.253.229.154',
|
||||
'rax-iad': '146.20.110.113',
|
||||
'liberty': '23.253.229.154',
|
||||
'ovh': '158.69.65.118',
|
||||
'nokey': '127.0.1.1'}
|
||||
|
||||
built_scenarios = []
|
||||
|
|
Loading…
Reference in New Issue