Rebase after "Bugfix Broadcast Group".
[armband.git] / patches / fuel-library / 0010-nova-Fix-inject-for-direct-boot-with-part-table.patch
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.
4
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).
9
10 [1] https://bugs.launchpad.net/nova/+bug/1290455
11
12 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
13 Signed-off-by: Stanislaw Kardach <stanislaw.kardach@caviumnetworks.com>
14 ---
15  .../openstack/files/nova-libvirt-inject.patch      | 44 ++++++++++++++++++++++
16  deployment/puppet/openstack/manifests/compute.pp   | 12 ++++++
17  2 files changed, 56 insertions(+)
18  create mode 100644 deployment/puppet/openstack/files/nova-libvirt-inject.patch
19
20 diff --git a/deployment/puppet/openstack/files/nova-libvirt-inject.patch b/deployment/puppet/openstack/files/nova-libvirt-inject.patch
21 new file mode 100644
22 index 0000000..9cbfe5f
23 --- /dev/null
24 +++ b/deployment/puppet/openstack/files/nova-libvirt-inject.patch
25 @@ -0,0 +1,44 @@
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
29 +
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).
34 +
35 +[1] https://bugs.launchpad.net/nova/+bug/1290455
36 +
37 +Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
38 +Signed-off-by: Stanislaw Kardach <stanislaw.kardach@caviumnetworks.com>
39 +---
40 +
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
45 +@@ -34,6 +34,7 @@
46 + import mmap
47 + import operator
48 + import os
49 ++import re
50 + import shutil
51 + import tempfile
52 + import time
53 +@@ -2820,7 +2821,15 @@
54 +         """
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")))
65 ++
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/manifests/compute.pp b/deployment/puppet/openstack/manifests/compute.pp
71 index 46b1801..d42d6a1 100644
72 --- a/deployment/puppet/openstack/manifests/compute.pp
73 +++ b/deployment/puppet/openstack/manifests/compute.pp
74 @@ -281,6 +281,18 @@ class openstack::compute (
75        notify_on_state_change => $notify_on_state_change,
76        memcached_servers      => $memcached_addresses,
77    } ->
78 +  # FIXME(armband): Fix inject for part image direct boot (bug LP #1469308)
79 +  file { "${nova_path}/libvirt-inject.patch":
80 +    ensure => "file",
81 +    source => "puppet:///modules/openstack/nova-libvirt-inject.patch",
82 +  } ->
83 +  exec { 'nova libvirt driver patch partitioned injection':
84 +    path    => ['/usr/bin'],
85 +    command => "patch -p1 < ${nova_path}/libvirt-inject.patch",
86 +    unless  => "patch -p1 -R -N --dry-run < ${nova_path}/libvirt-inject.patch",
87 +    cwd     => $nova_path,
88 +    require => [Package['patch']],
89 +  }
90    # FIXME(armband): Workaround for missing arm defaults in nova libvirt driver
91    file { "${nova_path}/libvirt-vga-console.patch":
92      ensure => "file",