Revision 074ca009
b/lib/constants.py | ||
---|---|---|
287 | 287 |
HV_PAE = "pae" |
288 | 288 |
HV_KERNEL_PATH = "kernel_path" |
289 | 289 |
HV_INITRD_PATH = "initrd_path" |
290 |
HV_ROOT_PATH = "root_path" |
|
290 | 291 |
|
291 | 292 |
HVS_PARAMETERS = frozenset([ |
292 | 293 |
HV_BOOT_ORDER, |
... | ... | |
298 | 299 |
HV_PAE, |
299 | 300 |
HV_KERNEL_PATH, |
300 | 301 |
HV_INITRD_PATH, |
302 |
HV_ROOT_PATH, |
|
301 | 303 |
]) |
302 | 304 |
|
303 | 305 |
# BE parameter names |
... | ... | |
426 | 428 |
HT_XEN_PVM: { |
427 | 429 |
HV_KERNEL_PATH: "/boot/vmlinuz-2.6-xenU", |
428 | 430 |
HV_INITRD_PATH: None, |
431 |
HV_ROOT_PATH: '/dev/sda', |
|
429 | 432 |
}, |
430 | 433 |
HT_XEN_HVM: { |
431 | 434 |
HV_BOOT_ORDER: "cd", |
... | ... | |
439 | 442 |
HT_KVM: { |
440 | 443 |
HV_KERNEL_PATH: "/boot/vmlinuz-2.6-kvmU", |
441 | 444 |
HV_INITRD_PATH: None, |
445 |
HV_ROOT_PATH: '/dev/vda', |
|
442 | 446 |
HV_ACPI: True, |
443 | 447 |
}, |
444 | 448 |
HT_FAKE: { |
b/lib/hypervisor/hv_kvm.py | ||
---|---|---|
51 | 51 |
PARAMETERS = [ |
52 | 52 |
constants.HV_KERNEL_PATH, |
53 | 53 |
constants.HV_INITRD_PATH, |
54 |
constants.HV_ROOT_PATH, |
|
54 | 55 |
constants.HV_ACPI, |
55 | 56 |
] |
56 | 57 |
|
... | ... | |
240 | 241 |
if initrd_path: |
241 | 242 |
kvm_cmd.extend(['-initrd', initrd_path]) |
242 | 243 |
|
243 |
kvm_cmd.extend(['-append', 'console=ttyS0,38400 root=/dev/vda']) |
|
244 |
root_path = instance.hvparams[constants.HV_ROOT_PATH] |
|
245 |
kvm_cmd.extend(['-append', 'console=ttyS0,38400 root=%s ro' % root_path]) |
|
244 | 246 |
|
245 | 247 |
#"hvm_boot_order", |
246 | 248 |
#"hvm_cdrom_image_path", |
... | ... | |
626 | 628 |
if not os.path.isabs(hvparams[constants.HV_KERNEL_PATH]): |
627 | 629 |
raise errors.HypervisorError("The kernel path must be an absolute path") |
628 | 630 |
|
631 |
if not hvparams[constants.HV_ROOT_PATH]: |
|
632 |
raise errors.HypervisorError("Need a root partition for the instance") |
|
633 |
|
|
629 | 634 |
if hvparams[constants.HV_INITRD_PATH]: |
630 | 635 |
if not os.path.isabs(hvparams[constants.HV_INITRD_PATH]): |
631 | 636 |
raise errors.HypervisorError("The initrd path must be an absolute path" |
b/lib/hypervisor/hv_xen.py | ||
---|---|---|
364 | 364 |
PARAMETERS = [ |
365 | 365 |
constants.HV_KERNEL_PATH, |
366 | 366 |
constants.HV_INITRD_PATH, |
367 |
constants.HV_ROOT_PATH, |
|
367 | 368 |
] |
368 | 369 |
|
369 | 370 |
@classmethod |
... | ... | |
386 | 387 |
if not os.path.isabs(hvparams[constants.HV_KERNEL_PATH]): |
387 | 388 |
raise errors.HypervisorError("The kernel path must be an absolute path") |
388 | 389 |
|
390 |
if not hvparams[constants.HV_ROOT_PATH]: |
|
391 |
raise errors.HypervisorError("Need a root partition for the instance") |
|
392 |
|
|
389 | 393 |
if hvparams[constants.HV_INITRD_PATH]: |
390 | 394 |
if not os.path.isabs(hvparams[constants.HV_INITRD_PATH]): |
391 | 395 |
raise errors.HypervisorError("The initrd path must be an absolute path" |
... | ... | |
443 | 447 |
config.write("disk = [%s]\n" % ",".join( |
444 | 448 |
cls._GetConfigFileDiskData(instance.disk_template, |
445 | 449 |
block_devices))) |
446 |
config.write("root = '/dev/sda ro'\n") |
|
450 |
|
|
451 |
rpath = instance.hvparams[constants.HV_ROOT_PATH] |
|
452 |
config.write("root = '%s ro'\n" % rpath) |
|
447 | 453 |
config.write("on_poweroff = 'destroy'\n") |
448 | 454 |
config.write("on_reboot = 'restart'\n") |
449 | 455 |
config.write("on_crash = 'restart'\n") |
Also available in: Unified diff