Verify: xen toolstack, hypervisor and hvparams
[ganeti-local] / lib / hypervisor / hv_base.py
index 55e0bcb..5135b4e 100644 (file)
@@ -1,7 +1,7 @@
 #
 #
 
-# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2012 Google Inc.
+# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2012, 2013 Google Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -206,7 +206,7 @@ class BaseHypervisor(object):
     """Reboot an instance."""
     raise NotImplementedError
 
-  def ListInstances(self):
+  def ListInstances(self, hvparams=None):
     """Get the list of running instances."""
     raise NotImplementedError
 
@@ -263,9 +263,12 @@ class BaseHypervisor(object):
 
     return (cls.ANCILLARY_FILES, cls.ANCILLARY_FILES_OPT)
 
-  def Verify(self):
+  def Verify(self, hvparams=None):
     """Verify the hypervisor.
 
+    @type hvparams: dict of strings
+    @param hvparams: hypervisor parameters to be verified against
+
     @return: Problem description if something is wrong, C{None} otherwise
 
     """
@@ -520,3 +523,17 @@ class BaseHypervisor(object):
       result = utils.RunCmd(["reboot", "-n", "-f"])
       if not result:
         logging.error("Can't run shutdown: %s", result.output)
+
+  @staticmethod
+  def _FormatVerifyResults(msgs):
+    """Formats the verification results, given a list of errors.
+
+    @param msgs: list of errors, possibly empty
+    @return: overall problem description if something is wrong,
+        C{None} otherwise
+
+    """
+    if msgs:
+      return "; ".join(msgs)
+    else:
+      return None