From e1b8653f46b80cf07606fc7bac45f4bd1db75d53 Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Wed, 20 May 2009 14:02:28 +0100
Subject: [PATCH] _RedistributeAncillaryFiles: add hypervisor files

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             |  6 ++++++
 lib/hypervisor/hv_base.py | 14 ++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 35c14b13f..27dfe5f45 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -1572,6 +1572,12 @@ def _RedistributeAncillaryFiles(lu, additional_nodes=None):
                     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):
diff --git a/lib/hypervisor/hv_base.py b/lib/hypervisor/hv_base.py
index 7f100476f..442cd810d 100644
--- a/lib/hypervisor/hv_base.py
+++ b/lib/hypervisor/hv_base.py
@@ -100,6 +100,7 @@ class BaseHypervisor(object):
 
   """
   PARAMETERS = {}
+  ANCILLARY_FILES = []
 
   def __init__(self):
     pass
@@ -157,6 +158,19 @@ class BaseHypervisor(object):
     """
     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.
 
-- 
GitLab