519 |
519 |
constants.HV_PAE,
|
520 |
520 |
constants.HV_VNC_BIND_ADDRESS,
|
521 |
521 |
constants.HV_KERNEL_PATH,
|
|
522 |
constants.HV_DEVICE_MODEL,
|
522 |
523 |
]
|
523 |
524 |
|
524 |
525 |
@classmethod
|
... | ... | |
566 |
567 |
if not os.path.isabs(hvparams[constants.HV_KERNEL_PATH]):
|
567 |
568 |
raise errors.HypervisorError("The kernel path must be an absolute path")
|
568 |
569 |
|
|
570 |
if not hvparams[constants.HV_DEVICE_MODEL]:
|
|
571 |
raise errors.HypervisorError("Need a device model for the instance")
|
|
572 |
|
|
573 |
if not os.path.isabs(hvparams[constants.HV_DEVICE_MODEL]):
|
|
574 |
raise errors.HypervisorError("The device model must be an absolute path")
|
|
575 |
|
|
576 |
|
569 |
577 |
def ValidateParameters(self, hvparams):
|
570 |
578 |
"""Check the given parameters for validity.
|
571 |
579 |
|
... | ... | |
592 |
600 |
raise errors.HypervisorError("Instance kernel '%s' not found or"
|
593 |
601 |
" not a file" % kernel_path)
|
594 |
602 |
|
|
603 |
device_model = hvparams[constants.HV_DEVICE_MODEL]
|
|
604 |
if not os.path.isfile(device_model):
|
|
605 |
raise errors.HypervisorError("Device model '%s' not found or"
|
|
606 |
" not a file" % device_model)
|
|
607 |
|
595 |
608 |
@classmethod
|
596 |
609 |
def _WriteConfigFile(cls, instance, block_devices):
|
597 |
610 |
"""Create a Xen 3.1 HVM config file.
|
... | ... | |
610 |
623 |
config.write("memory = %d\n" % instance.beparams[constants.BE_MEMORY])
|
611 |
624 |
config.write("vcpus = %d\n" % instance.beparams[constants.BE_VCPUS])
|
612 |
625 |
config.write("name = '%s'\n" % instance.name)
|
613 |
|
if instance.hvparams[constants.HV_PAE]:
|
|
626 |
if hvp[constants.HV_PAE]:
|
614 |
627 |
config.write("pae = 1\n")
|
615 |
628 |
else:
|
616 |
629 |
config.write("pae = 0\n")
|
617 |
|
if instance.hvparams[constants.HV_ACPI]:
|
|
630 |
if hvp[constants.HV_ACPI]:
|
618 |
631 |
config.write("acpi = 1\n")
|
619 |
632 |
else:
|
620 |
633 |
config.write("acpi = 0\n")
|
621 |
634 |
config.write("apic = 1\n")
|
622 |
|
arch = os.uname()[4]
|
623 |
|
if '64' in arch:
|
624 |
|
config.write("device_model = '/usr/lib64/xen/bin/qemu-dm'\n")
|
625 |
|
else:
|
626 |
|
config.write("device_model = '/usr/lib/xen/bin/qemu-dm'\n")
|
|
635 |
config.write("device_model = '%s'\n" % hvp[constants.HV_DEVICE_MODEL])
|
627 |
636 |
config.write("boot = '%s'\n" % hvp[constants.HV_BOOT_ORDER])
|
628 |
637 |
config.write("sdl = 0\n")
|
629 |
638 |
config.write("usb = 1\n")
|