Commit d9a798f8 authored by Klaus Aehlig's avatar Klaus Aehlig

Relax cleanliness condition to allow the empty tree

When, at cluster init, checking for left overs of a previous
cluster, only look for spurious files. This will the directory
structure to be set up ahead of time.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarPetr Pudlak <pudlak@google.com>
parent 5b645c9f
......@@ -576,20 +576,16 @@ def InitCluster(cluster_name, mac_prefix, # pylint: disable=R0913, R0914
errors.ECODE_STATE)
data_dir = vcluster.AddNodePrefix(pathutils.DATA_DIR)
if os.path.isdir(data_dir):
for entry in os.listdir(data_dir):
if not os.path.isdir(os.path.join(data_dir, entry)):
raise errors.OpPrereqError(
"%s contains non-directory enries like %s. Remove left-overs of an"
" old cluster before initialising a new one" % (data_dir, entry),
errors.ECODE_STATE)
queue_dir = vcluster.AddNodePrefix(pathutils.QUEUE_DIR)
if os.path.isdir(queue_dir) and os.listdir(queue_dir):
raise errors.OpPrereqError(
"%s not empty. Remove left-overs of an old cluster before initialising"
" a new one" % queue_dir,
errors.ECODE_STATE)
archive_dir = vcluster.AddNodePrefix(pathutils.JOB_QUEUE_ARCHIVE_DIR)
for ddir in [queue_dir, data_dir, archive_dir]:
if os.path.isdir(ddir):
for entry in os.listdir(ddir):
if not os.path.isdir(os.path.join(ddir, entry)):
raise errors.OpPrereqError(
"%s contains non-directory enries like %s. Remove left-overs of an"
" old cluster before initialising a new one" % (ddir, entry),
errors.ECODE_STATE)
if not enabled_hypervisors:
raise errors.OpPrereqError("Enabled hypervisors list must contain at"
......
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