From f1b083ce396bf55a2155ac679a441022264ae59d Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Fri, 1 Oct 2010 13:56:53 +0200
Subject: [PATCH] =?UTF-8?q?gnt-cluster:=20Replace=20hardcoded=20=E2=80=9Cx?=
 =?UTF-8?q?envg=E2=80=9D=20with=20value=20retrieved=20from=20master?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This fixes issue 125 (http://code.google.com/p/ganeti/issues/detail?id=125)

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 scripts/gnt-cluster | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/scripts/gnt-cluster b/scripts/gnt-cluster
index 73161ba11..c65cc808a 100755
--- a/scripts/gnt-cluster
+++ b/scripts/gnt-cluster
@@ -428,8 +428,10 @@ def VerifyDisks(opts, args):
   @return: the desired exit code
 
   """
+  cl = GetClient()
+
   op = opcodes.OpVerifyDisks()
-  result = SubmitOpCode(op, opts=opts)
+  result = SubmitOpCode(op, opts=opts, cl=cl)
   if not isinstance(result, (list, tuple)) or len(result) != 3:
     raise errors.ProgrammerError("Unknown result type for OpVerifyDisks")
 
@@ -451,13 +453,15 @@ def VerifyDisks(opts, args):
       op = opcodes.OpActivateInstanceDisks(instance_name=iname)
       try:
         ToStdout("Activating disks for instance '%s'", iname)
-        SubmitOpCode(op, opts=opts)
+        SubmitOpCode(op, opts=opts, cl=cl)
       except errors.GenericError, err:
         nret, msg = FormatError(err)
         retcode |= nret
         ToStderr("Error activating disks for instance %s: %s", iname, msg)
 
   if missing:
+    (vg_name, ) = cl.QueryConfigValues(["volume_group_name"])
+
     for iname, ival in missing.iteritems():
       all_missing = compat.all(x[0] in bad_nodes for x in ival)
       if all_missing:
@@ -468,11 +472,12 @@ def VerifyDisks(opts, args):
         ival.sort()
         for node, vol in ival:
           if node in bad_nodes:
-            ToStdout("\tbroken node %s /dev/xenvg/%s", node, vol)
+            ToStdout("\tbroken node %s /dev/%s/%s", node, vg_name, vol)
           else:
-            ToStdout("\t%s /dev/xenvg/%s", node, vol)
+            ToStdout("\t%s /dev/%s/%s", node, vg_name, vol)
+
     ToStdout("You need to run replace_disks for all the above"
-           " instances, if this message persist after fixing nodes.")
+             " instances, if this message persist after fixing nodes.")
     retcode |= 1
 
   return retcode
-- 
GitLab