|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH OSSTEST v5 1/5] host: introduce modify_host
Abstract the set_property checks and DB call into a helper.
No functional change.
Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
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@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |