1 From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
2 Date: Fri, 25 Mar 2016 16:12:08 +0100
3 Subject: [PATCH] nova: Fix inject for direct boot with part table.
5 See [1] for full bug description.
6 For now, we detect direct kernel boot with a partition table inside
7 disk image by passing target_partition when root kernel arg points
8 to a partition (instead of the whole disk).
10 [1] https://bugs.launchpad.net/nova/+bug/1290455
12 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
13 Signed-off-by: Stanislaw Kardach <stanislaw.kardach@caviumnetworks.com>
15 .../openstack/files/nova-libvirt-inject.patch | 44 ++++++++++++++++++++++
16 deployment/puppet/openstack_tasks/manifests/roles/compute.pp | 12 ++++++
17 2 files changed, 56 insertions(+)
18 create mode 100644 deployment/puppet/openstack/files/nova-libvirt-inject.patch
20 diff --git a/deployment/puppet/openstack/files/nova-libvirt-inject.patch b/deployment/puppet/openstack/files/nova-libvirt-inject.patch
22 index 0000000..9cbfe5f
24 +++ b/deployment/puppet/openstack/files/nova-libvirt-inject.patch
26 +From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
27 +Date: Tue, 22 Mar 2016 12:05:09 +0100
28 +Subject: [PATCH] Fix inject for direct boot with partition table
30 +See [1] for full bug description.
31 +For now, we detect direct kernel boot with a partition table inside
32 +disk image by passing target_partition when root kernel arg points
33 +to a partition (instead of the whole disk).
35 +[1] https://bugs.launchpad.net/nova/+bug/1290455
37 +Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
38 +Signed-off-by: Stanislaw Kardach <stanislaw.kardach@caviumnetworks.com>
41 +diff --git a/virt/libvirt/driver.py b/virt/libvirt/driver.py
42 +index 920a283..751b140 100644
43 +--- a/virt/libvirt/driver.py
44 ++++ b/virt/libvirt/driver.py
53 +@@ -2820,7 +2821,15 @@
55 + # Handles the partition need to be used.
56 + target_partition = None
57 +- if not instance.kernel_id:
58 ++ image_meta = objects.ImageMeta.from_instance(instance)
59 ++ # FIXME(armband): https://bugs.launchpad.net/nova/+bug/1290455
60 ++ # Support direct kernel boot with a partition table inside disk image:
61 ++ # pass target_partition when root kernel arg points to a partition
62 ++ # (instead of the whole disk).
63 ++ has_partition_table = re.search("root=/dev/.d.([1-9]+)",
64 ++ str(image_meta.properties.get("os_command_line")))
66 ++ if not instance.kernel_id or has_partition_table:
67 + target_partition = CONF.libvirt.inject_partition
68 + if target_partition == 0:
69 + target_partition = None
70 diff --git a/deployment/puppet/openstack_tasks/manifests/roles/compute.pp b/deployment/puppet/openstack_tasks/manifests/roles/compute.pp
71 index 46b1801..d42d6a1 100644
72 --- a/deployment/puppet/openstack_tasks/manifests/roles/compute.pp
73 +++ b/deployment/puppet/openstack_tasks/manifests/roles/compute.pp
74 @@ -281,4 +281,16 @@ class openstack::compute (
76 + # FIXME(armband): Fix inject for part image direct boot (bug LP #1469308)
77 + file { "${nova_path}/libvirt-inject.patch":
79 + source => "puppet:///modules/openstack/nova-libvirt-inject.patch",
81 + exec { 'nova libvirt driver patch partitioned injection':
82 + path => ['/usr/bin'],
83 + command => "patch -p1 < ${nova_path}/libvirt-inject.patch",
84 + unless => "patch -p1 -R -N --dry-run < ${nova_path}/libvirt-inject.patch",
86 + require => [Package['patch']],
88 # FIXME(armband): Workaround for missing arm defaults in nova libvirt driver
89 file { "${nova_path}/libvirt-vga-console.patch":