[pve-devel] [PATCH v2 container 2/2] close #3471: Support for NetworkManager on CentOS.

Denis Knauf deac+git at denkn.at
Wed Jun 16 20:23:17 CEST 2021


NetworkManager is used on RHEL8 and similar distributions like CentOS8,
AlmaLinux8 and RockyLinux8.
On RHEL7/CentOS7 it was not mandatory, but possible to use
NetworkManager.
The past config was used on CentOS6/7 withour NetworkManager, so tests
were also testing this basic network-config.

The patches is compatible to any RHEL7/RHEL8-compatible distribution with/without
NetworkManager.

Because the NetworkManager requires a UUID, the tests were extended by
special behaviour in case of UUIDs in `ifcfg-eth*`.

Successfully tested against:
* CentOS7 without NetworkManager
* CentOS7 with NetworkManager
* CentOS8
* RockyLinux 8

Signed-off-by: Denis Knauf <deac+git at denkn.at>
---
 src/PVE/LXC/Setup/CentOS.pm                   | 14 ++++++++--
 src/test/run_setup_tests.pl                   | 15 ++++++----
 .../sysconfig/network-scripts/ifcfg-eth0.exp  |  4 +++
 .../sysconfig/network-scripts/ifcfg-eth1.exp  |  4 +++
 .../sysconfig/network-scripts/ifcfg-eth0.exp  |  4 +++
 .../sysconfig/network-scripts/ifcfg-eth1.exp  |  4 +++
 src/test/test-centos7-003/config              |  4 +++
 src/test/test-centos7-003/etc/hosts.exp       |  5 ++++
 .../etc/init/power-status-changed.conf.exp    |  5 ++++
 .../etc/init/start-ttys.conf.exp              | 18 ++++++++++++
 .../test-centos7-003/etc/init/tty.conf.exp    | 13 +++++++++
 src/test/test-centos7-003/etc/rc.d/rc.sysinit |  6 ++++
 .../test-centos7-003/etc/rc.d/rc.sysinit.exp  |  6 ++++
 src/test/test-centos7-003/etc/redhat-release  |  1 +
 src/test/test-centos7-003/etc/resolv.conf.exp |  5 ++++
 src/test/test-centos7-003/etc/securetty       | 23 +++++++++++++++
 src/test/test-centos7-003/etc/securetty.exp   | 28 +++++++++++++++++++
 .../test-centos7-003/etc/sysconfig/network    |  0
 .../sysconfig/network-scripts/ifcfg-eth0.exp  | 12 ++++++++
 .../sysconfig/network-scripts/ifcfg-eth1.exp  | 12 ++++++++
 .../etc/sysconfig/network.exp                 |  3 ++
 .../root/.ssh/authorized_keys.exp             |  3 ++
 src/test/test-centos7-004/config              |  4 +++
 src/test/test-centos7-004/etc/hosts.exp       |  5 ++++
 .../etc/init/power-status-changed.conf.exp    |  5 ++++
 .../etc/init/start-ttys.conf.exp              | 18 ++++++++++++
 .../test-centos7-004/etc/init/tty.conf.exp    | 13 +++++++++
 src/test/test-centos7-004/etc/rc.d/rc.sysinit |  6 ++++
 .../test-centos7-004/etc/rc.d/rc.sysinit.exp  |  6 ++++
 src/test/test-centos7-004/etc/redhat-release  |  1 +
 src/test/test-centos7-004/etc/resolv.conf.exp |  5 ++++
 src/test/test-centos7-004/etc/securetty       | 23 +++++++++++++++
 src/test/test-centos7-004/etc/securetty.exp   | 28 +++++++++++++++++++
 .../test-centos7-004/etc/sysconfig/network    |  0
 .../sysconfig/network-scripts/ifcfg-eth0.exp  | 12 ++++++++
 .../sysconfig/network-scripts/ifcfg-eth1.exp  | 12 ++++++++
 .../etc/sysconfig/network.exp                 |  3 ++
 .../root/.ssh/authorized_keys.exp             |  3 ++
 38 files changed, 326 insertions(+), 7 deletions(-)
 create mode 100644 src/test/test-centos7-003/config
 create mode 100644 src/test/test-centos7-003/etc/hosts.exp
 create mode 100644 src/test/test-centos7-003/etc/init/power-status-changed.conf.exp
 create mode 100644 src/test/test-centos7-003/etc/init/start-ttys.conf.exp
 create mode 100644 src/test/test-centos7-003/etc/init/tty.conf.exp
 create mode 100644 src/test/test-centos7-003/etc/rc.d/rc.sysinit
 create mode 100644 src/test/test-centos7-003/etc/rc.d/rc.sysinit.exp
 create mode 100644 src/test/test-centos7-003/etc/redhat-release
 create mode 100644 src/test/test-centos7-003/etc/resolv.conf.exp
 create mode 100644 src/test/test-centos7-003/etc/securetty
 create mode 100644 src/test/test-centos7-003/etc/securetty.exp
 create mode 100644 src/test/test-centos7-003/etc/sysconfig/network
 create mode 100644 src/test/test-centos7-003/etc/sysconfig/network-scripts/ifcfg-eth0.exp
 create mode 100644 src/test/test-centos7-003/etc/sysconfig/network-scripts/ifcfg-eth1.exp
 create mode 100644 src/test/test-centos7-003/etc/sysconfig/network.exp
 create mode 100644 src/test/test-centos7-003/root/.ssh/authorized_keys.exp
 create mode 100644 src/test/test-centos7-004/config
 create mode 100644 src/test/test-centos7-004/etc/hosts.exp
 create mode 100644 src/test/test-centos7-004/etc/init/power-status-changed.conf.exp
 create mode 100644 src/test/test-centos7-004/etc/init/start-ttys.conf.exp
 create mode 100644 src/test/test-centos7-004/etc/init/tty.conf.exp
 create mode 100644 src/test/test-centos7-004/etc/rc.d/rc.sysinit
 create mode 100644 src/test/test-centos7-004/etc/rc.d/rc.sysinit.exp
 create mode 100644 src/test/test-centos7-004/etc/redhat-release
 create mode 100644 src/test/test-centos7-004/etc/resolv.conf.exp
 create mode 100644 src/test/test-centos7-004/etc/securetty
 create mode 100644 src/test/test-centos7-004/etc/securetty.exp
 create mode 100644 src/test/test-centos7-004/etc/sysconfig/network
 create mode 100644 src/test/test-centos7-004/etc/sysconfig/network-scripts/ifcfg-eth0.exp
 create mode 100644 src/test/test-centos7-004/etc/sysconfig/network-scripts/ifcfg-eth1.exp
 create mode 100644 src/test/test-centos7-004/etc/sysconfig/network.exp
 create mode 100644 src/test/test-centos7-004/root/.ssh/authorized_keys.exp

