From e7e2d84bec0d404057bce203f9c90231360e88ee Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Tue, 31 May 2016 22:34:54 +0200 Subject: Rebase: deploy related patch series. After change "common.py: catch stderr in exec_cmd" [1] and other unrelated changes were merged upstream, we need to rebase the complete deploy related series. While we're at it, re-export Fuel@OPNFV patches in Armband. [1] https://gerrit.opnfv.org/gerrit/#/c/14561/ Change-Id: Icbc8261c2e24e4b29e8f5f2bc83db6829219129a --- .../0001-Allow-customizing-Fuel-commit.patch | 21 -- ...llow-specifying-number-of-attempts-in-exe.patch | 70 +++++++ ...low-customizing-java-and-fuel-mirror-URLs.patch | 42 ---- ...i_adapter-simplify-retry-if-command-fails.patch | 168 +++++++++++++++ .../0003-Add-arm64-deb-repositories-setup.patch | 166 --------------- ...lFuel-Add-temp_dir-and-vm_name-attributes.patch | 57 +++++ .../0004-Build-bootstrap-image-for-arm64.patch | 37 ---- ...l-factor-out-image-creation-into-a-method.patch | 35 ++++ ...bootstrap-Use-public-Ubuntu-ports-mirrors.patch | 48 ----- ...irtual_fuel-make-vm_template-an-attribute.patch | 44 ++++ ...bootstrap-Add-armband-rtc-efi-fix-package.patch | 38 ---- ...l_fuel-initial-support-for-remote-libvirt.patch | 233 +++++++++++++++++++++ ...llow-customizing-fuel-plugin-opendaylight.patch | 26 --- ...l-add-XML-tree-as-attribute-of-VirtualFue.patch | 62 ++++++ ...l-prepare-class-to-allow-multiple-bridges.patch | 75 +++++++ ...09-deploy.py-add-multiple-bridges-support.patch | 69 ++++++ ...build-Makefile-Use-python-debian-from-pip.patch | 29 --- ...eploy.sh-allow-specifying-several-bridges.patch | 47 +++++ .../0011-deploy.sh-accept-a-timeout-flag-T.patch | 81 +++++++ .../0012-Fuel-VM-for-the-Enea-Armband-lab.patch | 106 ++++++++++ ...lFuel-Add-temp_dir-and-vm_name-attributes.patch | 57 ----- ...ant-Generate-extra-interfaces-config-file.patch | 107 ++++++++++ .../0014-deploy.sh-no-need-to-set-umask-0000.patch | 33 +++ ...l-factor-out-image-creation-into-a-method.patch | 35 ---- .../opnfv-fuel/0015-Remove-check-for-root.patch | 80 +++++++ ..._fuel-initial-support-for-libvirt-volumes.patch | 209 ------------------ .../0016-Allow-customizing-Fuel-commit.patch | 21 ++ .../opnfv-fuel/0016-Remove-check-for-root.patch | 79 ------- ...low-customizing-java-and-fuel-mirror-URLs.patch | 42 ++++ ...virtual_fuel-make-vm_template-an-attibute.patch | 33 --- ...reap.py-Dump-extra-interfaces-information.patch | 90 ++++++++ ...l-add-XML-tree-as-attribute-of-VirtualFue.patch | 102 --------- ...ploy-ipmi-adapter-Add-port-config-support.patch | 74 +++++++ ...ant-Generate-extra-interfaces-config-file.patch | 107 ---------- .../0020-Add-arm64-deb-repositories-setup.patch | 166 +++++++++++++++ .../0020-deploy.sh-no-need-to-set-umask-0000.patch | 33 --- .../0021-Build-bootstrap-image-for-arm64.patch | 39 ++++ ...llow-specifying-number-of-attempts-in-exe.patch | 70 ------- ...bootstrap-Use-public-Ubuntu-ports-mirrors.patch | 48 +++++ ...i_adapter-simplify-retry-if-command-fails.patch | 171 --------------- ...bootstrap-Add-armband-rtc-efi-fix-package.patch | 38 ++++ ...23-deploy.py-add-multiple-bridges-support.patch | 68 ------ ...llow-customizing-fuel-plugin-opendaylight.patch | 26 +++ ...eploy.sh-allow-specifying-several-bridges.patch | 47 ----- .../0025-Fuel-VM-for-the-Enea-Armband-lab.patch | 106 ---------- ...build-Makefile-Use-python-debian-from-pip.patch | 29 +++ .../0026-deploy.sh-accept-a-timeout-flag-T.patch | 81 ------- ...build-Repeat-mirror-build-up-to-ten-times.patch | 73 +++++++ ...date-bootstrap-target-build-time-estimate.patch | 47 +++++ ...reap.py-Dump-extra-interfaces-information.patch | 90 -------- .../0028-bootstrap-Add-lshw-package.patch | 30 +++ ...build-Repeat-mirror-build-up-to-ten-times.patch | 73 ------- ...date-bootstrap-target-build-time-estimate.patch | 47 ----- ...ploy-ipmi-adapter-Add-port-config-support.patch | 74 ------- .../0031-bootstrap-Add-lshw-package.patch | 30 --- 55 files changed, 1990 insertions(+), 1919 deletions(-) delete mode 100644 patches/opnfv-fuel/0001-Allow-customizing-Fuel-commit.patch create mode 100644 patches/opnfv-fuel/0001-common.py-allow-specifying-number-of-attempts-in-exe.patch delete mode 100644 patches/opnfv-fuel/0002-Allow-customizing-java-and-fuel-mirror-URLs.patch create mode 100644 patches/opnfv-fuel/0002-ipmi_adapter-simplify-retry-if-command-fails.patch delete mode 100644 patches/opnfv-fuel/0003-Add-arm64-deb-repositories-setup.patch create mode 100644 patches/opnfv-fuel/0003-VirtualFuel-Add-temp_dir-and-vm_name-attributes.patch delete mode 100644 patches/opnfv-fuel/0004-Build-bootstrap-image-for-arm64.patch create mode 100644 patches/opnfv-fuel/0004-virtual_fuel-factor-out-image-creation-into-a-method.patch delete mode 100644 patches/opnfv-fuel/0005-bootstrap-Use-public-Ubuntu-ports-mirrors.patch create mode 100644 patches/opnfv-fuel/0005-virtual_fuel-make-vm_template-an-attribute.patch delete mode 100644 patches/opnfv-fuel/0006-bootstrap-Add-armband-rtc-efi-fix-package.patch create mode 100644 patches/opnfv-fuel/0006-virtual_fuel-initial-support-for-remote-libvirt.patch delete mode 100644 patches/opnfv-fuel/0007-Allow-customizing-fuel-plugin-opendaylight.patch create mode 100644 patches/opnfv-fuel/0007-virtual_fuel-add-XML-tree-as-attribute-of-VirtualFue.patch create mode 100644 patches/opnfv-fuel/0008-virtual_fuel-prepare-class-to-allow-multiple-bridges.patch create mode 100644 patches/opnfv-fuel/0009-deploy.py-add-multiple-bridges-support.patch delete mode 100644 patches/opnfv-fuel/0009-f_repobuild-Makefile-Use-python-debian-from-pip.patch create mode 100644 patches/opnfv-fuel/0010-deploy.sh-allow-specifying-several-bridges.patch create mode 100644 patches/opnfv-fuel/0011-deploy.sh-accept-a-timeout-flag-T.patch create mode 100644 patches/opnfv-fuel/0012-Fuel-VM-for-the-Enea-Armband-lab.patch delete mode 100644 patches/opnfv-fuel/0013-VirtualFuel-Add-temp_dir-and-vm_name-attributes.patch create mode 100644 patches/opnfv-fuel/0013-transplant-Generate-extra-interfaces-config-file.patch create mode 100644 patches/opnfv-fuel/0014-deploy.sh-no-need-to-set-umask-0000.patch delete mode 100644 patches/opnfv-fuel/0014-virtual_fuel-factor-out-image-creation-into-a-method.patch create mode 100644 patches/opnfv-fuel/0015-Remove-check-for-root.patch delete mode 100644 patches/opnfv-fuel/0015-virtual_fuel-initial-support-for-libvirt-volumes.patch create mode 100644 patches/opnfv-fuel/0016-Allow-customizing-Fuel-commit.patch delete mode 100644 patches/opnfv-fuel/0016-Remove-check-for-root.patch create mode 100644 patches/opnfv-fuel/0017-Allow-customizing-java-and-fuel-mirror-URLs.patch delete mode 100644 patches/opnfv-fuel/0017-virtual_fuel-make-vm_template-an-attibute.patch create mode 100644 patches/opnfv-fuel/0018-deploy-reap.py-Dump-extra-interfaces-information.patch delete mode 100644 patches/opnfv-fuel/0018-virtual_fuel-add-XML-tree-as-attribute-of-VirtualFue.patch create mode 100644 patches/opnfv-fuel/0019-deploy-ipmi-adapter-Add-port-config-support.patch delete mode 100644 patches/opnfv-fuel/0019-transplant-Generate-extra-interfaces-config-file.patch create mode 100644 patches/opnfv-fuel/0020-Add-arm64-deb-repositories-setup.patch delete mode 100644 patches/opnfv-fuel/0020-deploy.sh-no-need-to-set-umask-0000.patch create mode 100644 patches/opnfv-fuel/0021-Build-bootstrap-image-for-arm64.patch delete mode 100644 patches/opnfv-fuel/0021-common.py-allow-specifying-number-of-attempts-in-exe.patch create mode 100644 patches/opnfv-fuel/0022-bootstrap-Use-public-Ubuntu-ports-mirrors.patch delete mode 100644 patches/opnfv-fuel/0022-ipmi_adapter-simplify-retry-if-command-fails.patch create mode 100644 patches/opnfv-fuel/0023-bootstrap-Add-armband-rtc-efi-fix-package.patch delete mode 100644 patches/opnfv-fuel/0023-deploy.py-add-multiple-bridges-support.patch create mode 100644 patches/opnfv-fuel/0024-Allow-customizing-fuel-plugin-opendaylight.patch delete mode 100644 patches/opnfv-fuel/0024-deploy.sh-allow-specifying-several-bridges.patch delete mode 100644 patches/opnfv-fuel/0025-Fuel-VM-for-the-Enea-Armband-lab.patch create mode 100644 patches/opnfv-fuel/0025-f_repobuild-Makefile-Use-python-debian-from-pip.patch delete mode 100644 patches/opnfv-fuel/0026-deploy.sh-accept-a-timeout-flag-T.patch create mode 100644 patches/opnfv-fuel/0026-f_repobuild-Repeat-mirror-build-up-to-ten-times.patch create mode 100644 patches/opnfv-fuel/0027-UX-Update-bootstrap-target-build-time-estimate.patch delete mode 100644 patches/opnfv-fuel/0027-deploy-reap.py-Dump-extra-interfaces-information.patch create mode 100644 patches/opnfv-fuel/0028-bootstrap-Add-lshw-package.patch delete mode 100644 patches/opnfv-fuel/0028-f_repobuild-Repeat-mirror-build-up-to-ten-times.patch delete mode 100644 patches/opnfv-fuel/0029-UX-Update-bootstrap-target-build-time-estimate.patch delete mode 100644 patches/opnfv-fuel/0030-deploy-ipmi-adapter-Add-port-config-support.patch delete mode 100644 patches/opnfv-fuel/0031-bootstrap-Add-lshw-package.patch (limited to 'patches') diff --git a/patches/opnfv-fuel/0001-Allow-customizing-Fuel-commit.patch b/patches/opnfv-fuel/0001-Allow-customizing-Fuel-commit.patch deleted file mode 100644 index cf962502..00000000 --- a/patches/opnfv-fuel/0001-Allow-customizing-Fuel-commit.patch +++ /dev/null @@ -1,21 +0,0 @@ -From: Stanislaw Kardach -Date: Sun, 21 Feb 2016 16:28:02 +0100 -Subject: [PATCH] Allow customizing Fuel commit - ---- - build/config.mk | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/build/config.mk b/build/config.mk -index 667575c..30d9ccc 100644 ---- a/build/config.mk -+++ b/build/config.mk -@@ -9,7 +9,7 @@ - ############################################################################## - - FUEL_MAIN_REPO := https://github.com/openstack/fuel-main --FUEL_MAIN_TAG = 9.0 -+FUEL_MAIN_TAG := 9.0 - MOS_VERSION = 9.0 - OPENSTACK_VERSION = mitaka-9.0 - diff --git a/patches/opnfv-fuel/0001-common.py-allow-specifying-number-of-attempts-in-exe.patch b/patches/opnfv-fuel/0001-common.py-allow-specifying-number-of-attempts-in-exe.patch new file mode 100644 index 00000000..b3cd2dc9 --- /dev/null +++ b/patches/opnfv-fuel/0001-common.py-allow-specifying-number-of-attempts-in-exe.patch @@ -0,0 +1,70 @@ +From: Josep Puigdemont +Date: Fri, 6 May 2016 03:28:26 +0200 +Subject: [PATCH] common.py: allow specifying number of attempts in exec_cmd + +Some commands executed by exec_cmd may fail because of a temporary +cause, and it may be desirable to retry the same command several times +until it succeeds. One example of this are the ipmitool commands, which +may fail temorarily on some targets if they get too many requests +simultaneously. + +In this patch three new optional parameters are introduced to the +function signature, which do not break backward compatibility: + attempts: which indicates how many times the command should be run if + it returns a non-zero value*, and defaults to 1 (as today). + delay: which indicates the delay in seconds between attempts, and + defaults to 5 seconds. + verbose: It will print the remaining attempts left for the current + command if set to True. + +* It may be desirable to add yet another parameter to indicate what + return value should be considered an error, but non-zero for now + seems a reasonable default. + +Signed-off-by: Josep Puigdemont +--- + deploy/common.py | 24 +++++++++++++++++------- + 1 file changed, 17 insertions(+), 7 deletions(-) + +diff --git a/deploy/common.py b/deploy/common.py +index 41b4e27..3cd3e0e 100644 +--- a/deploy/common.py ++++ b/deploy/common.py +@@ -16,6 +16,7 @@ import argparse + import shutil + import stat + import errno ++import time + + N = {'id': 0, 'status': 1, 'name': 2, 'cluster': 3, 'ip': 4, 'mac': 5, + 'roles': 6, 'pending_roles': 7, 'online': 8, 'group_id': 9} +@@ -37,13 +38,22 @@ out_handler.setFormatter(formatter) + LOG.addHandler(out_handler) + os.chmod(LOGFILE, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) + +-def exec_cmd(cmd, check=True): +- process = subprocess.Popen(cmd, +- stdout=subprocess.PIPE, +- stderr=subprocess.PIPE, +- shell=True) +- (response, stderr) = process.communicate() +- return_code = process.returncode ++def exec_cmd(cmd, check=True, attempts=1, delay=5, verbose=False): ++ # a negative value means forever ++ while attempts != 0: ++ attempts = attempts - 1 ++ process = subprocess.Popen(cmd, ++ stdout=subprocess.PIPE, ++ stderr=subprocess.PIPE, ++ shell=True) ++ (response, stderr) = process.communicate() ++ return_code = process.returncode ++ if return_code == 0 or attempts == 0: ++ break ++ time.sleep(delay) ++ if verbose: ++ log('%d attempts left: %s' % (attempts, cmd)) ++ + response = response.strip() + if check: + if return_code > 0: diff --git a/patches/opnfv-fuel/0002-Allow-customizing-java-and-fuel-mirror-URLs.patch b/patches/opnfv-fuel/0002-Allow-customizing-java-and-fuel-mirror-URLs.patch deleted file mode 100644 index 719ec935..00000000 --- a/patches/opnfv-fuel/0002-Allow-customizing-java-and-fuel-mirror-URLs.patch +++ /dev/null @@ -1,42 +0,0 @@ -From: Stanislaw Kardach -Date: Wed, 24 Feb 2016 20:02:25 +0100 -Subject: [PATCH] Allow customizing java and fuel-mirror URLs - ---- - build/f_isoroot/f_odlpluginbuild/config.mk | 2 +- - build/f_isoroot/f_repobuild/Makefile | 3 ++- - 2 files changed, 3 insertions(+), 2 deletions(-) - -diff --git a/build/f_isoroot/f_odlpluginbuild/config.mk b/build/f_isoroot/f_odlpluginbuild/config.mk -index a5e8a96..e64a05e 100644 ---- a/build/f_isoroot/f_odlpluginbuild/config.mk -+++ b/build/f_isoroot/f_odlpluginbuild/config.mk -@@ -12,6 +12,6 @@ ODL_CHANGE=ec9474c1178e7451ec75f6e306ac84424a84a28a - ODL_REPO="https://github.com/openstack/fuel-plugin-opendaylight.git" - - export USE_JAVA8=true --export JAVA8_URL=https://launchpad.net/~openjdk-r/+archive/ubuntu/ppa/+files/openjdk-8-jre-headless_8u72-b15-1~trusty1_amd64.deb -+export JAVA8_URL:=https://launchpad.net/~openjdk-r/+archive/ubuntu/ppa/+files/openjdk-8-jre-headless_8u72-b15-1~trusty1_amd64.deb - export ODL_TARBALL_LOCATION=https://nexus.opendaylight.org/content/repositories/opendaylight.release/org/opendaylight/integration/distribution-karaf/0.4.1-Beryllium-SR1/distribution-karaf-0.4.1-Beryllium-SR1.tar.gz - export ODL_VERSION_NUMBER=0.4.1 -diff --git a/build/f_isoroot/f_repobuild/Makefile b/build/f_isoroot/f_repobuild/Makefile -index e95dbf2..709ca6b 100644 ---- a/build/f_isoroot/f_repobuild/Makefile -+++ b/build/f_isoroot/f_repobuild/Makefile -@@ -12,6 +12,7 @@ SHELL := /bin/bash - TOP := $(shell pwd) - TMP_ROOT_DIR := $(shell echo "$(MIRROR_UBUNTU_ROOT)" | cut -d "/" -f2) - # Enable use of exact repo commit if defined, else use Fuel main branch -+FUEL_MIRROR_REPO:=https://github.com/openstack/fuel-mirror - FUEL_MIRROR_COMMIT?=$(FUEL_MAIN_TAG) - - include ../../config.mk -@@ -26,7 +27,7 @@ nailgun: - sudo apt-get install -y git libxml2-dev libxslt-dev python-dev python-pip libz-dev libyaml-dev createrepo python-yaml - rm -Rf nailgun - sudo mkdir -p /var/www/nailgun -- git clone https://github.com/openstack/fuel-mirror -+ git clone $(FUEL_MIRROR_REPO) - cd fuel-mirror && git checkout -q $(FUEL_MIRROR_COMMIT) - sudo pip install -U -r ./fuel-mirror/requirements.txt - sudo pip install ./fuel-mirror diff --git a/patches/opnfv-fuel/0002-ipmi_adapter-simplify-retry-if-command-fails.patch b/patches/opnfv-fuel/0002-ipmi_adapter-simplify-retry-if-command-fails.patch new file mode 100644 index 00000000..4fb3cb95 --- /dev/null +++ b/patches/opnfv-fuel/0002-ipmi_adapter-simplify-retry-if-command-fails.patch @@ -0,0 +1,168 @@ +From: Josep Puigdemont +Date: Fri, 6 May 2016 12:09:58 +0200 +Subject: [PATCH] ipmi_adapter: simplify, retry if command fails + +The method get_node_state has been added to the the IpmiAdapter class. + +In addition, now the power on/off methods will try several times to +perform their IPMI command before giving up, instead of bailing out at +the first error. + +After the power on/off command is completed, the method will wait until +the node is in the desired state. + +NOTE: a command could potentially take several minutes if the defaults +are used; each IPMI command can take up to 1 minute, and there can be 3 +commands issued per operation, one of them may be retried 20 times with +the current defaults. Ideally we would use eventlet or something similar +to allow each command a limited time to execute, instead: + + with eventlet.timeout.Timeout(seconds) as t: + power_on/off_command + +Signed-off-by: Josep Puigdemont +--- + deploy/dha_adapters/ipmi_adapter.py | 101 +++++++++++++++--------------------- + 1 file changed, 42 insertions(+), 59 deletions(-) + +diff --git a/deploy/dha_adapters/ipmi_adapter.py b/deploy/dha_adapters/ipmi_adapter.py +index 8fda4f9..283bd57 100644 +--- a/deploy/dha_adapters/ipmi_adapter.py ++++ b/deploy/dha_adapters/ipmi_adapter.py +@@ -1,5 +1,6 @@ + ############################################################################### + # Copyright (c) 2015 Ericsson AB and others. ++# (c) 2016 Enea Software AB + # szilard.cserey@ericsson.com + # All rights reserved. This program and the accompanying materials + # are made available under the terms of the Apache License, Version 2.0 +@@ -20,8 +21,10 @@ from common import ( + + class IpmiAdapter(HardwareAdapter): + +- def __init__(self, yaml_path): ++ def __init__(self, yaml_path, attempts=20, delay=3): + super(IpmiAdapter, self).__init__(yaml_path) ++ self.attempts = attempts ++ self.delay = delay + + def get_access_info(self, node_id): + ip = self.get_node_property(node_id, 'ipmiIp') +@@ -40,69 +43,46 @@ class IpmiAdapter(HardwareAdapter): + mac_list.append(self.get_node_property(node_id, 'pxeMac').lower()) + return mac_list + ++ def node_get_state(self, node_id): ++ state = exec_cmd('%s chassis power status' % self.ipmi_cmd(node_id), ++ attempts=self.attempts, delay=self.delay, ++ verbose=True) ++ return state ++ ++ def __node_power_cmd__(self, node_id, cmd): ++ expected = 'Chassis Power is %s' % cmd ++ if self.node_get_state(node_id) == expected: ++ return ++ ++ pow_cmd = '%s chassis power %s' % (self.ipmi_cmd(node_id), cmd) ++ exec_cmd(pow_cmd, attempts=self.attempts, delay=self.delay, ++ verbose=True) ++ ++ attempts = self.attempts ++ while attempts: ++ state = self.node_get_state(node_id) ++ attempts -= 1 ++ if state == expected: ++ return ++ elif attempts != 0: ++ # reinforce our will, but allow the command to fail, ++ # we know our message got across once already... ++ exec_cmd(pow_cmd, check=False) ++ ++ err('Could not set chassis %s for node %s' % (cmd, node_id)) ++ + def node_power_on(self, node_id): +- WAIT_LOOP = 200 +- SLEEP_TIME = 3 + log('Power ON Node %s' % node_id) +- cmd_prefix = self.ipmi_cmd(node_id) +- state = exec_cmd('%s chassis power status' % cmd_prefix) +- if state == 'Chassis Power is off': +- exec_cmd('%s chassis power on' % cmd_prefix) +- done = False +- for i in range(WAIT_LOOP): +- state, _ = exec_cmd('%s chassis power status' % cmd_prefix, +- False) +- if state == 'Chassis Power is on': +- done = True +- break +- else: +- time.sleep(SLEEP_TIME) +- if not done: +- err('Could Not Power ON Node %s' % node_id) ++ self.__node_power_cmd__(node_id, 'on') + + def node_power_off(self, node_id): +- WAIT_LOOP = 200 +- SLEEP_TIME = 3 + log('Power OFF Node %s' % node_id) +- cmd_prefix = self.ipmi_cmd(node_id) +- state = exec_cmd('%s chassis power status' % cmd_prefix) +- if state == 'Chassis Power is on': +- done = False +- exec_cmd('%s chassis power off' % cmd_prefix) +- for i in range(WAIT_LOOP): +- state, _ = exec_cmd('%s chassis power status' % cmd_prefix, +- False) +- if state == 'Chassis Power is off': +- done = True +- break +- else: +- time.sleep(SLEEP_TIME) +- if not done: +- err('Could Not Power OFF Node %s' % node_id) ++ self.__node_power_cmd__(node_id, 'off') + + def node_reset(self, node_id): +- WAIT_LOOP = 600 + log('RESET Node %s' % node_id) +- cmd_prefix = self.ipmi_cmd(node_id) +- state = exec_cmd('%s chassis power status' % cmd_prefix) +- if state == 'Chassis Power is on': +- was_shut_off = False +- done = False +- exec_cmd('%s chassis power reset' % cmd_prefix) +- for i in range(WAIT_LOOP): +- state, _ = exec_cmd('%s chassis power status' % cmd_prefix, +- False) +- if state == 'Chassis Power is off': +- was_shut_off = True +- elif state == 'Chassis Power is on' and was_shut_off: +- done = True +- break +- time.sleep(1) +- if not done: +- err('Could Not RESET Node %s' % node_id) +- else: +- err('Cannot RESET Node %s because it\'s not Active, state: %s' +- % (node_id, state)) ++ cmd = '%s chassis power reset' % self.ipmi_cmd(node_id) ++ exec_cmd(cmd, attempts=self.attempts, delay=self.delay, verbose=True) + + def node_set_boot_order(self, node_id, boot_order_list): + log('Set boot order %s on Node %s' % (boot_order_list, node_id)) +@@ -111,9 +91,12 @@ class IpmiAdapter(HardwareAdapter): + for dev in boot_order_list: + if dev == 'pxe': + exec_cmd('%s chassis bootdev pxe options=persistent' +- % cmd_prefix) ++ % cmd_prefix, attempts=self.attempts, delay=self.delay, ++ verbose=True) + elif dev == 'iso': +- exec_cmd('%s chassis bootdev cdrom' % cmd_prefix) ++ exec_cmd('%s chassis bootdev cdrom' % cmd_prefix, ++ attempts=self.attempts, delay=self.delay, verbose=True) + elif dev == 'disk': + exec_cmd('%s chassis bootdev disk options=persistent' +- % cmd_prefix) ++ % cmd_prefix, attempts=self.attempts, delay=self.delay, ++ verbose=True) diff --git a/patches/opnfv-fuel/0003-Add-arm64-deb-repositories-setup.patch b/patches/opnfv-fuel/0003-Add-arm64-deb-repositories-setup.patch deleted file mode 100644 index 8b2dd534..00000000 --- a/patches/opnfv-fuel/0003-Add-arm64-deb-repositories-setup.patch +++ /dev/null @@ -1,166 +0,0 @@ -From: Stanislaw Kardach -Date: Wed, 24 Feb 2016 20:04:03 +0100 -Subject: [PATCH] Add arm64 deb repositories setup - ---- - build/f_isoroot/f_kscfg/ks.cfg | 1 + - build/install/apt-ftparchive-deb.conf | 8 +++++++- - build/install/apt-ftparchive-release.conf | 2 +- - build/install/apt-ftparchive-udeb.conf | 7 ++++++- - build/install/install.sh | 22 ++++++++++++++++++---- - build/install/uninstall.sh | 18 ++++++++++-------- - 6 files changed, 43 insertions(+), 15 deletions(-) - -diff --git a/build/f_isoroot/f_kscfg/ks.cfg.patch b/build/f_isoroot/f_kscfg/ks.cfg.patch -index a6840e4..e1ae8fc 100644 ---- a/build/f_isoroot/f_kscfg/ks.cfg.patch -+++ b/build/f_isoroot/f_kscfg/ks.cfg.patch -@@ -1,6 +1,16 @@ - *** /dev/null 2016-04-26 10:10:11.481587709 +0200 - --- ks.cfg 2016-04-26 10:10:11.481587709 +0200 - *************** -+*** 448,453 **** -+--- 448,454 ---- -+ cp ${SOURCE}/.treeinfo ${repodir}/centos/x86_64 -+ -+ # Copying Ubuntu files -++ # FIXME: This is missleading as dist/pool may contain multiple arch! -+ mkdir -p ${repodir}/ubuntu/x86_64/images -+ cp -r ${SOURCE}/ubuntu/dists ${repodir}/ubuntu/x86_64 -+ cp -r ${SOURCE}/ubuntu/pool ${repodir}/ubuntu/x86_64 -+*************** - *** 579,584 **** - --- 579,592 ---- - -diff --git a/build/install/apt-ftparchive-deb.conf b/build/install/apt-ftparchive-deb.conf -index 0d15aec..e6392f8 100644 ---- a/build/install/apt-ftparchive-deb.conf -+++ b/build/install/apt-ftparchive-deb.conf -@@ -16,12 +16,18 @@ TreeDefault { - Directory "pool"; - }; - --BinDirectory "pool/main" { -+BinDirectory "pool/main/binary-amd64" { - Packages "dists/trusty/main/binary-amd64/Packages"; - BinOverride "./indices/override.trusty.main"; - ExtraOverride "./indices/override.trusty.extra.main"; - }; - -+BinDirectory "pool/main/binary-arm64" { -+ Packages "dists/trusty/main/binary-arm64/Packages"; -+ BinOverride "./indices/override.trusty.main"; -+ ExtraOverride "./indices/override.trusty.extra.main"; -+}; -+ - Default { - Packages { - Extensions ".deb"; -diff --git a/build/install/apt-ftparchive-release.conf b/build/install/apt-ftparchive-release.conf -index 02706bd..2838714 100644 ---- a/build/install/apt-ftparchive-release.conf -+++ b/build/install/apt-ftparchive-release.conf -@@ -13,6 +13,6 @@ APT::FTPArchive::Release::Label "Ubuntu"; - APT::FTPArchive::Release::Suite "trusty"; - APT::FTPArchive::Release::Version "1.04"; - APT::FTPArchive::Release::Codename "trusty"; --APT::FTPArchive::Release::Architectures "amd64"; -+APT::FTPArchive::Release::Architectures "amd64 arm64"; - APT::FTPArchive::Release::Components "main"; - APT::FTPArchive::Release::Description "Ubuntu Trusty Tahr 14.04 LTS"; -diff --git a/build/install/apt-ftparchive-udeb.conf b/build/install/apt-ftparchive-udeb.conf -index 3b5b239..c6ab4fb 100644 ---- a/build/install/apt-ftparchive-udeb.conf -+++ b/build/install/apt-ftparchive-udeb.conf -@@ -16,11 +16,16 @@ TreeDefault { - Directory "pool"; - }; - --BinDirectory "pool/debian-installer" { -+BinDirectory "pool/debian-installer/binary-amd64" { - Packages "dists/trusty/main/debian-installer/binary-amd64/Packages"; - BinOverride "./indices/override.trusty.main.debian-installer"; - }; - -+BinDirectory "pool/debian-installer/binary-arm64" { -+ Packages "dists/trusty/main/debian-installer/binary-arm64/Packages"; -+ BinOverride "./indices/override.trusty.main.debian-installer"; -+}; -+ - Default { - Packages { - Extensions ".udeb"; -diff --git a/build/install/install.sh b/build/install/install.sh -index 4e0389e..8c29e08 100755 ---- a/build/install/install.sh -+++ b/build/install/install.sh -@@ -122,12 +122,24 @@ prep_make_live() { - ssh-copy-id root@$FUELHOST - sshfs root@1${FUELHOST}:/ $TMP_HOSTMOUNT - -- if [ -f $REPO/dists/trusty/main/binary-amd64/Packages.backup ]; then -+ for arch in arm64 amd64; do -+ if [ -f $REPO/dists/trusty/main/binary-${arch}/Packages.backup ]; then -+ echo "Error - found backup file for Packages for ${arch}!" -+ exit 1 -+ fi -+ -+ if [ -f $REPO/dists/trusty/main/binary-${arch}/Packages.gz.backup ]; then -+ echo "Error - found backup file for Packages.gz for ${arch}!" -+ exit 1 -+ fi -+ done -+ -+ if [ -f $REPO/dists/trusty/main/binary-arm64/Packages.backup ]; then - echo "Error - found backup file for Packages!" - exit 1 - fi - -- if [ -f $REPO/dists/trusty/main/binary-amd64/Packages.gz.backup ]; then -+ if [ -f $REPO/dists/trusty/main/binary-arm64/Packages.gz.backup ]; then - echo "Error - found backup file for Packages.gz!" - exit 1 - fi -@@ -142,8 +154,10 @@ prep_make_live() { - exit 1 - fi - -- cp $REPO/dists/trusty/main/binary-amd64/Packages $REPO/dists/trusty/main/binary-amd64/Packages.backup -- cp $REPO/dists/trusty/main/binary-amd64/Packages.gz $REPO/dists/trusty/main/binary-amd64/Packages.gz.backup -+ for arch in arm64 amd64; do -+ cp $REPO/dists/trusty/main/binary-${arch}/Packages $REPO/dists/trusty/main/binary-${arch}/Packages.backup -+ cp $REPO/dists/trusty/main/binary-${arch}/Packages.gz $REPO/dists/trusty/main/binary-${arch}/Packages.gz.backup -+ done - cp $REPO/dists/trusty/Release $REPO/dists/trusty/Release.backup - cp -Rvp $DEST/etc/puppet $DEST/etc/puppet.backup - } -diff --git a/build/install/uninstall.sh b/build/install/uninstall.sh -index a9e74bc..e90c632 100755 ---- a/build/install/uninstall.sh -+++ b/build/install/uninstall.sh -@@ -31,15 +31,17 @@ DEST=$MOUNT - REPO=$DEST/var/www/nailgun/ubuntu/fuelweb/x86_64 - - cd $REPO --if [ ! -f $REPO/dists/trusty/main/binary-amd64/Packages.backup ]; then -- echo "Error - didn't find backup file for Packages!" -- exit 1 --fi -+for arch in arm64 amd64; do -+ if [ ! -f $REPO/dists/trusty/main/binary-${arch}/Packages.backup ]; then -+ echo "Error - didn't find backup file for Packages for ${arch}!" -+ exit 1 -+ fi - --if [ ! -f $REPO/dists/trusty/main/binary-amd64/Packages.gz.backup ]; then -- echo "Error - didn't find backup file for Packages.gz!" -- exit 1 --fi -+ if [ ! -f $REPO/dists/trusty/main/binary-${arch}/Packages.gz.backup ]; then -+ echo "Error - didn't find backup file for Packages.gz for ${arch}!" -+ exit 1 -+ fi -+done - - if [ ! -f $REPO/dists/trusty/Release.backup ]; then - echo "Error - didn't find backup file for Release!" diff --git a/patches/opnfv-fuel/0003-VirtualFuel-Add-temp_dir-and-vm_name-attributes.patch b/patches/opnfv-fuel/0003-VirtualFuel-Add-temp_dir-and-vm_name-attributes.patch new file mode 100644 index 00000000..83d6e292 --- /dev/null +++ b/patches/opnfv-fuel/0003-VirtualFuel-Add-temp_dir-and-vm_name-attributes.patch @@ -0,0 +1,57 @@ +From: Josep Puigdemont +Date: Wed, 4 May 2016 14:27:23 +0200 +Subject: [PATCH] VirtualFuel: Add temp_dir and vm_name attributes + +These two variables are defined in one of the methods right now. They +will be useful to other methods too, so we add them as attributes to the +object here. + +Signed-off-by: Josep Puigdemont +--- + deploy/environments/virtual_fuel.py | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +diff --git a/deploy/environments/virtual_fuel.py b/deploy/environments/virtual_fuel.py +index cb3bc6c..966bb91 100644 +--- a/deploy/environments/virtual_fuel.py ++++ b/deploy/environments/virtual_fuel.py +@@ -25,6 +25,12 @@ class VirtualFuel(ExecutionEnvironment): + def __init__(self, storage_dir, pxe_bridge, dha_file, root_dir): + super(VirtualFuel, self).__init__(storage_dir, dha_file, root_dir) + self.pxe_bridge = pxe_bridge ++ self.temp_dir = tempfile.mkdtemp() ++ self.vm_name = self.dha.get_node_property(self.fuel_node_id, ++ 'libvirtName') ++ ++ def __del__(self): ++ delete(self.temp_dir) + + def set_vm_nic(self, temp_vm_file): + with open(temp_vm_file) as f: +@@ -46,23 +52,20 @@ class VirtualFuel(ExecutionEnvironment): + vm_xml.write(f, pretty_print=True, xml_declaration=True) + + def create_vm(self): +- temp_dir = tempfile.mkdtemp() +- vm_name = self.dha.get_node_property(self.fuel_node_id, 'libvirtName') + vm_template = '%s/%s' % (self.root_dir, + self.dha.get_node_property( + self.fuel_node_id, 'libvirtTemplate')) + check_file_exists(vm_template) +- disk_path = '%s/%s.raw' % (self.storage_dir, vm_name) ++ disk_path = '%s/%s.raw' % (self.storage_dir, self.vm_name) + disk_sizes = self.dha.get_disks() + disk_size = disk_sizes['fuel'] + exec_cmd('qemu-img create -f qcow2 %s %s' % (disk_path, disk_size)) +- temp_vm_file = '%s/%s' % (temp_dir, vm_name) ++ temp_vm_file = '%s/%s' % (self.temp_dir, self.vm_name) + exec_cmd('cp %s %s' % (vm_template, temp_vm_file)) + self.set_vm_nic(temp_vm_file) + vm_definition_overwrite = self.dha.get_vm_definition('fuel') +- self.define_vm(vm_name, temp_vm_file, disk_path, ++ self.define_vm(self.vm_name, temp_vm_file, disk_path, + vm_definition_overwrite) +- delete(temp_dir) + + def setup_environment(self): + check_if_root() diff --git a/patches/opnfv-fuel/0004-Build-bootstrap-image-for-arm64.patch b/patches/opnfv-fuel/0004-Build-bootstrap-image-for-arm64.patch deleted file mode 100644 index 454cef68..00000000 --- a/patches/opnfv-fuel/0004-Build-bootstrap-image-for-arm64.patch +++ /dev/null @@ -1,37 +0,0 @@ -From: Stanislaw Kardach -Date: Thu, 3 Mar 2016 19:04:07 +0100 -Subject: [PATCH] Build bootstrap image for arm64 - -For now the arch is hardcoded for simplicity. We should detect this -but how? If we're multi-arch then one bootstrap image should be built -per supported arch. This requires Fuel refactoring. ---- - build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/build/bootstrap_admin_node.sh.patch -+++ b/build/bootstrap_admin_node.sh.patch -@@ -53,6 +53,23 @@ - # Enable iptables - systemctl enable iptables.service - *************** -+*** 484,490 **** -+ local ret=1 -+ echo ${bs_progress_message} >&2 -+ set_ui_bootstrap_error "${bs_progress_message}" >&2 -+! if fuel-bootstrap -v --debug build --activate >>"$bs_build_log" 2>&1; then -+ ret=0 -+ fuel notify --topic "done" --send "${bs_done_message}" -+ else -+--- 484,490 ---- -+ local ret=1 -+ echo ${bs_progress_message} >&2 -+ set_ui_bootstrap_error "${bs_progress_message}" >&2 -+! if fuel-bootstrap -v --debug build --target_arch arm64 --activate >>"$bs_build_log" 2>&1; then -+ ret=0 -+ fuel notify --topic "done" --send "${bs_done_message}" -+ else -+*************** - *** 529,534 **** - --- 541,556 ---- - diff --git a/patches/opnfv-fuel/0004-virtual_fuel-factor-out-image-creation-into-a-method.patch b/patches/opnfv-fuel/0004-virtual_fuel-factor-out-image-creation-into-a-method.patch new file mode 100644 index 00000000..4e1f583b --- /dev/null +++ b/patches/opnfv-fuel/0004-virtual_fuel-factor-out-image-creation-into-a-method.patch @@ -0,0 +1,35 @@ +From: Josep Puigdemont +Date: Wed, 4 May 2016 14:27:23 +0200 +Subject: [PATCH] virtual_fuel: factor out image creation into a method + +Signed-off-by: Josep Puigdemont +--- + deploy/environments/virtual_fuel.py | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/deploy/environments/virtual_fuel.py b/deploy/environments/virtual_fuel.py +index 966bb91..82c4e47 100644 +--- a/deploy/environments/virtual_fuel.py ++++ b/deploy/environments/virtual_fuel.py +@@ -51,15 +51,20 @@ class VirtualFuel(ExecutionEnvironment): + with open(temp_vm_file, 'w') as f: + vm_xml.write(f, pretty_print=True, xml_declaration=True) + ++ def create_image(self, disk_path, disk_size): ++ exec_cmd('qemu-img create -f qcow2 %s %s' % (disk_path, disk_size)) ++ + def create_vm(self): + vm_template = '%s/%s' % (self.root_dir, + self.dha.get_node_property( + self.fuel_node_id, 'libvirtTemplate')) + check_file_exists(vm_template) ++ + disk_path = '%s/%s.raw' % (self.storage_dir, self.vm_name) + disk_sizes = self.dha.get_disks() + disk_size = disk_sizes['fuel'] +- exec_cmd('qemu-img create -f qcow2 %s %s' % (disk_path, disk_size)) ++ self.create_image(disk_path, disk_size) ++ + temp_vm_file = '%s/%s' % (self.temp_dir, self.vm_name) + exec_cmd('cp %s %s' % (vm_template, temp_vm_file)) + self.set_vm_nic(temp_vm_file) diff --git a/patches/opnfv-fuel/0005-bootstrap-Use-public-Ubuntu-ports-mirrors.patch b/patches/opnfv-fuel/0005-bootstrap-Use-public-Ubuntu-ports-mirrors.patch deleted file mode 100644 index 2300153b..00000000 --- a/patches/opnfv-fuel/0005-bootstrap-Use-public-Ubuntu-ports-mirrors.patch +++ /dev/null @@ -1,48 +0,0 @@ -From: Alexandru Avadanii -Date: Thu, 3 Mar 2016 19:18:27 +0100 -Subject: [PATCH] bootstrap: Use public Ubuntu-ports mirrors. - -Instead of relying on 127.0.0.1 partial Ubuntu mirror, use -public archives. -While doing so, switch to Ubuntu-ports, enabling building arm64 -bootstraps. - -NOTE: This disables the abillity to build amd64 bootstraps with -current config. ---- - build/f_isoroot/f_repobuild/fuel_bootstrap_cli.yaml | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - -diff --git a/build/f_isoroot/f_repobuild/fuel_bootstrap_cli.yaml b/build/f_isoroot/f_repobuild/fuel_bootstrap_cli.yaml -index aa12c45..2e4843d 100644 ---- a/build/f_isoroot/f_repobuild/fuel_bootstrap_cli.yaml -+++ b/build/f_isoroot/f_repobuild/fuel_bootstrap_cli.yaml -@@ -36,19 +36,19 @@ - repos: - - name: ubuntu - section: "main universe multiverse" -- uri: "http://127.0.0.1:8080/mirrors/ubuntu" -+ uri: "http://ports.ubuntu.com/ubuntu-ports" - priority: - suite: trusty - type: deb - - name: ubuntu-updates - section: "main universe multiverse" -- uri: "http://127.0.0.1:8080/mirrors/ubuntu" -+ uri: "http://ports.ubuntu.com/ubuntu-ports" - priority: - suite: trusty-updates - type: deb - - name: ubuntu-security - section: "main universe multiverse" -- uri: "http://127.0.0.1:8080/mirrors/ubuntu" -+ uri: "http://ports.ubuntu.com/ubuntu-ports" - priority: - suite: trusty-security - type: deb -@@ -60,4 +60,5 @@ - type: deb - skip_default_img_build: true - direct_repo_addresses: -+ - "ports.ubuntu.com" - - "127.0.0.1" diff --git a/patches/opnfv-fuel/0005-virtual_fuel-make-vm_template-an-attribute.patch b/patches/opnfv-fuel/0005-virtual_fuel-make-vm_template-an-attribute.patch new file mode 100644 index 00000000..b03a12ee --- /dev/null +++ b/patches/opnfv-fuel/0005-virtual_fuel-make-vm_template-an-attribute.patch @@ -0,0 +1,44 @@ +From: Josep Puigdemont +Date: Wed, 4 May 2016 14:27:23 +0200 +Subject: [PATCH] virtual_fuel: make vm_template an attribute + +Signed-off-by: Josep Puigdemont +--- + deploy/environments/virtual_fuel.py | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +diff --git a/deploy/environments/virtual_fuel.py b/deploy/environments/virtual_fuel.py +index 82c4e47..ac5fc53 100644 +--- a/deploy/environments/virtual_fuel.py ++++ b/deploy/environments/virtual_fuel.py +@@ -28,6 +28,10 @@ class VirtualFuel(ExecutionEnvironment): + self.temp_dir = tempfile.mkdtemp() + self.vm_name = self.dha.get_node_property(self.fuel_node_id, + 'libvirtName') ++ self.vm_template = '%s/%s' % (self.root_dir, ++ self.dha.get_node_property( ++ self.fuel_node_id, 'libvirtTemplate')) ++ check_file_exists(self.vm_template) + + def __del__(self): + delete(self.temp_dir) +@@ -55,18 +59,13 @@ class VirtualFuel(ExecutionEnvironment): + exec_cmd('qemu-img create -f qcow2 %s %s' % (disk_path, disk_size)) + + def create_vm(self): +- vm_template = '%s/%s' % (self.root_dir, +- self.dha.get_node_property( +- self.fuel_node_id, 'libvirtTemplate')) +- check_file_exists(vm_template) +- + disk_path = '%s/%s.raw' % (self.storage_dir, self.vm_name) + disk_sizes = self.dha.get_disks() + disk_size = disk_sizes['fuel'] + self.create_image(disk_path, disk_size) + + temp_vm_file = '%s/%s' % (self.temp_dir, self.vm_name) +- exec_cmd('cp %s %s' % (vm_template, temp_vm_file)) ++ exec_cmd('cp %s %s' % (self.vm_template, temp_vm_file)) + self.set_vm_nic(temp_vm_file) + vm_definition_overwrite = self.dha.get_vm_definition('fuel') + self.define_vm(self.vm_name, temp_vm_file, disk_path, diff --git a/patches/opnfv-fuel/0006-bootstrap-Add-armband-rtc-efi-fix-package.patch b/patches/opnfv-fuel/0006-bootstrap-Add-armband-rtc-efi-fix-package.patch deleted file mode 100644 index 90c4e977..00000000 --- a/patches/opnfv-fuel/0006-bootstrap-Add-armband-rtc-efi-fix-package.patch +++ /dev/null @@ -1,38 +0,0 @@ -From: Alexandru Avadanii -Date: Sun, 17 Apr 2016 15:37:38 +0200 -Subject: [PATCH] bootstrap: Add armband-rtc-efi-fix package. - -Older ThunderX and possibly other UEFI-enabled targets do not support -rtc-efi properly, so they end up filling dmesg with useless -complaints about not being able to read system time. - -armband-rtc-efi-fix validates rtc-efi can be used on the system, -otherwise it rmmods rtc_efi kernel module via rcS script. - -This patch hardcodes the addition of armband-rtc-ef-fix package during -bootstrap image build. - -NOTES: -This could be later removed or, if other fixes need to be delivered -like this, grouped in a meta package. - -Fuel 9.0 moved default package list to openstack.yaml fixture, see [1]. - -[1] https://github.com/openstack/fuel-web/commit/ - 4ee42effe27694bd231663e3d0f10c0c42877177 ---- - build/f_isoroot/f_repobuild/fuel_bootstrap_cli.yaml | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/build/f_isoroot/f_repobuild/fuel_bootstrap_cli.yaml b/build/f_isoroot/f_repobuild/fuel_bootstrap_cli.yaml -index 2e4843d..15d9e9d 100644 ---- a/build/f_isoroot/f_repobuild/fuel_bootstrap_cli.yaml -+++ b/build/f_isoroot/f_repobuild/fuel_bootstrap_cli.yaml -@@ -28,6 +28,7 @@ - - xz-utils - - squashfs-tools - - msmtp-mta -+ - armband-rtc-efi-fix - bootstrap_images_dir: /var/www/nailgun/bootstraps - active_bootstrap_symlink: /var/www/nailgun/bootstraps/active_bootstrap - flavor: ubuntu diff --git a/patches/opnfv-fuel/0006-virtual_fuel-initial-support-for-remote-libvirt.patch b/patches/opnfv-fuel/0006-virtual_fuel-initial-support-for-remote-libvirt.patch new file mode 100644 index 00000000..f6a0f859 --- /dev/null +++ b/patches/opnfv-fuel/0006-virtual_fuel-initial-support-for-remote-libvirt.patch @@ -0,0 +1,233 @@ +From: Josep Puigdemont +Date: Wed, 4 May 2016 14:27:23 +0200 +Subject: [PATCH] virtual_fuel: initial support for remote libvirt + +With this patch it should be possible to create a fuel VM on a remote +libvirt server by properly defining the LIBVIRT_DEFAULT_URI [1] +environment variable. If the variable is not defined, then there should +be no percievable change in behaviour for the script. + +This patch introduces the ability to create volumes (images) on a +remote libvirt host where the Fuel VM is to be deployed. For now +the volumes are created by default in a pool named jenkins, but +the idea is to allow this to be configured, probably in the POD's +DHA file. + +Since all virsh commands honor LIBVIRT_DEFAULT_URI, we use this +environment variable to detect wheter we should create a volume or not. +The rationale being that the variable will only be set if the user wants +to to do the VM deployment on a remote libvirt host. + +We need to create a volume because we can not rely on being able to +access the remote server's file system directly. + +The images are then transferred to the libvirt host using virsh +commands. All this could also be done using scp and a user directory +on the host machine, but using pools allows us to take advantage of +libvirt's policies and file permissions. + +CHANGE: when LIBVIRT_DEFAULT_URI is defined, the script will not check +for the presence of the required PXE bridge. This will still be checked +when the Fuel VM is started and the bridge not found, but this happens +at a later point than it does today. + +CHANGE: before this patch, the file system image was named like the VM: +vm_name.raw. This patch introduces a change and adds a timestamp suffix +to the image: vm_name-timestamp.raw. This is so to avoid collisions with +an image with the same name on the remote pool (two PODs may be using +the same pool). It may also be useful to keep around old file system +images. + +FIXME: This patch requires a pool named "jenkins" in the remote libvirt +server, and it will fail if it is not present. This should be +configurable. + +Notice though that we can still define LIBVIRT_DEFAULT_URI as +"qemu:///system" to create the Fuel VM on the local host. + +[1] https://libvirt.org/remote.html#Remote_URI_reference + +Change-Id: I40925ed31337d3ad9cf505f284f5c3d14e9129a0 +Signed-off-by: Josep Puigdemont +--- + deploy/deploy.py | 5 +++ + deploy/dha_adapters/libvirt_adapter.py | 31 +++++++++++++++++++ + deploy/environments/virtual_fuel.py | 56 ++++++++++++++++++++++++++++++++-- + deploy/install_fuel_master.py | 8 +++-- + 4 files changed, 95 insertions(+), 5 deletions(-) + +diff --git a/deploy/deploy.py b/deploy/deploy.py +index 742e76b..179ee7b 100755 +--- a/deploy/deploy.py ++++ b/deploy/deploy.py +@@ -245,6 +245,11 @@ class AutoDeploy(object): + + + def check_bridge(pxe_bridge, dha_path): ++ # Assume that bridges on remote nodes exists, we could ssh but ++ # the remote user might not have a login shell. ++ if os.environ.get('LIBVIRT_DEFAULT_URI'): ++ return ++ + with io.open(dha_path) as yaml_file: + dha_struct = yaml.load(yaml_file) + if dha_struct['adapter'] != 'libvirt': +diff --git a/deploy/dha_adapters/libvirt_adapter.py b/deploy/dha_adapters/libvirt_adapter.py +index 85913ac..466f134 100644 +--- a/deploy/dha_adapters/libvirt_adapter.py ++++ b/deploy/dha_adapters/libvirt_adapter.py +@@ -11,6 +11,7 @@ + from lxml import etree + from hardware_adapter import HardwareAdapter + import tempfile ++import os + + from common import ( + log, +@@ -23,6 +24,15 @@ DEV = {'pxe': 'network', + 'disk': 'hd', + 'iso': 'cdrom'} + ++VOL_XML_TEMPLATE = ''' ++ {name} ++ {size!s} ++ ++ ++ ++''' ++ ++DEFAULT_POOL = 'jenkins' + + class LibvirtAdapter(HardwareAdapter): + +@@ -140,3 +150,24 @@ class LibvirtAdapter(HardwareAdapter): + + def get_virt_net_conf_dir(self): + return self.dha_struct['virtNetConfDir'] ++ ++ def upload_iso(self, iso_file): ++ size = os.path.getsize(iso_file) ++ vol_name = os.path.basename(iso_file) ++ vol_xml = VOL_XML_TEMPLATE.format(name=vol_name, unit='bytes', ++ size=size, format_type='raw') ++ fd, fname = tempfile.mkstemp(text=True, suffix='deploy') ++ os.write(fd, vol_xml) ++ os.close(fd) ++ ++ log(vol_xml) ++ pool = DEFAULT_POOL # FIXME ++ exec_cmd('virsh vol-create --pool %s %s' % (pool, fname)) ++ vol_path = exec_cmd('virsh vol-path --pool %s %s' % (pool, vol_name)) ++ ++ exec_cmd('virsh vol-upload %s %s' % (vol_path, iso_file), ++ attempts=5, delay=10, verbose=True) ++ ++ delete(fname) ++ ++ return vol_path +diff --git a/deploy/environments/virtual_fuel.py b/deploy/environments/virtual_fuel.py +index ac5fc53..f9f9f7a 100644 +--- a/deploy/environments/virtual_fuel.py ++++ b/deploy/environments/virtual_fuel.py +@@ -11,14 +11,36 @@ + from lxml import etree + from execution_environment import ExecutionEnvironment + import tempfile ++import os ++import re ++import time + + from common import ( + exec_cmd, + check_file_exists, + check_if_root, + delete, ++ log, + ) + ++VOL_XML_TEMPLATE = ''' ++ {name} ++ {size!s} ++ ++ ++ ++''' ++ ++DEFAULT_POOL = 'jenkins' ++ ++def get_size_and_unit(s): ++ p = re.compile('^(\d+)\s*(\D+)') ++ m = p.match(s) ++ if m == None: ++ return None, None ++ size = m.groups()[0] ++ unit = m.groups()[1] ++ return size, unit + + class VirtualFuel(ExecutionEnvironment): + +@@ -55,14 +77,42 @@ class VirtualFuel(ExecutionEnvironment): + with open(temp_vm_file, 'w') as f: + vm_xml.write(f, pretty_print=True, xml_declaration=True) + ++ def create_volume(self, pool, name, su, img_type='qcow2'): ++ log('Creating image using Libvirt volumes in pool %s, name: %s' % ++ (pool, name)) ++ size, unit = get_size_and_unit(su) ++ if size == None: ++ err('Could not determine size and unit of %s' % s) ++ ++ vol_xml = VOL_XML_TEMPLATE.format(name=name, unit=unit, size=size, ++ format_type=img_type) ++ fname = os.path.join(self.temp_dir, '%s_vol.xml' % name) ++ with file(fname, 'w') as f: ++ f.write(vol_xml) ++ ++ exec_cmd('virsh vol-create --pool %s %s' % (pool, fname)) ++ vol_path = exec_cmd('virsh vol-path --pool %s %s' % (pool, name)) ++ ++ delete(fname) ++ ++ return vol_path ++ + def create_image(self, disk_path, disk_size): +- exec_cmd('qemu-img create -f qcow2 %s %s' % (disk_path, disk_size)) ++ if os.environ.get('LIBVIRT_DEFAULT_URI') == None: ++ exec_cmd('qemu-img create -f qcow2 %s %s' % (disk_path, disk_size)) ++ else: ++ pool = DEFAULT_POOL # FIXME ++ name = os.path.basename(disk_path) ++ disk_path = self.create_volume(pool, name, disk_size) ++ ++ return disk_path + + def create_vm(self): +- disk_path = '%s/%s.raw' % (self.storage_dir, self.vm_name) ++ stamp = time.strftime("%Y%m%d%H%M%S") ++ disk_path = '%s/%s-%s.raw' % (self.storage_dir, self.vm_name, stamp) + disk_sizes = self.dha.get_disks() + disk_size = disk_sizes['fuel'] +- self.create_image(disk_path, disk_size) ++ disk_path = self.create_image(disk_path, disk_size) + + temp_vm_file = '%s/%s' % (self.temp_dir, self.vm_name) + exec_cmd('cp %s %s' % (self.vm_template, temp_vm_file)) +diff --git a/deploy/install_fuel_master.py b/deploy/install_fuel_master.py +index 631bf99..5adccef 100644 +--- a/deploy/install_fuel_master.py ++++ b/deploy/install_fuel_master.py +@@ -54,8 +54,12 @@ class InstallFuelMaster(object): + + self.dha.node_power_off(self.fuel_node_id) + +- log('Zero the MBR') +- self.dha.node_zero_mbr(self.fuel_node_id) ++ if os.environ.get('LIBVIRT_DEFAULT_URI'): ++ log('Upload ISO to pool') ++ self.iso_file = self.dha.upload_iso(self.iso_file) ++ else: ++ log('Zero the MBR') ++ self.dha.node_zero_mbr(self.fuel_node_id) + + self.dha.node_set_boot_order(self.fuel_node_id, ['disk', 'iso']) + diff --git a/patches/opnfv-fuel/0007-Allow-customizing-fuel-plugin-opendaylight.patch b/patches/opnfv-fuel/0007-Allow-customizing-fuel-plugin-opendaylight.patch deleted file mode 100644 index c47b166c..00000000 --- a/patches/opnfv-fuel/0007-Allow-customizing-fuel-plugin-opendaylight.patch +++ /dev/null @@ -1,26 +0,0 @@ -From: Florin Dumitrascu -Date: Thu, 17 Mar 2016 19:37:19 +0100 -Subject: [PATCH] Allow customizing fuel-plugin-opendaylight - -Signed-off-by: Florin Dumitrascu ---- - build/f_isoroot/f_odlpluginbuild/config.mk | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/build/f_isoroot/f_odlpluginbuild/config.mk b/build/f_isoroot/f_odlpluginbuild/config.mk -index e64a05e..bca432c 100644 ---- a/build/f_isoroot/f_odlpluginbuild/config.mk -+++ b/build/f_isoroot/f_odlpluginbuild/config.mk -@@ -7,9 +7,9 @@ - # http://www.apache.org/licenses/LICENSE-2.0 - ############################################################################## - --ODL_BRANCH=brahmaputra-sr2 --ODL_CHANGE=ec9474c1178e7451ec75f6e306ac84424a84a28a --ODL_REPO="https://github.com/openstack/fuel-plugin-opendaylight.git" -+ODL_BRANCH:=brahmaputra-sr2 -+ODL_CHANGE:=ec9474c1178e7451ec75f6e306ac84424a84a28a -+ODL_REPO:="https://github.com/openstack/fuel-plugin-opendaylight.git" - - export USE_JAVA8=true - export JAVA8_URL:=https://launchpad.net/~openjdk-r/+archive/ubuntu/ppa/+files/openjdk-8-jre-headless_8u72-b15-1~trusty1_amd64.deb diff --git a/patches/opnfv-fuel/0007-virtual_fuel-add-XML-tree-as-attribute-of-VirtualFue.patch b/patches/opnfv-fuel/0007-virtual_fuel-add-XML-tree-as-attribute-of-VirtualFue.patch new file mode 100644 index 00000000..53e1a8db --- /dev/null +++ b/patches/opnfv-fuel/0007-virtual_fuel-add-XML-tree-as-attribute-of-VirtualFue.patch @@ -0,0 +1,62 @@ +From: Josep Puigdemont +Date: Fri, 20 May 2016 10:05:11 +0200 +Subject: [PATCH] virtual_fuel: add XML tree as attribute of VirtualFuel + +Now the VM XML definition tree is an attribute of the object, this way +it can be used by all methods without having to re-read the file. + +Methods added: +update_vm_template_file: Flushes the contents of the in-memory XML + representation of the VM to the backing file. + +Signed-off-by: Josep Puigdemont +--- + deploy/environments/virtual_fuel.py | 21 ++++++++++++++------- + 1 file changed, 14 insertions(+), 7 deletions(-) + +diff --git a/deploy/environments/virtual_fuel.py b/deploy/environments/virtual_fuel.py +index f9f9f7a..7dc9720 100644 +--- a/deploy/environments/virtual_fuel.py ++++ b/deploy/environments/virtual_fuel.py +@@ -54,14 +54,21 @@ class VirtualFuel(ExecutionEnvironment): + self.dha.get_node_property( + self.fuel_node_id, 'libvirtTemplate')) + check_file_exists(self.vm_template) ++ with open(self.vm_template) as f: ++ self.vm_xml = etree.parse(f) ++ ++ self.temp_vm_file = '%s/%s' % (self.temp_dir, self.vm_name) ++ self.update_vm_template_file() + + def __del__(self): + delete(self.temp_dir) + +- def set_vm_nic(self, temp_vm_file): +- with open(temp_vm_file) as f: +- vm_xml = etree.parse(f) +- interfaces = vm_xml.xpath('/domain/devices/interface') ++ def update_vm_template_file(self): ++ with open(self.temp_vm_file, "wc") as f: ++ self.vm_xml.write(f, pretty_print=True, xml_declaration=True) ++ ++ def set_vm_nic(self): ++ interfaces = self.vm_xml.xpath('/domain/devices/interface') + for interface in interfaces: + interface.getparent().remove(interface) + interface = etree.Element('interface') +@@ -70,12 +77,12 @@ class VirtualFuel(ExecutionEnvironment): + source.set('bridge', self.pxe_bridge) + model = etree.SubElement(interface, 'model') + model.set('type', 'virtio') +- devices = vm_xml.xpath('/domain/devices') ++ devices = self.vm_xml.xpath('/domain/devices') + if devices: + device = devices[0] + device.append(interface) +- with open(temp_vm_file, 'w') as f: +- vm_xml.write(f, pretty_print=True, xml_declaration=True) ++ ++ self.update_vm_template_file() + + def create_volume(self, pool, name, su, img_type='qcow2'): + log('Creating image using Libvirt volumes in pool %s, name: %s' % diff --git a/patches/opnfv-fuel/0008-virtual_fuel-prepare-class-to-allow-multiple-bridges.patch b/patches/opnfv-fuel/0008-virtual_fuel-prepare-class-to-allow-multiple-bridges.patch new file mode 100644 index 00000000..f2e21e24 --- /dev/null +++ b/patches/opnfv-fuel/0008-virtual_fuel-prepare-class-to-allow-multiple-bridges.patch @@ -0,0 +1,75 @@ +From: Josep Puigdemont +Date: Fri, 20 May 2016 10:23:45 +0200 +Subject: [PATCH] virtual_fuel: prepare class to allow multiple bridges + +The VirtualFuel class has now two new methods: + + del_vm_nics: Deletes all interfaces from the VM. + + add_vm_nic: Adds a NIC to the VM, attached to the specified bridge. + +The following method has been deleted: + + set_vm_nic: implemented with the two new methods + +Apart from the deleted method, no functionality has been changed. This +is just a small but necessary step towards adding support for supporting +more than one bridge in the fuel VM. + +Signed-off-by: Josep Puigdemont +--- + deploy/environments/virtual_fuel.py | 21 +++++++++++++-------- + 1 file changed, 13 insertions(+), 8 deletions(-) + +diff --git a/deploy/environments/virtual_fuel.py b/deploy/environments/virtual_fuel.py +index 7dc9720..5a86c97 100644 +--- a/deploy/environments/virtual_fuel.py ++++ b/deploy/environments/virtual_fuel.py +@@ -67,22 +67,25 @@ class VirtualFuel(ExecutionEnvironment): + with open(self.temp_vm_file, "wc") as f: + self.vm_xml.write(f, pretty_print=True, xml_declaration=True) + +- def set_vm_nic(self): ++ def del_vm_nics(self): + interfaces = self.vm_xml.xpath('/domain/devices/interface') + for interface in interfaces: + interface.getparent().remove(interface) ++ ++ def add_vm_nic(self, bridge): + interface = etree.Element('interface') + interface.set('type', 'bridge') + source = etree.SubElement(interface, 'source') +- source.set('bridge', self.pxe_bridge) ++ source.set('bridge', bridge) + model = etree.SubElement(interface, 'model') + model.set('type', 'virtio') ++ + devices = self.vm_xml.xpath('/domain/devices') + if devices: + device = devices[0] + device.append(interface) +- +- self.update_vm_template_file() ++ else: ++ err('No devices!') + + def create_volume(self, pool, name, su, img_type='qcow2'): + log('Creating image using Libvirt volumes in pool %s, name: %s' % +@@ -121,11 +124,13 @@ class VirtualFuel(ExecutionEnvironment): + disk_size = disk_sizes['fuel'] + disk_path = self.create_image(disk_path, disk_size) + +- temp_vm_file = '%s/%s' % (self.temp_dir, self.vm_name) +- exec_cmd('cp %s %s' % (self.vm_template, temp_vm_file)) +- self.set_vm_nic(temp_vm_file) ++ self.del_vm_nics() ++ self.add_vm_nic(self.pxe_bridge) ++ self.update_vm_template_file() ++ + vm_definition_overwrite = self.dha.get_vm_definition('fuel') +- self.define_vm(self.vm_name, temp_vm_file, disk_path, ++ ++ self.define_vm(self.vm_name, self.temp_vm_file, disk_path, + vm_definition_overwrite) + + def setup_environment(self): diff --git a/patches/opnfv-fuel/0009-deploy.py-add-multiple-bridges-support.patch b/patches/opnfv-fuel/0009-deploy.py-add-multiple-bridges-support.patch new file mode 100644 index 00000000..6743f25c --- /dev/null +++ b/patches/opnfv-fuel/0009-deploy.py-add-multiple-bridges-support.patch @@ -0,0 +1,69 @@ +From: Josep Puigdemont +Date: Fri, 6 May 2016 04:32:06 +0200 +Subject: [PATCH] deploy.py: add multiple bridges support + +Some Fuel VMs may need more than one network interface. To be able to do +that, we now allow the user to specify the "-b" paramter (bridge) +multiple times, creating a new NIC for each one of them. + +The NICs are created in the same order as they are given in the command +line. + +There is no change in behavior from earlier versions, pxebr will still +be the default bridge if none is specified. + +Signed-off-by: Josep Puigdemont +--- + deploy/deploy.py | 10 +++++++--- + deploy/environments/virtual_fuel.py | 3 ++- + 2 files changed, 9 insertions(+), 4 deletions(-) + +diff --git a/deploy/deploy.py b/deploy/deploy.py +index 179ee7b..9db1754 100755 +--- a/deploy/deploy.py ++++ b/deploy/deploy.py +@@ -316,8 +316,8 @@ def parse_arguments(): + parser.add_argument('-s', dest='storage_dir', action='store', + default='%s/images' % CWD, + help='Storage Directory [default: images]') +- parser.add_argument('-b', dest='pxe_bridge', action='store', +- default='pxebr', ++ parser.add_argument('-b', dest='pxe_bridge', action='append', ++ default=[], + help='Linux Bridge for booting up the Fuel Master VM ' + '[default: pxebr]') + parser.add_argument('-p', dest='fuel_plugins_dir', action='store', +@@ -333,6 +333,9 @@ def parse_arguments(): + action='store_true', default=False, + help=('Do not launch environment deployment')) + ++ if not args.pxe_bridge: ++ args.pxe_bridge = ['pxebr'] ++ + args = parser.parse_args() + log(args) + +@@ -348,7 +351,8 @@ def parse_arguments(): + check_file_exists(iso_abs_path) + log('Using image directory: %s' % args.storage_dir) + create_dir_if_not_exists(args.storage_dir) +- check_bridge(args.pxe_bridge, args.dha_file) ++ for bridge in args.pxe_bridge: ++ check_bridge(bridge, args.dha_file) + + kwargs = {'no_fuel': args.no_fuel, 'fuel_only': args.fuel_only, + 'no_health_check': args.no_health_check, +diff --git a/deploy/environments/virtual_fuel.py b/deploy/environments/virtual_fuel.py +index 5a86c97..b1a76e4 100644 +--- a/deploy/environments/virtual_fuel.py ++++ b/deploy/environments/virtual_fuel.py +@@ -125,7 +125,8 @@ class VirtualFuel(ExecutionEnvironment): + disk_path = self.create_image(disk_path, disk_size) + + self.del_vm_nics() +- self.add_vm_nic(self.pxe_bridge) ++ for bridge in self.pxe_bridge: ++ self.add_vm_nic(bridge) + self.update_vm_template_file() + + vm_definition_overwrite = self.dha.get_vm_definition('fuel') diff --git a/patches/opnfv-fuel/0009-f_repobuild-Makefile-Use-python-debian-from-pip.patch b/patches/opnfv-fuel/0009-f_repobuild-Makefile-Use-python-debian-from-pip.patch deleted file mode 100644 index f84b4c0c..00000000 --- a/patches/opnfv-fuel/0009-f_repobuild-Makefile-Use-python-debian-from-pip.patch +++ /dev/null @@ -1,29 +0,0 @@ -From: Alexandru Avadanii -Date: Tue, 26 Apr 2016 23:12:20 +0200 -Subject: [PATCH] f_repobuild/Makefile: Use python-debian from pip. - -Currently, Ubuntu Trusty provides a broken python-debian package, -that fails to parse foreign architecture (package:any) relationships. - -Purge debian package and let pip resolve this dependency, using a -newer version from pypi. - -[1] http://lists.alioth.debian.org/pipermail/ - pkg-python-debian-maint/2014-July/001795.html ---- - build/f_isoroot/f_repobuild/Makefile | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/build/f_isoroot/f_repobuild/Makefile b/build/f_isoroot/f_repobuild/Makefile -index 709ca6b..5e7157b 100644 ---- a/build/f_isoroot/f_repobuild/Makefile -+++ b/build/f_isoroot/f_repobuild/Makefile -@@ -25,6 +25,8 @@ all: nailgun - - nailgun: - sudo apt-get install -y git libxml2-dev libxslt-dev python-dev python-pip libz-dev libyaml-dev createrepo python-yaml -+ # python-debian from Ubuntu can't parse foreign arch relationships, use pip -+ sudo apt-get purge -y --force-yes python-debian - rm -Rf nailgun - sudo mkdir -p /var/www/nailgun - git clone $(FUEL_MIRROR_REPO) diff --git a/patches/opnfv-fuel/0010-deploy.sh-allow-specifying-several-bridges.patch b/patches/opnfv-fuel/0010-deploy.sh-allow-specifying-several-bridges.patch new file mode 100644 index 00000000..d3de23f6 --- /dev/null +++ b/patches/opnfv-fuel/0010-deploy.sh-allow-specifying-several-bridges.patch @@ -0,0 +1,47 @@ +From: Josep Puigdemont +Date: Fri, 6 May 2016 04:39:44 +0200 +Subject: [PATCH] deploy.sh: allow specifying several bridges + +It might be desirable to add several bridges to the fuel VM, so we let +the user specify -B more than once, and honor that when calling +deploy.py. We also make it possible to specify a comma separated list of +bridges, as in: -B br1,br2, for convenience for the Jenkins jobs. + +There is a change in behavior from the previous version, and that is +that it may call the deploy.py python script with more than one instance +of the "-b" parameter. + +Signed-off-by: Josep Puigdemont +--- + ci/deploy.sh | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/ci/deploy.sh b/ci/deploy.sh +index dc13f1c..3a95327 100755 +--- a/ci/deploy.sh ++++ b/ci/deploy.sh +@@ -57,7 +57,10 @@ and provides a fairly simple mechanism to execute a deployment. + Input parameters to the build script is: + -b Base URI to the configuration directory (needs to be provided in a URI + style, it can be a local resource: file:// or a remote resource http(s)://) +--B PXE Bridge for booting of Fuel master, default is pxebr ++-B PXE Bridge for booting of Fuel master. It can be specified several times, ++ or as a comma separated list of bridges, or both: -B br1 -B br2,br3 ++ One NIC connected to each specified bridge will be created in the Fuel VM, ++ in the same order as provided in the command line. The default is pxebr. + -d Dry-run - Produces deploy config files (config/dea.yaml and + config/dha.yaml), but does not execute deploy + -f Deploy on existing Fuel master +@@ -133,9 +136,9 @@ do + fi + ;; + B) +- if [[ ${OPTARG} ]]; then +- PXE_BRIDGE="-b ${OPTARG}" +- fi ++ for bridge in ${OPTARG//,/ }; do ++ PXE_BRIDGE+=" -b $bridge" ++ done + ;; + d) + DRY_RUN=1 diff --git a/patches/opnfv-fuel/0011-deploy.sh-accept-a-timeout-flag-T.patch b/patches/opnfv-fuel/0011-deploy.sh-accept-a-timeout-flag-T.patch new file mode 100644 index 00000000..6ccafcc1 --- /dev/null +++ b/patches/opnfv-fuel/0011-deploy.sh-accept-a-timeout-flag-T.patch @@ -0,0 +1,81 @@ +From: Josep Puigdemont +Date: Mon, 9 May 2016 11:05:58 +0200 +Subject: [PATCH] deploy.sh: accept a timeout flag (-T) + +Signed-off-by: Josep Puigdemont +--- + ci/deploy.sh | 19 +++++++++++++++---- + 1 file changed, 15 insertions(+), 4 deletions(-) + +diff --git a/ci/deploy.sh b/ci/deploy.sh +index 3a95327..a8b3015 100755 +--- a/ci/deploy.sh ++++ b/ci/deploy.sh +@@ -29,7 +29,7 @@ cat << EOF + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + `basename $0`: Deploys the Fuel@OPNFV stack + +-usage: `basename $0` -b base-uri [-B PXE Bridge] [-f] [-F] [-H] -l lab-name -p pod-name -s deploy-scenario [-S image-dir] -i iso ++usage: `basename $0` -b base-uri [-B PXE Bridge] [-f] [-F] [-H] -l lab-name -p pod-name -s deploy-scenario [-S image-dir] [-T timeout] -i iso + -s deployment-scenario [-S optional Deploy-scenario path URI] + [-R optional local relen repo (containing deployment Scenarios] + +@@ -46,6 +46,7 @@ OPTIONS: + -p Pod-name + -s Deploy-scenario short-name/base-file-name + -S Storage dir for VM images ++ -T Timeout, in minutes, for the deploy. + -i iso url + + Description: +@@ -76,6 +77,8 @@ Input parameters to the build script is: + or a deployment short-name as defined by scenario.yaml in the deployment + scenario path. + -S Storage dir for VM images, default is fuel/deploy/images ++-T Timeout, in minutes, for the deploy. It defaults to using the DEPLOY_TIMEOUT ++ environment variable when defined, or to the default in deploy.py otherwise + -i .iso image to be deployed (needs to be provided in a URI + style, it can be a local resource: file:// or a remote resource http(s)://) + +@@ -114,6 +117,11 @@ FUEL_CREATION_ONLY='' + NO_DEPLOY_ENVIRONMENT='' + STORAGE_DIR='' + DRY_RUN=0 ++if ! [ -z $DEPLOY_TIMEOUT ]; then ++ DEPLOY_TIMEOUT="-dt $DEPLOY_TIMEOUT" ++else ++ DEPLOY_TIMEOUT="" ++fi + # + # END of variables to customize + ############################################################################ +@@ -121,7 +129,7 @@ DRY_RUN=0 + ############################################################################ + # BEGIN of main + # +-while getopts "b:B:dfFHl:p:s:S:i:he" OPTION ++while getopts "b:B:dfFHl:p:s:S:T:i:he" OPTION + do + case $OPTION in + b) +@@ -169,6 +177,9 @@ do + STORAGE_DIR="-s ${OPTARG}" + fi + ;; ++ T) ++ DEPLOY_TIMEOUT="-dt ${OPTARG}" ++ ;; + i) + ISO=${OPTARG} + if [[ ! $ISO == file://* ]] && \ +@@ -238,8 +249,8 @@ if [ $DRY_RUN -eq 0 ]; then + ISO=${SCRIPT_PATH}/ISO/image.iso + fi + # Start deployment +- echo "python deploy.py $STORAGE_DIR $PXE_BRIDGE $USE_EXISTING_FUEL $FUEL_CREATION_ONLY $NO_HEALTH_CHECK $NO_DEPLOY_ENVIRONMENT -dea ${SCRIPT_PATH}/config/dea.yaml -dha ${SCRIPT_PATH}/config/dha.yaml -iso $ISO" +- python deploy.py $STORAGE_DIR $PXE_BRIDGE $USE_EXISTING_FUEL $FUEL_CREATION_ONLY $NO_HEALTH_CHECK $NO_DEPLOY_ENVIRONMENT -dea ${SCRIPT_PATH}/config/dea.yaml -dha ${SCRIPT_PATH}/config/dha.yaml -iso $ISO ++ echo "python deploy.py $STORAGE_DIR $PXE_BRIDGE $USE_EXISTING_FUEL $FUEL_CREATION_ONLY $NO_HEALTH_CHECK $NO_DEPLOY_ENVIRONMENT -dea ${SCRIPT_PATH}/config/dea.yaml -dha ${SCRIPT_PATH}/config/dha.yaml -iso $ISO $DEPLOY_TIMEOUT" ++ python deploy.py $STORAGE_DIR $PXE_BRIDGE $USE_EXISTING_FUEL $FUEL_CREATION_ONLY $NO_HEALTH_CHECK $NO_DEPLOY_ENVIRONMENT -dea ${SCRIPT_PATH}/config/dea.yaml -dha ${SCRIPT_PATH}/config/dha.yaml -iso $ISO $DEPLOY_TIMEOUT + fi + popd > /dev/null + diff --git a/patches/opnfv-fuel/0012-Fuel-VM-for-the-Enea-Armband-lab.patch b/patches/opnfv-fuel/0012-Fuel-VM-for-the-Enea-Armband-lab.patch new file mode 100644 index 00000000..fbcd11d1 --- /dev/null +++ b/patches/opnfv-fuel/0012-Fuel-VM-for-the-Enea-Armband-lab.patch @@ -0,0 +1,106 @@ +From: Josep Puigdemont +Date: Wed, 4 May 2016 14:27:23 +0200 +Subject: [PATCH] Fuel VM for the Enea Armband lab + +This is the initial VM description fit for Enea's Armband lab. + +Signed-off-by: Josep Puigdemont +--- + .../hardware_environment/vms/enea_lab/fuel.xml | 88 ++++++++++++++++++++++ + 1 file changed, 88 insertions(+) + create mode 100644 deploy/templates/hardware_environment/vms/enea_lab/fuel.xml + +diff --git a/deploy/templates/hardware_environment/vms/enea_lab/fuel.xml b/deploy/templates/hardware_environment/vms/enea_lab/fuel.xml +new file mode 100644 +index 0000000..8773ed4 +--- /dev/null ++++ b/deploy/templates/hardware_environment/vms/enea_lab/fuel.xml +@@ -0,0 +1,88 @@ ++ ++ fuel ++ 8290304 ++ 8290304 ++ 8 ++ ++ /machine ++ ++ ++ hvm ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ destroy ++ restart ++ restart ++ ++ ++ ++ ++ ++ /usr/libexec/qemu-kvm ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ diff --git a/patches/opnfv-fuel/0013-VirtualFuel-Add-temp_dir-and-vm_name-attributes.patch b/patches/opnfv-fuel/0013-VirtualFuel-Add-temp_dir-and-vm_name-attributes.patch deleted file mode 100644 index 83d6e292..00000000 --- a/patches/opnfv-fuel/0013-VirtualFuel-Add-temp_dir-and-vm_name-attributes.patch +++ /dev/null @@ -1,57 +0,0 @@ -From: Josep Puigdemont -Date: Wed, 4 May 2016 14:27:23 +0200 -Subject: [PATCH] VirtualFuel: Add temp_dir and vm_name attributes - -These two variables are defined in one of the methods right now. They -will be useful to other methods too, so we add them as attributes to the -object here. - -Signed-off-by: Josep Puigdemont ---- - deploy/environments/virtual_fuel.py | 15 +++++++++------ - 1 file changed, 9 insertions(+), 6 deletions(-) - -diff --git a/deploy/environments/virtual_fuel.py b/deploy/environments/virtual_fuel.py -index cb3bc6c..966bb91 100644 ---- a/deploy/environments/virtual_fuel.py -+++ b/deploy/environments/virtual_fuel.py -@@ -25,6 +25,12 @@ class VirtualFuel(ExecutionEnvironment): - def __init__(self, storage_dir, pxe_bridge, dha_file, root_dir): - super(VirtualFuel, self).__init__(storage_dir, dha_file, root_dir) - self.pxe_bridge = pxe_bridge -+ self.temp_dir = tempfile.mkdtemp() -+ self.vm_name = self.dha.get_node_property(self.fuel_node_id, -+ 'libvirtName') -+ -+ def __del__(self): -+ delete(self.temp_dir) - - def set_vm_nic(self, temp_vm_file): - with open(temp_vm_file) as f: -@@ -46,23 +52,20 @@ class VirtualFuel(ExecutionEnvironment): - vm_xml.write(f, pretty_print=True, xml_declaration=True) - - def create_vm(self): -- temp_dir = tempfile.mkdtemp() -- vm_name = self.dha.get_node_property(self.fuel_node_id, 'libvirtName') - vm_template = '%s/%s' % (self.root_dir, - self.dha.get_node_property( - self.fuel_node_id, 'libvirtTemplate')) - check_file_exists(vm_template) -- disk_path = '%s/%s.raw' % (self.storage_dir, vm_name) -+ disk_path = '%s/%s.raw' % (self.storage_dir, self.vm_name) - disk_sizes = self.dha.get_disks() - disk_size = disk_sizes['fuel'] - exec_cmd('qemu-img create -f qcow2 %s %s' % (disk_path, disk_size)) -- temp_vm_file = '%s/%s' % (temp_dir, vm_name) -+ temp_vm_file = '%s/%s' % (self.temp_dir, self.vm_name) - exec_cmd('cp %s %s' % (vm_template, temp_vm_file)) - self.set_vm_nic(temp_vm_file) - vm_definition_overwrite = self.dha.get_vm_definition('fuel') -- self.define_vm(vm_name, temp_vm_file, disk_path, -+ self.define_vm(self.vm_name, temp_vm_file, disk_path, - vm_definition_overwrite) -- delete(temp_dir) - - def setup_environment(self): - check_if_root() diff --git a/patches/opnfv-fuel/0013-transplant-Generate-extra-interfaces-config-file.patch b/patches/opnfv-fuel/0013-transplant-Generate-extra-interfaces-config-file.patch new file mode 100644 index 00000000..b6a351e4 --- /dev/null +++ b/patches/opnfv-fuel/0013-transplant-Generate-extra-interfaces-config-file.patch @@ -0,0 +1,107 @@ +From: Josep Puigdemont +Date: Wed, 4 May 2016 17:58:56 +0200 +Subject: [PATCH] transplant: Generate extra interfaces config file + +The DEA override may contain a IFCGF_ section in its 'fuel:' +section, containing the necessary keys to produce a ifcfg- +file, like in this example: + +fuel: + IFCFG_ETH1: + device: eth1 + ipaddress: 10.0.1.10 + netmask: 255.255.255.0 + gateway: 10.0.1.254 + +FIXME: In order for Network Manager to use the newly added interfaces +for outgoing traffic and honor their GATEWAY setting (e.g. if we just +added one public interface), the default route on admin iface (most of +the time called eth0) should be disabled. For now, we assume the admin +interface is always "eth0". + +Signed-off-by: Josep Puigdemont +Signed-off-by: Alexandu Avadanii +--- + deploy/transplant_fuel_settings.py | 37 +++++++++++++++++++++++++++++++++++++ + 1 file changed, 37 insertions(+) + +diff --git a/deploy/transplant_fuel_settings.py b/deploy/transplant_fuel_settings.py +index e57a4fb..9a65cf6 100644 +--- a/deploy/transplant_fuel_settings.py ++++ b/deploy/transplant_fuel_settings.py +@@ -11,10 +11,14 @@ + import sys + import io + import yaml ++import re ++import os + from dea import DeploymentEnvironmentAdapter + + from common import ( + check_file_exists, ++ exec_cmd, ++ log, + ) + + ASTUTE_YAML = '/etc/fuel/astute.yaml' +@@ -35,15 +39,45 @@ def parse_arguments(): + check_file_exists(dea_file) + return dea_file + ++def write_ifcfg_file(key, fuel_conf): ++ config = ('BOOTPROTO=none\n' ++ 'ONBOOT=yes\n' ++ 'TYPE=Ethernet\n' ++ 'NM_CONTROLLED=yes\n') ++ for skey in ('ipaddress', 'device', 'netmask', 'gateway'): ++ if not fuel_conf[key].get(skey): ++ log('Warning: missing key %s for %s' % (skey, key)) ++ config += '%s=\n' % skey.upper() ++ elif skey == 'ipaddress': ++ config += 'IPADDR=%s\n' % fuel_conf[key][skey] ++ else: ++ config += '%s=%s\n' % (skey.upper(), fuel_conf[key][skey]) ++ ++ fname = os.path.join('/etc/sysconfig/network-scripts/', ++ key.lower().replace('_','-')) ++ with open(fname, 'wc') as f: ++ f.write(config) + + def transplant(dea, astute): + fuel_conf = dea.get_fuel_config() ++ require_network_restart = False + for key in fuel_conf.iterkeys(): + if key == 'ADMIN_NETWORK': + for skey in fuel_conf[key].iterkeys(): + astute[key][skey] = fuel_conf[key][skey] ++ elif re.match('^IFCFG', key): ++ log('Adding interface configuration for: %s' % key.lower()) ++ require_network_restart = True ++ write_ifcfg_file(key, fuel_conf) ++ if astute.has_key(key): ++ astute.pop(key, None) + else: + astute[key] = fuel_conf[key] ++ if require_network_restart: ++ admin_ifcfg = '/etc/sysconfig/network-scripts/ifcfg-eth0' ++ exec_cmd('echo "DEFROUTE=no" >> %s' % admin_ifcfg) ++ log('At least one interface was reconfigured, restart network manager') ++ exec_cmd('systemctl restart network') + return astute + + +@@ -51,11 +85,14 @@ def main(): + dea_file = parse_arguments() + check_file_exists(ASTUTE_YAML) + dea = DeploymentEnvironmentAdapter(dea_file) ++ log('Reading astute file %s' % ASTUTE_YAML) + with io.open(ASTUTE_YAML) as stream: + astute = yaml.load(stream) ++ log('Initiating transplant') + transplant(dea, astute) + with io.open(ASTUTE_YAML, 'w') as stream: + yaml.dump(astute, stream, default_flow_style=False) ++ log('Transplant done') + + + if __name__ == '__main__': diff --git a/patches/opnfv-fuel/0014-deploy.sh-no-need-to-set-umask-0000.patch b/patches/opnfv-fuel/0014-deploy.sh-no-need-to-set-umask-0000.patch new file mode 100644 index 00000000..446a2071 --- /dev/null +++ b/patches/opnfv-fuel/0014-deploy.sh-no-need-to-set-umask-0000.patch @@ -0,0 +1,33 @@ +From: Josep Puigdemont +Date: Fri, 6 May 2016 03:07:40 +0200 +Subject: [PATCH] deploy.sh: no need to set umask 0000 + +Signed-off-by: Josep Puigdemont +--- + ci/deploy.sh | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/ci/deploy.sh b/ci/deploy.sh +index a8b3015..cd7f652 100755 +--- a/ci/deploy.sh ++++ b/ci/deploy.sh +@@ -82,9 +82,6 @@ Input parameters to the build script is: + -i .iso image to be deployed (needs to be provided in a URI + style, it can be a local resource: file:// or a remote resource http(s)://) + +-NOTE: Root priviledges are needed for this script to run +- +- + Examples: + sudo `basename $0` -b file:///home/jenkins/lab-config -l lf -p pod1 -s ha_odl-l3_heat_ceilometer -i file:///home/jenkins/myiso.iso + EOF +@@ -226,9 +223,6 @@ fi + # Enable the automatic exit trap + trap do_exit SIGINT SIGTERM EXIT + +-# Set no restrictive umask so that Jenkins can removeeee any residuals +-umask 0000 +- + clean + + pushd ${DEPLOY_DIR} > /dev/null diff --git a/patches/opnfv-fuel/0014-virtual_fuel-factor-out-image-creation-into-a-method.patch b/patches/opnfv-fuel/0014-virtual_fuel-factor-out-image-creation-into-a-method.patch deleted file mode 100644 index 4e1f583b..00000000 --- a/patches/opnfv-fuel/0014-virtual_fuel-factor-out-image-creation-into-a-method.patch +++ /dev/null @@ -1,35 +0,0 @@ -From: Josep Puigdemont -Date: Wed, 4 May 2016 14:27:23 +0200 -Subject: [PATCH] virtual_fuel: factor out image creation into a method - -Signed-off-by: Josep Puigdemont ---- - deploy/environments/virtual_fuel.py | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/deploy/environments/virtual_fuel.py b/deploy/environments/virtual_fuel.py -index 966bb91..82c4e47 100644 ---- a/deploy/environments/virtual_fuel.py -+++ b/deploy/environments/virtual_fuel.py -@@ -51,15 +51,20 @@ class VirtualFuel(ExecutionEnvironment): - with open(temp_vm_file, 'w') as f: - vm_xml.write(f, pretty_print=True, xml_declaration=True) - -+ def create_image(self, disk_path, disk_size): -+ exec_cmd('qemu-img create -f qcow2 %s %s' % (disk_path, disk_size)) -+ - def create_vm(self): - vm_template = '%s/%s' % (self.root_dir, - self.dha.get_node_property( - self.fuel_node_id, 'libvirtTemplate')) - check_file_exists(vm_template) -+ - disk_path = '%s/%s.raw' % (self.storage_dir, self.vm_name) - disk_sizes = self.dha.get_disks() - disk_size = disk_sizes['fuel'] -- exec_cmd('qemu-img create -f qcow2 %s %s' % (disk_path, disk_size)) -+ self.create_image(disk_path, disk_size) -+ - temp_vm_file = '%s/%s' % (self.temp_dir, self.vm_name) - exec_cmd('cp %s %s' % (vm_template, temp_vm_file)) - self.set_vm_nic(temp_vm_file) diff --git a/patches/opnfv-fuel/0015-Remove-check-for-root.patch b/patches/opnfv-fuel/0015-Remove-check-for-root.patch new file mode 100644 index 00000000..ab0df01c --- /dev/null +++ b/patches/opnfv-fuel/0015-Remove-check-for-root.patch @@ -0,0 +1,80 @@ +From: Josep Puigdemont +Date: Wed, 4 May 2016 14:27:23 +0200 +Subject: [PATCH] Remove check for root + +Signed-off-by: Josep Puigdemont +--- + ci/deploy.sh | 5 ----- + deploy/deploy-config.py | 1 - + deploy/deploy.py | 2 -- + deploy/environments/virtual_fuel.py | 2 -- + 4 files changed, 10 deletions(-) + +diff --git a/ci/deploy.sh b/ci/deploy.sh +index cd7f652..5f06a19 100755 +--- a/ci/deploy.sh ++++ b/ci/deploy.sh +@@ -204,11 +204,6 @@ do + esac + done + +-if [[ $EUID -ne 0 ]]; then +- echo "This script must be run as root" 1>&2 +- exit 1 +-fi +- + if [ -z $BASE_CONFIG_URI ] || [ -z $TARGET_LAB ] || \ + [ -z $TARGET_POD ] || [ -z $DEPLOY_SCENARIO ] || \ + [ -z $ISO ]; then +diff --git a/deploy/deploy-config.py b/deploy/deploy-config.py +index 65d51b2..88a1111 100644 +--- a/deploy/deploy-config.py ++++ b/deploy/deploy-config.py +@@ -40,7 +40,6 @@ from common import ( + check_file_exists, + create_dir_if_not_exists, + delete, +- check_if_root, + ArgParser, + ) + +diff --git a/deploy/deploy.py b/deploy/deploy.py +index 9db1754..ca092f5 100755 +--- a/deploy/deploy.py ++++ b/deploy/deploy.py +@@ -32,7 +32,6 @@ from common import ( + check_file_exists, + create_dir_if_not_exists, + delete, +- check_if_root, + ArgParser, + ) + +@@ -232,7 +231,6 @@ class AutoDeploy(object): + return 0 + + def run(self): +- check_if_root() + if self.cleanup_only: + self.cleanup_execution_environment() + else: +diff --git a/deploy/environments/virtual_fuel.py b/deploy/environments/virtual_fuel.py +index b1a76e4..4ff68f6 100644 +--- a/deploy/environments/virtual_fuel.py ++++ b/deploy/environments/virtual_fuel.py +@@ -18,7 +18,6 @@ import time + from common import ( + exec_cmd, + check_file_exists, +- check_if_root, + delete, + log, + ) +@@ -135,7 +134,6 @@ class VirtualFuel(ExecutionEnvironment): + vm_definition_overwrite) + + def setup_environment(self): +- check_if_root() + self.cleanup_environment() + self.create_vm() + diff --git a/patches/opnfv-fuel/0015-virtual_fuel-initial-support-for-libvirt-volumes.patch b/patches/opnfv-fuel/0015-virtual_fuel-initial-support-for-libvirt-volumes.patch deleted file mode 100644 index 87266ef8..00000000 --- a/patches/opnfv-fuel/0015-virtual_fuel-initial-support-for-libvirt-volumes.patch +++ /dev/null @@ -1,209 +0,0 @@ -From: Josep Puigdemont -Date: Wed, 4 May 2016 14:27:23 +0200 -Subject: [PATCH] virtual_fuel: initial support for libvirt volumes - -This patch introduces the ability to create volumes on the libvirt host -where the Fuel VM is being deployed. For now a default pool is used, -but the idea is to allow this to be configured. - -Since all virsh commands honor LIBVIRT_DEFAULT_URI, we use this -environment variable to detect wheter we should create a volume or not. -The rationale being that this environment variable will only be set if -the user wants to do the VM deployment on a remote libvirt host. - -All this could also be done using scp and a user directory on the host -machine, but using pools allows us to take advantage of libvirt's -policies and file permissions. - -CHANGE: before this patch, the file system image was named like the VM: -vm_name.raw. This patch introduces a change and adds a timestamp suffix -to the image: vm_name-timestamp.raw. This is so to avoid collisions with -an image with the same name on the remote pool. It may also be useful to -keep around old images for later testing, while the VM definition can -likely be the same. - -FIXME: This patch will use a pool called "jenkins" in the libvirt -server, and it will fail if it is not present. This is a requirement -that should be amended in the future, and properly documented. - -Signed-off-by: Josep Puigdemont ---- - deploy/deploy.py | 5 +++ - deploy/dha_adapters/libvirt_adapter.py | 28 +++++++++++++++++ - deploy/environments/virtual_fuel.py | 57 +++++++++++++++++++++++++++++----- - deploy/install_fuel_master.py | 8 +++-- - 4 files changed, 88 insertions(+), 10 deletions(-) - -diff --git a/deploy/deploy.py b/deploy/deploy.py -index f86f2be..265e888 100755 ---- a/deploy/deploy.py -+++ b/deploy/deploy.py -@@ -243,6 +243,11 @@ class AutoDeploy(object): - - - def check_bridge(pxe_bridge, dha_path): -+ # Assume that bridges on remote nodes exists, we could ssh but -+ # the remote user might not have a login shell. -+ if os.environ.get('LIBVIRT_DEFAULT_URI'): -+ return -+ - with io.open(dha_path) as yaml_file: - dha_struct = yaml.load(yaml_file) - if dha_struct['adapter'] != 'libvirt': -diff --git a/deploy/dha_adapters/libvirt_adapter.py b/deploy/dha_adapters/libvirt_adapter.py -index 85913ac..8f3042c 100644 ---- a/deploy/dha_adapters/libvirt_adapter.py -+++ b/deploy/dha_adapters/libvirt_adapter.py -@@ -11,6 +11,7 @@ - from lxml import etree - from hardware_adapter import HardwareAdapter - import tempfile -+import os - - from common import ( - log, -@@ -23,6 +24,13 @@ DEV = {'pxe': 'network', - 'disk': 'hd', - 'iso': 'cdrom'} - -+vol_xml_template = ''' -+ %s -+ %s -+ -+ -+ -+''' - - class LibvirtAdapter(HardwareAdapter): - -@@ -140,3 +148,23 @@ class LibvirtAdapter(HardwareAdapter): - - def get_virt_net_conf_dir(self): - return self.dha_struct['virtNetConfDir'] -+ -+ def upload_iso(self, iso_file): -+ size = os.path.getsize(iso_file) -+ vol_name = os.path.basename(iso_file) -+ vol_xml = vol_xml_template % (vol_name, 'bytes', str(size), 'raw') -+ fd, fname = tempfile.mkstemp(text=True, suffix='deploy') -+ os.write(fd, vol_xml) -+ os.close(fd) -+ -+ log(vol_xml) -+ pool = 'jenkins' # FIXME -+ exec_cmd('virsh vol-create --pool %s %s' % (pool, fname)) -+ vol_path = exec_cmd('virsh vol-path --pool %s %s' % (pool, vol_name)) -+ -+ exec_cmd('virsh vol-upload %s %s' % (vol_path, iso_file), -+ attempts=5, delay=10, verbose=True) -+ -+ delete(fname) -+ -+ return vol_path -diff --git a/deploy/environments/virtual_fuel.py b/deploy/environments/virtual_fuel.py -index 82c4e47..56d6f98 100644 ---- a/deploy/environments/virtual_fuel.py -+++ b/deploy/environments/virtual_fuel.py -@@ -11,14 +11,33 @@ - from lxml import etree - from execution_environment import ExecutionEnvironment - import tempfile -+import os -+import re - - from common import ( - exec_cmd, - check_file_exists, - check_if_root, - delete, -+ log, - ) - -+vol_xml_template = ''' -+ %s -+ %s -+ -+ -+ -+''' -+ -+def get_size_and_unit(s): -+ p = re.compile('^(\d+)\s*(\D+)') -+ m = p.match(s) -+ if m == None: -+ return None, None -+ size = m.groups()[0] -+ unit = m.groups()[1] -+ return size, unit - - class VirtualFuel(ExecutionEnvironment): - -@@ -51,19 +70,41 @@ class VirtualFuel(ExecutionEnvironment): - with open(temp_vm_file, 'w') as f: - vm_xml.write(f, pretty_print=True, xml_declaration=True) - -+ def create_volume(self, pool, name, su, img_type='qcow2'): -+ log('Creating image using Libvirt volumes in pool %s, name: %s' % -+ (pool, name)) -+ size, unit = get_size_and_unit(su) -+ if size == None: -+ err('Could not determine size and unit of %s' % s) -+ -+ vol_xml = vol_xml_template % (name, unit, str(size), img_type) -+ fname = os.path.join(self.temp_dir, '%s_vol.xml' % name) -+ with file(fname, 'w') as f: -+ f.write(vol_xml) -+ -+ exec_cmd('virsh vol-create --pool %s %s' % (pool, fname)) -+ vol_path = exec_cmd('virsh vol-path --pool %s %s' % (pool, name)) -+ -+ delete(fname) -+ -+ return vol_path -+ - def create_image(self, disk_path, disk_size): -- exec_cmd('qemu-img create -f qcow2 %s %s' % (disk_path, disk_size)) -+ if os.environ.get('LIBVIRT_DEFAULT_URI') == None: -+ exec_cmd('qemu-img create -f qcow2 %s %s' % (disk_path, disk_size)) -+ else: -+ pool = 'jenkins' # FIXME -+ name = os.path.basename(disk_path) -+ disk_path = self.create_volume(pool, name, disk_size) - -- def create_vm(self): -- vm_template = '%s/%s' % (self.root_dir, -- self.dha.get_node_property( -- self.fuel_node_id, 'libvirtTemplate')) -- check_file_exists(vm_template) -+ return disk_path - -- disk_path = '%s/%s.raw' % (self.storage_dir, self.vm_name) -+ def create_vm(self): -+ stamp = time.strftime("%Y%m%d%H%M%S") -+ disk_path = '%s/%s-%s.raw' % (self.storage_dir, self.vm_name, stamp) - disk_sizes = self.dha.get_disks() - disk_size = disk_sizes['fuel'] -- self.create_image(disk_path, disk_size) -+ disk_path = self.create_image(disk_path, disk_size) - - temp_vm_file = '%s/%s' % (self.temp_dir, self.vm_name) - exec_cmd('cp %s %s' % (vm_template, temp_vm_file)) -diff --git a/deploy/install_fuel_master.py b/deploy/install_fuel_master.py -index 4f6a052..1c1bf05 100644 ---- a/deploy/install_fuel_master.py -+++ b/deploy/install_fuel_master.py -@@ -54,8 +54,12 @@ class InstallFuelMaster(object): - - self.dha.node_power_off(self.fuel_node_id) - -- log('Zero the MBR') -- self.dha.node_zero_mbr(self.fuel_node_id) -+ if os.environ.get('LIBVIRT_DEFAULT_URI'): -+ log('Upload ISO to pool') -+ self.iso_file = self.dha.upload_iso(self.iso_file) -+ else: -+ log('Zero the MBR') -+ self.dha.node_zero_mbr(self.fuel_node_id) - - self.dha.node_set_boot_order(self.fuel_node_id, ['disk', 'iso']) - diff --git a/patches/opnfv-fuel/0016-Allow-customizing-Fuel-commit.patch b/patches/opnfv-fuel/0016-Allow-customizing-Fuel-commit.patch new file mode 100644 index 00000000..b67bd311 --- /dev/null +++ b/patches/opnfv-fuel/0016-Allow-customizing-Fuel-commit.patch @@ -0,0 +1,21 @@ +From: Stanislaw Kardach +Date: Sun, 21 Feb 2016 16:28:02 +0100 +Subject: [PATCH] Allow customizing Fuel commit + +--- + build/config.mk | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/build/config.mk b/build/config.mk +index 23bda18..af63fcd 100644 +--- a/build/config.mk ++++ b/build/config.mk +@@ -9,7 +9,7 @@ + ############################################################################## + + FUEL_MAIN_REPO := https://github.com/openstack/fuel-main +-FUEL_MAIN_TAG = 9.0 ++FUEL_MAIN_TAG := 9.0 + MOS_VERSION = 9.0 + OPENSTACK_VERSION = mitaka-9.0 + diff --git a/patches/opnfv-fuel/0016-Remove-check-for-root.patch b/patches/opnfv-fuel/0016-Remove-check-for-root.patch deleted file mode 100644 index 4c24bb0e..00000000 --- a/patches/opnfv-fuel/0016-Remove-check-for-root.patch +++ /dev/null @@ -1,79 +0,0 @@ -From: Josep Puigdemont -Date: Wed, 4 May 2016 14:27:23 +0200 -Subject: [PATCH] Remove check for root - ---- - ci/deploy.sh | 5 ----- - deploy/deploy-config.py | 1 - - deploy/deploy.py | 2 -- - deploy/environments/virtual_fuel.py | 2 -- - 4 files changed, 10 deletions(-) - -diff --git a/ci/deploy.sh b/ci/deploy.sh -index dc13f1c..343d499 100755 ---- a/ci/deploy.sh -+++ b/ci/deploy.sh -@@ -193,11 +193,6 @@ do - esac - done - --if [[ $EUID -ne 0 ]]; then -- echo "This script must be run as root" 1>&2 -- exit 1 --fi -- - if [ -z $BASE_CONFIG_URI ] || [ -z $TARGET_LAB ] || \ - [ -z $TARGET_POD ] || [ -z $DEPLOY_SCENARIO ] || \ - [ -z $ISO ]; then -diff --git a/deploy/deploy-config.py b/deploy/deploy-config.py -index 65d51b2..88a1111 100644 ---- a/deploy/deploy-config.py -+++ b/deploy/deploy-config.py -@@ -40,7 +40,6 @@ from common import ( - check_file_exists, - create_dir_if_not_exists, - delete, -- check_if_root, - ArgParser, - ) - -diff --git a/deploy/deploy.py b/deploy/deploy.py -index 265e888..ff4582a 100755 ---- a/deploy/deploy.py -+++ b/deploy/deploy.py -@@ -32,7 +32,6 @@ from common import ( - check_file_exists, - create_dir_if_not_exists, - delete, -- check_if_root, - ArgParser, - ) - -@@ -230,7 +229,6 @@ class AutoDeploy(object): - return 0 - - def run(self): -- check_if_root() - if self.cleanup_only: - self.cleanup_execution_environment() - else: -diff --git a/deploy/environments/virtual_fuel.py b/deploy/environments/virtual_fuel.py -index 56d6f98..f07207f 100644 ---- a/deploy/environments/virtual_fuel.py -+++ b/deploy/environments/virtual_fuel.py -@@ -17,7 +17,6 @@ import re - from common import ( - exec_cmd, - check_file_exists, -- check_if_root, - delete, - log, - ) -@@ -114,7 +113,6 @@ class VirtualFuel(ExecutionEnvironment): - vm_definition_overwrite) - - def setup_environment(self): -- check_if_root() - self.cleanup_environment() - self.create_vm() - diff --git a/patches/opnfv-fuel/0017-Allow-customizing-java-and-fuel-mirror-URLs.patch b/patches/opnfv-fuel/0017-Allow-customizing-java-and-fuel-mirror-URLs.patch new file mode 100644 index 00000000..719ec935 --- /dev/null +++ b/patches/opnfv-fuel/0017-Allow-customizing-java-and-fuel-mirror-URLs.patch @@ -0,0 +1,42 @@ +From: Stanislaw Kardach +Date: Wed, 24 Feb 2016 20:02:25 +0100 +Subject: [PATCH] Allow customizing java and fuel-mirror URLs + +--- + build/f_isoroot/f_odlpluginbuild/config.mk | 2 +- + build/f_isoroot/f_repobuild/Makefile | 3 ++- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/build/f_isoroot/f_odlpluginbuild/config.mk b/build/f_isoroot/f_odlpluginbuild/config.mk +index a5e8a96..e64a05e 100644 +--- a/build/f_isoroot/f_odlpluginbuild/config.mk ++++ b/build/f_isoroot/f_odlpluginbuild/config.mk +@@ -12,6 +12,6 @@ ODL_CHANGE=ec9474c1178e7451ec75f6e306ac84424a84a28a + ODL_REPO="https://github.com/openstack/fuel-plugin-opendaylight.git" + + export USE_JAVA8=true +-export JAVA8_URL=https://launchpad.net/~openjdk-r/+archive/ubuntu/ppa/+files/openjdk-8-jre-headless_8u72-b15-1~trusty1_amd64.deb ++export JAVA8_URL:=https://launchpad.net/~openjdk-r/+archive/ubuntu/ppa/+files/openjdk-8-jre-headless_8u72-b15-1~trusty1_amd64.deb + export ODL_TARBALL_LOCATION=https://nexus.opendaylight.org/content/repositories/opendaylight.release/org/opendaylight/integration/distribution-karaf/0.4.1-Beryllium-SR1/distribution-karaf-0.4.1-Beryllium-SR1.tar.gz + export ODL_VERSION_NUMBER=0.4.1 +diff --git a/build/f_isoroot/f_repobuild/Makefile b/build/f_isoroot/f_repobuild/Makefile +index e95dbf2..709ca6b 100644 +--- a/build/f_isoroot/f_repobuild/Makefile ++++ b/build/f_isoroot/f_repobuild/Makefile +@@ -12,6 +12,7 @@ SHELL := /bin/bash + TOP := $(shell pwd) + TMP_ROOT_DIR := $(shell echo "$(MIRROR_UBUNTU_ROOT)" | cut -d "/" -f2) + # Enable use of exact repo commit if defined, else use Fuel main branch ++FUEL_MIRROR_REPO:=https://github.com/openstack/fuel-mirror + FUEL_MIRROR_COMMIT?=$(FUEL_MAIN_TAG) + + include ../../config.mk +@@ -26,7 +27,7 @@ nailgun: + sudo apt-get install -y git libxml2-dev libxslt-dev python-dev python-pip libz-dev libyaml-dev createrepo python-yaml + rm -Rf nailgun + sudo mkdir -p /var/www/nailgun +- git clone https://github.com/openstack/fuel-mirror ++ git clone $(FUEL_MIRROR_REPO) + cd fuel-mirror && git checkout -q $(FUEL_MIRROR_COMMIT) + sudo pip install -U -r ./fuel-mirror/requirements.txt + sudo pip install ./fuel-mirror diff --git a/patches/opnfv-fuel/0017-virtual_fuel-make-vm_template-an-attibute.patch b/patches/opnfv-fuel/0017-virtual_fuel-make-vm_template-an-attibute.patch deleted file mode 100644 index db602029..00000000 --- a/patches/opnfv-fuel/0017-virtual_fuel-make-vm_template-an-attibute.patch +++ /dev/null @@ -1,33 +0,0 @@ -From: Josep Puigdemont -Date: Wed, 4 May 2016 14:27:23 +0200 -Subject: [PATCH] virtual_fuel: make vm_template an attibute - -Signed-off-by: Josep Puigdemont ---- - deploy/environments/virtual_fuel.py | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/deploy/environments/virtual_fuel.py b/deploy/environments/virtual_fuel.py -index f07207f..92a234c 100644 ---- a/deploy/environments/virtual_fuel.py -+++ b/deploy/environments/virtual_fuel.py -@@ -46,6 +46,10 @@ class VirtualFuel(ExecutionEnvironment): - self.temp_dir = tempfile.mkdtemp() - self.vm_name = self.dha.get_node_property(self.fuel_node_id, - 'libvirtName') -+ self.vm_template = '%s/%s' % (self.root_dir, -+ self.dha.get_node_property( -+ self.fuel_node_id, 'libvirtTemplate')) -+ check_file_exists(self.vm_template) - - def __del__(self): - delete(self.temp_dir) -@@ -106,7 +110,7 @@ class VirtualFuel(ExecutionEnvironment): - disk_path = self.create_image(disk_path, disk_size) - - temp_vm_file = '%s/%s' % (self.temp_dir, self.vm_name) -- exec_cmd('cp %s %s' % (vm_template, temp_vm_file)) -+ exec_cmd('cp %s %s' % (self.vm_template, temp_vm_file)) - self.set_vm_nic(temp_vm_file) - vm_definition_overwrite = self.dha.get_vm_definition('fuel') - self.define_vm(self.vm_name, temp_vm_file, disk_path, diff --git a/patches/opnfv-fuel/0018-deploy-reap.py-Dump-extra-interfaces-information.patch b/patches/opnfv-fuel/0018-deploy-reap.py-Dump-extra-interfaces-information.patch new file mode 100644 index 00000000..8a9fe759 --- /dev/null +++ b/patches/opnfv-fuel/0018-deploy-reap.py-Dump-extra-interfaces-information.patch @@ -0,0 +1,90 @@ +From: Alexandru Avadanii +Date: Wed, 4 May 2016 18:31:09 +0200 +Subject: [PATCH] deploy/reap.py: Dump extra interfaces information. + +Since on AArch64, Ubuntu local mirror lacks arm64 packages (see [1]), +Fuel master requires internet connectivity during deploy, and hence +a way to setup such a public (extra) interface automatically. + +Previous commit "transplant: Generate extra interfaces config file" +introduced support for passing this information via DEA (override), +which may define a IFCGF_ section in its 'fuel:' +section, containing the necessary keys to produce a ifcfg- +file, like in this example: + +fuel: + IFCFG_ETH1: + device: eth1 + ipaddress: 10.0.1.10 + netmask: 255.255.255.0 + gateway: 10.0.1.254 + +In order for Network Manager to use the newly added interfaces +for outgoing traffic and honor their GATEWAY setting (e.g. if we just +added one public interface), the default route on admin iface (most of +the time called eth0) is disabled when extra interfaces are present. + +FIXME: Only supports lowercase interface names, but so does Fuel, +see related bug report [2]. + +[1] https://jira.opnfv.org/browse/ARMBAND-35 +[2] https://jira.opnfv.org/browse/FUEL-136 + +Signed-off-by: Alexandu Avadanii +Signed-off-by: Josep Puigdemont +--- + deploy/reap.py | 34 ++++++++++++++++++++++++++++++++++ + 1 file changed, 34 insertions(+) + +diff --git a/deploy/reap.py b/deploy/reap.py +index 1262d4c..1f1b8ad 100644 +--- a/deploy/reap.py ++++ b/deploy/reap.py +@@ -15,6 +15,8 @@ import yaml + import glob + import shutil + import tempfile ++import re ++import netaddr + + from common import ( + N, +@@ -246,6 +248,38 @@ class Reap(object): + if key not in ['ipaddress', 'netmask', + 'dhcp_pool_start', 'dhcp_pool_end']: + del fuel['ADMIN_NETWORK'][key] ++ ++ ## FIXME(armband): Factor in support for adding public/other interfaces. ++ ## TODO: Following block expects interface name(s) to be lowercase only ++ interfaces_list = exec_cmd('ip -o -4 a | grep -e "e[nt][hopsx].*"') ++ for interface in re.split('\n', interfaces_list): ++ # Sample output line from above cmd: ++ # 3: eth1 inet 10.0.2.10/24 scope global eth1 valid_lft forever ... ++ ifcfg = re.split(r'\s+', interface) ++ ifcfg_name = ifcfg[1] ++ ifcfg_ipaddr = ifcfg[3] ++ ++ # Filter out admin interface (device name is not known, match IP) ++ current_network = netaddr.IPNetwork(ifcfg_ipaddr) ++ if str(current_network.ip) == fuel['ADMIN_NETWORK']['ipaddress']: ++ continue ++ ++ # Read ifcfg-* network interface config file, write IFCFG_ ++ ifcfg_sec = 'IFCFG_%s' % ifcfg_name.upper() ++ fuel[ifcfg_sec] = {} ++ ifcfg_data = {} ++ ifcfg_f = ('/etc/sysconfig/network-scripts/ifcfg-%s' % ifcfg_name) ++ with open(ifcfg_f) as f: ++ for line in f: ++ (key, val) = line.split('=') ++ ifcfg_data[key.lower()] = val.rstrip() ++ ++ # Keep only needed info (e.g. filter-out type=Ethernet). ++ fuel[ifcfg_sec]['ipaddress'] = ifcfg_data['ipaddr'] ++ fuel[ifcfg_sec]['device'] = ifcfg_data['device'] ++ fuel[ifcfg_sec]['netmask'] = str(current_network.netmask) ++ fuel[ifcfg_sec]['gateway'] = ifcfg_data['gateway'] ++ + self.write_yaml(self.dea_file, {'fuel': fuel}) + + def reap_network_settings(self): diff --git a/patches/opnfv-fuel/0018-virtual_fuel-add-XML-tree-as-attribute-of-VirtualFue.patch b/patches/opnfv-fuel/0018-virtual_fuel-add-XML-tree-as-attribute-of-VirtualFue.patch deleted file mode 100644 index ebaad984..00000000 --- a/patches/opnfv-fuel/0018-virtual_fuel-add-XML-tree-as-attribute-of-VirtualFue.patch +++ /dev/null @@ -1,102 +0,0 @@ -From: Josep Puigdemont -Date: Wed, 4 May 2016 14:27:23 +0200 -Subject: [PATCH] virtual_fuel: add XML tree as attribute of VirtualFuel - -Now the VM XML definition tree is an attribute of the object, this way -it can be used by all methods without having to re-read the file from -the file. - -Methods added: -update_vm_template_file: Flushes the contents of the in-memory XML - representation of the VM to the backing file. - -del_vm_nics: Deletes all interfaces from the VM - -add_vm_nic: Adds a new NIC to the VM, it now takes the name of the - bridge as a parameter. - -Add a function to flush the contents of the in-memory XML representation -to the file update_vm_template_file - -Signed-off-by: Josep Puigdemont ---- - deploy/environments/virtual_fuel.py | 37 +++++++++++++++++++++++++------------ - 1 file changed, 25 insertions(+), 12 deletions(-) - -diff --git a/deploy/environments/virtual_fuel.py b/deploy/environments/virtual_fuel.py -index 92a234c..b68577e 100644 ---- a/deploy/environments/virtual_fuel.py -+++ b/deploy/environments/virtual_fuel.py -@@ -13,6 +13,7 @@ from execution_environment import ExecutionEnvironment - import tempfile - import os - import re -+import time - - from common import ( - exec_cmd, -@@ -50,28 +51,38 @@ class VirtualFuel(ExecutionEnvironment): - self.dha.get_node_property( - self.fuel_node_id, 'libvirtTemplate')) - check_file_exists(self.vm_template) -+ with open(self.vm_template) as f: -+ self.vm_xml = etree.parse(f) -+ -+ self.temp_vm_file = '%s/%s' % (self.temp_dir, self.vm_name) -+ self.update_vm_template_file() - - def __del__(self): - delete(self.temp_dir) - -- def set_vm_nic(self, temp_vm_file): -- with open(temp_vm_file) as f: -- vm_xml = etree.parse(f) -- interfaces = vm_xml.xpath('/domain/devices/interface') -+ def update_vm_template_file(self): -+ with open(self.temp_vm_file, "wc") as f: -+ self.vm_xml.write(f, pretty_print=True, xml_declaration=True) -+ -+ def del_vm_nics(self): -+ interfaces = self.vm_xml.xpath('/domain/devices/interface') - for interface in interfaces: - interface.getparent().remove(interface) -+ -+ def add_vm_nic(self, bridge): - interface = etree.Element('interface') - interface.set('type', 'bridge') - source = etree.SubElement(interface, 'source') -- source.set('bridge', self.pxe_bridge) -+ source.set('bridge', bridge) - model = etree.SubElement(interface, 'model') - model.set('type', 'virtio') -- devices = vm_xml.xpath('/domain/devices') -+ -+ devices = self.vm_xml.xpath('/domain/devices') - if devices: - device = devices[0] - device.append(interface) -- with open(temp_vm_file, 'w') as f: -- vm_xml.write(f, pretty_print=True, xml_declaration=True) -+ else: -+ err('No devices!') - - def create_volume(self, pool, name, su, img_type='qcow2'): - log('Creating image using Libvirt volumes in pool %s, name: %s' % -@@ -109,11 +120,13 @@ class VirtualFuel(ExecutionEnvironment): - disk_size = disk_sizes['fuel'] - disk_path = self.create_image(disk_path, disk_size) - -- temp_vm_file = '%s/%s' % (self.temp_dir, self.vm_name) -- exec_cmd('cp %s %s' % (self.vm_template, temp_vm_file)) -- self.set_vm_nic(temp_vm_file) -+ self.del_vm_nics() -+ self.add_vm_nic(self.pxe_bridge) -+ self.update_vm_template_file() -+ - vm_definition_overwrite = self.dha.get_vm_definition('fuel') -- self.define_vm(self.vm_name, temp_vm_file, disk_path, -+ -+ self.define_vm(self.vm_name, self.temp_vm_file, disk_path, - vm_definition_overwrite) - - def setup_environment(self): diff --git a/patches/opnfv-fuel/0019-deploy-ipmi-adapter-Add-port-config-support.patch b/patches/opnfv-fuel/0019-deploy-ipmi-adapter-Add-port-config-support.patch new file mode 100644 index 00000000..a650ab88 --- /dev/null +++ b/patches/opnfv-fuel/0019-deploy-ipmi-adapter-Add-port-config-support.patch @@ -0,0 +1,74 @@ +From: Alexandru Avadanii +Date: Mon, 23 May 2016 22:06:09 +0200 +Subject: [PATCH] deploy: ipmi adapter: Add config support. + +Sometimes the IPMI lanplus protocol listens on a non-standard +remote port, e.g. when target nodes are interfaced through a +fake IPMI BMC application that listens on multiple ports on the +same IP address. + +Therefore, allow setting IPMI port in the DHA using a new +property named `ipmiPort`, and pass it along to `ipmitool` when set. + +CHANGE: get_access_info now also supports specifying the IPMI +port to use with `ipmitool` by configuring the `ipmiPort` +property in the DHA. + +hp_adapter.py: updated `get_access_info` return signature with +the new (unused there) `ipmiport`. + +Signed-off-by: Alexandru Avadanii +--- + deploy/dha_adapters/hp_adapter.py | 2 +- + deploy/dha_adapters/ipmi_adapter.py | 7 +++++-- + deploy/reap.py | 2 ++ + 3 files changed, 8 insertions(+), 3 deletions(-) + +diff --git a/deploy/dha_adapters/hp_adapter.py b/deploy/dha_adapters/hp_adapter.py +index 13bb349..6434da8 100644 +--- a/deploy/dha_adapters/hp_adapter.py ++++ b/deploy/dha_adapters/hp_adapter.py +@@ -29,7 +29,7 @@ class HpAdapter(IpmiAdapter): + + def node_set_boot_order(self, node_id, boot_order_list): + log('Set boot order %s on Node %s' % (boot_order_list, node_id)) +- ip, username, password = self.get_access_info(node_id) ++ ip, username, password, ipmiport = self.get_access_info(node_id) + ssh = SSHClient(ip, username, password) + with ssh as s: + for order, dev in enumerate(boot_order_list): +diff --git a/deploy/dha_adapters/ipmi_adapter.py b/deploy/dha_adapters/ipmi_adapter.py +index 283bd57..f4f2e6a 100644 +--- a/deploy/dha_adapters/ipmi_adapter.py ++++ b/deploy/dha_adapters/ipmi_adapter.py +@@ -30,12 +30,15 @@ class IpmiAdapter(HardwareAdapter): + ip = self.get_node_property(node_id, 'ipmiIp') + username = self.get_node_property(node_id, 'ipmiUser') + password = self.get_node_property(node_id, 'ipmiPass') +- return ip, username, password ++ ipmiport = self.get_node_property(node_id, 'ipmiPort') ++ return ip, username, password, ipmiport + + def ipmi_cmd(self, node_id): +- ip, username, password = self.get_access_info(node_id) ++ ip, username, password, ipmiport = self.get_access_info(node_id) + cmd = 'ipmitool -I lanplus -A password' + cmd += ' -H %s -U %s -P %s' % (ip, username, password) ++ if ipmiport: ++ cmd += ' -p %d' % int(ipmiport) + return cmd + + def get_node_pxe_mac(self, node_id): +diff --git a/deploy/reap.py b/deploy/reap.py +index 1f1b8ad..d5386aa 100644 +--- a/deploy/reap.py ++++ b/deploy/reap.py +@@ -59,6 +59,8 @@ adapter: + # ipmiIp + # ipmiUser + # ipmiPass ++# and you *MAY* provide (optional, not added by reap.py): ++# ipmiPort + # - libvirt adapter you need to provide: + # libvirtName: + # libvirtTemplate: [libvirt/vms/controller.xml | libvirt/vms/compute.xml] diff --git a/patches/opnfv-fuel/0019-transplant-Generate-extra-interfaces-config-file.patch b/patches/opnfv-fuel/0019-transplant-Generate-extra-interfaces-config-file.patch deleted file mode 100644 index b6a351e4..00000000 --- a/patches/opnfv-fuel/0019-transplant-Generate-extra-interfaces-config-file.patch +++ /dev/null @@ -1,107 +0,0 @@ -From: Josep Puigdemont -Date: Wed, 4 May 2016 17:58:56 +0200 -Subject: [PATCH] transplant: Generate extra interfaces config file - -The DEA override may contain a IFCGF_ section in its 'fuel:' -section, containing the necessary keys to produce a ifcfg- -file, like in this example: - -fuel: - IFCFG_ETH1: - device: eth1 - ipaddress: 10.0.1.10 - netmask: 255.255.255.0 - gateway: 10.0.1.254 - -FIXME: In order for Network Manager to use the newly added interfaces -for outgoing traffic and honor their GATEWAY setting (e.g. if we just -added one public interface), the default route on admin iface (most of -the time called eth0) should be disabled. For now, we assume the admin -interface is always "eth0". - -Signed-off-by: Josep Puigdemont -Signed-off-by: Alexandu Avadanii ---- - deploy/transplant_fuel_settings.py | 37 +++++++++++++++++++++++++++++++++++++ - 1 file changed, 37 insertions(+) - -diff --git a/deploy/transplant_fuel_settings.py b/deploy/transplant_fuel_settings.py -index e57a4fb..9a65cf6 100644 ---- a/deploy/transplant_fuel_settings.py -+++ b/deploy/transplant_fuel_settings.py -@@ -11,10 +11,14 @@ - import sys - import io - import yaml -+import re -+import os - from dea import DeploymentEnvironmentAdapter - - from common import ( - check_file_exists, -+ exec_cmd, -+ log, - ) - - ASTUTE_YAML = '/etc/fuel/astute.yaml' -@@ -35,15 +39,45 @@ def parse_arguments(): - check_file_exists(dea_file) - return dea_file - -+def write_ifcfg_file(key, fuel_conf): -+ config = ('BOOTPROTO=none\n' -+ 'ONBOOT=yes\n' -+ 'TYPE=Ethernet\n' -+ 'NM_CONTROLLED=yes\n') -+ for skey in ('ipaddress', 'device', 'netmask', 'gateway'): -+ if not fuel_conf[key].get(skey): -+ log('Warning: missing key %s for %s' % (skey, key)) -+ config += '%s=\n' % skey.upper() -+ elif skey == 'ipaddress': -+ config += 'IPADDR=%s\n' % fuel_conf[key][skey] -+ else: -+ config += '%s=%s\n' % (skey.upper(), fuel_conf[key][skey]) -+ -+ fname = os.path.join('/etc/sysconfig/network-scripts/', -+ key.lower().replace('_','-')) -+ with open(fname, 'wc') as f: -+ f.write(config) - - def transplant(dea, astute): - fuel_conf = dea.get_fuel_config() -+ require_network_restart = False - for key in fuel_conf.iterkeys(): - if key == 'ADMIN_NETWORK': - for skey in fuel_conf[key].iterkeys(): - astute[key][skey] = fuel_conf[key][skey] -+ elif re.match('^IFCFG', key): -+ log('Adding interface configuration for: %s' % key.lower()) -+ require_network_restart = True -+ write_ifcfg_file(key, fuel_conf) -+ if astute.has_key(key): -+ astute.pop(key, None) - else: - astute[key] = fuel_conf[key] -+ if require_network_restart: -+ admin_ifcfg = '/etc/sysconfig/network-scripts/ifcfg-eth0' -+ exec_cmd('echo "DEFROUTE=no" >> %s' % admin_ifcfg) -+ log('At least one interface was reconfigured, restart network manager') -+ exec_cmd('systemctl restart network') - return astute - - -@@ -51,11 +85,14 @@ def main(): - dea_file = parse_arguments() - check_file_exists(ASTUTE_YAML) - dea = DeploymentEnvironmentAdapter(dea_file) -+ log('Reading astute file %s' % ASTUTE_YAML) - with io.open(ASTUTE_YAML) as stream: - astute = yaml.load(stream) -+ log('Initiating transplant') - transplant(dea, astute) - with io.open(ASTUTE_YAML, 'w') as stream: - yaml.dump(astute, stream, default_flow_style=False) -+ log('Transplant done') - - - if __name__ == '__main__': diff --git a/patches/opnfv-fuel/0020-Add-arm64-deb-repositories-setup.patch b/patches/opnfv-fuel/0020-Add-arm64-deb-repositories-setup.patch new file mode 100644 index 00000000..9083ceb1 --- /dev/null +++ b/patches/opnfv-fuel/0020-Add-arm64-deb-repositories-setup.patch @@ -0,0 +1,166 @@ +From: Stanislaw Kardach +Date: Wed, 24 Feb 2016 20:04:03 +0100 +Subject: [PATCH] Add arm64 deb repositories setup + +--- + build/f_isoroot/f_kscfg/ks.cfg.patch | 10 ++++++++++ + build/install/apt-ftparchive-deb.conf | 8 +++++++- + build/install/apt-ftparchive-release.conf | 2 +- + build/install/apt-ftparchive-udeb.conf | 7 ++++++- + build/install/install.sh | 22 ++++++++++++++++++---- + build/install/uninstall.sh | 18 ++++++++++-------- + 6 files changed, 52 insertions(+), 15 deletions(-) + +diff --git a/build/f_isoroot/f_kscfg/ks.cfg.patch b/build/f_isoroot/f_kscfg/ks.cfg.patch +index a6840e4..e1ae8fc 100644 +--- a/build/f_isoroot/f_kscfg/ks.cfg.patch ++++ b/build/f_isoroot/f_kscfg/ks.cfg.patch +@@ -1,6 +1,16 @@ + *** /dev/null 2016-04-26 10:10:11.481587709 +0200 + --- ks.cfg 2016-04-26 10:10:11.481587709 +0200 + *************** ++*** 448,453 **** ++--- 448,454 ---- ++ cp ${SOURCE}/.treeinfo ${repodir}/centos/x86_64 ++ ++ # Copying Ubuntu files +++ # FIXME: This is missleading as dist/pool may contain multiple arch! ++ mkdir -p ${repodir}/ubuntu/x86_64/images ++ cp -r ${SOURCE}/ubuntu/dists ${repodir}/ubuntu/x86_64 ++ cp -r ${SOURCE}/ubuntu/pool ${repodir}/ubuntu/x86_64 ++*************** + *** 579,584 **** + --- 579,592 ---- + +diff --git a/build/install/apt-ftparchive-deb.conf b/build/install/apt-ftparchive-deb.conf +index 0d15aec..e6392f8 100644 +--- a/build/install/apt-ftparchive-deb.conf ++++ b/build/install/apt-ftparchive-deb.conf +@@ -16,12 +16,18 @@ TreeDefault { + Directory "pool"; + }; + +-BinDirectory "pool/main" { ++BinDirectory "pool/main/binary-amd64" { + Packages "dists/trusty/main/binary-amd64/Packages"; + BinOverride "./indices/override.trusty.main"; + ExtraOverride "./indices/override.trusty.extra.main"; + }; + ++BinDirectory "pool/main/binary-arm64" { ++ Packages "dists/trusty/main/binary-arm64/Packages"; ++ BinOverride "./indices/override.trusty.main"; ++ ExtraOverride "./indices/override.trusty.extra.main"; ++}; ++ + Default { + Packages { + Extensions ".deb"; +diff --git a/build/install/apt-ftparchive-release.conf b/build/install/apt-ftparchive-release.conf +index 02706bd..2838714 100644 +--- a/build/install/apt-ftparchive-release.conf ++++ b/build/install/apt-ftparchive-release.conf +@@ -13,6 +13,6 @@ APT::FTPArchive::Release::Label "Ubuntu"; + APT::FTPArchive::Release::Suite "trusty"; + APT::FTPArchive::Release::Version "1.04"; + APT::FTPArchive::Release::Codename "trusty"; +-APT::FTPArchive::Release::Architectures "amd64"; ++APT::FTPArchive::Release::Architectures "amd64 arm64"; + APT::FTPArchive::Release::Components "main"; + APT::FTPArchive::Release::Description "Ubuntu Trusty Tahr 14.04 LTS"; +diff --git a/build/install/apt-ftparchive-udeb.conf b/build/install/apt-ftparchive-udeb.conf +index 3b5b239..c6ab4fb 100644 +--- a/build/install/apt-ftparchive-udeb.conf ++++ b/build/install/apt-ftparchive-udeb.conf +@@ -16,11 +16,16 @@ TreeDefault { + Directory "pool"; + }; + +-BinDirectory "pool/debian-installer" { ++BinDirectory "pool/debian-installer/binary-amd64" { + Packages "dists/trusty/main/debian-installer/binary-amd64/Packages"; + BinOverride "./indices/override.trusty.main.debian-installer"; + }; + ++BinDirectory "pool/debian-installer/binary-arm64" { ++ Packages "dists/trusty/main/debian-installer/binary-arm64/Packages"; ++ BinOverride "./indices/override.trusty.main.debian-installer"; ++}; ++ + Default { + Packages { + Extensions ".udeb"; +diff --git a/build/install/install.sh b/build/install/install.sh +index 4e0389e..8c29e08 100755 +--- a/build/install/install.sh ++++ b/build/install/install.sh +@@ -122,12 +122,24 @@ prep_make_live() { + ssh-copy-id root@$FUELHOST + sshfs root@1${FUELHOST}:/ $TMP_HOSTMOUNT + +- if [ -f $REPO/dists/trusty/main/binary-amd64/Packages.backup ]; then ++ for arch in arm64 amd64; do ++ if [ -f $REPO/dists/trusty/main/binary-${arch}/Packages.backup ]; then ++ echo "Error - found backup file for Packages for ${arch}!" ++ exit 1 ++ fi ++ ++ if [ -f $REPO/dists/trusty/main/binary-${arch}/Packages.gz.backup ]; then ++ echo "Error - found backup file for Packages.gz for ${arch}!" ++ exit 1 ++ fi ++ done ++ ++ if [ -f $REPO/dists/trusty/main/binary-arm64/Packages.backup ]; then + echo "Error - found backup file for Packages!" + exit 1 + fi + +- if [ -f $REPO/dists/trusty/main/binary-amd64/Packages.gz.backup ]; then ++ if [ -f $REPO/dists/trusty/main/binary-arm64/Packages.gz.backup ]; then + echo "Error - found backup file for Packages.gz!" + exit 1 + fi +@@ -142,8 +154,10 @@ prep_make_live() { + exit 1 + fi + +- cp $REPO/dists/trusty/main/binary-amd64/Packages $REPO/dists/trusty/main/binary-amd64/Packages.backup +- cp $REPO/dists/trusty/main/binary-amd64/Packages.gz $REPO/dists/trusty/main/binary-amd64/Packages.gz.backup ++ for arch in arm64 amd64; do ++ cp $REPO/dists/trusty/main/binary-${arch}/Packages $REPO/dists/trusty/main/binary-${arch}/Packages.backup ++ cp $REPO/dists/trusty/main/binary-${arch}/Packages.gz $REPO/dists/trusty/main/binary-${arch}/Packages.gz.backup ++ done + cp $REPO/dists/trusty/Release $REPO/dists/trusty/Release.backup + cp -Rvp $DEST/etc/puppet $DEST/etc/puppet.backup + } +diff --git a/build/install/uninstall.sh b/build/install/uninstall.sh +index a9e74bc..e90c632 100755 +--- a/build/install/uninstall.sh ++++ b/build/install/uninstall.sh +@@ -31,15 +31,17 @@ DEST=$MOUNT + REPO=$DEST/var/www/nailgun/ubuntu/fuelweb/x86_64 + + cd $REPO +-if [ ! -f $REPO/dists/trusty/main/binary-amd64/Packages.backup ]; then +- echo "Error - didn't find backup file for Packages!" +- exit 1 +-fi ++for arch in arm64 amd64; do ++ if [ ! -f $REPO/dists/trusty/main/binary-${arch}/Packages.backup ]; then ++ echo "Error - didn't find backup file for Packages for ${arch}!" ++ exit 1 ++ fi + +-if [ ! -f $REPO/dists/trusty/main/binary-amd64/Packages.gz.backup ]; then +- echo "Error - didn't find backup file for Packages.gz!" +- exit 1 +-fi ++ if [ ! -f $REPO/dists/trusty/main/binary-${arch}/Packages.gz.backup ]; then ++ echo "Error - didn't find backup file for Packages.gz for ${arch}!" ++ exit 1 ++ fi ++done + + if [ ! -f $REPO/dists/trusty/Release.backup ]; then + echo "Error - didn't find backup file for Release!" diff --git a/patches/opnfv-fuel/0020-deploy.sh-no-need-to-set-umask-0000.patch b/patches/opnfv-fuel/0020-deploy.sh-no-need-to-set-umask-0000.patch deleted file mode 100644 index 241f3078..00000000 --- a/patches/opnfv-fuel/0020-deploy.sh-no-need-to-set-umask-0000.patch +++ /dev/null @@ -1,33 +0,0 @@ -From: Josep Puigdemont -Date: Fri, 6 May 2016 03:07:40 +0200 -Subject: [PATCH] deploy.sh: no need to set umask 0000 - -Signed-off-by: Josep Puigdemont ---- - ci/deploy.sh | 6 ------ - 1 file changed, 6 deletions(-) - -diff --git a/ci/deploy.sh b/ci/deploy.sh -index 343d499..34ecc57 100755 ---- a/ci/deploy.sh -+++ b/ci/deploy.sh -@@ -76,9 +76,6 @@ Input parameters to the build script is: - -i .iso image to be deployed (needs to be provided in a URI - style, it can be a local resource: file:// or a remote resource http(s)://) - --NOTE: Root priviledges are needed for this script to run -- -- - Examples: - sudo `basename $0` -b file:///home/jenkins/lab-config -l lf -p pod1 -s ha_odl-l3_heat_ceilometer -i file:///home/jenkins/myiso.iso - EOF -@@ -207,9 +204,6 @@ fi - # Enable the automatic exit trap - trap do_exit SIGINT SIGTERM EXIT - --# Set no restrictive umask so that Jenkins can removeeee any residuals --umask 0000 -- - clean - - pushd ${DEPLOY_DIR} > /dev/null diff --git a/patches/opnfv-fuel/0021-Build-bootstrap-image-for-arm64.patch b/patches/opnfv-fuel/0021-Build-bootstrap-image-for-arm64.patch new file mode 100644 index 00000000..42218ad1 --- /dev/null +++ b/patches/opnfv-fuel/0021-Build-bootstrap-image-for-arm64.patch @@ -0,0 +1,39 @@ +From: Stanislaw Kardach +Date: Thu, 3 Mar 2016 19:04:07 +0100 +Subject: [PATCH] Build bootstrap image for arm64 + +For now the arch is hardcoded for simplicity. We should detect this +but how? If we're multi-arch then one bootstrap image should be built +per supported arch. This requires Fuel refactoring. +--- + build/bootstrap_admin_node.sh.patch | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/build/bootstrap_admin_node.sh.patch b/build/bootstrap_admin_node.sh.patch +index aeef3f7..c66b497 100644 +--- a/build/bootstrap_admin_node.sh.patch ++++ b/build/bootstrap_admin_node.sh.patch +@@ -53,6 +53,23 @@ + # Enable iptables + systemctl enable iptables.service + *************** ++*** 484,490 **** ++ local ret=1 ++ echo ${bs_progress_message} >&2 ++ set_ui_bootstrap_error "${bs_progress_message}" >&2 ++! if fuel-bootstrap -v --debug build --activate >>"$bs_build_log" 2>&1; then ++ ret=0 ++ fuel notify --topic "done" --send "${bs_done_message}" ++ else ++--- 484,490 ---- ++ local ret=1 ++ echo ${bs_progress_message} >&2 ++ set_ui_bootstrap_error "${bs_progress_message}" >&2 ++! if fuel-bootstrap -v --debug build --target_arch arm64 --activate >>"$bs_build_log" 2>&1; then ++ ret=0 ++ fuel notify --topic "done" --send "${bs_done_message}" ++ else ++*************** + *** 529,534 **** + --- 541,556 ---- + diff --git a/patches/opnfv-fuel/0021-common.py-allow-specifying-number-of-attempts-in-exe.patch b/patches/opnfv-fuel/0021-common.py-allow-specifying-number-of-attempts-in-exe.patch deleted file mode 100644 index d799723e..00000000 --- a/patches/opnfv-fuel/0021-common.py-allow-specifying-number-of-attempts-in-exe.patch +++ /dev/null @@ -1,70 +0,0 @@ -From: Josep Puigdemont -Date: Fri, 6 May 2016 03:28:26 +0200 -Subject: [PATCH] common.py: allow specifying number of attempts in exec_cmd - -Some commands executed by exec_cmd may fail because of a temporary -cause, and it may be desirable to retry the same command several times -until it succeeds. One example of this are the ipmitool commands, which -may fail temorarily on some targets if they get too many requests -simultaneously. - -In this patch two new optional parameters are introduced to the function -signature, which do not break backward compatibility: - attempts: which indicates how many times the command should be run if - it returns a non-zero value*, and defaults to 1 (as today). - delay: which indicates the delay in seconds between attempts, and - defaults to 5 seconds. - verbose: It will print the remaining attempts left for the current - command if set to True. - -* It may be desirable to add yet another parameter to indicate what - return value should be considered an error, but zero for now seems a - reasonable default - -Signed-off-by: Josep Puigdemont ---- - deploy/common.py | 24 +++++++++++++++++------- - 1 file changed, 17 insertions(+), 7 deletions(-) - -diff --git a/deploy/common.py b/deploy/common.py -index 41b4e27..3cd3e0e 100644 ---- a/deploy/common.py -+++ b/deploy/common.py -@@ -16,6 +16,7 @@ import argparse - import shutil - import stat - import errno -+import time - - N = {'id': 0, 'status': 1, 'name': 2, 'cluster': 3, 'ip': 4, 'mac': 5, - 'roles': 6, 'pending_roles': 7, 'online': 8, 'group_id': 9} -@@ -37,13 +38,22 @@ out_handler.setFormatter(formatter) - LOG.addHandler(out_handler) - os.chmod(LOGFILE, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) - --def exec_cmd(cmd, check=True): -- process = subprocess.Popen(cmd, -- stdout=subprocess.PIPE, -- stderr=subprocess.PIPE, -- shell=True) -- (response, stderr) = process.communicate() -- return_code = process.returncode -+def exec_cmd(cmd, check=True, attempts=1, delay=5, verbose=False): -+ # a negative value means forever -+ while attempts != 0: -+ attempts = attempts - 1 -+ process = subprocess.Popen(cmd, -+ stdout=subprocess.PIPE, -+ stderr=subprocess.PIPE, -+ shell=True) -+ (response, stderr) = process.communicate() -+ return_code = process.returncode -+ if return_code == 0 or attempts == 0: -+ break -+ time.sleep(delay) -+ if verbose: -+ log('%d attempts left: %s' % (attempts, cmd)) -+ - response = response.strip() - if check: - if return_code > 0: diff --git a/patches/opnfv-fuel/0022-bootstrap-Use-public-Ubuntu-ports-mirrors.patch b/patches/opnfv-fuel/0022-bootstrap-Use-public-Ubuntu-ports-mirrors.patch new file mode 100644 index 00000000..2300153b --- /dev/null +++ b/patches/opnfv-fuel/0022-bootstrap-Use-public-Ubuntu-ports-mirrors.patch @@ -0,0 +1,48 @@ +From: Alexandru Avadanii +Date: Thu, 3 Mar 2016 19:18:27 +0100 +Subject: [PATCH] bootstrap: Use public Ubuntu-ports mirrors. + +Instead of relying on 127.0.0.1 partial Ubuntu mirror, use +public archives. +While doing so, switch to Ubuntu-ports, enabling building arm64 +bootstraps. + +NOTE: This disables the abillity to build amd64 bootstraps with +current config. +--- + build/f_isoroot/f_repobuild/fuel_bootstrap_cli.yaml | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/build/f_isoroot/f_repobuild/fuel_bootstrap_cli.yaml b/build/f_isoroot/f_repobuild/fuel_bootstrap_cli.yaml +index aa12c45..2e4843d 100644 +--- a/build/f_isoroot/f_repobuild/fuel_bootstrap_cli.yaml ++++ b/build/f_isoroot/f_repobuild/fuel_bootstrap_cli.yaml +@@ -36,19 +36,19 @@ + repos: + - name: ubuntu + section: "main universe multiverse" +- uri: "http://127.0.0.1:8080/mirrors/ubuntu" ++ uri: "http://ports.ubuntu.com/ubuntu-ports" + priority: + suite: trusty + type: deb + - name: ubuntu-updates + section: "main universe multiverse" +- uri: "http://127.0.0.1:8080/mirrors/ubuntu" ++ uri: "http://ports.ubuntu.com/ubuntu-ports" + priority: + suite: trusty-updates + type: deb + - name: ubuntu-security + section: "main universe multiverse" +- uri: "http://127.0.0.1:8080/mirrors/ubuntu" ++ uri: "http://ports.ubuntu.com/ubuntu-ports" + priority: + suite: trusty-security + type: deb +@@ -60,4 +60,5 @@ + type: deb + skip_default_img_build: true + direct_repo_addresses: ++ - "ports.ubuntu.com" + - "127.0.0.1" diff --git a/patches/opnfv-fuel/0022-ipmi_adapter-simplify-retry-if-command-fails.patch b/patches/opnfv-fuel/0022-ipmi_adapter-simplify-retry-if-command-fails.patch deleted file mode 100644 index c1617f04..00000000 --- a/patches/opnfv-fuel/0022-ipmi_adapter-simplify-retry-if-command-fails.patch +++ /dev/null @@ -1,171 +0,0 @@ -From: Josep Puigdemont -Date: Fri, 6 May 2016 12:09:58 +0200 -Subject: [PATCH] ipmi_adapter: simplify, retry if command fails - -The method get_node_state has been added to the The IpmiAdapter class. - -In addition, now the power on/off methods will try several times to -perform their IPMI command before giving up, instead of bailing out at -the first error. - -After the power on/off command is completed, the method will wait until -the node is in the desired state. - -FIXME: a command could potentially take several minutes if the defaults -are used; each IPMI command can take 1 minutes, and there can be three -commands issued per operation, one of them may be retried 20 times with -the current defaults. Ideally we would use eventlet or something alike -to allow each command a limited time to execute: - with eventlet.timeout.Timeout(seconds) as t: - power_on/off_command - -FIXME: There is a potential dead-lock situation by issuing the command -and then checking the status, as someone could have intervened in -between the two commands. - -Signed-off-by: Josep Puigdemont ---- - deploy/dha_adapters/ipmi_adapter.py | 101 +++++++++++++++--------------------- - 1 file changed, 42 insertions(+), 59 deletions(-) - -diff --git a/deploy/dha_adapters/ipmi_adapter.py b/deploy/dha_adapters/ipmi_adapter.py -index 8fda4f9..283bd57 100644 ---- a/deploy/dha_adapters/ipmi_adapter.py -+++ b/deploy/dha_adapters/ipmi_adapter.py -@@ -1,5 +1,6 @@ - ############################################################################### - # Copyright (c) 2015 Ericsson AB and others. -+# (c) 2016 Enea Software AB - # szilard.cserey@ericsson.com - # All rights reserved. This program and the accompanying materials - # are made available under the terms of the Apache License, Version 2.0 -@@ -20,8 +21,10 @@ from common import ( - - class IpmiAdapter(HardwareAdapter): - -- def __init__(self, yaml_path): -+ def __init__(self, yaml_path, attempts=20, delay=3): - super(IpmiAdapter, self).__init__(yaml_path) -+ self.attempts = attempts -+ self.delay = delay - - def get_access_info(self, node_id): - ip = self.get_node_property(node_id, 'ipmiIp') -@@ -40,69 +43,46 @@ class IpmiAdapter(HardwareAdapter): - mac_list.append(self.get_node_property(node_id, 'pxeMac').lower()) - return mac_list - -+ def node_get_state(self, node_id): -+ state = exec_cmd('%s chassis power status' % self.ipmi_cmd(node_id), -+ attempts=self.attempts, delay=self.delay, -+ verbose=True) -+ return state -+ -+ def __node_power_cmd__(self, node_id, cmd): -+ expected = 'Chassis Power is %s' % cmd -+ if self.node_get_state(node_id) == expected: -+ return -+ -+ pow_cmd = '%s chassis power %s' % (self.ipmi_cmd(node_id), cmd) -+ exec_cmd(pow_cmd, attempts=self.attempts, delay=self.delay, -+ verbose=True) -+ -+ attempts = self.attempts -+ while attempts: -+ state = self.node_get_state(node_id) -+ attempts -= 1 -+ if state == expected: -+ return -+ elif attempts != 0: -+ # reinforce our will, but allow the command to fail, -+ # we know our message got across once already... -+ exec_cmd(pow_cmd, check=False) -+ -+ err('Could not set chassis %s for node %s' % (cmd, node_id)) -+ - def node_power_on(self, node_id): -- WAIT_LOOP = 200 -- SLEEP_TIME = 3 - log('Power ON Node %s' % node_id) -- cmd_prefix = self.ipmi_cmd(node_id) -- state = exec_cmd('%s chassis power status' % cmd_prefix) -- if state == 'Chassis Power is off': -- exec_cmd('%s chassis power on' % cmd_prefix) -- done = False -- for i in range(WAIT_LOOP): -- state, _ = exec_cmd('%s chassis power status' % cmd_prefix, -- False) -- if state == 'Chassis Power is on': -- done = True -- break -- else: -- time.sleep(SLEEP_TIME) -- if not done: -- err('Could Not Power ON Node %s' % node_id) -+ self.__node_power_cmd__(node_id, 'on') - - def node_power_off(self, node_id): -- WAIT_LOOP = 200 -- SLEEP_TIME = 3 - log('Power OFF Node %s' % node_id) -- cmd_prefix = self.ipmi_cmd(node_id) -- state = exec_cmd('%s chassis power status' % cmd_prefix) -- if state == 'Chassis Power is on': -- done = False -- exec_cmd('%s chassis power off' % cmd_prefix) -- for i in range(WAIT_LOOP): -- state, _ = exec_cmd('%s chassis power status' % cmd_prefix, -- False) -- if state == 'Chassis Power is off': -- done = True -- break -- else: -- time.sleep(SLEEP_TIME) -- if not done: -- err('Could Not Power OFF Node %s' % node_id) -+ self.__node_power_cmd__(node_id, 'off') - - def node_reset(self, node_id): -- WAIT_LOOP = 600 - log('RESET Node %s' % node_id) -- cmd_prefix = self.ipmi_cmd(node_id) -- state = exec_cmd('%s chassis power status' % cmd_prefix) -- if state == 'Chassis Power is on': -- was_shut_off = False -- done = False -- exec_cmd('%s chassis power reset' % cmd_prefix) -- for i in range(WAIT_LOOP): -- state, _ = exec_cmd('%s chassis power status' % cmd_prefix, -- False) -- if state == 'Chassis Power is off': -- was_shut_off = True -- elif state == 'Chassis Power is on' and was_shut_off: -- done = True -- break -- time.sleep(1) -- if not done: -- err('Could Not RESET Node %s' % node_id) -- else: -- err('Cannot RESET Node %s because it\'s not Active, state: %s' -- % (node_id, state)) -+ cmd = '%s chassis power reset' % self.ipmi_cmd(node_id) -+ exec_cmd(cmd, attempts=self.attempts, delay=self.delay, verbose=True) - - def node_set_boot_order(self, node_id, boot_order_list): - log('Set boot order %s on Node %s' % (boot_order_list, node_id)) -@@ -111,9 +91,12 @@ class IpmiAdapter(HardwareAdapter): - for dev in boot_order_list: - if dev == 'pxe': - exec_cmd('%s chassis bootdev pxe options=persistent' -- % cmd_prefix) -+ % cmd_prefix, attempts=self.attempts, delay=self.delay, -+ verbose=True) - elif dev == 'iso': -- exec_cmd('%s chassis bootdev cdrom' % cmd_prefix) -+ exec_cmd('%s chassis bootdev cdrom' % cmd_prefix, -+ attempts=self.attempts, delay=self.delay, verbose=True) - elif dev == 'disk': - exec_cmd('%s chassis bootdev disk options=persistent' -- % cmd_prefix) -+ % cmd_prefix, attempts=self.attempts, delay=self.delay, -+ verbose=True) diff --git a/patches/opnfv-fuel/0023-bootstrap-Add-armband-rtc-efi-fix-package.patch b/patches/opnfv-fuel/0023-bootstrap-Add-armband-rtc-efi-fix-package.patch new file mode 100644 index 00000000..90c4e977 --- /dev/null +++ b/patches/opnfv-fuel/0023-bootstrap-Add-armband-rtc-efi-fix-package.patch @@ -0,0 +1,38 @@ +From: Alexandru Avadanii +Date: Sun, 17 Apr 2016 15:37:38 +0200 +Subject: [PATCH] bootstrap: Add armband-rtc-efi-fix package. + +Older ThunderX and possibly other UEFI-enabled targets do not support +rtc-efi properly, so they end up filling dmesg with useless +complaints about not being able to read system time. + +armband-rtc-efi-fix validates rtc-efi can be used on the system, +otherwise it rmmods rtc_efi kernel module via rcS script. + +This patch hardcodes the addition of armband-rtc-ef-fix package during +bootstrap image build. + +NOTES: +This could be later removed or, if other fixes need to be delivered +like this, grouped in a meta package. + +Fuel 9.0 moved default package list to openstack.yaml fixture, see [1]. + +[1] https://github.com/openstack/fuel-web/commit/ + 4ee42effe27694bd231663e3d0f10c0c42877177 +--- + build/f_isoroot/f_repobuild/fuel_bootstrap_cli.yaml | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/build/f_isoroot/f_repobuild/fuel_bootstrap_cli.yaml b/build/f_isoroot/f_repobuild/fuel_bootstrap_cli.yaml +index 2e4843d..15d9e9d 100644 +--- a/build/f_isoroot/f_repobuild/fuel_bootstrap_cli.yaml ++++ b/build/f_isoroot/f_repobuild/fuel_bootstrap_cli.yaml +@@ -28,6 +28,7 @@ + - xz-utils + - squashfs-tools + - msmtp-mta ++ - armband-rtc-efi-fix + bootstrap_images_dir: /var/www/nailgun/bootstraps + active_bootstrap_symlink: /var/www/nailgun/bootstraps/active_bootstrap + flavor: ubuntu diff --git a/patches/opnfv-fuel/0023-deploy.py-add-multiple-bridges-support.patch b/patches/opnfv-fuel/0023-deploy.py-add-multiple-bridges-support.patch deleted file mode 100644 index 37a888b4..00000000 --- a/patches/opnfv-fuel/0023-deploy.py-add-multiple-bridges-support.patch +++ /dev/null @@ -1,68 +0,0 @@ -From: Josep Puigdemont -Date: Fri, 6 May 2016 04:32:06 +0200 -Subject: [PATCH] deploy.py: add multiple bridges support - -Some Fuel VMs may need more than one network interface. To be able to do -that, we now allow the user to specify the "-b" paramter (bridge) -multiple times, creating a new NIC for each one of them. - -The NICs are created in the same order as they are given in the command -line. - -There is no change in behavior from earlier versions, pxebr will still -be the default bridge if none is specified. - -Signed-off-by: Josep Puigdemont ---- - deploy/deploy.py | 10 +++++++--- - deploy/environments/virtual_fuel.py | 3 ++- - 2 files changed, 9 insertions(+), 4 deletions(-) - -diff --git a/deploy/deploy.py b/deploy/deploy.py -index ff4582a..041ba2f 100755 ---- a/deploy/deploy.py -+++ b/deploy/deploy.py -@@ -312,8 +312,8 @@ def parse_arguments(): - parser.add_argument('-s', dest='storage_dir', action='store', - default='%s/images' % CWD, - help='Storage Directory [default: images]') -- parser.add_argument('-b', dest='pxe_bridge', action='store', -- default='pxebr', -+ parser.add_argument('-b', dest='pxe_bridge', action='append', -+ default=[], - help='Linux Bridge for booting up the Fuel Master VM ' - '[default: pxebr]') - parser.add_argument('-p', dest='fuel_plugins_dir', action='store', -@@ -332,6 +332,9 @@ def parse_arguments(): - args = parser.parse_args() - log(args) - -+ if not args.pxe_bridge: -+ args.pxe_bridge = ['pxebr'] -+ - check_file_exists(args.dha_file) - - if not args.cleanup_only: -@@ -343,6 +346,7 @@ def parse_arguments(): - log('Using image directory: %s' % args.storage_dir) - create_dir_if_not_exists(args.storage_dir) -- check_bridge(args.pxe_bridge, args.dha_file) -+ for bridge in args.pxe_bridge: -+ check_bridge(bridge, args.dha_file) - - kwargs = {'no_fuel': args.no_fuel, 'fuel_only': args.fuel_only, - 'no_health_check': args.no_health_check, -diff --git a/deploy/environments/virtual_fuel.py b/deploy/environments/virtual_fuel.py -index b68577e..6b673d0 100644 ---- a/deploy/environments/virtual_fuel.py -+++ b/deploy/environments/virtual_fuel.py -@@ -121,7 +121,8 @@ class VirtualFuel(ExecutionEnvironment): - disk_path = self.create_image(disk_path, disk_size) - - self.del_vm_nics() -- self.add_vm_nic(self.pxe_bridge) -+ for bridge in self.pxe_bridge: -+ self.add_vm_nic(bridge) - self.update_vm_template_file() - - vm_definition_overwrite = self.dha.get_vm_definition('fuel') diff --git a/patches/opnfv-fuel/0024-Allow-customizing-fuel-plugin-opendaylight.patch b/patches/opnfv-fuel/0024-Allow-customizing-fuel-plugin-opendaylight.patch new file mode 100644 index 00000000..c47b166c --- /dev/null +++ b/patches/opnfv-fuel/0024-Allow-customizing-fuel-plugin-opendaylight.patch @@ -0,0 +1,26 @@ +From: Florin Dumitrascu +Date: Thu, 17 Mar 2016 19:37:19 +0100 +Subject: [PATCH] Allow customizing fuel-plugin-opendaylight + +Signed-off-by: Florin Dumitrascu +--- + build/f_isoroot/f_odlpluginbuild/config.mk | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/build/f_isoroot/f_odlpluginbuild/config.mk b/build/f_isoroot/f_odlpluginbuild/config.mk +index e64a05e..bca432c 100644 +--- a/build/f_isoroot/f_odlpluginbuild/config.mk ++++ b/build/f_isoroot/f_odlpluginbuild/config.mk +@@ -7,9 +7,9 @@ + # http://www.apache.org/licenses/LICENSE-2.0 + ############################################################################## + +-ODL_BRANCH=brahmaputra-sr2 +-ODL_CHANGE=ec9474c1178e7451ec75f6e306ac84424a84a28a +-ODL_REPO="https://github.com/openstack/fuel-plugin-opendaylight.git" ++ODL_BRANCH:=brahmaputra-sr2 ++ODL_CHANGE:=ec9474c1178e7451ec75f6e306ac84424a84a28a ++ODL_REPO:="https://github.com/openstack/fuel-plugin-opendaylight.git" + + export USE_JAVA8=true + export JAVA8_URL:=https://launchpad.net/~openjdk-r/+archive/ubuntu/ppa/+files/openjdk-8-jre-headless_8u72-b15-1~trusty1_amd64.deb diff --git a/patches/opnfv-fuel/0024-deploy.sh-allow-specifying-several-bridges.patch b/patches/opnfv-fuel/0024-deploy.sh-allow-specifying-several-bridges.patch deleted file mode 100644 index b10effee..00000000 --- a/patches/opnfv-fuel/0024-deploy.sh-allow-specifying-several-bridges.patch +++ /dev/null @@ -1,47 +0,0 @@ -From: Josep Puigdemont -Date: Fri, 6 May 2016 04:39:44 +0200 -Subject: [PATCH] deploy.sh: allow specifying several bridges - -It might be desirable to add several bridges to the fuel VM, so we let -the user specify -B more than once, and honor that when calling -deploy.py. We also make it possible to specify a comma separated list of -bridges, as in: -B br1,br2, for convenience for the Jenkins jobs. - -There is a change in behavior from the previous version, and that is -that it may call the deploy.py python script with more than one instance -of the "-b" parameter. - -Signed-off-by: Josep Puigdemont ---- - ci/deploy.sh | 11 +++++++---- - 1 file changed, 7 insertions(+), 4 deletions(-) - -diff --git a/ci/deploy.sh b/ci/deploy.sh -index 34ecc57..c9b836b 100755 ---- a/ci/deploy.sh -+++ b/ci/deploy.sh -@@ -57,7 +57,10 @@ and provides a fairly simple mechanism to execute a deployment. - Input parameters to the build script is: - -b Base URI to the configuration directory (needs to be provided in a URI - style, it can be a local resource: file:// or a remote resource http(s)://) ---B PXE Bridge for booting of Fuel master, default is pxebr -+-B PXE Bridge for booting of Fuel master. It can be specified several times, -+ or as a comma separated list of bridges, or both: -B br1 -B br2,br3 -+ One NIC connected to each specified bridge will be created in the Fuel VM, -+ in the same order as provided in the command line. The default is pxebr. - -d Dry-run - Produces deploy config files (config/dea.yaml and - config/dha.yaml), but does not execute deploy - -f Deploy on existing Fuel master -@@ -130,9 +133,9 @@ do - fi - ;; - B) -- if [[ ${OPTARG} ]]; then -- PXE_BRIDGE="-b ${OPTARG}" -- fi -+ for bridge in ${OPTARG//,/ }; do -+ PXE_BRIDGE+=" -b $bridge" -+ done - ;; - d) - DRY_RUN=1 diff --git a/patches/opnfv-fuel/0025-Fuel-VM-for-the-Enea-Armband-lab.patch b/patches/opnfv-fuel/0025-Fuel-VM-for-the-Enea-Armband-lab.patch deleted file mode 100644 index fbcd11d1..00000000 --- a/patches/opnfv-fuel/0025-Fuel-VM-for-the-Enea-Armband-lab.patch +++ /dev/null @@ -1,106 +0,0 @@ -From: Josep Puigdemont -Date: Wed, 4 May 2016 14:27:23 +0200 -Subject: [PATCH] Fuel VM for the Enea Armband lab - -This is the initial VM description fit for Enea's Armband lab. - -Signed-off-by: Josep Puigdemont ---- - .../hardware_environment/vms/enea_lab/fuel.xml | 88 ++++++++++++++++++++++ - 1 file changed, 88 insertions(+) - create mode 100644 deploy/templates/hardware_environment/vms/enea_lab/fuel.xml - -diff --git a/deploy/templates/hardware_environment/vms/enea_lab/fuel.xml b/deploy/templates/hardware_environment/vms/enea_lab/fuel.xml -new file mode 100644 -index 0000000..8773ed4 ---- /dev/null -+++ b/deploy/templates/hardware_environment/vms/enea_lab/fuel.xml -@@ -0,0 +1,88 @@ -+ -+ fuel -+ 8290304 -+ 8290304 -+ 8 -+ -+ /machine -+ -+ -+ hvm -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ destroy -+ restart -+ restart -+ -+ -+ -+ -+ -+ /usr/libexec/qemu-kvm -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ diff --git a/patches/opnfv-fuel/0025-f_repobuild-Makefile-Use-python-debian-from-pip.patch b/patches/opnfv-fuel/0025-f_repobuild-Makefile-Use-python-debian-from-pip.patch new file mode 100644 index 00000000..f84b4c0c --- /dev/null +++ b/patches/opnfv-fuel/0025-f_repobuild-Makefile-Use-python-debian-from-pip.patch @@ -0,0 +1,29 @@ +From: Alexandru Avadanii +Date: Tue, 26 Apr 2016 23:12:20 +0200 +Subject: [PATCH] f_repobuild/Makefile: Use python-debian from pip. + +Currently, Ubuntu Trusty provides a broken python-debian package, +that fails to parse foreign architecture (package:any) relationships. + +Purge debian package and let pip resolve this dependency, using a +newer version from pypi. + +[1] http://lists.alioth.debian.org/pipermail/ + pkg-python-debian-maint/2014-July/001795.html +--- + build/f_isoroot/f_repobuild/Makefile | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/build/f_isoroot/f_repobuild/Makefile b/build/f_isoroot/f_repobuild/Makefile +index 709ca6b..5e7157b 100644 +--- a/build/f_isoroot/f_repobuild/Makefile ++++ b/build/f_isoroot/f_repobuild/Makefile +@@ -25,6 +25,8 @@ all: nailgun + + nailgun: + sudo apt-get install -y git libxml2-dev libxslt-dev python-dev python-pip libz-dev libyaml-dev createrepo python-yaml ++ # python-debian from Ubuntu can't parse foreign arch relationships, use pip ++ sudo apt-get purge -y --force-yes python-debian + rm -Rf nailgun + sudo mkdir -p /var/www/nailgun + git clone $(FUEL_MIRROR_REPO) diff --git a/patches/opnfv-fuel/0026-deploy.sh-accept-a-timeout-flag-T.patch b/patches/opnfv-fuel/0026-deploy.sh-accept-a-timeout-flag-T.patch deleted file mode 100644 index 19651467..00000000 --- a/patches/opnfv-fuel/0026-deploy.sh-accept-a-timeout-flag-T.patch +++ /dev/null @@ -1,81 +0,0 @@ -From: Josep Puigdemont -Date: Mon, 9 May 2016 11:05:58 +0200 -Subject: [PATCH] deploy.sh: accept a timeout flag (-T) - -Signed-off-by: Josep Puigdemont ---- - ci/deploy.sh | 19 +++++++++++++++---- - 1 file changed, 15 insertions(+), 4 deletions(-) - -diff --git a/ci/deploy.sh b/ci/deploy.sh -index c9b836b..5f06a19 100755 ---- a/ci/deploy.sh -+++ b/ci/deploy.sh -@@ -29,7 +29,7 @@ cat << EOF - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - `basename $0`: Deploys the Fuel@OPNFV stack - --usage: `basename $0` -b base-uri [-B PXE Bridge] [-f] [-F] [-H] -l lab-name -p pod-name -s deploy-scenario [-S image-dir] -i iso -+usage: `basename $0` -b base-uri [-B PXE Bridge] [-f] [-F] [-H] -l lab-name -p pod-name -s deploy-scenario [-S image-dir] [-T timeout] -i iso - -s deployment-scenario [-S optional Deploy-scenario path URI] - [-R optional local relen repo (containing deployment Scenarios] - -@@ -46,6 +46,7 @@ OPTIONS: - -p Pod-name - -s Deploy-scenario short-name/base-file-name - -S Storage dir for VM images -+ -T Timeout, in minutes, for the deploy. - -i iso url - - Description: -@@ -76,6 +77,8 @@ Input parameters to the build script is: - or a deployment short-name as defined by scenario.yaml in the deployment - scenario path. - -S Storage dir for VM images, default is fuel/deploy/images -+-T Timeout, in minutes, for the deploy. It defaults to using the DEPLOY_TIMEOUT -+ environment variable when defined, or to the default in deploy.py otherwise - -i .iso image to be deployed (needs to be provided in a URI - style, it can be a local resource: file:// or a remote resource http(s)://) - -@@ -111,6 +114,11 @@ FUEL_CREATION_ONLY='' - NO_DEPLOY_ENVIRONMENT='' - STORAGE_DIR='' - DRY_RUN=0 -+if ! [ -z $DEPLOY_TIMEOUT ]; then -+ DEPLOY_TIMEOUT="-dt $DEPLOY_TIMEOUT" -+else -+ DEPLOY_TIMEOUT="" -+fi - # - # END of variables to customize - ############################################################################ -@@ -118,7 +126,7 @@ DRY_RUN=0 - ############################################################################ - # BEGIN of main - # --while getopts "b:B:dfFHl:p:s:S:i:he" OPTION -+while getopts "b:B:dfFHl:p:s:S:T:i:he" OPTION - do - case $OPTION in - b) -@@ -166,6 +174,9 @@ do - STORAGE_DIR="-s ${OPTARG}" - fi - ;; -+ T) -+ DEPLOY_TIMEOUT="-dt ${OPTARG}" -+ ;; - i) - ISO=${OPTARG} - if [[ ! $ISO == file://* ]] && \ -@@ -227,8 +238,8 @@ if [ $DRY_RUN -eq 0 ]; then - ISO=${SCRIPT_PATH}/ISO/image.iso - fi - # Start deployment -- echo "python deploy.py $STORAGE_DIR $PXE_BRIDGE $USE_EXISTING_FUEL $FUEL_CREATION_ONLY $NO_HEALTH_CHECK $NO_DEPLOY_ENVIRONMENT -dea ${SCRIPT_PATH}/config/dea.yaml -dha ${SCRIPT_PATH}/config/dha.yaml -iso $ISO" -- python deploy.py $STORAGE_DIR $PXE_BRIDGE $USE_EXISTING_FUEL $FUEL_CREATION_ONLY $NO_HEALTH_CHECK $NO_DEPLOY_ENVIRONMENT -dea ${SCRIPT_PATH}/config/dea.yaml -dha ${SCRIPT_PATH}/config/dha.yaml -iso $ISO -+ echo "python deploy.py $STORAGE_DIR $PXE_BRIDGE $USE_EXISTING_FUEL $FUEL_CREATION_ONLY $NO_HEALTH_CHECK $NO_DEPLOY_ENVIRONMENT -dea ${SCRIPT_PATH}/config/dea.yaml -dha ${SCRIPT_PATH}/config/dha.yaml -iso $ISO $DEPLOY_TIMEOUT" -+ python deploy.py $STORAGE_DIR $PXE_BRIDGE $USE_EXISTING_FUEL $FUEL_CREATION_ONLY $NO_HEALTH_CHECK $NO_DEPLOY_ENVIRONMENT -dea ${SCRIPT_PATH}/config/dea.yaml -dha ${SCRIPT_PATH}/config/dha.yaml -iso $ISO $DEPLOY_TIMEOUT - fi - popd > /dev/null - diff --git a/patches/opnfv-fuel/0026-f_repobuild-Repeat-mirror-build-up-to-ten-times.patch b/patches/opnfv-fuel/0026-f_repobuild-Repeat-mirror-build-up-to-ten-times.patch new file mode 100644 index 00000000..0b1f92f1 --- /dev/null +++ b/patches/opnfv-fuel/0026-f_repobuild-Repeat-mirror-build-up-to-ten-times.patch @@ -0,0 +1,73 @@ +From: Alexandru Avadanii +Date: Sun, 8 May 2016 22:37:43 +0200 +Subject: [PATCH] f_repobuild: Repeat mirror build up to ten times. + +OPNFV ISO build uses fuel-mirror to create a local Ubuntu +partial mirror in nailgun. + +Work around temporary mirror issue (e.g. during rsync) by +retrying mirror build up to 10 times. + +Signed-off-by: Alexandru Avadanii +--- + build/f_isoroot/f_repobuild/Makefile | 6 +++++- + build/f_isoroot/f_repobuild/fuel_mirror_loop | 26 ++++++++++++++++++++++++++ + 2 files changed, 31 insertions(+), 1 deletion(-) + create mode 100755 build/f_isoroot/f_repobuild/fuel_mirror_loop + +diff --git a/build/f_isoroot/f_repobuild/Makefile b/build/f_isoroot/f_repobuild/Makefile +index 5e7157b..9abe9bb 100644 +--- a/build/f_isoroot/f_repobuild/Makefile ++++ b/build/f_isoroot/f_repobuild/Makefile +@@ -23,6 +23,9 @@ export OPENSTACK_VERSION + .PHONY: all + all: nailgun + ++nailgun_mirror: ++ sudo fuel-mirror --debug --config ./opnfv-config.yaml create --group ubuntu --pattern=ubuntu ++ + nailgun: + sudo apt-get install -y git libxml2-dev libxslt-dev python-dev python-pip libz-dev libyaml-dev createrepo python-yaml + # python-debian from Ubuntu can't parse foreign arch relationships, use pip +@@ -35,7 +38,8 @@ nailgun: + sudo pip install ./fuel-mirror + sudo pip install ./fuel-mirror/contrib/fuel_mirror + ./opnfv_mirror_conf.py +- sudo fuel-mirror --debug --config ./opnfv-config.yaml create --group ubuntu --pattern=ubuntu ++ # Repeat mirror build up to ten times ++ sudo -E ./fuel_mirror_loop + sudo chmod -R 755 /var/www/nailgun + cp -Rp /var/www/nailgun . + # On the end we want to have ubuntu repository in mirrors/ubuntu directory +diff --git a/build/f_isoroot/f_repobuild/fuel_mirror_loop b/build/f_isoroot/f_repobuild/fuel_mirror_loop +new file mode 100755 +index 0000000..f123cf2 +--- /dev/null ++++ b/build/f_isoroot/f_repobuild/fuel_mirror_loop +@@ -0,0 +1,26 @@ ++#!/bin/bash ++############################################################################## ++# Copyright (c) 2016 Ericsson AB and others. ++# Copyright (c) 2016 Enea AB and others. ++# All rights reserved. This program and the accompanying materials ++# are made available under the terms of the Apache License, Version 2.0 ++# which accompanies this distribution, and is available at ++# http://www.apache.org/licenses/LICENSE-2.0 ++############################################################################## ++ ++maxcount=10 ++cnt=0 ++rc=1 ++while [ $cnt -lt $maxcount ] && [ $rc -ne 0 ] ++do ++ cnt=$[cnt + 1] ++ echo -e "\n\n\n*** Starting mirror build attempt # $cnt" ++ make nailgun_mirror ++ rc=$? ++ if [ $rc -ne 0 ]; then ++ echo "### Mirror build failed with rc $rc ###" ++ else ++ echo "### Mirror build successful at attempt # $cnt" ++ fi ++done ++exit $rc diff --git a/patches/opnfv-fuel/0027-UX-Update-bootstrap-target-build-time-estimate.patch b/patches/opnfv-fuel/0027-UX-Update-bootstrap-target-build-time-estimate.patch new file mode 100644 index 00000000..66ac65e8 --- /dev/null +++ b/patches/opnfv-fuel/0027-UX-Update-bootstrap-target-build-time-estimate.patch @@ -0,0 +1,47 @@ +From: Alexandru Avadanii +Date: Mon, 9 May 2016 17:05:53 +0200 +Subject: [PATCH] UX: Update bootstrap/target build time estimate. + +While building for a different architecture (e.g. AArch64 on x86_64), +the bootstrap/target image build may take longer, due to latency +introduced by using qemu-user-static. + +Signed-off-by: Alexandru Avadanii +--- + build/bootstrap_admin_node.sh.patch | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +diff --git a/build/bootstrap_admin_node.sh.patch b/build/bootstrap_admin_node.sh.patch +index c66b497..46b53e6 100644 +--- a/build/bootstrap_admin_node.sh.patch ++++ b/build/bootstrap_admin_node.sh.patch +@@ -1,6 +1,29 @@ + *** bootstrap_admin_node.sh.orig Mon May 30 06:31:38 2016 + --- bootstrap_admin_node.sh Mon May 30 06:35:11 2016 + *************** ++*** 86,94 **** ++ http://docs.openstack.org/developer/fuel-docs/userdocs/fuel-install-guide/bootstrap/\ ++ bootstrap_troubleshoot.html" ++ bs_progress_message="There is no active bootstrap. Bootstrap image building \ ++! is in progress. Usually it takes 15-20 minutes. It depends on your internet \ ++! connection and hardware performance. After bootstrap image becomes available, \ ++! reboot nodes that failed to be discovered." ++ bs_done_message="Default bootstrap image building done. Now you can boot new \ ++ nodes over PXE, they will be discovered and become available for installing \ ++ OpenStack on them" ++--- 86,96 ---- ++ http://docs.openstack.org/developer/fuel-docs/userdocs/fuel-install-guide/bootstrap/\ ++ bootstrap_troubleshoot.html" ++ bs_progress_message="There is no active bootstrap. Bootstrap image building \ ++! is in progress. Usually it takes 15-20 minutes for a native build (x86_64) \ ++! and/or 30-45 minutes for each cross-build (e.g. AArch64). \ ++! It depends on your internet connection, hardware performance and selected \ ++! bootstrap architecture(s). This ISO supports AArch64 only. After bootstrap \ ++! image becomes available, reboot nodes that failed to be discovered." ++ bs_done_message="Default bootstrap image building done. Now you can boot new \ ++ nodes over PXE, they will be discovered and become available for installing \ ++ OpenStack on them" ++*************** + *** 339,346 **** + set +x + echo "Done!" diff --git a/patches/opnfv-fuel/0027-deploy-reap.py-Dump-extra-interfaces-information.patch b/patches/opnfv-fuel/0027-deploy-reap.py-Dump-extra-interfaces-information.patch deleted file mode 100644 index fba7e713..00000000 --- a/patches/opnfv-fuel/0027-deploy-reap.py-Dump-extra-interfaces-information.patch +++ /dev/null @@ -1,90 +0,0 @@ -From: Alexandru Avadanii -Date: Wed, 4 May 2016 18:31:09 +0200 -Subject: [PATCH] deploy/reap.py: Dump extra interfaces information. - -Since on AArch64, Ubuntu local mirror lacks arm64 packages (see [1]), -Fuel master requires internet connectivity during deploy, and hence -a way to setup such a public (extra) interface automatically. - -Previous commit "transplant: Generate extra interfaces config file" -introduced support for passing this information via DEA (override), -which may define a IFCGF_ section in its 'fuel:' -section, containing the necessary keys to produce a ifcfg- -file, like in this example: - -fuel: - IFCFG_ETH1: - device: eth1 - ipaddress: 10.0.1.10 - netmask: 255.255.255.0 - gateway: 10.0.1.254 - -In order for Network Manager to use the newly added interfaces -for outgoing traffic and honor their GATEWAY setting (e.g. if we just -added one public interface), the default route on admin iface (most of -the time called eth0) is disabled when extra interfaces are present. - -FIXME: Only supports lowercase interface names, but so does Fuel, -see related bug report [2]. - -[1] https://jira.opnfv.org/browse/ARMBAND-35 -[2] https://jira.opnfv.org/browse/FUEL-136 - -Signed-off-by: Alexandu Avadanii -Signed-off-by: Josep Puigdemont ---- - deploy/reap.py | 34 ++++++++++++++++++++++++++++++++++ - 1 file changed, 34 insertions(+) - -diff --git a/deploy/reap.py b/deploy/reap.py -index bf64d40..6feaf17 100755 ---- a/deploy/reap.py -+++ b/deploy/reap.py -@@ -15,6 +15,8 @@ import yaml - import glob - import shutil - import tempfile -+import re -+import netaddr - - from common import ( - N, -@@ -245,6 +247,38 @@ class Reap(object): - if key not in ['ipaddress', 'netmask', - 'dhcp_pool_start', 'dhcp_pool_end']: - del fuel['ADMIN_NETWORK'][key] -+ -+ ## FIXME(armband): Factor in support for adding public/other interfaces. -+ ## TODO: Following block expects interface name(s) to be lowercase only -+ interfaces_list = exec_cmd('ip -o -4 a | grep -e "e[nt][hopsx].*"') -+ for interface in re.split('\n', interfaces_list): -+ # Sample output line from above cmd: -+ # 3: eth1 inet 10.0.2.10/24 scope global eth1 valid_lft forever ... -+ ifcfg = re.split(r'\s+', interface) -+ ifcfg_name = ifcfg[1] -+ ifcfg_ipaddr = ifcfg[3] -+ -+ # Filter out admin interface (device name is not known, match IP) -+ current_network = netaddr.IPNetwork(ifcfg_ipaddr) -+ if str(current_network.ip) == fuel['ADMIN_NETWORK']['ipaddress']: -+ continue -+ -+ # Read ifcfg-* network interface config file, write IFCFG_ -+ ifcfg_sec = 'IFCFG_%s' % ifcfg_name.upper() -+ fuel[ifcfg_sec] = {} -+ ifcfg_data = {} -+ ifcfg_f = ('/etc/sysconfig/network-scripts/ifcfg-%s' % ifcfg_name) -+ with open(ifcfg_f) as f: -+ for line in f: -+ (key, val) = line.split('=') -+ ifcfg_data[key.lower()] = val.rstrip() -+ -+ # Keep only needed info (e.g. filter-out type=Ethernet). -+ fuel[ifcfg_sec]['ipaddress'] = ifcfg_data['ipaddr'] -+ fuel[ifcfg_sec]['device'] = ifcfg_data['device'] -+ fuel[ifcfg_sec]['netmask'] = str(current_network.netmask) -+ fuel[ifcfg_sec]['gateway'] = ifcfg_data['gateway'] -+ - self.write_yaml(self.dea_file, {'fuel': fuel}) - - def reap_network_settings(self): diff --git a/patches/opnfv-fuel/0028-bootstrap-Add-lshw-package.patch b/patches/opnfv-fuel/0028-bootstrap-Add-lshw-package.patch new file mode 100644 index 00000000..09ddb13f --- /dev/null +++ b/patches/opnfv-fuel/0028-bootstrap-Add-lshw-package.patch @@ -0,0 +1,30 @@ +From: Alexandru Avadanii +Date: Tue, 24 May 2016 16:42:21 +0200 +Subject: [PATCH] bootstrap: Add lshw package. + +Until Ubuntu Trusty fixes the following bug on AArch64 [1]: +"AArch64: slow cpuinfo due to redundant loop" +we will be using a patched version of from Armband MOS repos. + +This change enforces replacing the lshw from Ubuntu with our custom, +patched package. + +[1] https://bugs.launchpad.net/ubuntu/+source/lshw/+bug/1582181 + +Signed-off-by: Alexandru Avadanii +--- + build/f_isoroot/f_repobuild/fuel_bootstrap_cli.yaml | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/build/f_isoroot/f_repobuild/fuel_bootstrap_cli.yaml b/build/f_isoroot/f_repobuild/fuel_bootstrap_cli.yaml +index 15d9e9d..b45a14a 100644 +--- a/build/f_isoroot/f_repobuild/fuel_bootstrap_cli.yaml ++++ b/build/f_isoroot/f_repobuild/fuel_bootstrap_cli.yaml +@@ -29,6 +29,7 @@ + - squashfs-tools + - msmtp-mta + - armband-rtc-efi-fix ++ - lshw + bootstrap_images_dir: /var/www/nailgun/bootstraps + active_bootstrap_symlink: /var/www/nailgun/bootstraps/active_bootstrap + flavor: ubuntu diff --git a/patches/opnfv-fuel/0028-f_repobuild-Repeat-mirror-build-up-to-ten-times.patch b/patches/opnfv-fuel/0028-f_repobuild-Repeat-mirror-build-up-to-ten-times.patch deleted file mode 100644 index 0b1f92f1..00000000 --- a/patches/opnfv-fuel/0028-f_repobuild-Repeat-mirror-build-up-to-ten-times.patch +++ /dev/null @@ -1,73 +0,0 @@ -From: Alexandru Avadanii -Date: Sun, 8 May 2016 22:37:43 +0200 -Subject: [PATCH] f_repobuild: Repeat mirror build up to ten times. - -OPNFV ISO build uses fuel-mirror to create a local Ubuntu -partial mirror in nailgun. - -Work around temporary mirror issue (e.g. during rsync) by -retrying mirror build up to 10 times. - -Signed-off-by: Alexandru Avadanii ---- - build/f_isoroot/f_repobuild/Makefile | 6 +++++- - build/f_isoroot/f_repobuild/fuel_mirror_loop | 26 ++++++++++++++++++++++++++ - 2 files changed, 31 insertions(+), 1 deletion(-) - create mode 100755 build/f_isoroot/f_repobuild/fuel_mirror_loop - -diff --git a/build/f_isoroot/f_repobuild/Makefile b/build/f_isoroot/f_repobuild/Makefile -index 5e7157b..9abe9bb 100644 ---- a/build/f_isoroot/f_repobuild/Makefile -+++ b/build/f_isoroot/f_repobuild/Makefile -@@ -23,6 +23,9 @@ export OPENSTACK_VERSION - .PHONY: all - all: nailgun - -+nailgun_mirror: -+ sudo fuel-mirror --debug --config ./opnfv-config.yaml create --group ubuntu --pattern=ubuntu -+ - nailgun: - sudo apt-get install -y git libxml2-dev libxslt-dev python-dev python-pip libz-dev libyaml-dev createrepo python-yaml - # python-debian from Ubuntu can't parse foreign arch relationships, use pip -@@ -35,7 +38,8 @@ nailgun: - sudo pip install ./fuel-mirror - sudo pip install ./fuel-mirror/contrib/fuel_mirror - ./opnfv_mirror_conf.py -- sudo fuel-mirror --debug --config ./opnfv-config.yaml create --group ubuntu --pattern=ubuntu -+ # Repeat mirror build up to ten times -+ sudo -E ./fuel_mirror_loop - sudo chmod -R 755 /var/www/nailgun - cp -Rp /var/www/nailgun . - # On the end we want to have ubuntu repository in mirrors/ubuntu directory -diff --git a/build/f_isoroot/f_repobuild/fuel_mirror_loop b/build/f_isoroot/f_repobuild/fuel_mirror_loop -new file mode 100755 -index 0000000..f123cf2 ---- /dev/null -+++ b/build/f_isoroot/f_repobuild/fuel_mirror_loop -@@ -0,0 +1,26 @@ -+#!/bin/bash -+############################################################################## -+# Copyright (c) 2016 Ericsson AB and others. -+# Copyright (c) 2016 Enea AB and others. -+# All rights reserved. This program and the accompanying materials -+# are made available under the terms of the Apache License, Version 2.0 -+# which accompanies this distribution, and is available at -+# http://www.apache.org/licenses/LICENSE-2.0 -+############################################################################## -+ -+maxcount=10 -+cnt=0 -+rc=1 -+while [ $cnt -lt $maxcount ] && [ $rc -ne 0 ] -+do -+ cnt=$[cnt + 1] -+ echo -e "\n\n\n*** Starting mirror build attempt # $cnt" -+ make nailgun_mirror -+ rc=$? -+ if [ $rc -ne 0 ]; then -+ echo "### Mirror build failed with rc $rc ###" -+ else -+ echo "### Mirror build successful at attempt # $cnt" -+ fi -+done -+exit $rc diff --git a/patches/opnfv-fuel/0029-UX-Update-bootstrap-target-build-time-estimate.patch b/patches/opnfv-fuel/0029-UX-Update-bootstrap-target-build-time-estimate.patch deleted file mode 100644 index 4eefbc1d..00000000 --- a/patches/opnfv-fuel/0029-UX-Update-bootstrap-target-build-time-estimate.patch +++ /dev/null @@ -1,47 +0,0 @@ -From: Alexandru Avadanii -Date: Mon, 9 May 2016 17:05:53 +0200 -Subject: [PATCH] UX: Update bootstrap/target build time estimate. - -While building for a different architecture (e.g. AArch64 on x86_64), -the bootstrap/target image build may take longer, due to latency -introduced by using qemu-user-static. - -Signed-off-by: Alexandru Avadanii ---- - build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - -diff --git a/build/bootstrap_admin_node.sh.patch b/build/bootstrap_admin_node.sh.patch -index c66b497..46b53e6 100644 ---- a/build/bootstrap_admin_node.sh.patch -+++ b/build/bootstrap_admin_node.sh.patch -@@ -1,6 +1,29 @@ - *** bootstrap_admin_node.sh.orig Mon May 30 06:31:38 2016 - --- bootstrap_admin_node.sh Mon May 30 06:35:11 2016 - *************** -+*** 86,94 **** -+ http://docs.openstack.org/developer/fuel-docs/userdocs/fuel-install-guide/bootstrap/\ -+ bootstrap_troubleshoot.html" -+ bs_progress_message="There is no active bootstrap. Bootstrap image building \ -+! is in progress. Usually it takes 15-20 minutes. It depends on your internet \ -+! connection and hardware performance. After bootstrap image becomes available, \ -+! reboot nodes that failed to be discovered." -+ bs_done_message="Default bootstrap image building done. Now you can boot new \ -+ nodes over PXE, they will be discovered and become available for installing \ -+ OpenStack on them" -+--- 86,96 ---- -+ http://docs.openstack.org/developer/fuel-docs/userdocs/fuel-install-guide/bootstrap/\ -+ bootstrap_troubleshoot.html" -+ bs_progress_message="There is no active bootstrap. Bootstrap image building \ -+! is in progress. Usually it takes 15-20 minutes for a native build (x86_64) \ -+! and/or 30-45 minutes for each cross-build (e.g. AArch64). \ -+! It depends on your internet connection, hardware performance and selected \ -+! bootstrap architecture(s). This ISO supports AArch64 only. After bootstrap \ -+! image becomes available, reboot nodes that failed to be discovered." -+ bs_done_message="Default bootstrap image building done. Now you can boot new \ -+ nodes over PXE, they will be discovered and become available for installing \ -+ OpenStack on them" -+*************** - *** 339,346 **** - set +x - echo "Done!" diff --git a/patches/opnfv-fuel/0030-deploy-ipmi-adapter-Add-port-config-support.patch b/patches/opnfv-fuel/0030-deploy-ipmi-adapter-Add-port-config-support.patch deleted file mode 100644 index 4b5a893e..00000000 --- a/patches/opnfv-fuel/0030-deploy-ipmi-adapter-Add-port-config-support.patch +++ /dev/null @@ -1,74 +0,0 @@ -From: Alexandru Avadanii -Date: Mon, 23 May 2016 22:06:09 +0200 -Subject: [PATCH] deploy: ipmi adapter: Add config support. - -Sometimes the IPMI lanplus protocol listens on a non-standard -remote port, e.g. when target nodes are interfaced through a -fake IPMI BMC application that listens on multiple ports on the -same IP address. - -Therefore, allow setting IPMI port in the DHA using a new -property named `ipmiPort`, and pass it along to `ipmitool` when set. - -CHANGE: get_access_info now also supports specifying the IPMI -port to use with `ipmitool` by configuring the `ipmiPort` -property in the DHA. - -hp_adapter.py: updated `get_access_info` return signature with -the new (unused there) `ipmiport`. - -Signed-off-by: Alexandru Avadanii ---- - deploy/dha_adapters/hp_adapter.py | 2 +- - deploy/dha_adapters/ipmi_adapter.py | 7 +++++-- - deploy/reap.py | 2 ++ - 3 files changed, 8 insertions(+), 3 deletions(-) - -diff --git a/deploy/dha_adapters/hp_adapter.py b/deploy/dha_adapters/hp_adapter.py -index 13bb349..6434da8 100644 ---- a/deploy/dha_adapters/hp_adapter.py -+++ b/deploy/dha_adapters/hp_adapter.py -@@ -29,7 +29,7 @@ class HpAdapter(IpmiAdapter): - - def node_set_boot_order(self, node_id, boot_order_list): - log('Set boot order %s on Node %s' % (boot_order_list, node_id)) -- ip, username, password = self.get_access_info(node_id) -+ ip, username, password, ipmiport = self.get_access_info(node_id) - ssh = SSHClient(ip, username, password) - with ssh as s: - for order, dev in enumerate(boot_order_list): -diff --git a/deploy/dha_adapters/ipmi_adapter.py b/deploy/dha_adapters/ipmi_adapter.py -index 283bd57..f4f2e6a 100644 ---- a/deploy/dha_adapters/ipmi_adapter.py -+++ b/deploy/dha_adapters/ipmi_adapter.py -@@ -30,12 +30,15 @@ class IpmiAdapter(HardwareAdapter): - ip = self.get_node_property(node_id, 'ipmiIp') - username = self.get_node_property(node_id, 'ipmiUser') - password = self.get_node_property(node_id, 'ipmiPass') -- return ip, username, password -+ ipmiport = self.get_node_property(node_id, 'ipmiPort') -+ return ip, username, password, ipmiport - - def ipmi_cmd(self, node_id): -- ip, username, password = self.get_access_info(node_id) -+ ip, username, password, ipmiport = self.get_access_info(node_id) - cmd = 'ipmitool -I lanplus -A password' - cmd += ' -H %s -U %s -P %s' % (ip, username, password) -+ if ipmiport: -+ cmd += ' -p %d' % int(ipmiport) - return cmd - - def get_node_pxe_mac(self, node_id): -diff --git a/deploy/reap.py b/deploy/reap.py -index 6feaf17..9933d1d 100755 ---- a/deploy/reap.py -+++ b/deploy/reap.py -@@ -59,6 +59,8 @@ adapter: - # ipmiIp - # ipmiUser - # ipmiPass -+# and you *MAY* provide (optional, not added by reap.py): -+# ipmiPort - # - libvirt adapter you need to provide: - # libvirtName: - # libvirtTemplate: [libvirt/vms/controller.xml | libvirt/vms/compute.xml] diff --git a/patches/opnfv-fuel/0031-bootstrap-Add-lshw-package.patch b/patches/opnfv-fuel/0031-bootstrap-Add-lshw-package.patch deleted file mode 100644 index 09ddb13f..00000000 --- a/patches/opnfv-fuel/0031-bootstrap-Add-lshw-package.patch +++ /dev/null @@ -1,30 +0,0 @@ -From: Alexandru Avadanii -Date: Tue, 24 May 2016 16:42:21 +0200 -Subject: [PATCH] bootstrap: Add lshw package. - -Until Ubuntu Trusty fixes the following bug on AArch64 [1]: -"AArch64: slow cpuinfo due to redundant loop" -we will be using a patched version of from Armband MOS repos. - -This change enforces replacing the lshw from Ubuntu with our custom, -patched package. - -[1] https://bugs.launchpad.net/ubuntu/+source/lshw/+bug/1582181 - -Signed-off-by: Alexandru Avadanii ---- - build/f_isoroot/f_repobuild/fuel_bootstrap_cli.yaml | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/build/f_isoroot/f_repobuild/fuel_bootstrap_cli.yaml b/build/f_isoroot/f_repobuild/fuel_bootstrap_cli.yaml -index 15d9e9d..b45a14a 100644 ---- a/build/f_isoroot/f_repobuild/fuel_bootstrap_cli.yaml -+++ b/build/f_isoroot/f_repobuild/fuel_bootstrap_cli.yaml -@@ -29,6 +29,7 @@ - - squashfs-tools - - msmtp-mta - - armband-rtc-efi-fix -+ - lshw - bootstrap_images_dir: /var/www/nailgun/bootstraps - active_bootstrap_symlink: /var/www/nailgun/bootstraps/active_bootstrap - flavor: ubuntu -- cgit 1.2.3-korg