From: Dario Faggioli <dario.faggioli@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Juergen Gross <jgross@suse.com>,
Ian Jackson <ian.jackson@eu.citrix.com>,
Ian Campbell <ian.campbell@citrix.com>
Subject: [OSSTEST PATCH v3 1/3] ts-cpupools: new test script
Date: Sat, 03 Oct 2015 02:39:22 +0200 [thread overview]
Message-ID: <20151003003922.12311.48452.stgit@Solace.station> (raw)
In-Reply-To: <20151003003554.12311.97039.stgit@Solace.station>
for smoke testing cpupools a bit. It tries to partition
a live host in two cpupools, trying out the following 3
schedulers for the new cpupool (one after the other):
credit, credit2 and RTDS.
It also tries to migrating a domain to the new cpupool
and then back to Pool-0.
Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Juergen Gross <jgross@suse.com>
---
Changes from v2:
* reorganized internal subroutines;
* avoid failing (just don't run the test) if we find
only 1 pCPU on the host;
* use 'map' and 'grep' in place of foreach loops, as
suggested during review;
* fix the check for the default cpupool configuration
to be in place when starting the test, as identified
during review;
* fix quoting for the name of the cpupool, as idenfied
during review;
* use target_cmd_root(), instead of target_cmd_output_root(),
as requested during review;
* check for the toolstack to be xl and only xl, as
requested during review.
---
ts-cpupools | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 121 insertions(+)
create mode 100755 ts-cpupools
diff --git a/ts-cpupools b/ts-cpupools
new file mode 100755
index 0000000..7fe9a27
--- /dev/null
+++ b/ts-cpupools
@@ -0,0 +1,121 @@
+#!/usr/bin/perl -w
+# This is part of "osstest", an automated testing framework for Xen.
+# Copyright (C) 2009-2014 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;
+use Osstest;
+use Osstest::TestSupport;
+
+tsreadconfig();
+
+our ($ho,$gho) = ts_get_host_guest(@ARGV);
+
+our $nr_cpus;
+our $default_pool= "Pool-0";
+our @schedulers= ("credit","credit2","rtds");
+our @cpulist;
+
+# Figure out the number of pCPUs of the host. We need to know that for
+# deciding with what pCPUs we'll create the test pool.
+sub check_cpus () {
+ my $xlinfo= target_cmd_output_root($ho, "xl info");
+ $xlinfo =~ /nr_cpus\s*:\s([0-9]*)/;
+ $nr_cpus= $1;
+ logm("Found $nr_cpus pCPUs");
+ logm("$nr_cpus is yoo few pCPUs for testing cpupools");
+}
+
+# At the beginning:
+# * only 1 pool must exist,
+# * it must be the default pool.
+sub check () {
+ my $cppinfo= target_cmd_output_root($ho, "xl cpupool-list");
+ my $nr_cpupools= $cppinfo =~ tr/\n//;
+
+ logm("Found $nr_cpupools cpupools");
+ die "There already is more than one cpu pool!" if $nr_cpupools > 1;
+ die "Non-default cpupool configuration detected"
+ unless $cppinfo =~ /$default_pool/;
+
+ die "This test is meant for xl only"
+ if toolstack($ho)->{Name} ne "xl";
+}
+
+# Odd pCPUs will end up in out test pool
+sub prep_cpulist () {
+ @cpulist = grep { $_ % 2 } (0..$nr_cpus);
+ logm("Using the following cpus fo the test pool: @cpulist");
+}
+
+sub prep_pool ($) {
+ my ($sched)= @_;
+ my @cpustr;
+
+ my @cpustr= map { $_ == -1 ? "[ " : $_ == $#cpulist+1 ? " ]" :
+ "\"$cpulist[$_]\"," } (-1 .. $#cpulist+1);
+
+ target_putfilecontents_stash($ho,100,<<"END","/etc/xen/cpupool-test-$sched");
+name = \"cpupool-test-$sched\"
+sched = \"$sched\"
+cpus = @cpustr
+END
+}
+
+# For each cpupool:
+# * create it
+# * rename it
+# * move a domain in it
+# * move back a domain out of it
+# * add back the pcpus from it to the default pool
+# * destroy it
+sub run ($) {
+ my ($sched)= @_;
+
+ foreach my $cpu (@cpulist) {
+ target_cmd_root($ho,"xl cpupool-cpu-remove $default_pool $cpu");
+ }
+ target_cmd_root($ho, "xl cpupool-list -c");
+ target_cmd_root($ho, "xl cpupool-create /etc/xen/cpupool-test-$sched");
+ target_cmd_root($ho, "xl cpupool-rename cpupool-test-$sched cpupool-test");
+ target_cmd_root($ho, "xl cpupool-list -c");
+
+ target_cmd_root($ho, "xl cpupool-migrate $gho->{Name} cpupool-test");
+ target_cmd_root($ho, "xl cpupool-list");
+ target_cmd_root($ho, "xl vcpu-list");
+
+ target_cmd_root($ho, "xl cpupool-migrate $gho->{Name} Pool-0");
+ target_cmd_root($ho, "xl cpupool-list");
+
+ foreach my $cpu (@cpulist) {
+ target_cmd_root($ho,"xl cpupool-cpu-remove cpupool-test $cpu");
+ target_cmd_root($ho,"xl cpupool-cpu-add $default_pool $cpu");
+ }
+ target_cmd_output_root($ho, "xl cpupool-list -c");
+
+ target_cmd_root($ho, "xl cpupool-destroy cpupool-test");
+ target_cmd_root($ho, "xl cpupool-list");
+}
+
+check();
+check_cpus();
+if ($nr_cpus > 1) {
+ prep_cpulist();
+ foreach my $s (@schedulers) {
+ prep_pool("$s");
+ run("$s");
+ }
+}
next prev parent reply other threads:[~2015-10-03 0:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-03 0:39 [OSSTEST PATCH v3 0/3] Test case for cpupools Dario Faggioli
2015-10-03 0:39 ` Dario Faggioli [this message]
2015-10-08 16:38 ` [OSSTEST PATCH v3 1/3] ts-cpupools: new test script Ian Campbell
2015-10-03 0:39 ` [OSSTEST PATCH v3 2/3] Testing cpupools: recipe for it and job definition Dario Faggioli
2015-10-09 14:34 ` Ian Campbell
2015-10-03 0:39 ` [OSSTEST PATCH v3 3/3] ts-logs-capture: include some cpupools info in the captured logs Dario Faggioli
2015-10-09 14:36 ` Ian Campbell
2015-10-03 0:45 ` [OSSTEST PATCH v3 0/3] Test case for cpupools Dario Faggioli
2015-10-08 15:20 ` Ian Campbell
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=20151003003922.12311.48452.stgit@Solace.station \
--to=dario.faggioli@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jgross@suse.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).