[OSSTEST,10/38] Debian guests: Write systemd random seed file
diff mbox series

Message ID 20200519190230.29519-11-ian.jackson@eu.citrix.com
State New
Headers show
Series
  • Upgrade most hosts/guests to buster
Related show

Commit Message

Ian Jackson May 19, 2020, 7:02 p.m. UTC
This involves a new ts-debian-di-fixup script, which runs after
xen-tools.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 Osstest/Debian.pm  | 14 ++++++++++++++
 sg-run-job         |  1 +
 ts-debian-di-fixup | 29 +++++++++++++++++++++++++++++
 ts-debian-fixup    |  1 +
 4 files changed, 45 insertions(+)
 create mode 100755 ts-debian-di-fixup

Patch
diff mbox series

diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm
index b8bf67dc..78d8c97e 100644
--- a/Osstest/Debian.pm
+++ b/Osstest/Debian.pm
@@ -49,6 +49,7 @@  BEGIN {
                       di_installcmdline_core
                       di_vg_name
                       debian_dhcp_rofs_fix
+		      debian_write_random_seed
                       );
     %EXPORT_TAGS = ( );
 
@@ -1612,4 +1613,17 @@  mv '$script.new' '$script'
 END
 }
 
+sub debian_write_random_seed ($) {
+    my ($gho) = @_;
+    my $mountpoint = '/mnt';
+    my $ho = $gho->{Host};
+    target_cmd_root($ho, <<END);
+        set -ex
+        mount /dev/$gho->{Vg}/$gho->{Lv} $mountpoint
+        umask 077
+        dd if=/dev/urandom of=$mountpoint/var/lib/systemd/random-seed bs=1k count=1
+END
+    guest_umount_lv($ho, $gho);
+}
+
 1;
diff --git a/sg-run-job b/sg-run-job
index aa7953ac..9255096d 100755
--- a/sg-run-job
+++ b/sg-run-job
@@ -511,6 +511,7 @@  proc run-job/test-debian {} {
 
 proc install-guest-debian-di {} {
     run-ts . = ts-debian-di-install
+    run-ts . = ts-debian-di-fixup + debian
     run-ts . = ts-guest-start + debian
 }
 
diff --git a/ts-debian-di-fixup b/ts-debian-di-fixup
new file mode 100755
index 00000000..68cda2f5
--- /dev/null
+++ b/ts-debian-di-fixup
@@ -0,0 +1,29 @@ 
+#!/usr/bin/perl -w
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2009-2013 Citrix Inc.
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+# 
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+use strict qw(vars);
+use DBI;
+BEGIN { unshift @INC, qw(.); }
+use Osstest;
+use Osstest::TestSupport;
+use Osstest::Debian;
+
+tsreadconfig();
+
+our ($ho,$gho) = ts_get_host_guest(@ARGV);
+
+debian_write_random_seed($gho);
diff --git a/ts-debian-fixup b/ts-debian-fixup
index fef9836e..45bbcd27 100755
--- a/ts-debian-fixup
+++ b/ts-debian-fixup
@@ -202,6 +202,7 @@  sub writecfg () {
     target_putfile_root($ho,10, $cfgstash, $cfgfile);
 }
 
+debian_write_random_seed($gho);
 savecfg();
 ether();
 target_kernkind_check($gho);