From d2f311db41005c58a6c2477dcb1ec59748a3b204 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Wed, 12 Dec 2007 13:13:38 +0000
Subject: [PATCH] =?UTF-8?q?Modify=20=E2=80=98ganeti-watcher=E2=80=99=20to?=
 =?UTF-8?q?=20run=20verify-disks?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This patch modifies the watcher to run the β€˜gnt-cluster verify-disks’
command and to log its output (if any).

Reviewed-by: imsnah
---
 daemons/ganeti-watcher | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/daemons/ganeti-watcher b/daemons/ganeti-watcher
index 215628b1e..8b2b18303 100755
--- a/daemons/ganeti-watcher
+++ b/daemons/ganeti-watcher
@@ -349,6 +349,7 @@ class Watcher(object):
     notepad = WatcherState()
     self.CheckInstances(notepad)
     self.CheckDisks(notepad)
+    self.VerifyDisks()
     notepad.Save()
 
   def CheckDisks(self, notepad):
@@ -417,6 +418,14 @@ class Watcher(object):
           msg = Message(NOTICE, "Restart of %s succeeded." % instance.name)
           self.messages.append(msg)
 
+  def VerifyDisks(self):
+    """Run gnt-cluster verify-disks.
+
+    """
+    result = DoCmd(['gnt-cluster', 'verify-disks', '--lock-retries=15'])
+    if result.output:
+      self.messages.append(Message(NOTICE, result.output))
+
   def WriteReport(self, logfile):
     """Log all messages to file.
 
-- 
GitLab