From: Ian Jackson <ian.jackson@eu.citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Robert Ho <robert.hu@intel.com>,
"longtao.pang" <longtaox.pang@intel.com>,
Ian Jackson <ian.jackson@eu.citrix.com>,
Ian Campbell <ian.campbell@citrix.com>
Subject: [OSSTEST PATCH 22/26] Nested HVM: Provide ts-nested-setup to help make L1 usable as a host
Date: Fri, 25 Sep 2015 20:15:18 +0100 [thread overview]
Message-ID: <1443208522-24905-14-git-send-email-ian.jackson@eu.citrix.com> (raw)
In-Reply-To: <1443208522-24905-1-git-send-email-ian.jackson@eu.citrix.com>
From: Robert Ho <robert.hu@intel.com>
* Provide the L1 with some storage for its own guests' disks
* Install some packages in the L1
* Optionally, set a runvar defining the L1 for the rest of the job
The recipe is going to run ts-xen-install etc.
Signed-off-by: longtao.pang <longtaox.pang@intel.com>
Signed-off-by: Robert Ho <robert.hu@intel.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
v14: Use target_check_ip (renamed, earlier, in a new patch)
ts-nested-setup now has a default gueststorage_size of 20G
and this is implicitly used by make-flight.
Adjusted for new selecthost nested host syntax and correspondingly
completely changed invocation syntax.
Only optionally sets the runvar, if you pass --define. (This
will make it easier to play around with interactively.)
Broken the pieces of work out into subroutines for clarity.
Comment about guest storage slightly edited and rewrapped.
Guest storage runvars and perl variable names etc. renamed to
`gueststorage' rather than `guest_storage'.
LVM and VG names and perl variable names changed to be clearer.
Install `ed' too.
Use lv_create and toolstack()->block_attach.
Dropped ack from Ian Campbell.
---
ts-nested-setup | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 99 insertions(+)
create mode 100755 ts-nested-setup
diff --git a/ts-nested-setup b/ts-nested-setup
new file mode 100755
index 0000000..f7e0ebd
--- /dev/null
+++ b/ts-nested-setup
@@ -0,0 +1,99 @@
+#!/usr/bin/perl -w
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2015 Intel 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;
+use Osstest;
+use Osstest::Debian;
+use Osstest::TestSupport;
+
+tsreadconfig();
+
+our $dodefine;
+if (@ARGV && $ARGV[0] eq '--define') { $dodefine=1; shift @ARGV; }
+
+our ($l1_identspec) = @ARGV;
+
+my $l1 = selecthost($l1_identspec);
+my $l0 = $l1->{Host};
+
+die unless $l0;
+
+our $def_gueststorage_size = 20000; # Mby
+
+sub packages () {
+ # Faster to install packages while L1 is still running PVHVM
+ target_install_packages_norec($l1, qw(lvm2 rsync ed genisoimage));
+}
+
+sub guest_storage () {
+ # We need to attach an extra disk to the L1 guest to be used as L2
+ # guest storage:
+ #
+ # When running in a nested HVM environment the L1 domain is acting
+ # as both a guest to L0 and a host to L2 guests and therefore
+ # potentially sees connections to two independent xenstore
+ # instances, one provided by the L0 host and one which is provided
+ # by the L1 instance of xenstore.
+ #
+ # Unfortunately the kernel is not capable of dealing with this and
+ # is only able to cope with a single xenstore connection. Since
+ # the L1 toolstack and L2 guests absolutely require xenstore to
+ # function we therefore cannot use the L0 xenstore and therefore
+ # cannot use PV devices (xvdX etc) in the L1 guest and must use
+ # emulated devices (sdX etc).
+ #
+ # However at the moment we have not yet rebooted L1 into Xen and
+ # so it does have PV devices available and sdb actually appears as
+ # xvdb. We could disable the Xen platform device and use emulated
+ # devices for the install phase too but that would be needlessly
+ # slow.
+ #
+ # Instead, to avoid needing to even mention the name of xvdb or
+ # sdb, we create the vg in l0. When the l1 reboots it will
+ # automatically find the empty vg we have created for it, and
+ # target_choose_vg on l1 (which is used by all the guest creation
+ # ts-* scripts) will use it since it has plenty of space.
+
+ my $size = guest_var($l1,'gueststorage_size',$def_gueststorage_size);
+ die "gueststorage_size is undefined" unless $size;
+
+ my $outer_vg = target_choose_vg($l0, $size);
+ my $outer_lv = "$l1->{Ident}_gueststorage_outer_lv";
+ my $inner_vg = "$l1->{Ident}_gueststorage_vg";
+
+ target_cmd_root($l0, "vgremove -f $inner_vg ||:");
+ my $outer_lvdev = lv_create($l0, $outer_vg, $outer_lv, $size);
+
+ target_cmd_root($l0, <<END);
+ pvcreate $outer_lvdev
+ vgcreate $inner_vg $outer_lvdev
+END
+
+ toolstack($l0)->block_attach($l1, "$outer_lvdev,raw,sdb,rw");
+ # NB this does not update the l1 guest config so if the l1 is shut
+ # down and recreated in the l0, this will vanish.
+}
+
+packages();
+guest_storage();
+host_install_postboot_complete($l1);
+
+if ($dodefine) {
+ $l1_identspec =~ m/^(.*)=/ or die "$l1_identspec ?";
+ store_runvar($1, $'); #';
+}
--
1.7.10.4
next prev parent reply other threads:[~2015-09-25 19:16 UTC|newest]
Thread overview: 137+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-25 11:36 [OSSTEST PATCH v14 PART 1 0/9] Nested HVM preparation patches Ian Jackson
2015-09-25 11:37 ` [OSSTEST PATCH 1/9] Tcl: Provide lunappend Ian Jackson
2015-09-25 11:37 ` [OSSTEST PATCH 2/9] Debian grub2: Optimize and re-format submenu parsing Ian Jackson
2015-09-25 11:37 ` [OSSTEST PATCH 3/9] Debian grub2: Correct a mistake in Xen entry parsing pattern Ian Jackson
2015-09-25 11:37 ` [OSSTEST PATCH 4/9] Debian HVM guests: Comment out CDROM entry in HVM guest VM Ian Jackson
2015-09-25 11:37 ` [OSSTEST PATCH 5/9] Debian HVM guests: Honour guest disk and ram size runvars Ian Jackson
2015-09-25 11:37 ` [OSSTEST PATCH 6/9] Debian HVM guests: Honour enable_nestedhvm guest runvar Ian Jackson
2015-09-25 11:37 ` [OSSTEST PATCH 7/9] Host install: Break out host_install_postboot_complete Ian Jackson
2015-09-25 11:37 ` [OSSTEST PATCH 8/9] Host install: Break out target_core_dump_setup Ian Jackson
2015-09-25 11:37 ` [OSSTEST PATCH 9/9] Host install: Move target_core_dump_setup call Ian Jackson
2015-09-25 19:15 ` [OSSTEST PATCH v14 PART 2 10-26/26] Nested HVM testing Ian Jackson
2015-09-25 19:15 ` [OSSTEST PATCH 10/26] cs-adjust-flight: Add some missing doc comment info Ian Jackson
2015-09-28 10:00 ` Ian Campbell
2015-09-25 19:15 ` [OSSTEST PATCH 11/26] cs-adjust-flight: Allow adjusting "this" flight Ian Jackson
2015-09-28 10:01 ` Ian Campbell
2015-09-25 19:15 ` [OSSTEST PATCH 12/26] selecthost: Minor cleanups Ian Jackson
2015-09-28 10:01 ` Ian Campbell
2015-10-31 2:16 ` Hu, Robert
2015-09-25 19:15 ` [OSSTEST PATCH 13/26] selecthost: Support nested hosts (guests which are also hosts) Ian Jackson
2015-09-28 10:10 ` Ian Campbell
2015-09-25 19:15 ` [OSSTEST PATCH 14/26] Nested hosts: Provide PDU power method Ian Jackson
2015-09-28 10:11 ` Ian Campbell
2015-10-31 2:31 ` Hu, Robert
2015-09-25 19:15 ` [OSSTEST PATCH 15/26] DhcpWatch::leases: Fix a reporting message Ian Jackson
2015-09-28 10:12 ` Ian Campbell
2015-10-12 3:07 ` Hu, Robert
2015-08-28 15:07 ` [OSSTest Nested v12 00/21] Introduction of netsted HVM test job Robert Ho
2015-08-28 15:07 ` [OSSTest Nested v12 01/21] Optimize and re-format previous code of 'submenu' parsing Robert Ho
2015-09-10 16:16 ` Ian Jackson
2015-09-11 7:29 ` Ian Campbell
2015-09-25 10:29 ` Ian Jackson
2015-08-28 15:07 ` [OSSTest Nested v12 02/21] Correct a mistake in setboot_grup2() of Xen entry parsing pattern Robert Ho
2015-09-10 16:20 ` Ian Jackson
2015-08-28 15:07 ` [OSSTest Nested v12 03/21] Allow runvars to specify guest disk and ram size (turning previous values into defaults) Robert Ho
2015-09-10 16:21 ` Ian Jackson
2015-09-25 10:35 ` Ian Jackson
2015-10-10 7:00 ` Hu, Robert
2015-10-13 10:41 ` [OSSTest Nested v12 03/21] Allow runvars to specify guest disk and ram size (turning previous values into defaults) [and 2 more messages] Ian Jackson
2015-10-15 9:29 ` Hu, Robert
2015-08-28 15:07 ` [OSSTest Nested v12 04/21] Comment out CDROM entry in HVM guest VM Robert Ho
2015-09-10 16:22 ` Ian Jackson
2015-08-28 15:07 ` [OSSTest Nested v12 05/21] Honour $xopts{ExtraConfig} and use it to enable nestedhvm Robert Ho
2015-09-10 16:26 ` Ian Jackson
2015-09-25 10:51 ` Ian Jackson
2015-08-28 15:07 ` [OSSTest Nested v12 06/21] Add new function of 'host_install_postboot_complete' Robert Ho
2015-09-10 16:29 ` Ian Jackson
2015-08-28 15:07 ` [OSSTest Nested v12 07/21] Replace 'start osstest-confirm-booted' code by function Robert Ho
2015-09-10 16:31 ` Ian Jackson
2015-08-28 15:07 ` [OSSTest Nested v12 08/21] Add new script to customize nested test configuration Robert Ho
2015-08-28 15:07 ` [OSSTest Nested v12 09/21] Wrapper and use core_dump_setup() for nested host and normal host to setup coredump sysctl Robert Ho
2015-09-10 17:23 ` Ian Jackson
2015-09-11 8:43 ` Ian Campbell
2015-09-11 14:04 ` Ian Jackson
2015-08-28 15:07 ` [OSSTest Nested v12 10/21] Add test job for nest test case Robert Ho
2015-08-28 15:08 ` [OSSTest Nested v12 11/21] Tcl: Provide lunappend Robert Ho
2015-08-28 15:08 ` [OSSTest Nested v12 12/21] sg-run-job: Declare Tcl (for the benefit of Emacs) Robert Ho
2015-08-28 15:08 ` [OSSTest Nested v12 13/21] sg-run-job: Break out per-host-prep and per-host-finish Robert Ho
2015-08-28 15:08 ` [OSSTest Nested v12 14/21] sg-run-job: Provide infrastructure for layers of nesting Robert Ho
2015-08-28 15:08 ` [OSSTest Nested v12 15/21] Integrate Ian J. code and small corrections Robert Ho
2015-09-10 17:25 ` Ian Jackson
2015-08-28 15:08 ` [OSSTest Nested v12 16/21] Add PDU power method for nested L1 and L2 guest Robert Ho
2015-09-25 16:35 ` Ian Jackson
2015-10-12 3:04 ` Hu, Robert
2015-10-12 8:50 ` Ian Campbell
2015-08-28 15:08 ` [OSSTest Nested v12 17/21] Compose the main recipe of nested test job Robert Ho
2015-08-28 15:08 ` [OSSTest Nested v12 18/21] After Xen install, configure its xenbr0 interface as dhcp Robert Ho
2015-08-28 15:08 ` [OSSTest Nested v12 19/21] Selecthost uses dynamic IP address if the host is not configured static IP Robert Ho
2015-09-25 16:59 ` Ian Jackson
2015-10-12 3:05 ` Hu, Robert
2015-08-28 15:08 ` [OSSTest Nested v12 20/21] Don't lvextend if actually no more space to extend Robert Ho
2015-09-16 14:27 ` Ian Jackson
2015-09-22 15:56 ` Ian Campbell
2015-09-22 16:05 ` Ian Jackson
2015-08-28 15:08 ` [OSSTest Nested v12 21/21] await_tcp(): check_ip for each loop iteration Robert Ho
2015-09-16 14:35 ` Ian Jackson
2015-09-16 14:37 ` [OSSTest Nested v12 00/21] Introduction of netsted HVM test job Ian Jackson
2015-09-17 4:58 ` Hu, Robert
2015-09-17 9:59 ` Ian Jackson
2015-10-31 2:50 ` [OSSTEST PATCH 15/26] DhcpWatch::leases: Fix a reporting message Hu, Robert
2015-09-25 19:15 ` [OSSTEST PATCH 16/26] target_check_ip: Rename and improve from guest_check_ip Ian Jackson
2015-09-28 10:15 ` Ian Campbell
2015-10-31 3:03 ` Hu, Robert
2015-09-25 19:15 ` [OSSTEST PATCH 17/26] await_tcp(): Run check_ip on each loop iteration Ian Jackson
2015-09-28 10:15 ` Ian Campbell
2015-10-31 3:05 ` Hu, Robert
2015-09-25 19:15 ` [OSSTEST PATCH 18/26] LVM: Break out lv_create Ian Jackson
2015-09-28 10:17 ` Ian Campbell
2015-10-12 7:42 ` Hu, Robert
2015-10-12 8:49 ` Ian Campbell
2015-10-14 2:35 ` Hu, Robert
2015-09-25 19:15 ` [OSSTEST PATCH 19/26] Toolstack::xl: Provide block_attach method Ian Jackson
2015-09-28 10:18 ` Ian Campbell
2015-10-13 10:34 ` Hu, Robert
2015-10-13 12:51 ` Ian Jackson
2015-09-25 19:15 ` [OSSTEST PATCH 20/26] sg-run-job: Break out per-host-prep and per-host-finish Ian Jackson
2015-09-28 10:19 ` Ian Campbell
2015-10-31 4:04 ` Hu, Robert
2015-09-25 19:15 ` [OSSTEST PATCH 21/26] sg-run-job: Provide infrastructure for layers of nesting Ian Jackson
2015-09-28 10:20 ` Ian Campbell
2015-10-29 7:23 ` Hu, Robert
2015-09-25 19:15 ` Ian Jackson [this message]
2015-09-28 10:29 ` [OSSTEST PATCH 22/26] Nested HVM: Provide ts-nested-setup to help make L1 usable as a host Ian Campbell
2015-09-25 19:15 ` [OSSTEST PATCH 23/26] Nested HVM: Provide test-nested recipe Ian Jackson
2015-09-28 10:30 ` Ian Campbell
2015-10-29 5:44 ` Hu, Robert
2015-09-25 19:15 ` [OSSTEST PATCH 24/26] Nested HVM: Add test job to appropriate flights Ian Jackson
2015-09-28 10:32 ` Ian Campbell
2015-09-25 19:15 ` [OSSTEST PATCH 25/26] ts-xen-install: Properly handle hosts without a static IP address Ian Jackson
2015-09-28 10:33 ` Ian Campbell
2015-10-31 5:32 ` Hu, Robert
2015-09-25 19:15 ` [OSSTEST PATCH 26/26] ts-xen-install: networking: Rename `nodhcp' to `ensurebridge' Ian Jackson
2015-09-28 10:33 ` Ian Campbell
2015-10-15 9:39 ` Hu, Robert
2015-10-15 9:58 ` Hu, Robert
2015-10-22 2:32 ` Hu, Robert
2015-10-23 6:16 ` Hu, Robert
2015-10-23 8:14 ` Ian Campbell
2015-10-23 13:25 ` Hu, Robert
2015-10-23 13:37 ` Ian Campbell
2015-10-25 2:45 ` Hu, Robert
2015-10-26 7:05 ` Hu, Robert
2015-10-26 9:43 ` Hu, Robert
2015-10-26 16:29 ` Ian Jackson
2015-10-27 2:44 ` Hu, Robert
2015-09-28 10:36 ` [OSSTEST PATCH v14 PART 2 10-26/26] Nested HVM testing Ian Campbell
2015-10-12 3:35 ` Hu, Robert
2015-10-12 8:04 ` Hu, Robert
2015-10-12 8:56 ` Ian Campbell
2015-10-12 9:34 ` Hu, Robert
2015-10-12 10:03 ` Ian Campbell
2015-10-12 10:23 ` Hu, Robert
2015-10-12 10:47 ` Ian Campbell
2015-10-13 2:29 ` Hu, Robert
2015-10-12 8:54 ` Ian Campbell
2015-11-02 3:44 ` Hu, Robert
2015-11-02 6:24 ` Hu, Robert
2015-11-04 16:59 ` [OSSTEST PATCH v15] Nested HVM Ian Jackson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1443208522-24905-14-git-send-email-ian.jackson@eu.citrix.com \
--to=ian.jackson@eu.citrix.com \
--cc=ian.campbell@citrix.com \
--cc=longtaox.pang@intel.com \
--cc=robert.hu@intel.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).