From 7dbac5c2f7b9e5d0ca04d4f5f4dc101f0ef0272e Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Tue, 25 Nov 2014 01:11:54 +0000 Subject: Add ipmitools to strata/tools.morph Add ipmitool to strata/tools.morph Ipmitool is needed to use pxeboot.write extension --- strata/tools.morph | 7 +++++++ strata/tools/ipmitool.morph | 5 +++++ 2 files changed, 12 insertions(+) create mode 100644 strata/tools/ipmitool.morph diff --git a/strata/tools.morph b/strata/tools.morph index a09c24f5..20bc1d27 100644 --- a/strata/tools.morph +++ b/strata/tools.morph @@ -105,3 +105,10 @@ chunks: unpetrify-ref: v3.3.9 build-depends: [] prefix: / +- name: ipmitool + morph: strata/tools/ipmitool.morph + repo: upstream:ipmitool + ref: be7917f9f58c8a354bc0960ed57516af5d2bd29a + unpetrify-ref: IPMITOOL_1_8_14 + build-depends: + - file diff --git a/strata/tools/ipmitool.morph b/strata/tools/ipmitool.morph new file mode 100644 index 00000000..db0d5a3a --- /dev/null +++ b/strata/tools/ipmitool.morph @@ -0,0 +1,5 @@ +name: ipmitool +kind: chunk +build-system: autotools +pre-configure-commands: +- touch NEWS -- cgit v1.2.1 From ac3dbaebc8084886a1f7aedb07db203d472d763a Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Mon, 8 Dec 2014 15:37:24 +0000 Subject: pxeboot.check: Fix a couple of syntax errors in the code --- pxeboot.check | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pxeboot.check b/pxeboot.check index d7eb9b5c..97b87d22 100755 --- a/pxeboot.check +++ b/pxeboot.check @@ -18,7 +18,7 @@ valid_option_sets = frozenset(( ('existing-server', frozenset(('PXEBOOT_CONFIG_TFTP_ADDRESS', 'PXEBOOT_ROOTFS_RSYNC_ADDRESS'))), )) -valid_modes = frozenset(mode for (mode, opt_set in valid_option_sets)) +valid_modes = frozenset(mode for mode, opt_set in valid_option_sets) def compute_matches(env): @@ -27,6 +27,7 @@ def compute_matches(env): if all(k in env for k in opt_set): complete_matches.add(opt_set) return complete_matches + complete_matches = compute_matches(os.environ) def word_separate_options(options): @@ -39,7 +40,7 @@ def word_separate_options(options): valid_options = frozenset(flatten(opt_set for (mode, opt_set) in valid_option_sets)) -matched_options = frozenset(o for o in valid_options) +matched_options = frozenset(o for o in valid_options if o in os.environ) if not complete_matches: addable_sets = frozenset(frozenset(os) - matched_options for os in -- cgit v1.2.1 From 8c1637e938416e068a086071d133b596543c9ecd Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Tue, 16 Dec 2014 16:05:46 +0000 Subject: pxeboot.check: Multiple complete_matches is not an error The code was assuming that if there are more than one complete_match we were setting more options that needed and this is not always true. For example when setting 'PXEBOOT_DEPLOYER_INTERFACE' and 'PXEBOOT_VLAN', there will be more than one complete_matches, given that these options match the spawn-vlan and the spawn-novlan modes. My workaround consists on report warning messages instead of failing when this happens. The reason that I haven't removed the code is that I think that it could be fixable. For now this code will report "warnings" instead of failing. --- pxeboot.check | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pxeboot.check b/pxeboot.check index 97b87d22..df1fcc0e 100755 --- a/pxeboot.check +++ b/pxeboot.check @@ -54,10 +54,9 @@ elif len(complete_matches) > 1: removable_sets = frozenset(matched_options - frozenset(os) for os in powerset(matched_options) if len(compute_matches(os)) == 1) - print('Please unset %s' % ' or '.join( + print('WARNING: Following options might not be needed: %s' % ' or '.join( word_separate_options(list(opt_set)) for opt_set in removable_sets if opt_set)) - sys.exit(1) if 'PXEBOOT_MODE' in os.environ: mode = os.environ['PXEBOOT_MODE'] -- cgit v1.2.1 From 201ecd52efd3cb5a44a5e9b6928146934b66012e Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Tue, 16 Dec 2014 16:06:50 +0000 Subject: pxeboot.check: Fail with a nice error if PXEBOOT_MODE is needed and not set This is needed because now pxeboot.check doesn't fail if the options specified in the environment match more than one mode. --- pxeboot.check | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pxeboot.check b/pxeboot.check index df1fcc0e..fabe8138 100755 --- a/pxeboot.check +++ b/pxeboot.check @@ -61,8 +61,15 @@ elif len(complete_matches) > 1: if 'PXEBOOT_MODE' in os.environ: mode = os.environ['PXEBOOT_MODE'] else: - mode, = (mode for (mode, opt_set) in valid_option_sets - if all(o in os.environ for o in opt_set)) + try: + mode, = (mode for (mode, opt_set) in valid_option_sets + if all(o in os.environ for o in opt_set)) + + except ValueError as e: + print ('More than one candidate for PXEBOOT_MODE, please ' + 'set a value for it. Type `morph help pxeboot.write for ' + 'more info') + sys.exit(1) if mode not in valid_modes: print('%s is not a valid PXEBOOT_MODE' % mode) -- cgit v1.2.1 From 8da19218ba4b6000be39794296deb30827f3f3b5 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Tue, 16 Dec 2014 17:51:15 +0000 Subject: pxeboot.check: Check if nfs-server is running when is needed --- pxeboot.check | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pxeboot.check b/pxeboot.check index fabe8138..611708a9 100755 --- a/pxeboot.check +++ b/pxeboot.check @@ -2,6 +2,7 @@ import itertools import os +import subprocess import sys flatten = itertools.chain.from_iterable @@ -74,3 +75,12 @@ else: if mode not in valid_modes: print('%s is not a valid PXEBOOT_MODE' % mode) sys.exit(1) + +if mode != 'existing-server': + with open(os.devnull, 'w') as devnull: + if subprocess.call(['systemctl', 'is-active', 'nfs-server'], + stdout=devnull) != 0: + print ('ERROR: nfs-server.service is not running and is needed ' + 'for this deployment. Please, run `systemctl start nfs-server` ' + 'and try `morph deploy` again.') + sys.exit(1) -- cgit v1.2.1 From 0b3f5e4cc74d50df18f407dd77bc01ac9aa3865d Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Tue, 16 Dec 2014 17:37:16 +0000 Subject: Add a cluster example to deploy into hardware --- clusters/hardware-deployment.morph | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 clusters/hardware-deployment.morph diff --git a/clusters/hardware-deployment.morph b/clusters/hardware-deployment.morph new file mode 100644 index 00000000..0b1335ae --- /dev/null +++ b/clusters/hardware-deployment.morph @@ -0,0 +1,36 @@ +name: hardware-deployment +kind: cluster +description: | + Deploy a build-system into hardware using the combination + of the pxeboot.write extension and the installer system. + This examples uses the spawn-novlan mode of pxeboot.write. +systems: +- morph: systems/installer-system-x86_64.morph + deploy: + installer: + type: pxeboot + location: AB:CD:EF:12:34:56:78 #MAC address. + PXEBOOT_MODE: spawn-novlan + PXEBOOT_DEPLOYER_INTERFACE: ens6 + DISK_SIZE: 6G + KERNEL_ARGS: console=ttyS1,9600 console=tty0 init=/usr/lib/baserock-installer/installer + HOSTNAME: installer-system + IPMI_USER: myipmiuser + IPMI_PASSWORD: myipmipassword + IPMI_HOST: 123.34.45.120 #IPMI ip address + INSTALLER_TARGET_STORAGE_DEVICE: /dev/sda + INSTALLER_ROOTFS_TO_INSTALL: /rootfs + subsystems: + - morph: systems/build-system-x86_64.morph + deploy: + to-install: + type: sysroot + location: /rootfs + INITRAMFS_PATH: boot/initramfs.gz + KERNEL_ARGS: console=ttyS1,9600 console=tty0 + subsystems: + - morph: systems/initramfs-x86_64.morph + deploy: + initramfs: + type: initramfs + location: boot/initramfs.gz -- cgit v1.2.1