From nobody Thu May 2 06:57:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1510414004586685.6661878115245; Sat, 11 Nov 2017 07:26:44 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7045799C78; Sat, 11 Nov 2017 15:26:42 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D724F60C8A; Sat, 11 Nov 2017 15:26:40 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 87A2A4BB79; Sat, 11 Nov 2017 15:26:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vABFQbgb005053 for ; Sat, 11 Nov 2017 10:26:37 -0500 Received: by smtp.corp.redhat.com (Postfix) id 02CE46266A; Sat, 11 Nov 2017 15:26:37 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F18C862A9F for ; Sat, 11 Nov 2017 15:26:35 +0000 (UTC) Received: from orion.uberspace.de (orion.uberspace.de [95.143.172.79]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 64E5236809 for ; Sat, 11 Nov 2017 15:26:32 +0000 (UTC) Received: (qmail 3336 invoked from network); 11 Nov 2017 15:26:30 -0000 Received: from localhost (HELO csarch) (127.0.0.1) by orion.uberspace.de with SMTP; 11 Nov 2017 15:26:30 -0000 Message-ID: <1510413988.13439.6.camel@cschwarz.com> From: Christian Schwarz To: libvir-list@redhat.com Date: Sat, 11 Nov 2017 16:26:28 +0100 Mime-Version: 1.0 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 205 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Sat, 11 Nov 2017 15:26:33 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Sat, 11 Nov 2017 15:26:33 +0000 (UTC) for IP:'95.143.172.79' DOMAIN:'orion.uberspace.de' HELO:'orion.uberspace.de' FROM:'me@cschwarz.com' RCPT:'' X-RedHat-Spam-Score: -0.7 (RCVD_IN_DNSWL_LOW) 95.143.172.79 orion.uberspace.de 95.143.172.79 orion.uberspace.de X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] bhyve: grub-bhyve: support overriding just --root flag X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sat, 11 Nov 2017 15:26:43 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Hi, I was trying to get a GPT-formatted VM boot on FreeBSD using the bhyve driv= er and the grub-bhyve bootloader. Turns out that libvirt 3.9.0 hardcodes the boot partition to (hd0,msdos1) or allows overriding it completly using . I hacked together a patch that allows overring just the --root argument to grub-bhyve and updated the documentation: https://github.com/problame/libvirt/commit/5fd1265c05987d907d9f1d9913dbee83= 2a227889 Obviously, this does not meet quality standards and should not be merged as= is, but maybe spawn some discussion (if anyone is actually using bhyve + libvir= t). Cheers, Christian --- commit 5fd1265c05987d907d9f1d9913dbee832a227889 Author: Christian Schwarz Date: Sat Nov 11 16:15:05 2017 +0100 bhyve: grub-bhyve: support overriding just the --root argument in domai= n config diff --git a/docs/drvbhyve.html.in b/docs/drvbhyve.html.in index 63260afae..2583bfa01 100644 --- a/docs/drvbhyve.html.in +++ b/docs/drvbhyve.html.in @@ -300,17 +300,26 @@ are omitted, libvirt will try and infer boot ordering= from user-supplied <boot order=3D'N'> configuration in the domain. Failing that, it wil= l boot the first disk in the domain (either cdrom- or disk-type devices). If the disk type is disk, it= will -attempt to boot from the first partition in the disk image.

+attempt to boot from the first partition in the disk image, assuming +an msdos partitioning scheme +(i.e. grub-bhyve --root hd0,msdos1). +You can override this behavior using bootloader_args or bootloader_grub_root. +

=20
 ...
 <bootloader>/usr/local/sbin/grub-bhyve</bootloader>
+<!-- the following tag overrides all args to grub-bhyve -->
 <bootloader_args>...</bootloader_args>
+<!-- the following tag overrides just the --root argument to grub-bhyve=
 -->
+<bootloader_grub_root>hd0,gpt1</bootloader_grub_root>
 ...
 
=20 -

Caveat: bootloader_args does not support any quoting. -Filenames, etc, must not have spaces or they will be tokenized incorrectly= .

+

Caveats when using bootloader_args: it does not support a= ny quoting. +Filenames, etc, must not have spaces or they will be tokenized incorrectly. +Additionally, you will have to maintain your own --device-map +file and keep it in sync with the domain XML.

=20

Using UEFI bootrom, VNC, and USB tablet

=20 diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index 55032ae1d..6cab6e516 100644 --- a/src/bhyve/bhyve_command.c +++ b/src/bhyve/bhyve_command.c @@ -774,15 +774,21 @@ virBhyveProcessBuildGrubbhyveCmd(virDomainDefPtr def, } =20 virCommandAddArg(cmd, "--root"); - if (userdef !=3D NULL) { - if (userdef->device =3D=3D VIR_DOMAIN_DISK_DEVICE_CDROM) + if (def->os.bootloaderGrubRoot !=3D NULL) { + virCommandAddArg(cmd, def->os.bootloaderGrubRoot); + } else { + + if (userdef !=3D NULL) { + if (userdef->device =3D=3D VIR_DOMAIN_DISK_DEVICE_CDROM) + virCommandAddArg(cmd, "cd"); + else + virCommandAddArg(cmd, "hd0,msdos1"); + } else if (cd !=3D NULL) { virCommandAddArg(cmd, "cd"); - else + } else { virCommandAddArg(cmd, "hd0,msdos1"); - } else if (cd !=3D NULL) { - virCommandAddArg(cmd, "cd"); - } else { - virCommandAddArg(cmd, "hd0,msdos1"); + } + } =20 virCommandAddArg(cmd, "--device-map"); diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 7dfd7b54e..ecd1f71dd 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -18141,6 +18141,7 @@ virDomainDefParseXML(xmlDocPtr xml, =20 def->os.bootloader =3D virXPathString("string(./bootloader)", ctxt); def->os.bootloaderArgs =3D virXPathString("string(./bootloader_args)",= ctxt); + def->os.bootloaderGrubRoot =3D virXPathString("string(./bootloader_gru= b_root)", ctxt); =20 tmp =3D virXPathString("string(./os/type[1])", ctxt); if (!tmp) { diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index e3f060b12..f969e9195 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1884,6 +1884,7 @@ struct _virDomainOSDef { char *slic_table; virDomainLoaderDefPtr loader; char *bootloader; + char *bootloaderGrubRoot; char *bootloaderArgs; int smbios_mode; =20 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list