Revision 77bad5b2
b/lib/cmdlib.py | ||
---|---|---|
2875 | 2875 |
lu.proc.LogWarning(msg) |
2876 | 2876 |
|
2877 | 2877 |
|
2878 |
def _RedistributeAncillaryFiles(lu, additional_nodes=None): |
|
2878 |
def _RedistributeAncillaryFiles(lu, additional_nodes=None, additional_vm=True):
|
|
2879 | 2879 |
"""Distribute additional files which are part of the cluster configuration. |
2880 | 2880 |
|
2881 | 2881 |
ConfigWriter takes care of distributing the config and ssconf files, but |
... | ... | |
2884 | 2884 |
|
2885 | 2885 |
@param lu: calling logical unit |
2886 | 2886 |
@param additional_nodes: list of nodes not in the config to distribute to |
2887 |
@type additional_vm: boolean |
|
2888 |
@param additional_vm: whether the additional nodes are vm-capable or not |
|
2887 | 2889 |
|
2888 | 2890 |
""" |
2889 | 2891 |
# 1. Gather target nodes |
2890 | 2892 |
myself = lu.cfg.GetNodeInfo(lu.cfg.GetMasterNode()) |
2891 | 2893 |
dist_nodes = lu.cfg.GetOnlineNodeList() |
2894 |
nvm_nodes = lu.cfg.GetNonVmCapableNodeList() |
|
2895 |
vm_nodes = [name for name in dist_nodes if name not in nvm_nodes] |
|
2892 | 2896 |
if additional_nodes is not None: |
2893 | 2897 |
dist_nodes.extend(additional_nodes) |
2898 |
if additional_vm: |
|
2899 |
vm_nodes.extend(additional_nodes) |
|
2894 | 2900 |
if myself.name in dist_nodes: |
2895 | 2901 |
dist_nodes.remove(myself.name) |
2902 |
if myself.name in vm_nodes: |
|
2903 |
vm_nodes.remove(myself.name) |
|
2896 | 2904 |
|
2897 | 2905 |
# 2. Gather files to distribute |
2898 | 2906 |
dist_files = set([constants.ETC_HOSTS, |
... | ... | |
2903 | 2911 |
constants.CLUSTER_DOMAIN_SECRET_FILE, |
2904 | 2912 |
]) |
2905 | 2913 |
|
2914 |
vm_files = set() |
|
2906 | 2915 |
enabled_hypervisors = lu.cfg.GetClusterInfo().enabled_hypervisors |
2907 | 2916 |
for hv_name in enabled_hypervisors: |
2908 | 2917 |
hv_class = hypervisor.GetHypervisor(hv_name) |
2909 |
dist_files.update(hv_class.GetAncillaryFiles())
|
|
2918 |
vm_files.update(hv_class.GetAncillaryFiles())
|
|
2910 | 2919 |
|
2911 | 2920 |
# 3. Perform the files upload |
2912 | 2921 |
for fname in dist_files: |
2913 | 2922 |
_UploadHelper(lu, dist_nodes, fname) |
2923 |
for fname in vm_files: |
|
2924 |
_UploadHelper(lu, vm_nodes, fname) |
|
2914 | 2925 |
|
2915 | 2926 |
|
2916 | 2927 |
class LURedistributeConfig(NoHooksLU): |
Also available in: Unified diff