curtin-dev team mailing list archive
-
curtin-dev team
-
Mailing list archive
-
Message #03380
Re: [Merge] curtin:nvme-initramfs into curtin:master
Diff comments:
> diff --git a/curtin/commands/curthooks.py b/curtin/commands/curthooks.py
> index 695ba30..132ccab 100644
> --- a/curtin/commands/curthooks.py
> +++ b/curtin/commands/curthooks.py
> @@ -1551,6 +1663,97 @@ def configure_nvme_stas(cfg, target):
> (stas_dir / 'stafd.conf').replace(stas_dir / '.stafd.conf.bak')
> (stas_dir / 'stafd.conf').symlink_to('stafd-curtin.conf')
>
> + if not nvmeotcp_need_network_in_initramfs(cfg):
> + # nvme-stas should be enough to boot.
> + return
> +
> + LOG.info('configuring network in initramfs for NVMe over TCP')
> +
> + hook_contents = '''\
> +#!/bin/sh
I won't block this MP on identifying a solution, but in post-24.04 work I'd like to see this moved out of curtin and into the archive. Imagine someone doing a preinstalled image, they would want the same functionality.
> +
> +PREREQ="udev"
> +
> +prereqs()
> +{
> + echo "$PREREQ"
> +}
> +
> +case "$1" in
> +prereqs)
> + prereqs
> + exit 0
> + ;;
> +esac
> +
> +. /usr/share/initramfs-tools/hook-functions
> +
> +copy_exec /usr/sbin/nvme /usr/sbin
> +copy_file config /etc/nvme/hostid /etc/nvme/
> +copy_file config /etc/nvme/hostnqn /etc/nvme/
> +copy_file config /etc/curtin-nvme-over-tcp/network-up /etc/curtin-nvme-over-tcp/
> +copy_file config /etc/curtin-nvme-over-tcp/connect-nvme /etc/curtin-nvme-over-tcp/
> +
> +manual_add_modules nvme-tcp
> +'''
> +
> + initramfs_hooks_dir = target / 'etc' / 'initramfs-tools' / 'hooks'
> + initramfs_hooks_dir.mkdir(parents=True, exist_ok=True)
> + with (initramfs_hooks_dir / 'curtin-nvme-over-tcp').open('w', encoding='utf-8') as fh:
> + print(hook_contents, file=fh)
> + (initramfs_hooks_dir / 'curtin-nvme-over-tcp').chmod(0o755)
> +
> + bootscript_contents = '''\
> +#!/bin/sh
> +
> + PREREQ=""
> +prereqs() { echo "$PREREQ"; }
> +case "$1" in
> +prereqs)
> + prereqs
> + exit 0
> + ;;
> +esac
> +
> +. /etc/curtin-nvme-over-tcp/network-up
> +
> +modprobe nvme-tcp
> +
> +. /etc/curtin-nvme-over-tcp/connect-nvme
> +
> +'''
> +
> + initramfs_init_premount_dir = target / 'etc' / 'initramfs-tools' / 'scripts' / 'init-premount'
> + initramfs_init_premount_dir.mkdir(parents=True, exist_ok=True)
> + bootscript = initramfs_init_premount_dir / 'curtin-nvme-over-tcp'
> + with bootscript.open('w', encoding='utf-8') as fh:
> + print(bootscript_contents, file=fh)
> + bootscript.chmod(0o755)
> +
> +
> +
> + curtin_nvme_over_tcp_dir = target / 'etc' / 'curtin-nvme-over-tcp'
> + curtin_nvme_over_tcp_dir.mkdir(parents=True, exist_ok=True)
> + network_up_script = curtin_nvme_over_tcp_dir / 'network-up'
> + connect_nvme_script = curtin_nvme_over_tcp_dir / 'connect-nvme'
> +
> + script_header = '''\
> +#!/bin/sh
> +
> +# This file was created by curtin.
> +# If you make modifications to it, please remember to regenerate the initramfs
> +# using the command `update-initramfs -u`.
> +'''
> + with open(connect_nvme_script, 'w', encoding='utf-8') as fh:
> + print(script_header, file=fh)
> + for cmd in nvmeotcp_get_nvme_commands(cfg):
> + print(shlex.join(cmd), file=fh)
> +
> + with open(network_up_script, 'w', encoding='utf-8') as fh:
> + print(script_header, file=fh)
> + for cmd in nvmeotcp_get_ip_commands(cfg):
> + print(shlex.join(cmd), file=fh)
> +
>
> def handle_cloudconfig(cfg, base_dir=None):
> """write cloud-init configuration files into base_dir.
--
https://code.launchpad.net/~curtin-dev/curtin/+git/curtin/+merge/461452
Your team curtin developers is requested to review the proposed merge of curtin:nvme-initramfs into curtin:master.
References