Revision e2ee1cea lib/hypervisor/hv_xen.py
b/lib/hypervisor/hv_xen.py | ||
---|---|---|
518 | 518 |
constants.HV_NIC_TYPE, |
519 | 519 |
constants.HV_PAE, |
520 | 520 |
constants.HV_VNC_BIND_ADDRESS, |
521 |
constants.HV_KERNEL_PATH, |
|
521 | 522 |
] |
522 | 523 |
|
523 | 524 |
@classmethod |
... | ... | |
559 | 560 |
" be an absolute path or None, not %s" % |
560 | 561 |
iso_path) |
561 | 562 |
|
563 |
if not hvparams[constants.HV_KERNEL_PATH]: |
|
564 |
raise errors.HypervisorError("Need a kernel for the instance") |
|
565 |
|
|
566 |
if not os.path.isabs(hvparams[constants.HV_KERNEL_PATH]): |
|
567 |
raise errors.HypervisorError("The kernel path must be an absolute path") |
|
568 |
|
|
562 | 569 |
def ValidateParameters(self, hvparams): |
563 | 570 |
"""Check the given parameters for validity. |
564 | 571 |
|
... | ... | |
580 | 587 |
" an existing regular file, not %s" % |
581 | 588 |
iso_path) |
582 | 589 |
|
590 |
kernel_path = hvparams[constants.HV_KERNEL_PATH] |
|
591 |
if not os.path.isfile(kernel_path): |
|
592 |
raise errors.HypervisorError("Instance kernel '%s' not found or" |
|
593 |
" not a file" % kernel_path) |
|
594 |
|
|
583 | 595 |
@classmethod |
584 | 596 |
def _WriteConfigFile(cls, instance, block_devices): |
585 | 597 |
"""Create a Xen 3.1 HVM config file. |
... | ... | |
589 | 601 |
|
590 | 602 |
config = StringIO() |
591 | 603 |
config.write("# this is autogenerated by Ganeti, please do not edit\n#\n") |
592 |
config.write("kernel = '/usr/lib/xen/boot/hvmloader'\n") |
|
604 |
|
|
605 |
# kernel handling |
|
606 |
kpath = hvp[constants.HV_KERNEL_PATH] |
|
607 |
config.write("kernel = '%s'\n" % kpath) |
|
608 |
|
|
593 | 609 |
config.write("builder = 'hvm'\n") |
594 | 610 |
config.write("memory = %d\n" % instance.beparams[constants.BE_MEMORY]) |
595 | 611 |
config.write("vcpus = %d\n" % instance.beparams[constants.BE_VCPUS]) |
Also available in: Unified diff