Skip to content
Snippets Groups Projects
Commit e2ee1cea authored by Iustin Pop's avatar Iustin Pop
Browse files

Implement the KERNEL_PATH parameter for xen-hvm


For the xen-hvm hypervisor, the KERNEL_PATH parameter is needed but
today is hardcoded to a constants in the xen hypervisor library (argh!).

This patch moves this to a hypervisor constant with the default value
being the current hardcoded path. This will allow cluster/instance
customisation based on the installed xen version.

This should fix Debian bug #528618.

Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent d1268971
No related branches found
No related tags found
No related merge requests found
......@@ -488,6 +488,7 @@ HVC_DEFAULTS = {
HV_VNC_BIND_ADDRESS: '0.0.0.0',
HV_ACPI: True,
HV_PAE: True,
HV_KERNEL_PATH: "/usr/lib/xen/boot/hvmloader",
},
HT_KVM: {
HV_KERNEL_PATH: "/boot/vmlinuz-2.6-kvmU",
......
......@@ -518,6 +518,7 @@ class XenHvmHypervisor(XenHypervisor):
constants.HV_NIC_TYPE,
constants.HV_PAE,
constants.HV_VNC_BIND_ADDRESS,
constants.HV_KERNEL_PATH,
]
@classmethod
......@@ -559,6 +560,12 @@ class XenHvmHypervisor(XenHypervisor):
" be an absolute path or None, not %s" %
iso_path)
if not hvparams[constants.HV_KERNEL_PATH]:
raise errors.HypervisorError("Need a kernel for the instance")
if not os.path.isabs(hvparams[constants.HV_KERNEL_PATH]):
raise errors.HypervisorError("The kernel path must be an absolute path")
def ValidateParameters(self, hvparams):
"""Check the given parameters for validity.
......@@ -580,6 +587,11 @@ class XenHvmHypervisor(XenHypervisor):
" an existing regular file, not %s" %
iso_path)
kernel_path = hvparams[constants.HV_KERNEL_PATH]
if not os.path.isfile(kernel_path):
raise errors.HypervisorError("Instance kernel '%s' not found or"
" not a file" % kernel_path)
@classmethod
def _WriteConfigFile(cls, instance, block_devices):
"""Create a Xen 3.1 HVM config file.
......@@ -589,7 +601,11 @@ class XenHvmHypervisor(XenHypervisor):
config = StringIO()
config.write("# this is autogenerated by Ganeti, please do not edit\n#\n")
config.write("kernel = '/usr/lib/xen/boot/hvmloader'\n")
# kernel handling
kpath = hvp[constants.HV_KERNEL_PATH]
config.write("kernel = '%s'\n" % kpath)
config.write("builder = 'hvm'\n")
config.write("memory = %d\n" % instance.beparams[constants.BE_MEMORY])
config.write("vcpus = %d\n" % instance.beparams[constants.BE_VCPUS])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment