Commit 2c313123 authored by Manuel Franceschini's avatar Manuel Franceschini
Browse files

Bugfix instance create when file-storage-dir None

os.path.join does not like None as argument and fails with
AttributeError: 'NoneType' object has no attribute 'startswith'.

This patch makes sure the passed argument is a string in any case.

Reviewed-by: iustinp
parent 1c6e3627
......@@ -3196,10 +3196,16 @@ class LUCreateInstance(LogicalUnit):
else:
network_port = None
# this is needed because os.path.join does not accept None arguments
if self.op.file_storage_dir is None:
string_file_storage_dir = ""
else:
string_file_storage_dir = self.op.file_storage_dir
# build the full file storage dir path
file_storage_dir = os.path.normpath(os.path.join(
self.sstore.GetFileStorageDir(),
self.op.file_storage_dir, instance))
string_file_storage_dir, instance))
disks = _GenerateDiskTemplate(self.cfg,
......
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