From 734d7f46b7aab0a050d29da1b7f383a29930c6b8 Mon Sep 17 00:00:00 2001 From: Hans Rosenfeld Date: Tue, 31 Mar 2026 16:44:37 +0200 Subject: [PATCH] brand/bhyve: Add bootdiskif attribute The bootdiskif attribute works exactly the same as diskif, but it applies only to the boot disk. For backwards compatibility, diskif will be used if if bootdiskif is unset. --- src/brand/bhyve/boot.py | 11 ++++++++++- src/man/bhyve.7 | 11 +++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/brand/bhyve/boot.py b/src/brand/bhyve/boot.py index 421f470de..3cea34f61 100755 --- a/src/brand/bhyve/boot.py +++ b/src/brand/bhyve/boot.py @@ -466,8 +466,17 @@ def apply_bootnext(v): try: bootdisk = z.findattr('bootdisk') + if (bootdiskif := z.findattr('bootdiskif')) is not None: + bootdiskif = bootdiskif.get('value').strip() + try: + bootdiskif = aliases['diskif'][bootdiskif] + except KeyError: + pass + else: + bootdiskif = opts['diskif'] + args.extend([ - '-s', '{0}:0,{1},{2}'.format(BOOTDISK_SLOT, opts['diskif'], + '-s', '{0}:0,{1},{2}'.format(BOOTDISK_SLOT, bootdiskif, diskpath(bootdisk.get('value').strip())) ]) add_bootoption('bootdisk', None, ('pci', f'{BOOTDISK_SLOT}.0')) diff --git a/src/man/bhyve.7 b/src/man/bhyve.7 index 27c73b1ab..c732f89e1 100644 --- a/src/man/bhyve.7 +++ b/src/man/bhyve.7 @@ -60,6 +60,17 @@ A suitable ZFS volume can be created using the command, for example: .Pp .Dl zfs create -V 30G rpool/bootdisk2 +.\" bootdiskif +.It Ic bootdiskif Ar type +.Pp +Specifies the type of interface to which the boot disk will be attached. +See the description of the +.Ic diskif +attribute for a list of available interface types. +.Pp +If unset, the value of the +.Ic diskif +attribute will be used. .\" bootorder .It Ic bootorder Ar option Ns Oo \&, Ns Ar option Ns \&... Oc .Pp