Commit 40ed12dd authored by Guido Trotter's avatar Guido Trotter
Browse files

Fix CreateInstance new optional parameters

Some new paramenters of the CreateInstance opcode are optional (namely
kernel_path, initrd_path and hvm_boot_order) but their absence makes the code
crash. Fix this by initializing them to a default value if they're not present.

Reviewed-by: iustinp
parent c19dfc03
......@@ -2890,6 +2890,10 @@ class LUCreateInstance(LogicalUnit):
"""Check prerequisites.
"""
for attr in ["kernel_path", "initrd_path", "hvm_boot_order"]:
if not hasattr(self.op, attr):
setattr(self.op, attr, None)
if self.op.mode not in (constants.INSTANCE_CREATE,
constants.INSTANCE_IMPORT):
raise errors.OpPrereqError("Invalid instance creation mode '%s'" %
......
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