Commit 2872a949 authored by Manuel Franceschini's avatar Manuel Franceschini
Browse files

Modify cluster-init to create file-storage-dir

This patch adds three things:
- it normalizes the file storage directory path passed to gnt-cluster init
- if the file-storage-path doesn't exist on the master node, ganeti
  tries to create it
- adds additional check if the passed file-storage-dir is not a directory

Reviewed-by: iustinp
parent 39e9e213
......@@ -478,14 +478,23 @@ class LUInitCluster(LogicalUnit):
if vgstatus:
raise errors.OpPrereqError("Error: %s" % vgstatus)
self.op.file_storage_dir = os.path.normpath(self.op.file_storage_dir)
if not os.path.isabs(self.op.file_storage_dir):
raise errors.OpPrereqError("The file storage directory you have is"
" not an absolute path.")
if not os.path.exists(self.op.file_storage_dir):
raise errors.OpPrereqError("Default file storage directory '%s' does "
"not exist. Please create." %
os.makedirs(self.op.file_storage_dir, 0750)
except OSError, err:
raise errors.OpPrereqError("Cannot create file storage directory"
" '%s': %s" %
(self.op.file_storage_dir, err))
if not os.path.isdir(self.op.file_storage_dir):
raise errors.OpPrereqError("The file storage directory '%s' is not"
" a directory." % self.op.file_storage_dir)
if not re.match("^[0-9a-z]{2}:[0-9a-z]{2}:[0-9a-z]{2}$",
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