Revert "Makefile: Finalize RPM repo switch."
[armband.git] / patches / fuel-library / 0009-Update-vga-console-defaults-for-armv7-and-aarch64.patch
1 From: Stanislaw Kardach <stanislaw.kardach@caviumnetworks.com>
2 Date: Tue, 22 Mar 2016 12:05:09 +0100
3 Subject: [PATCH] Update vga, console defaults for armv7 and aarch64
4
5 Nova hardcodes default options for both video=cirrus and console.
6 armv7 and aarch64 VMs require video=vga, and since most applications
7 use PL011 serial driver for guests, adding console=ttyAMA0 is also
8 a nice UX addition.
9 ---
10  .../openstack/files/nova-libvirt-vga-console.patch | 39 ++++++++++++++++++++++
11  deployment/puppet/openstack/manifests/compute.pp   | 19 +++++++++++
12  2 files changed, 58 insertions(+)
13  create mode 100644 deployment/puppet/openstack/files/nova-libvirt-vga-console.patch
14
15 diff --git a/deployment/puppet/openstack/files/nova-libvirt-vga-console.patch b/deployment/puppet/openstack/files/nova-libvirt-vga-console.patch
16 new file mode 100644
17 index 0000000..c5f8e5a
18 --- /dev/null
19 +++ b/deployment/puppet/openstack/files/nova-libvirt-vga-console.patch
20 @@ -0,0 +1,39 @@
21 +From: Stanislaw Kardach <stanislaw.kardach@caviumnetworks.com>
22 +Date: Tue, 22 Mar 2016 12:05:09 +0100
23 +Subject: [PATCH] Update vga, console defaults for armv7 and aarch64
24 +
25 +Nova hardcodes default options for both video=cirrus and console.
26 +armv7 and aarch64 VMs require video=vga, and since most applications
27 +use PL011 serial driver for guests, adding console=ttyAMA0 is also
28 +a nice UX addition.
29 +
30 +Signed-off-by: Stanislaw Kardach <stanislaw.kardach@caviumnetworks.com>
31 +Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
32 +---
33 +
34 +diff --git a/virt/libvirt/driver.py b/virt/libvirt/driver.py
35 +index 920a283..751b140 100644
36 +--- a/virt/libvirt/driver.py
37 ++++ b/virt/libvirt/driver.py
38 +@@ -3834,7 +3834,11 @@
39 +         if virt_type == "xen":
40 +             guest.os_cmdline = "ro root=%s" % root_device_name
41 +         else:
42 ++            guestarch = libvirt_utils.get_arch(image_meta)
43 +             guest.os_cmdline = ("root=%s %s" % (root_device_name, CONSOLE))
44 ++            if guestarch in (arch.ARMV7, arch.AARCH64):
45 ++                # NOTE(armband): ARM v7/v8 use PL011 drv, add ttyAMA0 console
46 ++                guest.os_cmdline += " console=ttyAMA0"
47 +             if virt_type == "qemu":
48 +                 guest.os_cmdline += " no_timer_check"
49 +         if instance.ramdisk_id:
50 +@@ -3972,7 +3972,8 @@ class LibvirtDriver(driver.ComputeDriver):
51 +             video.type = 'xen'
52 +         elif CONF.libvirt.virt_type == 'parallels':
53 +             video.type = 'vga'
54 +-        elif guestarch in (arch.PPC, arch.PPC64):
55 ++        elif guestarch in (arch.ARMV7, arch.AARCH64, arch.PPC, arch.PPC64):
56 ++            # NOTE(armband): Added ARM v7/v8, same as on PPC.
57 +             # NOTE(ldbragst): PowerKVM doesn't support 'cirrus' be default
58 +             # so use 'vga' instead when running on Power hardware.
59 +             video.type = 'vga'
60 diff --git a/deployment/puppet/openstack/manifests/compute.pp b/deployment/puppet/openstack/manifests/compute.pp
61 index c0349dc..46b1801 100644
62 --- a/deployment/puppet/openstack/manifests/compute.pp
63 +++ b/deployment/puppet/openstack/manifests/compute.pp
64 @@ -157,6 +157,12 @@ class openstack::compute (
65      }
66    }
67  
68 +  if ! defined(Package['patch']) {
69 +    package { 'patch':
70 +      ensure => 'present',
71 +    }
72 +  }
73 +
74    $glance_connection = $glance_api_servers
75  
76    case $::osfamily {
77 @@ -250,6 +256,7 @@ class openstack::compute (
78  
79    $memcached_addresses =  suffix($cache_server_ip, inline_template(":<%= @cache_server_port %>"))
80    $notify_on_state_change = 'vm_and_task_state'
81 +  $nova_path = '/usr/lib/python2.7/dist-packages/nova'
82  
83    class { 'nova':
84        install_utilities      => false,
85 @@ -273,6 +280,18 @@ class openstack::compute (
86        service_down_time      => $nova_service_down_time,
87        notify_on_state_change => $notify_on_state_change,
88        memcached_servers      => $memcached_addresses,
89 +  } ->
90 +  # FIXME(armband): Workaround for missing arm defaults in nova libvirt driver
91 +  file { "${nova_path}/libvirt-vga-console.patch":
92 +    ensure => "file",
93 +    source => "puppet:///modules/openstack/nova-libvirt-vga-console.patch",
94 +  } ->
95 +  exec { 'nova libvirt driver patch arm defaults':
96 +    path    => ['/usr/bin'],
97 +    command => "patch -p1 < ${nova_path}/libvirt-vga-console.patch",
98 +    unless  => "patch -p1 -R -N --dry-run < ${nova_path}/libvirt-vga-console.patch",
99 +    cwd     => $nova_path,
100 +    require => [Package['patch']],
101    }
102  
103    if str2bool($::is_virtual) {