mirror of
https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git
synced 2024-11-29 00:53:09 +00:00
Use nmcli for static network stuff, not ifcfg files
This should work even if the ifcfg plugin is not present (hi, CoreOS) or 'predictable' (har) network names are on. Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
parent
52d52c7062
commit
170ef0733a
@ -43,21 +43,16 @@ sub setup_tap_static {
|
|||||||
# use host's name servers (this is usually going to be correct,
|
# use host's name servers (this is usually going to be correct,
|
||||||
# tests which don't want this can overwrite resolv.conf)
|
# tests which don't want this can overwrite resolv.conf)
|
||||||
my @dns = get_host_dns();
|
my @dns = get_host_dns();
|
||||||
my $dnstext = '';
|
my $dnstext = 'ipv4.dns "' . join(", ", @dns) . '"';
|
||||||
for (my $i=0; $i < @dns; $i++) {
|
# bring up network
|
||||||
my $num = $i + 1;
|
# this gets us the name of the first connection in the list,
|
||||||
$dnstext .= "\nDNS" . ${num} . "=" . $dns[$i];
|
# which should be what we want
|
||||||
}
|
my $connection = script_output "nmcli --fields NAME con show | head -2 | tail -1";
|
||||||
# bring up network. DEFROUTE is *vital* here
|
assert_script_run "nmcli con mod '$connection' ipv4.method manual ipv4.addr $ip/24 ipv4.gateway 172.16.2.2 $dnstext";
|
||||||
my $conftext = "DEVICE=eth0\nBOOTPROTO=none\nIPADDR=$ip\nGATEWAY=172.16.2.2\nPREFIX=24\nDEFROUTE=yes\nONBOOT=yes" . $dnstext;
|
assert_script_run "nmcli con down '$connection'";
|
||||||
assert_script_run "printf '${conftext}\n' > /etc/sysconfig/network-scripts/ifcfg-eth0";
|
assert_script_run "nmcli con up '$connection'";
|
||||||
assert_script_run "systemctl restart NetworkManager.service";
|
# for debugging
|
||||||
# FIXME workaround for
|
assert_script_run "nmcli -t con show '$connection'";
|
||||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1739148
|
|
||||||
# remove when that's resolved
|
|
||||||
script_run 'nmcli con down "Wired connection 1"';
|
|
||||||
script_run 'nmcli con down "System eth0"';
|
|
||||||
script_run 'nmcli con up "System eth0"';
|
|
||||||
# the above doesn't seem to reliably set up resolv.conf, so...
|
# the above doesn't seem to reliably set up resolv.conf, so...
|
||||||
clone_host_file "/etc/resolv.conf";
|
clone_host_file "/etc/resolv.conf";
|
||||||
}
|
}
|
||||||
|
@ -1488,7 +1488,6 @@
|
|||||||
"settings": {
|
"settings": {
|
||||||
"BOOTFROM": "c",
|
"BOOTFROM": "c",
|
||||||
"DESKTOP": "gnome",
|
"DESKTOP": "gnome",
|
||||||
"GRUB_POSTINSTALL": "net.ifnames=0 biosdevname=0",
|
|
||||||
"HDD_1": "disk_f%CURRREL%_desktop_4_%ARCH%.img",
|
"HDD_1": "disk_f%CURRREL%_desktop_4_%ARCH%.img",
|
||||||
"INSTALL": "1",
|
"INSTALL": "1",
|
||||||
"NICTYPE": "tap",
|
"NICTYPE": "tap",
|
||||||
@ -1520,7 +1519,6 @@
|
|||||||
"settings": {
|
"settings": {
|
||||||
"BOOTFROM": "c",
|
"BOOTFROM": "c",
|
||||||
"DESKTOP": "gnome",
|
"DESKTOP": "gnome",
|
||||||
"GRUB_POSTINSTALL": "net.ifnames=0 biosdevname=0",
|
|
||||||
"HDD_1": "disk_f%CURRREL%_desktop_4_%ARCH%.img",
|
"HDD_1": "disk_f%CURRREL%_desktop_4_%ARCH%.img",
|
||||||
"INSTALL": "1",
|
"INSTALL": "1",
|
||||||
"NICTYPE": "tap",
|
"NICTYPE": "tap",
|
||||||
@ -1616,7 +1614,7 @@
|
|||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"BOOTFROM": "c",
|
"BOOTFROM": "c",
|
||||||
"GRUB_POSTINSTALL": "net.ifnames=0 biosdevname=0 zezere.url=http://172.16.2.118",
|
"GRUB_POSTINSTALL": "zezere.url=http://172.16.2.118",
|
||||||
"HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",
|
"HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",
|
||||||
"NICTYPE": "tap",
|
"NICTYPE": "tap",
|
||||||
"PARALLEL_WITH": "iot_zezere_server",
|
"PARALLEL_WITH": "iot_zezere_server",
|
||||||
@ -1635,7 +1633,6 @@
|
|||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"BOOTFROM": "c",
|
"BOOTFROM": "c",
|
||||||
"GRUB_POSTINSTALL": "net.ifnames=0 biosdevname=0",
|
|
||||||
"HDD_1": "disk_f%CURRREL%_support_5_%ARCH%.img",
|
"HDD_1": "disk_f%CURRREL%_support_5_%ARCH%.img",
|
||||||
"NICTYPE": "tap",
|
"NICTYPE": "tap",
|
||||||
"PARALLEL_CANCEL_WHOLE_CLUSTER": "0",
|
"PARALLEL_CANCEL_WHOLE_CLUSTER": "0",
|
||||||
@ -1712,7 +1709,6 @@
|
|||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"BOOTFROM": "c",
|
"BOOTFROM": "c",
|
||||||
"GRUB_POSTINSTALL": "net.ifnames=0 biosdevname=0",
|
|
||||||
"HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",
|
"HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",
|
||||||
"NICTYPE": "tap",
|
"NICTYPE": "tap",
|
||||||
"POSTINSTALL": "podman",
|
"POSTINSTALL": "podman",
|
||||||
@ -1730,7 +1726,6 @@
|
|||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"BOOTFROM": "c",
|
"BOOTFROM": "c",
|
||||||
"GRUB_POSTINSTALL": "net.ifnames=0 biosdevname=0",
|
|
||||||
"HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",
|
"HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",
|
||||||
"NICTYPE": "tap",
|
"NICTYPE": "tap",
|
||||||
"PARALLEL_WITH": "podman",
|
"PARALLEL_WITH": "podman",
|
||||||
@ -1752,7 +1747,6 @@
|
|||||||
"+HDD_1": "disk_%MACHINE%_cockpit.qcow2",
|
"+HDD_1": "disk_%MACHINE%_cockpit.qcow2",
|
||||||
"+START_AFTER_TEST": "server_cockpit_default",
|
"+START_AFTER_TEST": "server_cockpit_default",
|
||||||
"BOOTFROM": "c",
|
"BOOTFROM": "c",
|
||||||
"GRUB_POSTINSTALL": "net.ifnames=0 biosdevname=0",
|
|
||||||
"NICTYPE": "tap",
|
"NICTYPE": "tap",
|
||||||
"PARALLEL_WITH": "server_role_deploy_domain_controller",
|
"PARALLEL_WITH": "server_role_deploy_domain_controller",
|
||||||
"POSTINSTALL": "realmd_join_cockpit freeipa_webui freeipa_password_change freeipa_client",
|
"POSTINSTALL": "realmd_join_cockpit freeipa_webui freeipa_password_change freeipa_client",
|
||||||
@ -1770,7 +1764,6 @@
|
|||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"BOOTFROM": "c",
|
"BOOTFROM": "c",
|
||||||
"GRUB_POSTINSTALL": "net.ifnames=0 biosdevname=0",
|
|
||||||
"HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",
|
"HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",
|
||||||
"NICTYPE": "tap",
|
"NICTYPE": "tap",
|
||||||
"PARALLEL_WITH": "server_role_deploy_domain_controller",
|
"PARALLEL_WITH": "server_role_deploy_domain_controller",
|
||||||
@ -1854,7 +1847,6 @@
|
|||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"BOOTFROM": "c",
|
"BOOTFROM": "c",
|
||||||
"GRUB_POSTINSTALL": "net.ifnames=0 biosdevname=0",
|
|
||||||
"HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",
|
"HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",
|
||||||
"NICTYPE": "tap",
|
"NICTYPE": "tap",
|
||||||
"PARALLEL_WITH": "server_role_deploy_database_server",
|
"PARALLEL_WITH": "server_role_deploy_database_server",
|
||||||
@ -1904,8 +1896,6 @@
|
|||||||
"settings": {
|
"settings": {
|
||||||
"BOOTFROM": "c",
|
"BOOTFROM": "c",
|
||||||
"FREEIPA_REPLICA_CLIENT": "1",
|
"FREEIPA_REPLICA_CLIENT": "1",
|
||||||
"GRUB": "net.ifnames=0 biosdevname=0",
|
|
||||||
"GRUB_POSTINSTALL": "net.ifnames=0 biosdevname=0",
|
|
||||||
"HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",
|
"HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",
|
||||||
"NICTYPE": "tap",
|
"NICTYPE": "tap",
|
||||||
"PARALLEL_WITH": "server_freeipa_replication_replica",
|
"PARALLEL_WITH": "server_freeipa_replication_replica",
|
||||||
@ -1926,8 +1916,6 @@
|
|||||||
"settings": {
|
"settings": {
|
||||||
"BOOTFROM": "c",
|
"BOOTFROM": "c",
|
||||||
"FREEIPA_REPLICA_MASTER": "1",
|
"FREEIPA_REPLICA_MASTER": "1",
|
||||||
"GRUB": "net.ifnames=0 biosdevname=0",
|
|
||||||
"GRUB_POSTINSTALL": "net.ifnames=0 biosdevname=0",
|
|
||||||
"HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",
|
"HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",
|
||||||
"NICTYPE": "tap",
|
"NICTYPE": "tap",
|
||||||
"PARALLEL_CANCEL_WHOLE_CLUSTER": "0",
|
"PARALLEL_CANCEL_WHOLE_CLUSTER": "0",
|
||||||
@ -1948,8 +1936,6 @@
|
|||||||
"settings": {
|
"settings": {
|
||||||
"BOOTFROM": "c",
|
"BOOTFROM": "c",
|
||||||
"FREEIPA_REPLICA": "1",
|
"FREEIPA_REPLICA": "1",
|
||||||
"GRUB": "net.ifnames=0 biosdevname=0",
|
|
||||||
"GRUB_POSTINSTALL": "net.ifnames=0 biosdevname=0",
|
|
||||||
"HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",
|
"HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",
|
||||||
"NICTYPE": "tap",
|
"NICTYPE": "tap",
|
||||||
"PARALLEL_CANCEL_WHOLE_CLUSTER": "0",
|
"PARALLEL_CANCEL_WHOLE_CLUSTER": "0",
|
||||||
@ -1990,7 +1976,6 @@
|
|||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"BOOTFROM": "c",
|
"BOOTFROM": "c",
|
||||||
"GRUB_POSTINSTALL": "net.ifnames=0 biosdevname=0",
|
|
||||||
"HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",
|
"HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",
|
||||||
"NICTYPE": "tap",
|
"NICTYPE": "tap",
|
||||||
"PARALLEL_WITH": "server_remote_logging_server",
|
"PARALLEL_WITH": "server_remote_logging_server",
|
||||||
@ -2010,7 +1995,6 @@
|
|||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"BOOTFROM": "c",
|
"BOOTFROM": "c",
|
||||||
"GRUB_POSTINSTALL": "net.ifnames=0 biosdevname=0",
|
|
||||||
"HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",
|
"HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",
|
||||||
"NICTYPE": "tap",
|
"NICTYPE": "tap",
|
||||||
"PARALLEL_CANCEL_WHOLE_CLUSTER": "0",
|
"PARALLEL_CANCEL_WHOLE_CLUSTER": "0",
|
||||||
@ -2030,7 +2014,6 @@
|
|||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"BOOTFROM": "c",
|
"BOOTFROM": "c",
|
||||||
"GRUB_POSTINSTALL": "net.ifnames=0 biosdevname=0",
|
|
||||||
"HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",
|
"HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",
|
||||||
"NICTYPE": "tap",
|
"NICTYPE": "tap",
|
||||||
"PARALLEL_CANCEL_WHOLE_CLUSTER": "0",
|
"PARALLEL_CANCEL_WHOLE_CLUSTER": "0",
|
||||||
@ -2050,8 +2033,6 @@
|
|||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"BOOTFROM": "c",
|
"BOOTFROM": "c",
|
||||||
"GRUB": "net.ifnames=0 biosdevname=0",
|
|
||||||
"GRUB_POSTINSTALL": "net.ifnames=0 biosdevname=0",
|
|
||||||
"HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",
|
"HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2",
|
||||||
"NICTYPE": "tap",
|
"NICTYPE": "tap",
|
||||||
"PARALLEL_CANCEL_WHOLE_CLUSTER": "0",
|
"PARALLEL_CANCEL_WHOLE_CLUSTER": "0",
|
||||||
@ -2074,7 +2055,6 @@
|
|||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"BOOTFROM": "c",
|
"BOOTFROM": "c",
|
||||||
"GRUB_POSTINSTALL": "net.ifnames=0 biosdevname=0",
|
|
||||||
"HDD_1": "disk_f%CURRREL%_support_5_%ARCH%.img",
|
"HDD_1": "disk_f%CURRREL%_support_5_%ARCH%.img",
|
||||||
"NICTYPE": "tap",
|
"NICTYPE": "tap",
|
||||||
"NUMDISKS": "2",
|
"NUMDISKS": "2",
|
||||||
@ -2169,8 +2149,6 @@
|
|||||||
"settings": {
|
"settings": {
|
||||||
"+HDD_1": "disk_f%UP2REL%_server_3_%ARCH%.img",
|
"+HDD_1": "disk_f%UP2REL%_server_3_%ARCH%.img",
|
||||||
"BOOTFROM": "c",
|
"BOOTFROM": "c",
|
||||||
"GRUB": "net.ifnames=0 biosdevname=0",
|
|
||||||
"GRUB_POSTINSTALL": "net.ifnames=0 biosdevname=0",
|
|
||||||
"NICTYPE": "tap",
|
"NICTYPE": "tap",
|
||||||
"PARALLEL_WITH": "upgrade_2_server_domain_controller",
|
"PARALLEL_WITH": "upgrade_2_server_domain_controller",
|
||||||
"POSTINSTALL": "_setup_browser freeipa_webui freeipa_password_change freeipa_client",
|
"POSTINSTALL": "_setup_browser freeipa_webui freeipa_password_change freeipa_client",
|
||||||
@ -2207,8 +2185,6 @@
|
|||||||
"settings": {
|
"settings": {
|
||||||
"+HDD_1": "disk_f%UP2REL%_server_3_%ARCH%.img",
|
"+HDD_1": "disk_f%UP2REL%_server_3_%ARCH%.img",
|
||||||
"BOOTFROM": "c",
|
"BOOTFROM": "c",
|
||||||
"GRUB": "net.ifnames=0 biosdevname=0",
|
|
||||||
"GRUB_POSTINSTALL": "net.ifnames=0 biosdevname=0",
|
|
||||||
"NICTYPE": "tap",
|
"NICTYPE": "tap",
|
||||||
"PARALLEL_CANCEL_WHOLE_CLUSTER": "0",
|
"PARALLEL_CANCEL_WHOLE_CLUSTER": "0",
|
||||||
"POSTINSTALL": "role_deploy_domain_controller_check",
|
"POSTINSTALL": "role_deploy_domain_controller_check",
|
||||||
@ -2304,8 +2280,6 @@
|
|||||||
"settings": {
|
"settings": {
|
||||||
"+HDD_1": "disk_f%UP1REL%_server_3_%ARCH%.img",
|
"+HDD_1": "disk_f%UP1REL%_server_3_%ARCH%.img",
|
||||||
"BOOTFROM": "c",
|
"BOOTFROM": "c",
|
||||||
"GRUB": "net.ifnames=0 biosdevname=0",
|
|
||||||
"GRUB_POSTINSTALL": "net.ifnames=0 biosdevname=0",
|
|
||||||
"NICTYPE": "tap",
|
"NICTYPE": "tap",
|
||||||
"PARALLEL_WITH": "upgrade_server_domain_controller",
|
"PARALLEL_WITH": "upgrade_server_domain_controller",
|
||||||
"POSTINSTALL": "_setup_browser freeipa_webui freeipa_password_change freeipa_client",
|
"POSTINSTALL": "_setup_browser freeipa_webui freeipa_password_change freeipa_client",
|
||||||
@ -2343,8 +2317,6 @@
|
|||||||
"settings": {
|
"settings": {
|
||||||
"+HDD_1": "disk_f%UP1REL%_server_3_%ARCH%.img",
|
"+HDD_1": "disk_f%UP1REL%_server_3_%ARCH%.img",
|
||||||
"BOOTFROM": "c",
|
"BOOTFROM": "c",
|
||||||
"GRUB": "net.ifnames=0 biosdevname=0",
|
|
||||||
"GRUB_POSTINSTALL": "net.ifnames=0 biosdevname=0",
|
|
||||||
"NICTYPE": "tap",
|
"NICTYPE": "tap",
|
||||||
"PARALLEL_CANCEL_WHOLE_CLUSTER": "0",
|
"PARALLEL_CANCEL_WHOLE_CLUSTER": "0",
|
||||||
"POSTINSTALL": "role_deploy_domain_controller_check",
|
"POSTINSTALL": "role_deploy_domain_controller_check",
|
||||||
|
@ -23,8 +23,10 @@ sub run {
|
|||||||
}
|
}
|
||||||
bypass_1691487;
|
bypass_1691487;
|
||||||
assert_script_run "printf 'search domain.local\nnameserver ${server_ip}' > /etc/resolv.conf";
|
assert_script_run "printf 'search domain.local\nnameserver ${server_ip}' > /etc/resolv.conf";
|
||||||
assert_script_run "sed -i -e '/^DNS.*/d' /etc/sysconfig/network-scripts/ifcfg-eth0";
|
# this gets us the name of the first connection in the list,
|
||||||
assert_script_run "printf '\nDNS1=${server_ip}\n' >> /etc/sysconfig/network-scripts/ifcfg-eth0";
|
# which should be what we want
|
||||||
|
my $connection = script_output "nmcli --fields NAME con show | head -2 | tail -1";
|
||||||
|
assert_script_run "nmcli con mod '$connection' ipv4.dns '$server_ip'";
|
||||||
# wait for the server or replica to be ready (do it now just to be
|
# wait for the server or replica to be ready (do it now just to be
|
||||||
# sure name resolution is working before we proceed)
|
# sure name resolution is working before we proceed)
|
||||||
mutex_lock $server_mutex;
|
mutex_lock $server_mutex;
|
||||||
|
Loading…
Reference in New Issue
Block a user