* [OSSTEST PATCH 0/4] Miscellaneous bald yaks
@ 2015-09-29 16:21 Ian Jackson
2015-09-29 16:21 ` [OSSTEST PATCH 1/4] ts-debian-fixup: Set password Ian Jackson
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Ian Jackson @ 2015-09-29 16:21 UTC (permalink / raw)
To: xen-devel; +Cc: Ian Campbell
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [OSSTEST PATCH 1/4] ts-debian-fixup: Set password
2015-09-29 16:21 [OSSTEST PATCH 0/4] Miscellaneous bald yaks Ian Jackson
@ 2015-09-29 16:21 ` Ian Jackson
2015-09-29 16:21 ` [OSSTEST PATCH 2/4] Do not multiply console hvc0 getty entries Ian Jackson
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Ian Jackson @ 2015-09-29 16:21 UTC (permalink / raw)
To: xen-devel; +Cc: Ian Jackson, Ian Campbell
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"'
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
ts-debian-fixup | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/ts-debian-fixup b/ts-debian-fixup
index 75c93e3..cc779a3 100755
--- a/ts-debian-fixup
+++ b/ts-debian-fixup
@@ -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/.
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [OSSTEST PATCH 2/4] Do not multiply console hvc0 getty entries
2015-09-29 16:21 [OSSTEST PATCH 0/4] Miscellaneous bald yaks Ian Jackson
2015-09-29 16:21 ` [OSSTEST PATCH 1/4] ts-debian-fixup: Set password Ian Jackson
@ 2015-09-29 16:21 ` Ian Jackson
2015-09-29 16:21 ` [OSSTEST PATCH 3/4] Runvar functions: Provide target_xenkernel_ver Ian Jackson
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Ian Jackson @ 2015-09-29 16:21 UTC (permalink / raw)
To: xen-devel; +Cc: Ian Jackson, Ian Campbell
target_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).
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
Osstest/TestSupport.pm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 3fc8e15..09694f4 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -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:/;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [OSSTEST PATCH 3/4] Runvar functions: Provide target_xenkernel_ver
2015-09-29 16:21 [OSSTEST PATCH 0/4] Miscellaneous bald yaks Ian Jackson
2015-09-29 16:21 ` [OSSTEST PATCH 1/4] ts-debian-fixup: Set password Ian Jackson
2015-09-29 16:21 ` [OSSTEST PATCH 2/4] Do not multiply console hvc0 getty entries Ian Jackson
@ 2015-09-29 16:21 ` Ian Jackson
2015-09-29 16:21 ` [OSSTEST PATCH 4/4] Runvar functions: Introduce target_var and target_store_runvar Ian Jackson
2015-09-30 8:20 ` [OSSTEST PATCH 0/4] Miscellaneous bald yaks Ian Campbell
4 siblings, 0 replies; 6+ messages in thread
From: Ian Jackson @ 2015-09-29 16:21 UTC (permalink / raw)
To: xen-devel; +Cc: Ian Jackson, Ian Campbell
This abstracts away a number of places that do
guest_var($gho,'FOO',$r{xen_FOO})
We are going to change these runvar names.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
Osstest/TestSupport.pm | 8 ++++++++
ts-debian-install | 6 +++---
ts-logs-capture | 2 +-
3 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 09694f4..a21d835 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -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) = @_;
diff --git a/ts-debian-install b/ts-debian-install
index 0dfe40c..510a766 100755
--- a/ts-debian-install
+++ b/ts-debian-install
@@ -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";
diff --git a/ts-logs-capture b/ts-logs-capture
index b99b1db..ec66e11 100755
--- a/ts-logs-capture
+++ b/ts-logs-capture
@@ -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-$'";
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [OSSTEST PATCH 4/4] Runvar functions: Introduce target_var and target_store_runvar
2015-09-29 16:21 [OSSTEST PATCH 0/4] Miscellaneous bald yaks Ian Jackson
` (2 preceding siblings ...)
2015-09-29 16:21 ` [OSSTEST PATCH 3/4] Runvar functions: Provide target_xenkernel_ver Ian Jackson
@ 2015-09-29 16:21 ` Ian Jackson
2015-09-30 8:20 ` [OSSTEST PATCH 0/4] Miscellaneous bald yaks Ian Campbell
4 siblings, 0 replies; 6+ messages in thread
From: Ian Jackson @ 2015-09-29 16:21 UTC (permalink / raw)
To: xen-devel; +Cc: Ian Jackson, Ian Campbell
guest_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).
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
Osstest/Debian.pm | 4 ++--
Osstest/TestSupport.pm | 46 ++++++++++++++++++++++++++++------------------
2 files changed, 30 insertions(+), 20 deletions(-)
diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm
index 47d1767..a65664e 100644
--- a/Osstest/Debian.pm
+++ b/Osstest/Debian.pm
@@ -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 ($$$) {
diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index a21d835..a03c9fb 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -90,7 +90,8 @@ BEGIN {
target_ping_check_down target_ping_check_up
target_kernkind_check target_kernkind_console_inittab
target_xenkernel_ver
- target_var target_var_prefix
+ target_var target_var_prefixlist
+ target_store_runvar
selectguest prepareguest more_prepareguest_hvm
guest_var guest_var_commalist guest_var_boolean
prepareguest_part_lvmdisk prepareguest_part_diskimg
@@ -1583,9 +1584,8 @@ END
sub guest_var ($$$) {
my ($gho, $runvartail, $default) = @_;
- my $val= $r{ $gho->{Guest}."_".$runvartail }; return $val if defined $val;
- $val= $r{ "guests_$runvartail" }; return $val if defined $val;
- return $default;
+ # deprecated - use target_var instead
+ return target_var($gho, $runvartail, $default);
}
sub guest_var_boolean ($$) {
@@ -1995,35 +1995,45 @@ sub guest_await ($$) {
return $gho;
}
-sub target_var_prefix ($) {
- my ($ho) = @_;
- if (exists $ho->{Guest}) { return $ho->{Guest}.'_'; }
- return '';
+sub target_var_prefixlist ($) {
+ my ($tho) = @_;
+ defined $ho->{Guest} ?
+ ("$gho->{Guest}_", "guests_") :
+ ("$gho->{Ident}_", "");
}
-sub target_var ($$) {
- my ($ho,$vn) = @_;
- return $r{ target_var_prefix($ho). $vn };
+sub target_store_runvar ($$$) {
+ my ($tho,$vn,$val) = @_;
+ my ($pfx) = target_var_prefixlist($tho); # pick first prefix
+ store_runvar("${pfx}${vn}",$val);
+}
+
+sub target_var ($$;$) {
+ my ($tho,$vn,$default) = @_;
+ foreach my $pfx (target_var_prefixlist($tho)) {
+ my $v = $r{"${pfx}${vn}"};
+ return $v if defined $v;
+ }
+ return $default;
}
sub target_kernkind_check ($) {
my ($gho) = @_;
- my $pfx= target_var_prefix($gho);
- my $kernkind= $r{$pfx."kernkind"};
+ my $kernkind= target_var($gho,"kernkind"};
my $isguest= exists $gho->{Guest};
if ($kernkind eq 'pvops') {
- store_runvar($pfx."rootdev", 'xvda') if $isguest;
- store_runvar($pfx."console", 'hvc0');
+ target_store_runvar($gho, "rootdev", 'xvda') if $isguest;
+ target_store_runvar($gho, "console", 'hvc0');
} elsif ($kernkind !~ m/2618/) {
- store_runvar($pfx."console", 'xvc0') if $isguest;
+ target_store_runvar($gho, "console", 'xvc0') if $isguest;
}
}
sub target_xenkernel_var ($$) {
my ($tho,$vn) = @_;
return
- guest_var($gho,$vn,undef) //
- $r{"xen_${vn}"};
+ target_var($gho,$vn) //
+ ($tho->{Host} and target_var($tho->{Host},"xen_${vn}"));
}
sub target_kernkind_console_inittab ($$$) {
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [OSSTEST PATCH 0/4] Miscellaneous bald yaks
2015-09-29 16:21 [OSSTEST PATCH 0/4] Miscellaneous bald yaks Ian Jackson
` (3 preceding siblings ...)
2015-09-29 16:21 ` [OSSTEST PATCH 4/4] Runvar functions: Introduce target_var and target_store_runvar Ian Jackson
@ 2015-09-30 8:20 ` Ian Campbell
4 siblings, 0 replies; 6+ messages in thread
From: Ian Campbell @ 2015-09-30 8:20 UTC (permalink / raw)
To: Ian Jackson, xen-devel
On Tue, 2015-09-29 at 17:21 +0100, Ian Jackson wrote:
> 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.
All look good to me:
Acked-by: Ian Campbell <ian.campbell@citrix.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-09-30 8:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-29 16:21 [OSSTEST PATCH 0/4] Miscellaneous bald yaks Ian Jackson
2015-09-29 16:21 ` [OSSTEST PATCH 1/4] ts-debian-fixup: Set password Ian Jackson
2015-09-29 16:21 ` [OSSTEST PATCH 2/4] Do not multiply console hvc0 getty entries Ian Jackson
2015-09-29 16:21 ` [OSSTEST PATCH 3/4] Runvar functions: Provide target_xenkernel_ver Ian Jackson
2015-09-29 16:21 ` [OSSTEST PATCH 4/4] Runvar functions: Introduce target_var and target_store_runvar Ian Jackson
2015-09-30 8:20 ` [OSSTEST PATCH 0/4] Miscellaneous bald yaks Ian Campbell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).