From: Roger Pau Monne <roger.pau@citrix.com>
To: <xen-devel@lists.xenproject.org>
Cc: ian.jackson@eu.citrix.com, Roger Pau Monne <roger.pau@citrix.com>
Subject: [Xen-devel] [PATCH OSSTEST v5 2/5] host: introduce a helper to modify hostflags
Date: Wed, 11 Mar 2020 18:20:06 +0100 [thread overview]
Message-ID: <20200311172010.7777-2-roger.pau@citrix.com> (raw)
In-Reply-To: <20200311172010.7777-1-roger.pau@citrix.com>
Add a generic function to perform database changes related to a host
flag and add a wrapper to TestSupport.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Changes since v4:
- Move addition of hostflag_putative_record to a different patch.
- Introduce a single helper in TestSupport: modify_host_flag.
Changes since v3:
- Introduce modify_flag instead of {set/remove}_flag.
- Introduce a generic modify_host helper.
- Split from patch 1.
---
Requested on IRC:
17:08:58 Diziet royger: I think your ts-examine-hostprops-save hunk in 2/ belongs in 1/ ? (Or in
a separate 1.5/ along with hostflag_putative_record.)
---
Osstest/HostDB/Executive.pm | 17 +++++++++++++++++
Osstest/HostDB/Static.pm | 7 +++++++
Osstest/TestSupport.pm | 8 +++++++-
3 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/Osstest/HostDB/Executive.pm b/Osstest/HostDB/Executive.pm
index d402bcac..a6dc4462 100644
--- a/Osstest/HostDB/Executive.pm
+++ b/Osstest/HostDB/Executive.pm
@@ -96,6 +96,23 @@ END
return $flags;
}
+sub modify_flag ($$$$) {
+ my ($hd, $ho, $flag, $set) = @_;
+ my $rmq = $dbh_tests->prepare(<<END);
+ DELETE FROM hostflags WHERE hostname=? AND hostflag=?
+END
+ my $addq = $dbh_tests->prepare(<<END);
+ INSERT INTO hostflags (hostname,hostflag) VALUES (?,?)
+END
+
+ modify_host($hd, $ho, sub {
+ $rmq->execute($ho->{Name}, $flag);
+ if ($set) {
+ $addq->execute($ho->{Name}, $flag);
+ }
+ });
+}
+
sub get_arch_platforms ($$$) {
my ($hd, $blessing, $arch, $suite) = @_;
diff --git a/Osstest/HostDB/Static.pm b/Osstest/HostDB/Static.pm
index 0c6be3ee..d0669fb2 100644
--- a/Osstest/HostDB/Static.pm
+++ b/Osstest/HostDB/Static.pm
@@ -72,6 +72,13 @@ sub get_flags ($$) { #method
return $flags;
}
+sub modify_flag ($$$$) {
+ my ($hd, $ho, $flag, $set) = @_;
+
+ die
+ "Cannot modify flags in standalone mode for $ho->{Name} $flag set: $set\n";
+}
+
sub get_arch_platforms ($$$) {
my ($hd, $blessing, $arch, $suite) = @_;
diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index f49ed529..ceb6bb7b 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -84,7 +84,7 @@ BEGIN {
get_target_property get_host_native_linux_console
hostnamepath hostnamepath_list set_runtime_hostflag
power_state power_cycle power_reboot_attempts
- serial_fetch_logs set_host_property
+ serial_fetch_logs set_host_property modify_host_flag
propname_massage propname_check
hostprop_putative_record
@@ -1411,6 +1411,12 @@ sub hostprop_putative_record ($$$) {
store_runvar("hostprop/$ho->{Ident}/$prop", $val);
}
+sub modify_host_flag ($$$) {
+ my ($ho, $flag, $set) = @_;
+
+ $mhostdb->modify_flag($ho, $flag, $set);
+}
+
sub get_target_property ($$;$);
sub get_target_property ($$;$) {
my ($ho, $prop, $defval) = @_;
--
2.25.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2020-03-11 17:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-11 17:20 [Xen-devel] [PATCH OSSTEST v5 1/5] host: introduce modify_host Roger Pau Monne
2020-03-11 17:20 ` Roger Pau Monne [this message]
2020-03-12 10:57 ` [Xen-devel] [PATCH OSSTEST v5 2/5] host: introduce a helper to modify hostflags Ian Jackson
2020-03-11 17:20 ` [Xen-devel] [PATCH OSSTEST v5 3/5] ts-examine-hostprops-save: record hostflags also Roger Pau Monne
2020-03-12 10:58 ` Ian Jackson
2020-03-11 17:20 ` [Xen-devel] [PATCH OSSTEST v5 4/5] examine: detect IOMMU availability and add it as a hostflag Roger Pau Monne
2020-03-12 11:02 ` Ian Jackson
2020-03-12 11:12 ` Ian Jackson
2020-03-12 14:40 ` [Xen-devel] [PATCH OSSTEST v6 " Roger Pau Monne
2020-03-12 14:54 ` Ian Jackson
2020-03-11 17:20 ` [Xen-devel] [PATCH OSSTEST v5 5/5] make-flight: add dom0 PVH test Roger Pau Monne
2020-03-12 10:56 ` [Xen-devel] [PATCH OSSTEST v5 1/5] host: introduce modify_host 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=20200311172010.7777-2-roger.pau@citrix.com \
--to=roger.pau@citrix.com \
--cc=ian.jackson@eu.citrix.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.