Commit 69ab2e12 authored by Guido Trotter's avatar Guido Trotter
Browse files

Add hypervisors ancillary files list



These lists will be used to declare some of the files not necessarily
needed on all nodes. The files selected are files without which the
various hypervisors can still work, but that when they are present
should be synchronized across the cluster (or node group).
Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 22d568c2
......@@ -203,7 +203,7 @@ def _BuildUploadFileList():
for hv_name in constants.HYPER_TYPES:
hv_class = hypervisor.GetHypervisorClass(hv_name)
allowed_files.update(hv_class.GetAncillaryFiles())
allowed_files.update(hv_class.GetAncillaryFiles()[0])
return frozenset(allowed_files)
......
......@@ -3760,7 +3760,7 @@ def _ComputeAncillaryFiles(cluster, redist):
# Files which should only be on VM-capable nodes
files_vm = set(filename
for hv_name in cluster.enabled_hypervisors
for filename in hypervisor.GetHypervisor(hv_name).GetAncillaryFiles())
for filename in hypervisor.GetHypervisor(hv_name).GetAncillaryFiles()[0])
# Filenames must be unique
assert (len(files_all | files_all_opt | files_mc | files_vm) ==
......
......@@ -133,6 +133,7 @@ class BaseHypervisor(object):
"""
PARAMETERS = {}
ANCILLARY_FILES = []
ANCILLARY_FILES_OPT = []
CAN_MIGRATE = False
def __init__(self):
......@@ -221,13 +222,16 @@ class BaseHypervisor(object):
"""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
@rtype: (list of absolute paths, list of absolute paths)
@return: (all files, optional files)
"""
# 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
assert set(cls.ANCILLARY_FILES).issuperset(cls.ANCILLARY_FILES_OPT), \
"Optional ancillary files must be a subset of ancillary files"
return (cls.ANCILLARY_FILES, cls.ANCILLARY_FILES_OPT)
def Verify(self):
"""Verify the hypervisor.
......
......@@ -475,6 +475,9 @@ class KVMHypervisor(hv_base.BaseHypervisor):
ANCILLARY_FILES = [
_KVM_NETWORK_SCRIPT,
]
ANCILLARY_FILES_OPT = [
_KVM_NETWORK_SCRIPT,
]
def __init__(self):
hv_base.BaseHypervisor.__init__(self)
......
......@@ -55,6 +55,9 @@ class XenHypervisor(hv_base.BaseHypervisor):
XL_CONFIG_FILE,
VIF_BRIDGE_SCRIPT,
]
ANCILLARY_FILES_OPT = [
XL_CONFIG_FILE,
]
@staticmethod
def _ConfigFileName(instance_name):
......@@ -589,6 +592,9 @@ class XenHvmHypervisor(XenHypervisor):
ANCILLARY_FILES = XenHypervisor.ANCILLARY_FILES + [
constants.VNC_PASSWORD_FILE,
]
ANCILLARY_FILES_OPT = XenHypervisor.ANCILLARY_FILES_OPT + [
constants.VNC_PASSWORD_FILE,
]
PARAMETERS = {
constants.HV_ACPI: hv_base.NO_CHECK,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment