Miscellaneous bald yaks
cover Miscellaneous bald yaks
There are two patches here to fix annoyances which can make osstest-installed Debian guests hard to get into.
And two patches to reorganise slightly the runvar handling:
introducing a function target_var' to replace guest_var'. Currently there is no real motivation for this except that it seems tidier.
(I thought I wanted this because I thought I wanted TestSupport::await_tcp to know whether what it was probing was a Debian install and if so what suite. I also have an unfinished patch to set the target var specifying the suite, in all the places where we do a Debian install. But I don't now think anything needs this so I don't intend to finish that patch.)
I have done only fairly limited testing of the latter two patches. If they seem like a thing we want to keep I will test them properly, at least to discover if they seem to break anything.
Thanks,
Ian.
PATCH 1/4 ts-debian-fixup: Set password
Previously this script would try to set an empty password. However, default installs have a configuration which hates empty passwords.
Instead, set the password `xenroot'. The value is the output of:
perl -e '$x = crypt "xenroot", "aa"; print "$x\n"'
--- ts-debian-fixup | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
ts-debian-fixup +2 -1
@@ -58,7 +58,8 @@ sub access () { target_cmd_root($ho, <<END); set -ex mount /dev/$gho->{Vg}/$gho->{Lv} $mountpoint - perl -i~ -pe "s/^root:[^:]+:/root::/" /etc/shadow + perl -i~ -pe "s/^root:[^:]+:/root:aabyZIU4rIOok:/" /etc/shadow + # crypt of `xenroot' mkdir -p $mountpoint/root/.ssh $mountpoint/etc/ssh cp -a /root/.ssh/* $mountpoint/root/.ssh/. cp -a /etc/ssh/ssh_host_*key* $mountpoint/etc/ssh/.
Signature · 1 line
1.7.10.4
PATCH 2/4 Do not multiply console hvc0 getty entries
In reply to Ian Jacksontarget_kernkind_console_inittab is supposed to edit inittab to make sure that there is a getty running on hvc0.
However:
- It is not idempotent; if run more than once it can produce duplicate entries 1:' and xc:'.
- It works by copying and editing the entry `1:' but it might be that there is already another console entry for hvc0 for some other reason.
If we end up with multiple entries for hvc0, we can have two copies of getty fighting, and if you manage to log in, one of them will be fighting with your shell.
Guard the script with a grep, which looks for inittab entries mentioning the intended console. This makes makes it do nothing if nothing is needed (and therefore it also makes it idempotent).
--- Osstest/TestSupport.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Osstest/TestSupport.pm +2 -1
@@ -2027,7 +2027,8 @@ sub target_kernkind_console_inittab ($$$) { if (defined $console && length $console) { target_cmd_root($ho, <<END); set -ex - perl -i~ -ne " + egrep '^[0-9a-zA-Z].*getty.* $console\$' $inittabpath \\ + || perl -i~ -ne " next if m/^xc:/; print \\\$_ or die \\\$!; next unless s/^1:/xc:/;
Signature · 1 line
1.7.10.4
PATCH 3/4 Runvar functions: Provide target_xenkernel_ver
In reply to Ian JacksonThis abstracts away a number of places that do
guest_var($gho,'FOO',$r{xen_FOO})
We are going to change these runvar names.
--- Osstest/TestSupport.pm | 8 ++++++++ ts-debian-install | 6 +++--- ts-logs-capture | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-)
Osstest/TestSupport.pm +8 -0
@@ -89,6 +89,7 @@ BEGIN { target_ping_check_down target_ping_check_up target_kernkind_check target_kernkind_console_inittab + target_xenkernel_ver target_var target_var_prefix selectguest prepareguest more_prepareguest_hvm guest_var guest_var_commalist guest_var_boolean
@@ -2018,6 +2019,13 @@ sub target_kernkind_check ($) { } } +sub target_xenkernel_var ($$) { + my ($tho,$vn) = @_; + return + guest_var($gho,$vn,undef) // + $r{"xen_${vn}"}; +} + sub target_kernkind_console_inittab ($$$) { my ($ho, $gho, $root) = @_;
ts-debian-install +3 -3
@@ -49,10 +49,10 @@ sub ginstall () { my $archarg= defined($arch) ? "--arch $arch" : ''; my $gsuite= guest_var($gho,'suite',$c{GuestDebianSuite}); - my $kernpath = guest_var($gho,'kernel_path',$r{xen_kernel_path}); - my $initrd = guest_var($gho,'initrd_path',$r{xen_initrd_path}); + my $kernpath target_xenkernel_var($gho,'kernel_path'); + my $initrd = target_xenkernel_ver($gho,'initrd_path'); if (!$kernpath) { - my $kernver= guest_var($gho,'kernel_ver',$r{xen_kernel_ver}); + my $kernver= target_xenkernel_ver($gho,'kernel_ver'); $kernver ||= target_cmd_output($ho, 'uname -r'); $kernpath = "/boot/vmlinuz-$kernver"; $initrd ||= "/boot/initrd.img-$kernver";
ts-logs-capture +1 -1
@@ -210,7 +210,7 @@ sub fetch_xenctx_guest ($) { if (defined $gho->{Vcpus}) { foreach (my $vcpu=0; $vcpu < $gho->{Vcpus}; $vcpu++) { - my $kernpath = guest_var($gho,'kernel_path',$r{xen_kernel_path}); + my $kernpath = target_xenkernel_var($gho,'kernel_path'); my $sysmaparg = !defined $kernpath ? '' : $kernpath !~ m,/vmlinuz-, ? die "$kernpath ?" : "-s $`/System.map-$'";
Signature · 1 line
1.7.10.4
PATCH 4/4 Runvar functions: Introduce target_var and target_store_runvar
In reply to Ian Jacksonguest_var would check GUEST_VN and guests_VN. target_var_prefix would return GUEST_ or `' (for a host), but can only be sensibly used for setting, not getting (since a getter ought to check guests_VN as well).
But we might want to be able to set different runvars for different hosts, so we would like to be able to check IDENT_VN as well as VN.
So:
Introduce target_var_prefixlist to replace target_var_prefix, and make it return a sensible list for hosts.
Provide target_var, a replacement for guest_var. Mostly this is a rename (although target_var does not require a default value).
Provide target_store_runvar, which stores the value in the first entry in the prefixlist.
Adjust the non-runvar-handling-core users of target_var_prefix to use target_var and target-store_runvar.
Runvars xen_kernel_{path,ver} are now HOSTIDENT_xen_kernel_{path,ver}; adjust target_xenkernel_var accordingly. There should be no functional change with existing constructed flights. These are all synth runvars, so bisection etc., and copies of old flights, are not going to be affected. The change may break ad-hoc reuse of a flight (eg a standalone mode flight) where a different version of osstest did the ts-xen-install as is now doing a guest install which involves use of the host's kernel (ie, ts-debian-install, mostly).
--- Osstest/Debian.pm | 4 ++-- Osstest/TestSupport.pm | 46 ++++++++++++++++++++++++++++------------------ 2 files changed, 30 insertions(+), 20 deletions(-)
Osstest/Debian.pm +2 -2
@@ -116,8 +116,8 @@ sub debian_boot_setup ($$$$$;$) { $bootloader->{UpdateConfig}($ho); - store_runvar(target_var_prefix($ho).'xen_kernel_path',$kernpath); - store_runvar(target_var_prefix($ho).'xen_kernel_ver',$kernver); + target_store_runvar($ho,'xen_kernel_path',$kernpath); + target_store_runvar($ho,'xen_kernel_ver',$kernver); } sub bl_getmenu_open ($$$) {
Osstest/TestSupport.pm +28 -18
79 lines not on this page · raw message
Signature · 1 line
1.7.10.4
Quoted 6 lines · Ian Jackson
There are two patches here to fix annoyances which can make osstest-installed Debian guests hard to get into.
And two patches to reorganise slightly the runvar handling:
introducing a functiontarget_var' to replaceguest_var'. Currently there is no real motivation for this except that it seems tidier.
All look good to me: