diff options
author | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2014-12-23 16:28:30 +0100 |
---|---|---|
committer | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2014-12-23 16:28:30 +0100 |
commit | 8428be9519ca3dd2c8db2192810abd6cd71c18a2 (patch) | |
tree | 38ec4a0b10fe537a585d4f24bae31d0ea1ff9e78 | |
parent | bf3989e91264385ec812fe67781fc686ae4ba3c7 (diff) | |
parent | 0b3f5e4cc74d50df18f407dd77bc01ac9aa3865d (diff) | |
download | definitions-8428be9519ca3dd2c8db2192810abd6cd71c18a2.tar.gz |
Merge branch 'baserock/pedroalvarez/pxeboot-changes-needed2'
Reviewed-by: Sam Thursfield
-rw-r--r-- | clusters/hardware-deployment.morph | 36 | ||||
-rwxr-xr-x | pxeboot.check | 29 | ||||
-rw-r--r-- | strata/tools.morph | 7 | ||||
-rw-r--r-- | strata/tools/ipmitool.morph | 5 |
4 files changed, 71 insertions, 6 deletions
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 diff --git a/pxeboot.check b/pxeboot.check index d7eb9b5c..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 @@ -18,7 +19,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 +28,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 +41,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 @@ -53,17 +55,32 @@ 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'] 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) 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) 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 |