From 42f8585ebb8fffad19a89314659ab9129176c3e9 Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Sat, 1 Oct 2016 13:18:11 +0200 Subject: build: Rework patch mechanism for Fuel submodules While refactoring the patching mechanism, take care of: - Sync submodule handling with Fuel@OPFNV; - build: Investigate/prepare for moving patches to Fuel@OPNFV; - build: Investigate divergent fuel-mirror; - ISO build: cacheid for Fuel comps should not depend on Armband git commit; CHANGE: Rename/shuffle patches while grouping them in "features", preparing for upstreaming them to Fuel@OPNFV and beyond. CHANGE: Allow linking patches for better representing the dependency between one patch and different features. e.g. 0001-Add-arch-to-nailgun-release-and-target-image.patch: - part of `multiarch-fuel`, because it extends Fuel; - part of `direct-kernel-boot`, as arch is required for that; - part of `cross-bootstrap`, target image is arch-dependent; NOTE: Patch links are not staged to Fuel@OPNFV, they only serve as markers that a specific patch is part of a feature. CHANGE: Kill all Fuel component submodules, now handled in Fuel@OPNFV: - fuel-agent - fuel-astute - fuel-library - fuel-mirror - fuel-nailgun-agent - fuel-web CHANGE: Move armband-fuel-config.mk to armband git root. FIXME: m1.micro-Increase-profile-RAM-size-to-128MB.patch is NOT part of `cross-bootstrap` feature, but patch context says so ... FIXME: 0001-Add-arm64-deb-repositories-setup.patch is broken at `make patches-export` by removing spaces at EOL. v2 -> v3: * Phony patch support (links to show a patch belongs to a feature); * Updated README.md v3 -> v7: * Re-export Fuel submodules & plugins patches (update patch context); * Update Cavium mail addresses (s/caviumnetworks.com/cavium.com/); * Ignore submodule changes; * Add armband git repo info to gitinfo_fuel.txt at build time; Implements: ARMBAND-136 Closes-bug: ARMBAND-95 Closes-bug: ARMBAND-93 Closes-bug: ARMBAND-92 Change-Id: I1a236d9f43b2e6dca22055911f696b43c22b5973 Signed-off-by: Alexandru Avadanii --- ...oad_cirros-Add-direct-kernel-boot-support.patch | 118 +++++++++++++++++++++ ...ix-inject-for-direct-boot-with-part-table.patch | 92 ++++++++++++++++ 2 files changed, 210 insertions(+) create mode 100644 patches/fuel-library/direct-kernel-boot/0001-upload_cirros-Add-direct-kernel-boot-support.patch create mode 100644 patches/fuel-library/direct-kernel-boot/0002-nova-Fix-inject-for-direct-boot-with-part-table.patch (limited to 'patches/fuel-library/direct-kernel-boot') diff --git a/patches/fuel-library/direct-kernel-boot/0001-upload_cirros-Add-direct-kernel-boot-support.patch b/patches/fuel-library/direct-kernel-boot/0001-upload_cirros-Add-direct-kernel-boot-support.patch new file mode 100644 index 00000000..f3eb0748 --- /dev/null +++ b/patches/fuel-library/direct-kernel-boot/0001-upload_cirros-Add-direct-kernel-boot-support.patch @@ -0,0 +1,118 @@ +From: Stanislaw Kardach +Date: Tue, 15 Mar 2016 15:01:34 +0100 +Subject: [PATCH] upload_cirros: Add direct kernel boot support. + +AArch64 currently only supports direct kernel boot, so add the +functionality of uploading and connecting kernel and initramfs +images (disk formats `AKI` and `ARI`). + +Signed-off-by: Stanislaw Kardach +--- + .../osnailyfacter/modular/astute/upload_cirros.rb | 55 ++++++++++++++++++++-- + 1 file changed, 51 insertions(+), 4 deletions(-) + +diff --git a/deployment/puppet/osnailyfacter/modular/astute/upload_cirros.rb b/deployment/puppet/osnailyfacter/modular/astute/upload_cirros.rb +index f0441b0..371d051 100755 +--- a/deployment/puppet/osnailyfacter/modular/astute/upload_cirros.rb ++++ b/deployment/puppet/osnailyfacter/modular/astute/upload_cirros.rb +@@ -51,12 +51,12 @@ end + def image_list + stdout = `glance --verbose image-list` + return_code = $?.exitstatus +- images = [] ++ images = Hash[] + stdout.split("\n").each do |line| + fields = line.split('|').map { |f| f.chomp.strip } + next if fields[1] == 'ID' + next unless fields[2] +- images << {fields[2] => fields[6]} ++ images[fields[2]] = { :id => fields[1], :status => fields[6] } + end + {:images => images, :exit_code => return_code} + end +@@ -78,6 +78,16 @@ EOF + [ stdout, return_code ] + end + ++# Calls glance update-image with a given property and value ++# Supported properties: 'kernel-id', 'ramdisk-id' ++def update_image(image_id, property, value) ++ command = "/usr/bin/openstack image set --#{property}=#{value} #{image_id}" ++ puts command ++ stdout = `#{command}` ++ return_code = $?.exitstatus ++ [ stdout, return_code ] ++end ++ + # check if Glance is online + # waited until the glance is started because when vCenter used as a glance + # backend launch may takes up to 1 minute. +@@ -133,7 +143,7 @@ end + # return true if image has been uploaded and active + def check_image(image) + list_of_images = image_list +- if list_of_images[:exit_code] == 0 && list_of_images[:images].include?(image['img_name'] => "active") ++ if list_of_images[:exit_code] == 0 && list_of_images[:images].select { |k,v| k == image['img_name'] and v[:status] == "active" }.count > 0 + return true + end + return false +@@ -144,7 +154,7 @@ end + # the first one + def cleanup_image(image) + list_of_images = image_list +- unless list_of_images[:images].select { |img_hash| img_hash.key?(image['img_name']) }.empty? ++ unless list_of_images[:images].select { |img_hash, v| img_hash == image['img_name'] }.count == 0 + delete_image(image['img_name']) + end + end +@@ -157,6 +167,41 @@ def delete_image(image_name) + [ stdout, return_code ] + end + ++# For each disk image try to find a kernel and initramfs images and ++# attach then to it via kernel_id and ramdisk_id glance properties. ++def connect_dependant_images(images) ++ # for each image ++ # get image id from glance ++ img_list = image_list ++ return_code = img_list[:exit_code] ++ if return_code == 0 ++ images.each do |image| ++ img_list[:images].each do |k,v| ++ if k == image['img_name'] ++ image['id'] = v[:id] ++ end ++ end ++ end ++ # for each image that is not in [aki, ari] ++ images.each do |image| ++ next if ['aki', 'ari'].include?(image['disk_format']) ++ images.each do |i| ++ # find aki/ari image whose name starts with this image's name ++ if i['img_name'].start_with?(image['img_name']) ++ ret = 0 ++ if i['disk_format'] == 'aki' ++ _, ret = update_image(image['id'], 'kernel-id', i['id']) ++ elsif i['disk_format'] == 'ari' ++ _, ret = update_image(image['id'], 'ramdisk-id', i['id']) ++ end ++ return_code += ret ++ end ++ end ++ end ++ end ++ return return_code ++end ++ + ######################## + + wait_for_glance +@@ -180,6 +225,8 @@ if errors > 0 + cleanup_image(image) + end + exit 1 ++elsif connect_dependant_images(test_vm_images) > 0 ++ exit 2 + end + + exit 0 diff --git a/patches/fuel-library/direct-kernel-boot/0002-nova-Fix-inject-for-direct-boot-with-part-table.patch b/patches/fuel-library/direct-kernel-boot/0002-nova-Fix-inject-for-direct-boot-with-part-table.patch new file mode 100644 index 00000000..7cc743af --- /dev/null +++ b/patches/fuel-library/direct-kernel-boot/0002-nova-Fix-inject-for-direct-boot-with-part-table.patch @@ -0,0 +1,92 @@ +From: Alexandru Avadanii +Date: Fri, 25 Mar 2016 16:12:08 +0100 +Subject: [PATCH] nova: Fix inject for direct boot with part table. + +See [1] for full bug description. +For now, we detect direct kernel boot with a partition table inside +disk image by passing target_partition when root kernel arg points +to a partition (instead of the whole disk). + +[1] https://bugs.launchpad.net/nova/+bug/1290455 + +Signed-off-by: Alexandru Avadanii +Signed-off-by: Stanislaw Kardach +--- + .../openstack/files/nova-libvirt-inject.patch | 44 ++++++++++++++++++++++ + .../openstack_tasks/manifests/roles/compute.pp | 12 ++++++ + 2 files changed, 56 insertions(+) + create mode 100644 deployment/puppet/openstack/files/nova-libvirt-inject.patch + +diff --git a/deployment/puppet/openstack/files/nova-libvirt-inject.patch b/deployment/puppet/openstack/files/nova-libvirt-inject.patch +new file mode 100644 +index 0000000..b86927e +--- /dev/null ++++ b/deployment/puppet/openstack/files/nova-libvirt-inject.patch +@@ -0,0 +1,44 @@ ++From: Alexandru Avadanii ++Date: Tue, 22 Mar 2016 12:05:09 +0100 ++Subject: [PATCH] Fix inject for direct boot with partition table ++ ++See [1] for full bug description. ++For now, we detect direct kernel boot with a partition table inside ++disk image by passing target_partition when root kernel arg points ++to a partition (instead of the whole disk). ++ ++[1] https://bugs.launchpad.net/nova/+bug/1290455 ++ ++Signed-off-by: Alexandru Avadanii ++Signed-off-by: Stanislaw Kardach ++--- ++ ++diff --git a/virt/libvirt/driver.py b/virt/libvirt/driver.py ++index 920a283..751b140 100644 ++--- a/virt/libvirt/driver.py +++++ b/virt/libvirt/driver.py ++@@ -34,6 +34,7 @@ ++ import mmap ++ import operator ++ import os +++import re ++ import shutil ++ import tempfile ++ import time ++@@ -2820,7 +2821,15 @@ ++ """ ++ # Handles the partition need to be used. ++ target_partition = None ++- if not instance.kernel_id: +++ image_meta = objects.ImageMeta.from_instance(instance) +++ # FIXME(armband): https://bugs.launchpad.net/nova/+bug/1290455 +++ # Support direct kernel boot with a partition table inside disk image: +++ # pass target_partition when root kernel arg points to a partition +++ # (instead of the whole disk). +++ has_partition_table = re.search("root=/dev/.d.([1-9]+)", +++ str(image_meta.properties.get("os_command_line"))) +++ +++ if not instance.kernel_id or has_partition_table: ++ target_partition = CONF.libvirt.inject_partition ++ if target_partition == 0: ++ target_partition = None +diff --git a/deployment/puppet/openstack_tasks/manifests/roles/compute.pp b/deployment/puppet/openstack_tasks/manifests/roles/compute.pp +index dc61033..3fcfb51 100644 +--- a/deployment/puppet/openstack_tasks/manifests/roles/compute.pp ++++ b/deployment/puppet/openstack_tasks/manifests/roles/compute.pp +@@ -319,6 +319,18 @@ class openstack_tasks::roles::compute { + cinder_catalog_info => pick($nova_hash_real['cinder_catalog_info'], 'volumev2:cinderv2:internalURL'), + rabbit_heartbeat_timeout_threshold => $::os_service_default, + } -> ++ # FIXME(armband): Fix inject for part image direct boot (bug LP #1469308) ++ file { "${nova_path}/libvirt-inject.patch": ++ ensure => "file", ++ source => "puppet:///modules/openstack/nova-libvirt-inject.patch", ++ } -> ++ exec { 'nova libvirt driver patch partitioned injection': ++ path => ['/usr/bin'], ++ command => "patch -p1 < ${nova_path}/libvirt-inject.patch", ++ unless => "patch -p1 -R -N --dry-run < ${nova_path}/libvirt-inject.patch", ++ cwd => $nova_path, ++ require => [Package['patch']], ++ } -> + # FIXME(armband): Workaround for missing arm defaults in nova libvirt driver + file { "${nova_path}/libvirt-vga-console.patch": + ensure => "file", -- cgit 1.2.3-korg