HV_PAE = "pae"
HV_KERNEL_PATH = "kernel_path"
HV_INITRD_PATH = "initrd_path"
+HV_ROOT_PATH = "root_path"
HVS_PARAMETERS = frozenset([
HV_BOOT_ORDER,
HV_PAE,
HV_KERNEL_PATH,
HV_INITRD_PATH,
+ HV_ROOT_PATH,
])
# BE parameter names
HT_XEN_PVM: {
HV_KERNEL_PATH: "/boot/vmlinuz-2.6-xenU",
HV_INITRD_PATH: None,
+ HV_ROOT_PATH: '/dev/sda',
},
HT_XEN_HVM: {
HV_BOOT_ORDER: "cd",
HT_KVM: {
HV_KERNEL_PATH: "/boot/vmlinuz-2.6-kvmU",
HV_INITRD_PATH: None,
+ HV_ROOT_PATH: '/dev/vda',
HV_ACPI: True,
},
HT_FAKE: {
PARAMETERS = [
constants.HV_KERNEL_PATH,
constants.HV_INITRD_PATH,
+ constants.HV_ROOT_PATH,
constants.HV_ACPI,
]
if initrd_path:
kvm_cmd.extend(['-initrd', initrd_path])
- kvm_cmd.extend(['-append', 'console=ttyS0,38400 root=/dev/vda'])
+ root_path = instance.hvparams[constants.HV_ROOT_PATH]
+ kvm_cmd.extend(['-append', 'console=ttyS0,38400 root=%s ro' % root_path])
#"hvm_boot_order",
#"hvm_cdrom_image_path",
if not os.path.isabs(hvparams[constants.HV_KERNEL_PATH]):
raise errors.HypervisorError("The kernel path must be an absolute path")
+ if not hvparams[constants.HV_ROOT_PATH]:
+ raise errors.HypervisorError("Need a root partition for the instance")
+
if hvparams[constants.HV_INITRD_PATH]:
if not os.path.isabs(hvparams[constants.HV_INITRD_PATH]):
raise errors.HypervisorError("The initrd path must be an absolute path"
PARAMETERS = [
constants.HV_KERNEL_PATH,
constants.HV_INITRD_PATH,
+ constants.HV_ROOT_PATH,
]
@classmethod
if not os.path.isabs(hvparams[constants.HV_KERNEL_PATH]):
raise errors.HypervisorError("The kernel path must be an absolute path")
+ if not hvparams[constants.HV_ROOT_PATH]:
+ raise errors.HypervisorError("Need a root partition for the instance")
+
if hvparams[constants.HV_INITRD_PATH]:
if not os.path.isabs(hvparams[constants.HV_INITRD_PATH]):
raise errors.HypervisorError("The initrd path must be an absolute path"
config.write("disk = [%s]\n" % ",".join(
cls._GetConfigFileDiskData(instance.disk_template,
block_devices)))
- config.write("root = '/dev/sda ro'\n")
+
+ rpath = instance.hvparams[constants.HV_ROOT_PATH]
+ config.write("root = '%s ro'\n" % rpath)
config.write("on_poweroff = 'destroy'\n")
config.write("on_reboot = 'restart'\n")
config.write("on_crash = 'restart'\n")