All of lore.kernel.org
 help / color / mirror / Atom feed
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 1/5] host: introduce modify_host
Date: Wed, 11 Mar 2020 18:20:05 +0100	[thread overview]
Message-ID: <20200311172010.7777-1-roger.pau@citrix.com> (raw)

Abstract the set_property checks and DB call into a helper.

No functional change.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Requested on IRC:
17:09:30 Diziet Also if it were me I would put the modify_host refactoring in its own nfc patch,
                but I won't insist on that...
---
changes since v4:
 - New in this version.
---
 Osstest/HostDB/Executive.pm | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/Osstest/HostDB/Executive.pm b/Osstest/HostDB/Executive.pm
index 7ffca6c4..d402bcac 100644
--- a/Osstest/HostDB/Executive.pm
+++ b/Osstest/HostDB/Executive.pm
@@ -51,6 +51,16 @@ END
     }
 }
 
+sub modify_host ($$$) {
+    my ($hd, $ho, $query) = @_;
+    my $blessing = intended_blessing();
+
+    die "Attempting to modify host with intended blessing $blessing != real"
+        if $blessing ne "real";
+
+    db_retry($dbh_tests, [qw(resources)], $query);
+}
+
 sub set_property($$$$) {
     my ($hd, $ho, $prop, $val) = @_;
     my $rmq = $dbh_tests->prepare(<<END);
@@ -61,12 +71,8 @@ END
         INSERT INTO resource_properties (restype,resname,name,val)
                VALUES ('host', ?,?,?)
 END
-    my $blessing = intended_blessing();
-
-    die "Attempting to modify host props with intended blessing $blessing != real"
-        if $blessing ne "real";
 
-    db_retry($dbh_tests, [qw(resources)], sub {
+    modify_host($hd, $ho, sub {
         $rmq->execute($ho->{Name}, $prop);
         if (length $val) {
             $addq->execute($ho->{Name}, $prop, $val);
-- 
2.25.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

             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 Roger Pau Monne [this message]
2020-03-11 17:20 ` [Xen-devel] [PATCH OSSTEST v5 2/5] host: introduce a helper to modify hostflags Roger Pau Monne
2020-03-12 10:57   ` 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-1-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.