_RedistributeAncillaryFiles: add hypervisor files
authorGuido Trotter <ultrotter@google.com>
Wed, 20 May 2009 13:02:28 +0000 (14:02 +0100)
committerGuido Trotter <ultrotter@google.com>
Fri, 22 May 2009 10:01:50 +0000 (11:01 +0100)
Each hypervisor can declare additional files to be shipped to all nodes.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

lib/cmdlib.py
lib/hypervisor/hv_base.py

index 35c14b1..27dfe5f 100644 (file)
@@ -1572,6 +1572,12 @@ def _RedistributeAncillaryFiles(lu, additional_nodes=None):
                     constants.RAPI_CERT_FILE,
                     constants.RAPI_USERS_FILE,
                    ])
                     constants.RAPI_CERT_FILE,
                     constants.RAPI_USERS_FILE,
                    ])
+
+  enabled_hypervisors = lu.cfg.GetClusterInfo().enabled_hypervisors
+  for hv_name in enabled_hypervisors:
+    hv_class = hypervisor.GetHypervisor(hv_name)
+    dist_files.update(hv_class.GetAncillaryFiles())
+
   # 3. Perform the files upload
   for fname in dist_files:
     if os.path.exists(fname):
   # 3. Perform the files upload
   for fname in dist_files:
     if os.path.exists(fname):
index 7f10047..442cd81 100644 (file)
@@ -100,6 +100,7 @@ class BaseHypervisor(object):
 
   """
   PARAMETERS = {}
 
   """
   PARAMETERS = {}
+  ANCILLARY_FILES = []
 
   def __init__(self):
     pass
 
   def __init__(self):
     pass
@@ -157,6 +158,19 @@ class BaseHypervisor(object):
     """
     raise NotImplementedError
 
     """
     raise NotImplementedError
 
+  @classmethod
+  def GetAncillaryFiles(cls):
+    """Return a list of ancillary files to be copied to all nodes as ancillary
+    configuration files.
+
+    @rtype: list of strings
+    @return: list of absolute paths of files to ship cluster-wide
+
+    """
+    # By default we return a member variable, so that if an hypervisor has just
+    # a static list of files it doesn't have to override this function.
+    return cls.ANCILLARY_FILES
+
   def Verify(self):
     """Verify the hypervisor.
 
   def Verify(self):
     """Verify the hypervisor.