All of lore.kernel.org
 help / color / mirror / Atom feed
* [OSSTEST PATCH] mg-host: Prepare $checkhostq only if needed
@ 2017-09-01 15:22 Ian Jackson
  0 siblings, 0 replies; only message in thread
From: Ian Jackson @ 2017-09-01 15:22 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson, George Dunlap

This is helpful because in standalone mode there is no resources table
and this fails.  But we want people to use `mg-hosts power' in
standalone mode, if they can, rather than running ./msu-pdu ad-hoc (or
whatever).

Reported-by: George Dunlap <George.Dunlap@citrix.com>
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 mg-hosts | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/mg-hosts b/mg-hosts
index 5cdece5..b62e430 100755
--- a/mg-hosts
+++ b/mg-hosts
@@ -99,12 +99,14 @@ use File::Basename;
 
 csreadconfig();
 
-our $checkhostq = $dbh_tests->prepare(<<END);
-    SELECT * FROM resources WHERE restype='host' AND resname=?
-END
+our $checkhostq;
 
 sub checkhost ($) {
     my ($host) = @_;
+
+    $checkhostq //= $dbh_tests->prepare(<<END);
+    SELECT * FROM resources WHERE restype='host' AND resname=?
+END
     $checkhostq->execute($host);
     my $row = $checkhostq->fetchrow_hashref();
     die "$host ?" unless $row;
-- 
2.1.4


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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-09-01 15:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-01 15:22 [OSSTEST PATCH] mg-host: Prepare $checkhostq only if needed Ian Jackson

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.