diff --git a/src/PVE/LXC/Setup/CentOS.pm b/src/PVE/LXC/Setup/CentOS.pm
index 77eb6f7..ba11f81 100644
--- a/src/PVE/LXC/Setup/CentOS.pm
+++ b/src/PVE/LXC/Setup/CentOS.pm
@@ -10,6 +10,7 @@ use PVE::LXC;
 use PVE::LXC::Setup::Base;
 
 use base qw(PVE::LXC::Setup::Base);
+use UUID;
 
 sub new {
     my ($class, $conf, $rootdir) = @_;
@@ -185,7 +186,7 @@ sub setup_network {
 	my $routes = '';
 	my $routes6 = '';
 
-	my $header = "DEVICE=$d->{name}\nONBOOT=yes\n";
+	my $header = "DEVICE=$d->{name}\nONBOOT=yes\nUUID=".UUID::uuid()."\n";
 	my $data = '';
 	my $bootproto = '';
 
@@ -213,7 +214,7 @@ sub setup_network {
 	    if ($d->{ip6} eq 'auto') {
 		$data .= "IPV6_AUTOCONF=yes\n";
 	    }
-	    if ($d->{ip6} eq 'dhcp') {
+	    elsif ($d->{ip6} eq 'dhcp') {
 		$data .= "DHCPV6C=yes\n";
 	    } else {
 		$data .= "IPV6ADDR=$d->{ip6}\n";
@@ -229,6 +230,15 @@ sub setup_network {
 	    }
 	}
 
+	my ($searchdomains, $nameserver) = $self->lookup_dns_conf($conf);
+	my @nameservers = PVE::Tools::split_list($nameserver);
+
+	for my $i (0 .. $#nameservers) {
+	    $data .= "DNS".($i+1)."=$nameservers[$i]\n";
+	}
+	$data .= "DOMAIN=".join(' ', PVE::Tools::split_list($searchdomains))."\n"
+	    if $searchdomains;
+
 	next unless $data || $bootproto;
 	$header .= "BOOTPROTO=$bootproto\n";
 	$self->ct_file_set_contents($filename, $header . $data);
diff --git a/src/test/run_setup_tests.pl b/src/test/run_setup_tests.pl
index 582a97b..1c60102 100755
--- a/src/test/run_setup_tests.pl
+++ b/src/test/run_setup_tests.pl
@@ -17,14 +17,19 @@ sub test_file {
     my ($exp_fn, $real_fn) = @_;
 
     # replace @DAYS@ with the current correct value
-    if ($exp_fn =~ m/shadow.exp$/) {
+    if ($exp_fn =~ m/shadow\.exp$/) {
 	my $expecteddays = int(time()/(60*60*24));
-	system ("sed -i.bak 's/\@DAYS\@/$expecteddays/' $exp_fn");
-	my $ret = system("diff -u '$exp_fn' '$real_fn'");
-	system("mv '$exp_fn.bak' '$exp_fn'");
+	system ('sed', '-i.bak', 's/\@DAYS\@/'.$expecteddays.'/', $exp_fn);
+	my $ret = system('diff', '-u', $exp_fn, $real_fn);
+	system('mv', "$exp_fn.bak", $exp_fn);
+	return if $ret == 0;
+    } elsif ($exp_fn =~ m</ifcfg-eth\d\.exp$>) {
+	system ('sed', '-i.bak', '-Ee', 's/\b[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\b/@UUID@/g', $real_fn);
+	my $ret = system('diff', '-u', $exp_fn, $real_fn);
+	system('mv', "$real_fn.bak", $real_fn);
 	return if $ret == 0;
     } else {
-	return if system("diff -u '$exp_fn' '$real_fn'") == 0;
+	return if system('diff', '-u', $exp_fn, $real_fn) == 0;
     }
 
     die "files do not match\n";
diff --git a/src/test/test-centos7-001/etc/sysconfig/network-scripts/ifcfg-eth0.exp b/src/test/test-centos7-001/etc/sysconfig/network-scripts/ifcfg-eth0.exp
index 2c5e570..5e0d93c 100644
--- a/src/test/test-centos7-001/etc/sysconfig/network-scripts/ifcfg-eth0.exp
+++ b/src/test/test-centos7-001/etc/sysconfig/network-scripts/ifcfg-eth0.exp
@@ -1,6 +1,10 @@
 DEVICE=eth0
 ONBOOT=yes
+UUID=@UUID@
 BOOTPROTO=none
 IPADDR=1.2.3.4
 NETMASK=255.255.255.0
 GATEWAY=1.2.3.1
+DNS1=8.8.8.8
+DNS2=8.8.8.9
+DOMAIN=proxmox.com
diff --git a/src/test/test-centos7-001/etc/sysconfig/network-scripts/ifcfg-eth1.exp b/src/test/test-centos7-001/etc/sysconfig/network-scripts/ifcfg-eth1.exp
index 7be5df0..b7b3fe7 100644
--- a/src/test/test-centos7-001/etc/sysconfig/network-scripts/ifcfg-eth1.exp
+++ b/src/test/test-centos7-001/etc/sysconfig/network-scripts/ifcfg-eth1.exp
@@ -1,5 +1,9 @@
 DEVICE=eth1
 ONBOOT=yes
+UUID=@UUID@
 BOOTPROTO=none
 IPADDR=10.2.3.4
 NETMASK=255.255.255.0
+DNS1=8.8.8.8
+DNS2=8.8.8.9
+DOMAIN=proxmox.com
diff --git a/src/test/test-centos7-002/etc/sysconfig/network-scripts/ifcfg-eth0.exp b/src/test/test-centos7-002/etc/sysconfig/network-scripts/ifcfg-eth0.exp
index 6f04e03..9e8ff90 100644
--- a/src/test/test-centos7-002/etc/sysconfig/network-scripts/ifcfg-eth0.exp
+++ b/src/test/test-centos7-002/etc/sysconfig/network-scripts/ifcfg-eth0.exp
@@ -1,8 +1,12 @@
 DEVICE=eth0
 ONBOOT=yes
+UUID=@UUID@
 BOOTPROTO=none
 IPADDR=1.2.3.4
 NETMASK=255.255.255.0
 GATEWAY=4.3.2.1
 IPV6INIT=yes
 IPV6ADDR=2000::1/64
+DNS1=8.8.8.8
+DNS2=8.8.8.9
+DOMAIN=proxmox.com
diff --git a/src/test/test-centos7-002/etc/sysconfig/network-scripts/ifcfg-eth1.exp b/src/test/test-centos7-002/etc/sysconfig/network-scripts/ifcfg-eth1.exp
index a97b78b..4358122 100644
--- a/src/test/test-centos7-002/etc/sysconfig/network-scripts/ifcfg-eth1.exp
+++ b/src/test/test-centos7-002/etc/sysconfig/network-scripts/ifcfg-eth1.exp
@@ -1,6 +1,10 @@
 DEVICE=eth1
 ONBOOT=yes
+UUID=@UUID@
 BOOTPROTO=none
 IPV6INIT=yes
 IPV6ADDR=2222::1/64
 IPV6_DEFAULTGW=fe80::1
+DNS1=8.8.8.8
+DNS2=8.8.8.9
+DOMAIN=proxmox.com
diff --git a/src/test/test-centos7-003/config b/src/test/test-centos7-003/config
new file mode 100644
index 0000000..a13b503
--- /dev/null
+++ b/src/test/test-centos7-003/config
@@ -0,0 +1,4 @@
+hostname: test1
+net0: bridge=vmbr0,name=eth0,ip=1.2.3.4/24,gw=1.2.3.1,ip6=auto
+net1: bridge=vmbr0,name=eth1,ip=10.2.3.4/24,ip6=100::1234/64,gw6=100::ffff
+net2: bridge=vmbr0,name=eth2
diff --git a/src/test/test-centos7-003/etc/hosts.exp b/src/test/test-centos7-003/etc/hosts.exp
new file mode 100644
index 0000000..01ac197
--- /dev/null
+++ b/src/test/test-centos7-003/etc/hosts.exp
@@ -0,0 +1,5 @@
+# --- BEGIN PVE ---
+127.0.0.1 localhost.localnet localhost
+::1 localhost.localnet localhost
+1.2.3.4 test1.proxmox.com test1
+# --- END PVE ---
diff --git a/src/test/test-centos7-003/etc/init/power-status-changed.conf.exp b/src/test/test-centos7-003/etc/init/power-status-changed.conf.exp
new file mode 100644
index 0000000..0763ae5
--- /dev/null
+++ b/src/test/test-centos7-003/etc/init/power-status-changed.conf.exp
@@ -0,0 +1,5 @@
+#  power-status-changed - shutdown on SIGPWR
+#
+start on power-status-changed
+    
+exec /sbin/shutdown -h now "SIGPWR received"
diff --git a/src/test/test-centos7-003/etc/init/start-ttys.conf.exp b/src/test/test-centos7-003/etc/init/start-ttys.conf.exp
new file mode 100644
index 0000000..20e379b
--- /dev/null
+++ b/src/test/test-centos7-003/etc/init/start-ttys.conf.exp
@@ -0,0 +1,18 @@
+#
+# This service starts the configured number of gettys.
+#
+# Do not edit this file directly. If you want to change the behaviour,
+# please create a file start-ttys.override and put your changes there.
+
+start on stopped rc RUNLEVEL=[2345]
+
+env ACTIVE_CONSOLES=/dev/tty[1-6]
+env X_TTY=/dev/tty1
+task
+script
+        . /etc/sysconfig/init
+        for tty in $(echo $ACTIVE_CONSOLES) ; do
+                [ "$RUNLEVEL" = "5" -a "$tty" = "$X_TTY" ] && continue
+                initctl start tty TTY=$tty
+        done
+end script
diff --git a/src/test/test-centos7-003/etc/init/tty.conf.exp b/src/test/test-centos7-003/etc/init/tty.conf.exp
new file mode 100644
index 0000000..efad240
--- /dev/null
+++ b/src/test/test-centos7-003/etc/init/tty.conf.exp
@@ -0,0 +1,13 @@
+# tty - getty
+#
+# This service maintains a getty on the specified device.
+#
+# Do not edit this file directly. If you want to change the behaviour,
+# please create a file tty.override and put your changes there.
+
+stop on runlevel [S016]
+
+respawn
+instance $TTY
+exec /sbin/mingetty --nohangup $TTY
+usage 'tty TTY=/dev/ttyX  - where X is console id'
diff --git a/src/test/test-centos7-003/etc/rc.d/rc.sysinit b/src/test/test-centos7-003/etc/rc.d/rc.sysinit
new file mode 100644
index 0000000..a98b7dd
--- /dev/null
+++ b/src/test/test-centos7-003/etc/rc.d/rc.sysinit
@@ -0,0 +1,6 @@
+# just a test
+# dummy
+
+/sbin/start_udev xxxxxxxxxxyyyyyyzzzz
+
+
diff --git a/src/test/test-centos7-003/etc/rc.d/rc.sysinit.exp b/src/test/test-centos7-003/etc/rc.d/rc.sysinit.exp
new file mode 100644
index 0000000..097907e
--- /dev/null
+++ b/src/test/test-centos7-003/etc/rc.d/rc.sysinit.exp
@@ -0,0 +1,6 @@
+# just a test
+# dummy
+
+#/sbin/start_udev xxxxxxxxxxyyyyyyzzzz
+
+
diff --git a/src/test/test-centos7-003/etc/redhat-release b/src/test/test-centos7-003/etc/redhat-release
new file mode 100644
index 0000000..cdb73e8
--- /dev/null
+++ b/src/test/test-centos7-003/etc/redhat-release
@@ -0,0 +1 @@
+CentOS release 6.3 (Final)
diff --git a/src/test/test-centos7-003/etc/resolv.conf.exp b/src/test/test-centos7-003/etc/resolv.conf.exp
new file mode 100644
index 0000000..35181cc
--- /dev/null
+++ b/src/test/test-centos7-003/etc/resolv.conf.exp
@@ -0,0 +1,5 @@
+# --- BEGIN PVE ---
+search proxmox.com
+nameserver 8.8.8.8
+nameserver 8.8.8.9
+# --- END PVE ---
diff --git a/src/test/test-centos7-003/etc/securetty b/src/test/test-centos7-003/etc/securetty
new file mode 100644
index 0000000..fae1648
--- /dev/null
+++ b/src/test/test-centos7-003/etc/securetty
@@ -0,0 +1,23 @@
+console
+vc/1
+vc/2
+vc/3
+vc/4
+vc/5
+vc/6
+vc/7
+vc/8
+vc/9
+vc/10
+vc/11
+tty1
+tty2
+tty3
+tty4
+tty5
+tty6
+tty7
+tty8
+tty9
+tty10
+tty11
\ No newline at end of file
diff --git a/src/test/test-centos7-003/etc/securetty.exp b/src/test/test-centos7-003/etc/securetty.exp
new file mode 100644
index 0000000..573c668
--- /dev/null
+++ b/src/test/test-centos7-003/etc/securetty.exp
@@ -0,0 +1,28 @@
+console
+vc/1
+vc/2
+vc/3
+vc/4
+vc/5
+vc/6
+vc/7
+vc/8
+vc/9
+vc/10
+vc/11
+tty1
+tty2
+tty3
+tty4
+tty5
+tty6
+tty7
+tty8
+tty9
+tty10
+tty11
+lxc/console
+lxc/tty1
+lxc/tty2
+lxc/tty3
+lxc/tty4
diff --git a/src/test/test-centos7-003/etc/sysconfig/network b/src/test/test-centos7-003/etc/sysconfig/network
new file mode 100644
index 0000000..e69de29
diff --git a/src/test/test-centos7-003/etc/sysconfig/network-scripts/ifcfg-eth0.exp b/src/test/test-centos7-003/etc/sysconfig/network-scripts/ifcfg-eth0.exp
new file mode 100644
index 0000000..6e0bebc
--- /dev/null
+++ b/src/test/test-centos7-003/etc/sysconfig/network-scripts/ifcfg-eth0.exp
@@ -0,0 +1,12 @@
+DEVICE=eth0
+ONBOOT=yes
+UUID=@UUID@
+BOOTPROTO=none
+IPADDR=1.2.3.4
+NETMASK=255.255.255.0
+GATEWAY=1.2.3.1
+IPV6INIT=yes
+IPV6_AUTOCONF=yes
+DNS1=8.8.8.8
+DNS2=8.8.8.9
+DOMAIN=proxmox.com
diff --git a/src/test/test-centos7-003/etc/sysconfig/network-scripts/ifcfg-eth1.exp b/src/test/test-centos7-003/etc/sysconfig/network-scripts/ifcfg-eth1.exp
new file mode 100644
index 0000000..64e2ad2
--- /dev/null
+++ b/src/test/test-centos7-003/etc/sysconfig/network-scripts/ifcfg-eth1.exp
@@ -0,0 +1,12 @@
+DEVICE=eth1
+ONBOOT=yes
+UUID=@UUID@
+BOOTPROTO=none
+IPADDR=10.2.3.4
+NETMASK=255.255.255.0
+IPV6INIT=yes
+IPV6ADDR=100::1234/64
+IPV6_DEFAULTGW=100::ffff
+DNS1=8.8.8.8
+DNS2=8.8.8.9
+DOMAIN=proxmox.com
diff --git a/src/test/test-centos7-003/etc/sysconfig/network.exp b/src/test/test-centos7-003/etc/sysconfig/network.exp
new file mode 100644
index 0000000..9a37270
--- /dev/null
+++ b/src/test/test-centos7-003/etc/sysconfig/network.exp
@@ -0,0 +1,3 @@
+NETWORKING=yes
+NETWORKING_IPV6=yes
+HOSTNAME=test1
diff --git a/src/test/test-centos7-003/root/.ssh/authorized_keys.exp b/src/test/test-centos7-003/root/.ssh/authorized_keys.exp
new file mode 100644
index 0000000..1cb3ec3
--- /dev/null
+++ b/src/test/test-centos7-003/root/.ssh/authorized_keys.exp
@@ -0,0 +1,3 @@
+# --- BEGIN PVE ---
+ssh-rsa ABCDEFG ABC at DEF
+# --- END PVE ---
diff --git a/src/test/test-centos7-004/config b/src/test/test-centos7-004/config
new file mode 100644
index 0000000..a627dc4
--- /dev/null
+++ b/src/test/test-centos7-004/config
@@ -0,0 +1,4 @@
+hostname: test1
+net0: bridge=vmbr0,name=eth0,ip6=auto
+net1: bridge=vmbr0,name=eth1,ip6=100::1234/64,gw6=100::ffff
+net2: bridge=vmbr0,name=eth2
diff --git a/src/test/test-centos7-004/etc/hosts.exp b/src/test/test-centos7-004/etc/hosts.exp
new file mode 100644
index 0000000..01ac197
--- /dev/null
+++ b/src/test/test-centos7-004/etc/hosts.exp
@@ -0,0 +1,5 @@
+# --- BEGIN PVE ---
+127.0.0.1 localhost.localnet localhost
+::1 localhost.localnet localhost
+1.2.3.4 test1.proxmox.com test1
+# --- END PVE ---
diff --git a/src/test/test-centos7-004/etc/init/power-status-changed.conf.exp b/src/test/test-centos7-004/etc/init/power-status-changed.conf.exp
new file mode 100644
index 0000000..0763ae5
--- /dev/null
+++ b/src/test/test-centos7-004/etc/init/power-status-changed.conf.exp
@@ -0,0 +1,5 @@
+#  power-status-changed - shutdown on SIGPWR
+#
+start on power-status-changed
+    
+exec /sbin/shutdown -h now "SIGPWR received"
diff --git a/src/test/test-centos7-004/etc/init/start-ttys.conf.exp b/src/test/test-centos7-004/etc/init/start-ttys.conf.exp
new file mode 100644
index 0000000..20e379b
--- /dev/null
+++ b/src/test/test-centos7-004/etc/init/start-ttys.conf.exp
@@ -0,0 +1,18 @@
+#
+# This service starts the configured number of gettys.
+#
+# Do not edit this file directly. If you want to change the behaviour,
+# please create a file start-ttys.override and put your changes there.
+
+start on stopped rc RUNLEVEL=[2345]
+
+env ACTIVE_CONSOLES=/dev/tty[1-6]
+env X_TTY=/dev/tty1
+task
+script
+        . /etc/sysconfig/init
+        for tty in $(echo $ACTIVE_CONSOLES) ; do
+                [ "$RUNLEVEL" = "5" -a "$tty" = "$X_TTY" ] && continue
+                initctl start tty TTY=$tty
+        done
+end script
diff --git a/src/test/test-centos7-004/etc/init/tty.conf.exp b/src/test/test-centos7-004/etc/init/tty.conf.exp
new file mode 100644
index 0000000..efad240
--- /dev/null
+++ b/src/test/test-centos7-004/etc/init/tty.conf.exp
@@ -0,0 +1,13 @@
+# tty - getty
+#
+# This service maintains a getty on the specified device.
+#
+# Do not edit this file directly. If you want to change the behaviour,
+# please create a file tty.override and put your changes there.
+
+stop on runlevel [S016]
+
+respawn
+instance $TTY
+exec /sbin/mingetty --nohangup $TTY
+usage 'tty TTY=/dev/ttyX  - where X is console id'
diff --git a/src/test/test-centos7-004/etc/rc.d/rc.sysinit b/src/test/test-centos7-004/etc/rc.d/rc.sysinit
new file mode 100644
index 0000000..a98b7dd
--- /dev/null
+++ b/src/test/test-centos7-004/etc/rc.d/rc.sysinit
@@ -0,0 +1,6 @@
+# just a test
+# dummy
+
+/sbin/start_udev xxxxxxxxxxyyyyyyzzzz
+
+
diff --git a/src/test/test-centos7-004/etc/rc.d/rc.sysinit.exp b/src/test/test-centos7-004/etc/rc.d/rc.sysinit.exp
new file mode 100644
index 0000000..097907e
--- /dev/null
+++ b/src/test/test-centos7-004/etc/rc.d/rc.sysinit.exp
@@ -0,0 +1,6 @@
+# just a test
+# dummy
+
+#/sbin/start_udev xxxxxxxxxxyyyyyyzzzz
+
+
diff --git a/src/test/test-centos7-004/etc/redhat-release b/src/test/test-centos7-004/etc/redhat-release
new file mode 100644
index 0000000..cdb73e8
--- /dev/null
+++ b/src/test/test-centos7-004/etc/redhat-release
@@ -0,0 +1 @@
+CentOS release 6.3 (Final)
diff --git a/src/test/test-centos7-004/etc/resolv.conf.exp b/src/test/test-centos7-004/etc/resolv.conf.exp
new file mode 100644
index 0000000..35181cc
--- /dev/null
+++ b/src/test/test-centos7-004/etc/resolv.conf.exp
@@ -0,0 +1,5 @@
+# --- BEGIN PVE ---
+search proxmox.com
+nameserver 8.8.8.8
+nameserver 8.8.8.9
+# --- END PVE ---
diff --git a/src/test/test-centos7-004/etc/securetty b/src/test/test-centos7-004/etc/securetty
new file mode 100644
index 0000000..fae1648
--- /dev/null
+++ b/src/test/test-centos7-004/etc/securetty
@@ -0,0 +1,23 @@
+console
+vc/1
+vc/2
+vc/3
+vc/4
+vc/5
+vc/6
+vc/7
+vc/8
+vc/9
+vc/10
+vc/11
+tty1
+tty2
+tty3
+tty4
+tty5
+tty6
+tty7
+tty8
+tty9
+tty10
+tty11
\ No newline at end of file
diff --git a/src/test/test-centos7-004/etc/securetty.exp b/src/test/test-centos7-004/etc/securetty.exp
new file mode 100644
index 0000000..573c668
--- /dev/null
+++ b/src/test/test-centos7-004/etc/securetty.exp
@@ -0,0 +1,28 @@
+console
+vc/1
+vc/2
+vc/3
+vc/4
+vc/5
+vc/6
+vc/7
+vc/8
+vc/9
+vc/10
+vc/11
+tty1
+tty2
+tty3
+tty4
+tty5
+tty6
+tty7
+tty8
+tty9
+tty10
+tty11
+lxc/console
+lxc/tty1
+lxc/tty2
+lxc/tty3
+lxc/tty4
diff --git a/src/test/test-centos7-004/etc/sysconfig/network b/src/test/test-centos7-004/etc/sysconfig/network
new file mode 100644
index 0000000..e69de29
diff --git a/src/test/test-centos7-004/etc/sysconfig/network-scripts/ifcfg-eth0.exp b/src/test/test-centos7-004/etc/sysconfig/network-scripts/ifcfg-eth0.exp
new file mode 100644
index 0000000..6e0bebc
--- /dev/null
+++ b/src/test/test-centos7-004/etc/sysconfig/network-scripts/ifcfg-eth0.exp
@@ -0,0 +1,12 @@
+DEVICE=eth0
+ONBOOT=yes
+UUID=@UUID@
+BOOTPROTO=none
+IPADDR=1.2.3.4
+NETMASK=255.255.255.0
+GATEWAY=1.2.3.1
+IPV6INIT=yes
+IPV6_AUTOCONF=yes
+DNS1=8.8.8.8
+DNS2=8.8.8.9
+DOMAIN=proxmox.com
diff --git a/src/test/test-centos7-004/etc/sysconfig/network-scripts/ifcfg-eth1.exp b/src/test/test-centos7-004/etc/sysconfig/network-scripts/ifcfg-eth1.exp
new file mode 100644
index 0000000..64e2ad2
--- /dev/null
+++ b/src/test/test-centos7-004/etc/sysconfig/network-scripts/ifcfg-eth1.exp
@@ -0,0 +1,12 @@
+DEVICE=eth1
+ONBOOT=yes
+UUID=@UUID@
+BOOTPROTO=none
+IPADDR=10.2.3.4
+NETMASK=255.255.255.0
+IPV6INIT=yes
+IPV6ADDR=100::1234/64
+IPV6_DEFAULTGW=100::ffff
+DNS1=8.8.8.8
+DNS2=8.8.8.9
+DOMAIN=proxmox.com
diff --git a/src/test/test-centos7-004/etc/sysconfig/network.exp b/src/test/test-centos7-004/etc/sysconfig/network.exp
new file mode 100644
index 0000000..9a37270
--- /dev/null
+++ b/src/test/test-centos7-004/etc/sysconfig/network.exp
@@ -0,0 +1,3 @@
+NETWORKING=yes
+NETWORKING_IPV6=yes
+HOSTNAME=test1
diff --git a/src/test/test-centos7-004/root/.ssh/authorized_keys.exp b/src/test/test-centos7-004/root/.ssh/authorized_keys.exp
new file mode 100644
index 0000000..1cb3ec3
--- /dev/null
+++ b/src/test/test-centos7-004/root/.ssh/authorized_keys.exp
@@ -0,0 +1,3 @@
+# --- BEGIN PVE ---
+ssh-rsa ABCDEFG ABC at DEF
+# --- END PVE ---
-- 
2.25.1





More information about the pve-devel mailing list