[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [OSSTEST PATCH] mg-host: Prepare $checkhostq only if needed



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@xxxxxxxxxx>
Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.