Commit cb91d46e authored by Iustin Pop's avatar Iustin Pop
Browse files

Since the watcher can run on all nodes, let's get rid of the cron file

handling, as it can be static and outside of ganeti.

This also means we can get rid of a lot of infrastructure too:
  - the master/node config files checkers
  - one rpc function
parent ee7d831d
......@@ -243,9 +243,6 @@ class ServerObject(pb.Avatar):
def perspective_version(self, params):
return constants.PROTOCOL_VERSION
def perspective_configfile_list(self, params):
return backend.ListConfigFiles()
def perspective_upload_file(self, params):
return backend.UploadFile(*params)
......
......@@ -43,23 +43,6 @@ from ganeti import objects
from ganeti import ssconf
def ListConfigFiles():
"""Return a list of the config files present on the local node.
"""
configfiles = []
for testfile in constants.MASTER_CONFIGFILES:
if os.path.exists(testfile):
configfiles.append(testfile)
for testfile in constants.NODE_CONFIGFILES:
if os.path.exists(testfile):
configfiles.append(testfile)
return configfiles
def StartMaster():
"""Activate local node as master node.
......@@ -75,8 +58,6 @@ def StartMaster():
" error: '%s'" % (result.cmd, result.output))
return False
utils.RemoveFile(constants.MASTER_CRON_LINK)
os.symlink(constants.MASTER_CRON_FILE, constants.MASTER_CRON_LINK)
return True
......@@ -95,8 +76,6 @@ def StopMaster():
" error: '%s'" % (result.cmd, result.output))
return False
utils.RemoveFile(constants.MASTER_CRON_LINK)
return True
......
......@@ -738,7 +738,6 @@ class LUVerifyCluster(NoHooksLU):
bad = True
return bad
def _VerifyOrphanInstances(self, instancelist, node_instance, feedback_fn):
"""Verify the list of running instances.
......@@ -754,28 +753,6 @@ class LUVerifyCluster(NoHooksLU):
bad = True
return bad
def _VerifyNodeConfigFiles(self, ismaster, node, file_list, feedback_fn):
"""Verify the list of node config files"""
bad = False
for file_name in constants.MASTER_CONFIGFILES:
if ismaster and file_name not in file_list:
feedback_fn(" - ERROR: master config file %s missing from master"
" node %s" % (file_name, node))
bad = True
elif not ismaster and file_name in file_list:
feedback_fn(" - ERROR: master config file %s should not exist"
" on non-master node %s" % (file_name, node))
bad = True
for file_name in constants.NODE_CONFIGFILES:
if file_name not in file_list:
feedback_fn(" - ERROR: config file %s missing from node %s" %
(file_name, node))
bad = True
return bad
def CheckPrereq(self):
"""Check prerequisites.
......@@ -801,11 +778,12 @@ class LUVerifyCluster(NoHooksLU):
# FIXME: verify OS list
# do local checksums
file_names = constants.CLUSTER_CONF_FILES
file_names = list(self.sstore.GetFileList())
file_names.append(constants.SSL_CERT_FILE)
file_names.append(constants.CLUSTER_CONF_FILE)
local_checksums = utils.FingerprintFiles(file_names)
feedback_fn("* Gathering data (%d nodes)" % len(nodelist))
all_configfile = rpc.call_configfile_list(nodelist)
all_volumeinfo = rpc.call_volume_list(nodelist, vg_name)
all_instanceinfo = rpc.call_instance_list(nodelist)
all_vglist = rpc.call_vg_list(nodelist)
......@@ -823,16 +801,6 @@ class LUVerifyCluster(NoHooksLU):
all_vglist[node], all_nvinfo[node],
all_rversion[node], feedback_fn)
bad = bad or result
# node_configfile
nodeconfigfile = all_configfile[node]
if not nodeconfigfile:
feedback_fn(" - ERROR: connection to %s failed" % (node))
bad = True
continue
bad = bad or self._VerifyNodeConfigFiles(node==master, node,
nodeconfigfile, feedback_fn)
# node_volume
volumeinfo = all_volumeinfo[node]
......@@ -1452,8 +1420,7 @@ class LUAddNode(LogicalUnit):
logger.Error("copy of file %s to node %s failed" %
(fname, to_node))
to_copy = [constants.MASTER_CRON_FILE]
to_copy.extend(ss.GetFileList())
to_copy = ss.GetFileList()
for fname in to_copy:
if not ssh.CopyFileToNode(node, fname):
logger.Error("could not copy file %s to node %s" % (fname, node))
......
......@@ -33,15 +33,9 @@ EXPORT_VERSION = 0
DATA_DIR = "/var/lib/ganeti"
CLUSTER_CONF_FILE = DATA_DIR + "/config.data"
SSL_CERT_FILE = DATA_DIR + "/server.pem"
HYPERCONF_FILE = DATA_DIR + "/hypervisor"
WATCHER_STATEFILE = DATA_DIR + "/restart_state"
ETC_DIR = "/etc/ganeti"
MASTER_CRON_FILE = ETC_DIR + "/master-cron"
MASTER_CRON_LINK = "/etc/cron.d/ganeti-master-cron"
NODE_INITD_SCRIPT = "/etc/init.d/ganeti"
NODE_INITD_NAME = "ganeti"
DEFAULT_NODED_PORT = 1811
FIRST_DRBD_PORT = 11000
LAST_DRBD_PORT = 14999
......@@ -84,27 +78,6 @@ INSTANCE_IMPORT = "import"
DISK_TEMPLATES = frozenset([DT_DISKLESS, DT_PLAIN,
DT_LOCAL_RAID1, DT_REMOTE_RAID1])
# file groups
CLUSTER_CONF_FILES = ["/etc/hosts",
"/etc/ssh/ssh_known_hosts",
"/etc/ssh/ssh_host_dsa_key",
"/etc/ssh/ssh_host_dsa_key.pub",
"/etc/ssh/ssh_host_rsa_key",
"/etc/ssh/ssh_host_rsa_key.pub",
"/root/.ssh/authorized_keys",
"/root/.ssh/id_dsa",
"/root/.ssh/id_dsa.pub",
CLUSTER_CONF_FILE,
SSL_CERT_FILE,
MASTER_CRON_FILE,
]
MASTER_CONFIGFILES = [MASTER_CRON_LINK,]
NODE_CONFIGFILES = [NODE_INITD_SCRIPT,
"/etc/rc2.d/S20%s" % NODE_INITD_NAME,
"/etc/rc0.d/K80%s" % NODE_INITD_NAME]
# import/export config options
INISECT_EXP = "export"
INISECT_INS = "instance"
......
......@@ -451,17 +451,6 @@ def call_version(node_list):
return c.getresult()
def call_configfile_list(node_list):
"""Return list of existing configuration files.
This is a multi-node call.
"""
c = Client("configfile_list", [])
c.connect_list(node_list)
c.run()
return c.getresult()
def call_blockdev_create(node, bdev, size, on_primary):
"""Request creation of a given block device.
......
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