Commit 3fc175f0 authored by Alexander Schreiber's avatar Alexander Schreiber
Browse files

merge r997 from branches/ganeti/ganeti-1.2

Fix gnt-instance modify for HVM parameters

This patch makes gnt-instance modify work again for the advanced
HVM parameters after it was broken by other changes.


Reviewed-by: ultrotter
parent 0f933d15
......@@ -4270,11 +4270,13 @@ class LUSetInstanceParams(LogicalUnit):
# hvm_cdrom_image_path verification
if self.op.hvm_cdrom_image_path is not None:
if not os.path.isabs(self.op.hvm_cdrom_image_path):
if not (os.path.isabs(self.op.hvm_cdrom_image_path) or
self.op.hvm_cdrom_image_path.lower() == "none"):
raise errors.OpPrereqError("The path to the HVM CDROM image must"
" be an absolute path or None, not %s" %
self.op.hvm_cdrom_image_path)
if not os.path.isfile(self.op.hvm_cdrom_image_path):
if not (os.path.isfile(self.op.hvm_cdrom_image_path) or
self.op.hvm_cdrom_image_path.lower() == "none"):
raise errors.OpPrereqError("The HVM CDROM image must either be a"
" regular file or a symlink pointing to"
" an existing regular file, not %s" %
......@@ -4326,14 +4328,17 @@ class LUSetInstanceParams(LogicalUnit):
else:
instance.hvm_boot_order = self.hvm_boot_order
result.append(("hvm_boot_order", self.hvm_boot_order))
if self.hvm_acpi:
if self.hvm_acpi is not None:
instance.hvm_acpi = self.hvm_acpi
result.append(("hvm_acpi", self.hvm_acpi))
if self.hvm_pae:
if self.hvm_pae is not None:
instance.hvm_pae = self.hvm_pae
result.append(("hvm_pae", self.hvm_pae))
if self.hvm_cdrom_image_path:
instance.hvm_cdrom_image_path = self.hvm_cdrom_image_path
if self.hvm_cdrom_image_path == constants.VALUE_NONE:
instance.hvm_cdrom_image_path = None
else:
instance.hvm_cdrom_image_path = self.hvm_cdrom_image_path
result.append(("hvm_cdrom_image_path", self.hvm_cdrom_image_path))
if self.vnc_bind_address:
instance.vnc_bind_address = self.vnc_bind_address
......
......@@ -729,14 +729,15 @@ def SetInstanceParams(opts, args):
else:
hvm_boot_order = opts.hvm_boot_order
hvm_acpi = opts.hvm_acpi == _VALUE_TRUE
hvm_pae = opts.hvm_pae == _VALUE_TRUE
if opts.hvm_acpi is None:
hvm_acpi = opts.hvm_acpi
else:
hvm_acpi = opts.hvm_acpi == _VALUE_TRUE
if ((opts.hvm_cdrom_image_path is not None) and
(opts.hvm_cdrom_image_path.lower() == constants.VALUE_NONE)):
hvm_cdrom_image_path = None
if opts.hvm_pae is None:
hvm_pae = opts.hvm_pae
else:
hvm_cdrom_image_path = opts.hvm_cdrom_image_path
hvm_pae = opts.hvm_pae == _VALUE_TRUE
op = opcodes.OpSetInstanceParams(instance_name=args[0], mem=opts.mem,
vcpus=opts.vcpus, ip=opts.ip,
......@@ -745,7 +746,8 @@ def SetInstanceParams(opts, args):
initrd_path=opts.initrd_path,
hvm_boot_order=hvm_boot_order,
hvm_acpi=hvm_acpi, hvm_pae=hvm_pae,
hvm_cdrom_image_path=hvm_cdrom_image_path,
hvm_cdrom_image_path=
opts.hvm_cdrom_image_path,
vnc_bind_address=opts.vnc_bind_address)
result = SubmitOpCode(op)
......
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