[libvirt PATCH v2 0/1] ci: Add helper script
by Andrea Bolognani
Changes from [v1]:
* implement (partial) support for running builds and spawning
shells inside the container;
* make the code more maintainable by using a couple of classes.
[v1] https://listman.redhat.com/archives/libvir-list/2021-February/msg00900.h=
tml
Andrea Bolognani (1):
ci: Add helper script
ci/cirrus/refresh | 22 -----
ci/containers/refresh | 41 ---------
ci/helper | 187 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 187 insertions(+), 63 deletions(-)
delete mode 100755 ci/cirrus/refresh
delete mode 100755 ci/containers/refresh
create mode 100755 ci/helper
--=20
2.26.2
3 years, 7 months
[PATCH 00/14] deprecations: remove many old deprecations
by Daniel P. Berrangé
The following features have been deprecated for well over the 2
release cycle we promise
``-usbdevice`` (since 2.10.0)
``-drive file=3Djson:{...{'driver':'file'}}`` (since 3.0)
``-vnc acl`` (since 4.0.0)
``-mon ...,control=3Dreadline,pretty=3Don|off`` (since 4.1)
``migrate_set_downtime`` and ``migrate_set_speed`` (since 2.8.0)
``query-named-block-nodes`` result ``encryption_key_missing`` (since 2.10.0)
``query-block`` result ``inserted.encryption_key_missing`` (since 2.10.0)
``migrate-set-cache-size`` and ``query-migrate-cache-size`` (since 2.11.0)
``query-named-block-nodes`` and ``query-block`` result dirty-bitmaps[i].sta=
tus (ince 4.0)
``query-cpus`` (since 2.12.0)
``query-cpus-fast`` ``arch`` output member (since 3.0.0)
``query-events`` (since 4.0)
chardev client socket with ``wait`` option (since 4.0)
``acl_show``, ``acl_reset``, ``acl_policy``, ``acl_add``, ``acl_remove`` (s=
ince 4.0.0)
``ide-drive`` (since 4.2)
``scsi-disk`` (since 4.2)
AFAICT, libvirt has ceased to use all of these too.
There are many more similarly old deprecations not (yet) tackled.
Daniel P. Berrang=C3=A9 (14):
ui, monitor: remove deprecated VNC ACL option and HMP commands
monitor: raise error when 'pretty' option is used with HMP
monitor: remove 'query-events' QMP command
softmmu: remove '-usbdevice' command line option
migrate: remove QMP/HMP commands for speed, downtime and cache size
machine: remove 'query-cpus' QMP command
machine: remove 'arch' field from 'query-cpus-fast' QMP command
chardev: reject use of 'wait' flag for socket client chardevs
hw/ide: remove 'ide-drive' device
hw/scsi: remove 'scsi-disk' device
block: remove 'encryption_key_missing' flag from QAPI
block: remove dirty bitmaps 'status' field
block: remove 'dirty-bitmaps' field from 'BlockInfo' struct
block: remove support for using "file" driver with block/char devices
block/dirty-bitmap.c | 38 ---
block/file-posix.c | 17 +-
block/qapi.c | 6 -
chardev/char-socket.c | 12 +-
docs/devel/migration.rst | 2 +-
docs/qdev-device-use.txt | 2 +-
docs/rdma.txt | 2 +-
docs/system/deprecated.rst | 117 -------
docs/system/removed-features.rst | 123 +++++++
docs/xbzrle.txt | 5 -
hmp-commands-info.hx | 13 -
hmp-commands.hx | 121 -------
hw/core/machine-hmp-cmds.c | 8 +-
hw/core/machine-qmp-cmds.c | 120 -------
hw/i386/pc.c | 2 -
hw/ide/qdev.c | 38 ---
hw/ppc/mac_newworld.c | 13 -
hw/ppc/mac_oldworld.c | 13 -
hw/scsi/scsi-disk.c | 62 ----
hw/sparc64/sun4u.c | 15 -
include/block/dirty-bitmap.h | 1 -
include/monitor/hmp.h | 4 -
migration/migration.c | 45 ---
migration/ram.c | 2 +-
monitor/hmp-cmds.c | 34 --
monitor/misc.c | 187 ----------
monitor/monitor.c | 4 +-
monitor/qmp-cmds-control.c | 24 --
qapi/block-core.json | 64 +---
qapi/control.json | 45 ---
qapi/machine.json | 181 +---------
qapi/migration.json | 98 ------
qemu-options.hx | 5 +-
scripts/device-crash-test | 2 -
softmmu/vl.c | 43 ---
tests/acceptance/pc_cpu_hotplug_props.py | 2 +-
tests/acceptance/x86_cpu_model_versions.py | 2 +-
tests/migration/guestperf/engine.py | 18 +-
tests/qemu-iotests/051 | 4 -
tests/qemu-iotests/051.pc.out | 20 --
tests/qemu-iotests/124 | 4 -
tests/qemu-iotests/181 | 2 +-
tests/qemu-iotests/184.out | 6 +-
tests/qemu-iotests/191.out | 48 +--
tests/qemu-iotests/194 | 4 +-
tests/qemu-iotests/194.out | 4 +-
tests/qemu-iotests/226.out | 10 +-
tests/qemu-iotests/236 | 2 +-
tests/qemu-iotests/236.out | 42 +--
tests/qemu-iotests/246 | 3 +-
tests/qemu-iotests/246.out | 66 ++--
tests/qemu-iotests/254 | 2 +-
tests/qemu-iotests/254.out | 9 +-
tests/qemu-iotests/257.out | 378 +++++++--------------
tests/qemu-iotests/260 | 5 +-
tests/qemu-iotests/273.out | 15 +-
tests/qtest/migration-test.c | 48 ---
tests/qtest/numa-test.c | 6 +-
tests/qtest/qmp-test.c | 6 +-
tests/qtest/test-hmp.c | 6 +-
tests/qtest/test-x86-cpuid-compat.c | 4 +-
tests/qtest/vhost-user-test.c | 8 +-
ui/vnc.c | 38 ---
63 files changed, 380 insertions(+), 1850 deletions(-)
--=20
2.29.2
3 years, 7 months
[PATCH] bhyve: add <os firmware='efi'> support
by Roman Bogorodskiy
Implement "<os firmware='efi'>" support for bhyve driver.
As there are not really lot of options, try to find
"BHYVE_UEFI.fd" firmware which is installed by the
sysutils/uefi-edk2-bhyve FreeBSD port.
If not found, just use the first found firmware
in the firmwares directory (which is configurable via
config file).
Signed-off-by: Roman Bogorodskiy <bogorodskiy(a)gmail.com>
---
Not extremely happy about the LIBVIRT_BHYVE_FIRMWARE_DIR_OVERRIDE knob,
but not sure how to test this otherwise.
po/POTFILES.in | 1 +
src/bhyve/bhyve_domain.c | 5 +
src/bhyve/bhyve_firmware.c | 91 +++++++++++++++++++
src/bhyve/bhyve_firmware.h | 30 ++++++
src/bhyve/bhyve_process.c | 15 +++
src/bhyve/bhyve_process.h | 5 +
src/bhyve/meson.build | 1 +
.../bhyvexml2argv-firmware-efi.args | 11 +++
.../bhyvexml2argv-firmware-efi.ldargs | 1 +
.../bhyvexml2argv-firmware-efi.xml | 22 +++++
tests/bhyvexml2argvtest.c | 83 ++++++++++++++---
11 files changed, 254 insertions(+), 11 deletions(-)
create mode 100644 src/bhyve/bhyve_firmware.c
create mode 100644 src/bhyve/bhyve_firmware.h
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-firmware-efi.args
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-firmware-efi.ldargs
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-firmware-efi.xml
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 80c5f145be..413783ee35 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -14,6 +14,7 @@
@SRCDIR(a)src/bhyve/bhyve_command.c
@SRCDIR(a)src/bhyve/bhyve_domain.c
@SRCDIR(a)src/bhyve/bhyve_driver.c
+@SRCDIR(a)src/bhyve/bhyve_firmware.c
@SRCDIR(a)src/bhyve/bhyve_monitor.c
@SRCDIR(a)src/bhyve/bhyve_parse_command.c
@SRCDIR(a)src/bhyve/bhyve_process.c
diff --git a/src/bhyve/bhyve_domain.c b/src/bhyve/bhyve_domain.c
index 8fbc554a0a..209e4d3905 100644
--- a/src/bhyve/bhyve_domain.c
+++ b/src/bhyve/bhyve_domain.c
@@ -64,6 +64,9 @@ bhyveDomainDefNeedsISAController(virDomainDefPtr def)
if (def->os.bootloader == NULL && def->os.loader)
return true;
+ if (def->os.firmware == VIR_DOMAIN_OS_DEF_FIRMWARE_EFI)
+ return true;
+
if (def->nserials || def->nconsoles)
return true;
@@ -230,6 +233,8 @@ virDomainDefParserConfig virBhyveDriverDomainDefParserConfig = {
.domainPostParseCallback = bhyveDomainDefPostParse,
.assignAddressesCallback = bhyveDomainDefAssignAddresses,
.deviceValidateCallback = bhyveDomainDeviceDefValidate,
+
+ .features = VIR_DOMAIN_DEF_FEATURE_FW_AUTOSELECT,
};
static void
diff --git a/src/bhyve/bhyve_firmware.c b/src/bhyve/bhyve_firmware.c
new file mode 100644
index 0000000000..ccc3a5ffc8
--- /dev/null
+++ b/src/bhyve/bhyve_firmware.c
@@ -0,0 +1,91 @@
+/*
+ * bhyve_firmware.c: bhyve firmware management
+ *
+ * Copyright (C) 2021 Roman Bogorodskiy
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <config.h>
+#include <dirent.h>
+
+#include "viralloc.h"
+#include "virlog.h"
+#include "virfile.h"
+#include "bhyve_conf.h"
+#include "bhyve_firmware.h"
+
+#define VIR_FROM_THIS VIR_FROM_BHYVE
+
+VIR_LOG_INIT("bhyve.bhyve_firmware");
+
+
+#define BHYVE_DEFAULT_FIRMWARE "BHYVE_UEFI.fd"
+
+int
+bhyveFirmwareFillDomain(bhyveConnPtr driver,
+ virDomainDefPtr def,
+ unsigned int flags)
+{
+ g_autoptr(DIR) dir = NULL;
+ virBhyveDriverConfigPtr cfg = virBhyveDriverGetConfig(driver);
+ const char *firmware_dir_cfg = cfg->firmwareDir;
+ const char *firmware_dir_env = NULL, *firmware_dir = NULL;
+ struct dirent *entry;
+ char *matching_firmware = NULL;
+ char *first_found = NULL;
+
+ virCheckFlags(0, -1);
+
+ if (def->os.firmware == VIR_DOMAIN_OS_DEF_FIRMWARE_NONE)
+ return 0;
+
+ if (virDirOpenIfExists(&dir, firmware_dir_cfg) > 0) {
+ while ((virDirRead(dir, &entry, firmware_dir)) > 0) {
+ if (STREQ(entry->d_name, BHYVE_DEFAULT_FIRMWARE)) {
+ matching_firmware = g_strdup(entry->d_name);
+ break;
+ }
+ if (!first_found)
+ first_found = g_strdup(entry->d_name);
+ }
+ }
+
+ if (!matching_firmware) {
+ if (!first_found) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("no firmwares found in %s"),
+ firmware_dir_cfg);
+ return -1;
+ } else {
+ matching_firmware = first_found;
+ }
+ }
+
+ if (!def->os.loader)
+ def->os.loader = g_new0(virDomainLoaderDef, 1);
+
+ def->os.loader->type = VIR_DOMAIN_LOADER_TYPE_PFLASH;
+ def->os.loader->readonly = VIR_TRISTATE_BOOL_YES;
+
+ VIR_FREE(def->os.loader->path);
+
+ firmware_dir_env = g_getenv("LIBVIRT_BHYVE_FIRMWARE_DIR_OVERRIDE");
+ firmware_dir = firmware_dir_env ? firmware_dir_env : firmware_dir_cfg;
+ def->os.loader->path = g_build_filename(firmware_dir, matching_firmware, NULL);
+
+ return 0;
+}
diff --git a/src/bhyve/bhyve_firmware.h b/src/bhyve/bhyve_firmware.h
new file mode 100644
index 0000000000..ae4bc98676
--- /dev/null
+++ b/src/bhyve/bhyve_firmware.h
@@ -0,0 +1,30 @@
+/*
+ * bhyve_firmware.h: bhyve firmware management
+ *
+ * Copyright (C) 2021 Roman Bogorodskiy
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#pragma once
+
+#include "domain_conf.h"
+#include "bhyve_utils.h"
+
+int
+bhyveFirmwareFillDomain(bhyveConnPtr driver,
+ virDomainDefPtr def,
+ unsigned int flags);
diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c
index 060018bc70..0cfe69688c 100644
--- a/src/bhyve/bhyve_process.c
+++ b/src/bhyve/bhyve_process.c
@@ -33,6 +33,7 @@
#include "bhyve_device.h"
#include "bhyve_driver.h"
#include "bhyve_command.h"
+#include "bhyve_firmware.h"
#include "bhyve_monitor.h"
#include "bhyve_process.h"
#include "datatypes.h"
@@ -251,6 +252,17 @@ virBhyveProcessStartImpl(bhyveConnPtr driver,
return ret;
}
+int
+bhyveProcessPrepareDomain(bhyveConnPtr driver,
+ virDomainObjPtr vm,
+ unsigned int flags)
+{
+ if (bhyveFirmwareFillDomain(driver, vm->def, flags) < 0)
+ return -1;
+
+ return 0;
+}
+
int
virBhyveProcessStart(virConnectPtr conn,
virDomainObjPtr vm,
@@ -268,6 +280,9 @@ virBhyveProcessStart(virConnectPtr conn,
conn, bhyveProcessAutoDestroy) < 0)
return -1;
+ if (bhyveProcessPrepareDomain(driver, vm, flags) < 0)
+ return -1;
+
return virBhyveProcessStartImpl(driver, vm, reason);
}
diff --git a/src/bhyve/bhyve_process.h b/src/bhyve/bhyve_process.h
index d7b4e0bd4e..133863c1e0 100644
--- a/src/bhyve/bhyve_process.h
+++ b/src/bhyve/bhyve_process.h
@@ -23,6 +23,11 @@
#include "bhyve_utils.h"
+int
+bhyveProcessPrepareDomain(bhyveConnPtr driver,
+ virDomainObjPtr vm,
+ unsigned int flags);
+
int virBhyveProcessStart(virConnectPtr conn,
virDomainObjPtr vm,
virDomainRunningReason reason,
diff --git a/src/bhyve/meson.build b/src/bhyve/meson.build
index 2b65eecf5e..b3551477b7 100644
--- a/src/bhyve/meson.build
+++ b/src/bhyve/meson.build
@@ -2,6 +2,7 @@ bhyve_sources = files(
'bhyve_capabilities.c',
'bhyve_command.c',
'bhyve_conf.c',
+ 'bhyve_firmware.c',
'bhyve_parse_command.c',
'bhyve_device.c',
'bhyve_domain.c',
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-firmware-efi.args b/tests/bhyvexml2argvdata/bhyvexml2argv-firmware-efi.args
new file mode 100644
index 0000000000..40bc84ef27
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-firmware-efi.args
@@ -0,0 +1,11 @@
+/usr/sbin/bhyve \
+-c 1 \
+-m 214 \
+-u \
+-H \
+-P \
+-s 0:0,hostbridge \
+-l bootrom,test_firmware_dir/BHYVE_UEFI.fd \
+-s 1:0,lpc \
+-s 2:0,ahci,hd:/tmp/freebsd.img \
+-s 3:0,virtio-net,faketapdev,mac=52:54:00:00:00:00 bhyve
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-firmware-efi.ldargs b/tests/bhyvexml2argvdata/bhyvexml2argv-firmware-efi.ldargs
new file mode 100644
index 0000000000..421376db9e
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-firmware-efi.ldargs
@@ -0,0 +1 @@
+dummy
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-firmware-efi.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-firmware-efi.xml
new file mode 100644
index 0000000000..302326cb26
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-firmware-efi.xml
@@ -0,0 +1,22 @@
+<domain type='bhyve'>
+ <name>bhyve</name>
+ <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
+ <memory>219136</memory>
+ <vcpu>1</vcpu>
+ <os firmware='efi'>
+ <type>hvm</type>
+ </os>
+ <devices>
+ <disk type='file'>
+ <driver name='file' type='raw'/>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='hda' bus='sata'/>
+ <address type='drive' controller='0' bus='0' target='2' unit='0'/>
+ </disk>
+ <interface type='bridge'>
+ <model type='virtio'/>
+ <source bridge="virbr0"/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </interface>
+ </devices>
+</domain>
diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c
index 197334f9c4..13b8e34c2b 100644
--- a/tests/bhyvexml2argvtest.c
+++ b/tests/bhyvexml2argvtest.c
@@ -7,17 +7,20 @@
# include "datatypes.h"
# include "bhyve/bhyve_capabilities.h"
+# include "bhyve/bhyve_conf.h"
# include "bhyve/bhyve_domain.h"
# include "bhyve/bhyve_utils.h"
# include "bhyve/bhyve_command.h"
+# include "bhyve/bhyve_process.h"
# define VIR_FROM_THIS VIR_FROM_BHYVE
static bhyveConn driver;
typedef enum {
- FLAG_EXPECT_FAILURE = 1 << 0,
- FLAG_EXPECT_PARSE_ERROR = 1 << 1,
+ FLAG_EXPECT_FAILURE = 1 << 0,
+ FLAG_EXPECT_PARSE_ERROR = 1 << 1,
+ FLAG_EXPECT_PREPARE_ERROR = 1 << 2,
} virBhyveXMLToArgvTestFlags;
static int testCompareXMLToArgvFiles(const char *xml,
@@ -29,7 +32,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
g_autofree char *actualargv = NULL;
g_autofree char *actualld = NULL;
g_autofree char *actualdm = NULL;
- g_autoptr(virDomainDef) vmdef = NULL;
+ g_autoptr(virDomainObj) vm = NULL;
g_autoptr(virCommand) cmd = NULL;
g_autoptr(virCommand) ldcmd = NULL;
g_autoptr(virConnect) conn = NULL;
@@ -38,7 +41,10 @@ static int testCompareXMLToArgvFiles(const char *xml,
if (!(conn = virGetConnect()))
goto out;
- if (!(vmdef = virDomainDefParseFile(xml, driver.xmlopt,
+ if (!(vm = virDomainObjNew(driver.xmlopt)))
+ return -1;
+
+ if (!(vm->def = virDomainDefParseFile(xml, driver.xmlopt,
NULL, VIR_DOMAIN_DEF_PARSE_INACTIVE))) {
if (flags & FLAG_EXPECT_PARSE_ERROR) {
ret = 0;
@@ -54,11 +60,20 @@ static int testCompareXMLToArgvFiles(const char *xml,
conn->privateData = &driver;
- cmd = virBhyveProcessBuildBhyveCmd(&driver, vmdef, false);
- if (vmdef->os.loader)
+ if (bhyveProcessPrepareDomain(&driver, vm, 0) < 0) {
+ if (flags & FLAG_EXPECT_PREPARE_ERROR) {
+ ret = 0;
+ VIR_TEST_DEBUG("Got expected error: %s",
+ virGetLastErrorMessage());
+ }
+ goto out;
+ }
+
+ cmd = virBhyveProcessBuildBhyveCmd(&driver, vm->def, false);
+ if (vm->def->os.loader)
ldcmd = virCommandNew("dummy");
else
- ldcmd = virBhyveProcessBuildLoadCmd(&driver, vmdef, "<device.map>",
+ ldcmd = virBhyveProcessBuildLoadCmd(&driver, vm->def, "<device.map>",
&actualdm);
if ((cmd == NULL) || (ldcmd == NULL)) {
@@ -94,10 +109,10 @@ static int testCompareXMLToArgvFiles(const char *xml,
ret = 0;
out:
- if (vmdef &&
- vmdef->ngraphics == 1 &&
- vmdef->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC)
- virPortAllocatorRelease(vmdef->graphics[0]->data.vnc.port);
+ if (vm && vm->def &&
+ vm->def->ngraphics == 1 &&
+ vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC)
+ virPortAllocatorRelease(vm->def->graphics[0]->data.vnc.port);
return ret;
}
@@ -128,10 +143,16 @@ testCompareXMLToArgvHelper(const void *data)
return testCompareXMLToArgvFiles(xml, args, ldargs, dmargs, info->flags);
}
+# define FAKEFIRMWAREDIRTEMPLATE abs_builddir "/bhyvefakefirmwaredir-XXXXXX"
+
static int
mymain(void)
{
int ret = 0;
+ g_autofree char *fakefirmwaredir = NULL;
+ g_autofree char *emptyfirmwaredir = NULL;
+ const char *firmwares[] = {"BHYVE_UEFI.fd", "BHYVE_UEFI_CSM.fd", "refind_x64.efi", NULL};
+ size_t i;
if ((driver.caps = virBhyveCapsBuild()) == NULL)
return EXIT_FAILURE;
@@ -142,6 +163,35 @@ mymain(void)
if (!(driver.remotePorts = virPortAllocatorRangeNew("display", 5900, 65535)))
return EXIT_FAILURE;
+ if (!(driver.config = virBhyveDriverConfigNew()))
+ return EXIT_FAILURE;
+
+ fakefirmwaredir = g_strdup(FAKEFIRMWAREDIRTEMPLATE);
+
+ if (!g_mkdtemp(fakefirmwaredir)) {
+ fprintf(stderr, "Cannot create fakefirmwaredir");
+ abort();
+ }
+ driver.config->firmwareDir = fakefirmwaredir;
+
+ emptyfirmwaredir = g_strdup(FAKEFIRMWAREDIRTEMPLATE);
+
+ if (!g_mkdtemp(emptyfirmwaredir)) {
+ fprintf(stderr, "Cannot create emptyfirmwaredir");
+ abort();
+ }
+
+ i = 0;
+ while (firmwares[i]) {
+ g_autofree char *firmware_path = g_strdup_printf("%s/%s", fakefirmwaredir, firmwares[i++]);
+
+ if (virFileTouch(firmware_path, 0600) < 0) {
+ fprintf(stderr, "Cannot create firmware file");
+ abort();
+ }
+ }
+
+ g_setenv("LIBVIRT_BHYVE_FIRMWARE_DIR_OVERRIDE", "test_firmware_dir", TRUE);
# define DO_TEST_FULL(name, flags) \
do { \
@@ -162,6 +212,9 @@ mymain(void)
# define DO_TEST_PARSE_ERROR(name) \
DO_TEST_FULL(name, FLAG_EXPECT_PARSE_ERROR)
+# define DO_TEST_PREPARE_ERROR(name) \
+ DO_TEST_FULL(name, FLAG_EXPECT_PREPARE_ERROR)
+
driver.grubcaps = BHYVE_GRUB_CAP_CONSDEV;
driver.bhyvecaps = BHYVE_CAP_RTC_UTC | BHYVE_CAP_AHCI32SLOT | \
BHYVE_CAP_NET_E1000 | BHYVE_CAP_LPC_BOOTROM | \
@@ -209,6 +262,10 @@ mymain(void)
DO_TEST("sound");
DO_TEST("isa-controller");
DO_TEST_FAILURE("isa-multiple-controllers");
+ DO_TEST("firmware-efi");
+ g_unsetenv("LIBVIRT_BHYVE_FIRMWARE_DIR_OVERRIDE");
+ driver.config->firmwareDir = emptyfirmwaredir;
+ DO_TEST_PREPARE_ERROR("firmware-efi");
DO_TEST("fs-9p");
DO_TEST("fs-9p-readonly");
DO_TEST_FAILURE("fs-9p-unsupported-type");
@@ -264,9 +321,13 @@ mymain(void)
driver.bhyvecaps &= ~BHYVE_CAP_VNC_PASSWORD;
DO_TEST_FAILURE("vnc-password");
+ virFileDeleteTree(fakefirmwaredir);
+ virFileDeleteTree(emptyfirmwaredir);
+
virObjectUnref(driver.caps);
virObjectUnref(driver.xmlopt);
virPortAllocatorRangeFree(driver.remotePorts);
+ virObjectUnref(driver.config);
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
--
2.30.0
3 years, 7 months
[PATCH 0/4] ui: add support for 'secret' object to provide VNC/SPICE passwords
by Daniel P. Berrangé
This fixes a long standing limitation of the VNC/SPICE code which was
unable to securely accept passswords on the CLI, instead requiring use
of separate monitor commands after startup.
This takes the opportunity to also remove previously deprecated ACL
functionality from VNC.
Daniel P. Berrangé (4):
ui: introduce "password-secret" option for VNC servers
ui: introduce "password-secret" option for SPICE server
ui: deprecate "password" option for SPICE server
ui, monitor: remove deprecated VNC ACL option and HMP commands
docs/system/deprecated.rst | 24 ++--
docs/system/removed-features.rst | 13 +++
hmp-commands.hx | 76 -------------
monitor/misc.c | 187 -------------------------------
qemu-options.hx | 17 ++-
ui/spice-core.c | 32 +++++-
ui/vnc.c | 61 ++++------
7 files changed, 88 insertions(+), 322 deletions(-)
--
2.29.2
3 years, 7 months
[PATCH 00/23] RFC: get rid of macros when dealing with block io tunes
by Nikolay Shirokovskiy
Hi, all.
I started this work as adding missing parts/fixing issues/etc in block iotune
code but then turned to refactoring code. We use a lot of macros in this place
and if we get rid of them I belive we will have much more readable/reusable/
extendable code.
Most of macros usage is for iterating over unsigned long long values. I'm
talking about parsing/formating xml, converting from/to virTypedParameterPtr
list etc. These places do not care about tune semantics and thus we can
add tools for the said iteration. See patch [1] for the first such conversion.
Patches before it partially prepare for this conversion, partially just
improve code reuse and add missing parts.
The work on removing macros in code handling iotunes is not finished as
I wanted to get an approvement that I have taken a right direction. At the
same time series shows the potential of the approach (take a look on how
qemuDomainSetBlockIoTune and testDomainSetBlockIoTune are looking now!).
Some places like qemuDomainSetBlockIoTuneDefaults deal with fields semantics.
So we need another approach to remove macros there but it is a matter of
a different RFC.
Nikolay Shirokovskiy (23):
qemu: pass supportGroupNameOption as expected
qemu: factor out qemuValidateDomainBlkdeviotune
qemu: reuse validation in qemuDomainSetBlockIoTune
qemu: remove extra check for QEMU_BLOCK_IOTUNE_MAX
conf: factor out virDomainBlockIoTuneValidate
qemu: reuse virDomainBlockIoTuneValidate
test driver: reuse virDomainBlockIoTuneValidate
qemu: reset max iotune setting when needed
qemu: add max iotune settings check to virDomainBlockIoTuneValidate
qemu: remove iotune max checks
test driver: remove iotune max checks
qemu: prepare for removing qemuBlockIoTuneSetFlags
qemu: use group_name instead of QEMU_BLOCK_IOTUNE_SET_GROUP_NAME
qemu: remove qemuBlockIoTuneSetFlags usage in qemuDomainSetBlockIoTune
qemu: remove qemuBlockIoTuneSetFlags enum completly
conf: get rid of macros in virDomainDiskDefIotuneParse [1]
conf: get rid of macros in virDomainDiskDefFormatIotune
conf: add virDomainBlockIoTuneFromParams
conf: add virDomainBlockIoTuneToEventParams
qemu: qemuDomainSetBlockIoTune use functions to convert to/from params
test driver: remove TEST_BLOCK_IOTUNE_MAX checks
test driver: prepare to delete macros in testDomainSetBlockIoTune
test driver: testDomainSetBlockIoTune: use functions to convert
to/from params
src/conf/domain_conf.c | 303 +++++++++++++++++++++++++++++++++--------------
src/conf/domain_conf.h | 16 +++
src/libvirt_private.syms | 3 +
src/qemu/qemu_driver.c | 281 ++++++++++++-------------------------------
src/qemu/qemu_validate.c | 100 +++++++++-------
src/qemu/qemu_validate.h | 4 +
src/test/test_driver.c | 156 ++----------------------
7 files changed, 380 insertions(+), 483 deletions(-)
--
1.8.3.1
3 years, 7 months
[PATCH v2 00/12] qemu: Prepare for QAPIfied object-add
by Peter Krempa
QEMU plans to QAPIfy object add. This series prepares for the API change
(drop of 'props' wrapper for the object) and adds testing based on our
qemuxml2argv test data which forces the output to JSON and validates it
agains the schema.
Based on Kevin's qemu patches:
https://listman.redhat.com/archives/libvir-list/2021-February/msg01168.html
Last patch forces more files to be processed and as the summary suggest
will not be pushed.
The patch updating qemucapabilitiesdata will be updated after Kevin's
patches hit upstream repo.
Peter Krempa (12):
qemu: command: Generate commandline of 'masterKey0' secret via JSON
qemu: command: Generate commandline of 'sev0' sev-guest object via
JSON
qemu: command: Generate commandline of iothread objects JSON
qemu: capabilities: Introduce QEMU_CAPS_OBJECT_QAPIFIED
tests: qemuxml2argv: Validate generation of JSON props for object-add
qemu: command: Introduce raw JSON passthrough for '-object' for
testing
qemu: monitor: Make wrapping of 'props' of 'object-add' optional
qemuMonitorCreateObjectPropsWrap: Open-code in
qemuBuildMemoryBackendProps
qemu: monitor: Don't add 'props' wrapper if qemu has
QEMU_CAPS_OBJECT_QAPIFIED
qemumonitorjsontest: Remove bomb guarding object-add
tests: qemucapabilities: Update qemu caps for object-add qapification
[DON'T PUSH] Force-check all configs with latest capabilities
src/qemu/qemu_capabilities.c | 4 +
src/qemu/qemu_capabilities.h | 3 +
src/qemu/qemu_command.c | 326 +-
src/qemu/qemu_monitor.c | 78 +-
src/qemu/qemu_monitor.h | 4 -
src/util/virqemu.c | 48 +-
src/util/virqemu.h | 3 +-
.../caps_6.0.0.x86_64.replies | 3238 ++++++++++++-----
.../caps_6.0.0.x86_64.xml | 83 +-
tests/qemumonitorjsontest.c | 14 -
...v-missing-platform-info.x86_64-2.12.0.args | 2 +-
.../launch-security-sev.x86_64-2.12.0.args | 2 +-
tests/qemuxml2argvtest.c | 24 +-
13 files changed, 2775 insertions(+), 1054 deletions(-)
--
2.29.2
3 years, 7 months
[PATCH v4 0/1] qemu: add per-vcpu delay stats
by Aleksei Zakharov
Fixed since v3:
- Report error if cannot read stats.
- Don't fail if cannot read stats.
- Add documentation.
- Drop unnecessary checks.
- Don't delete unrelated whitespace.
- Make sure schedstat file is closed before returning.
Fixed since v2:
- Close schedstat file after use.
Fixes since v1:
- Collect per-vcpu stats.
- Coding style errors
- Use glib functions.
Aleksei Zakharov (1):
qemu: add per-vcpu delay stats
docs/manpages/virsh.rst | 4 ++++
src/libvirt-domain.c | 4 ++++
src/qemu/qemu_driver.c | 44 +++++++++++++++++++++++++++++++++++++++--
3 files changed, 50 insertions(+), 2 deletions(-)
--
2.17.1
3 years, 7 months
[PATCH] meson: Add documentation installation directory option
by Chris Mayo
Allow the directory to be chosen at installation time, to support local
conventions e.g. versioning.
Signed-off-by: Chris Mayo <aklhfex(a)gmail.com>
---
meson.build | 6 +++++-
meson_options.txt | 1 +
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index 369548f127..5c7a335947 100644
--- a/meson.build
+++ b/meson.build
@@ -83,8 +83,12 @@ mandir = prefix / get_option('mandir')
sbindir = prefix / get_option('sbindir')
sharedstatedir = prefix / get_option('sharedstatedir')
+docdir = get_option('docdir')
+if docdir == ''
+ docdir = datadir / 'doc' / meson.project_name()
+endif
+
confdir = sysconfdir / meson.project_name()
-docdir = datadir / 'doc' / meson.project_name()
pkgdatadir = datadir / meson.project_name()
diff --git a/meson_options.txt b/meson_options.txt
index e5d79c2b6b..2606648b64 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -7,6 +7,7 @@ option('expensive_tests', type: 'feature', value: 'auto', description: 'set the
option('test_coverage', type: 'boolean', value: false, description: 'turn on code coverage instrumentation')
option('git_werror', type: 'feature', value: 'auto', description: 'use -Werror if building from GIT')
option('rpath', type: 'feature', value: 'auto', description: 'whether to include rpath information in installed binaries and libraries')
+option('docdir', type: 'string', value: '', description: 'documentation installation directory')
option('docs', type: 'feature', value: 'auto', description: 'whether to generate documentation')
option('tests', type: 'feature', value: 'auto', description: 'whether to build tests')
--
2.28.0
3 years, 7 months
[libvirt PATCH] util: don't log error if SRIOV PF has no associated netdev
by Laine Stump
Some SRIOV PFs don't have a netdev associated with them (the spec
apparently doesn't require it). In most cases when libvirt is dealing
with an SRIOV VF, that VF must have a PF, and the PF *must* have an
associated netdev (the only way to set the MAC address of a VF is by
sending a netlink message to the netdev of that VF's PF). But there
are times when we don't need for the PF to have a netdev; in
particular, when we're just getting the Switchdev Features for a VF,
we don't need the PF netdev - the netdev of the VF (apparently) works
just as well.
Commit 6452e2f5 (libvirt 5.1.0) *kind of* made libvirt work around PFs
with no netdevs in this case - if virNetDevGetPhysicalFunction
returned an error when setting up to retrieve Switchdev feature info,
it would ignore the error, and then check if the PF netdev name was
NULL and, if so it would reset the error object and continue on rather
than returning early with a failure. The problem is that by the time
this special handling occured, the error message about missing netdev
had already been logged, which was harmless to proper operation, but
confused the user.
Fortunately there are only 2 users of virNetDevGetPhysicalFunction, so
it is easy to redefine it's API to state that a missing netdev name is
*not* an error - in that case it will still return success, but the
caller must be prepared for the PF netdev name to be NULL. After
making this change, we can modify the two callers to behave properly
with the new semantics (for one of the callers it *is* still an error,
so the error message is moved there, but for the other it is okay to
continue), and our spurious error messages are a thing of the past.
Resolves: https://bugzilla.redhat.com/1924616
Fixes: 6452e2f5e1837bd753ee465e6607ed3c4f62b815
Signed-off-by: Laine Stump <laine(a)redhat.com>
---
src/util/virnetdev.c | 31 +++++++++++++++----------------
1 file changed, 15 insertions(+), 16 deletions(-)
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index 2b4c8b6280..7b766234ec 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -1339,7 +1339,8 @@ virNetDevGetVirtualFunctionIndex(const char *pfname, const char *vfname,
*
* @ifname : name of the physical function interface name
* @pfname : Contains sriov physical function for interface ifname
- * upon successful return
+ * upon successful return (might be NULL if the PF has no
+ * associated netdev. This is *not* an error)
*
* Returns 0 on success, -1 on failure
*
@@ -1361,15 +1362,6 @@ virNetDevGetPhysicalFunction(const char *ifname, char **pfname)
return -1;
}
- if (!*pfname) {
- /* The SRIOV standard does not require VF netdevs to have
- * the netdev assigned to a PF. */
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("The PF device for VF %s has no network device name"),
- ifname);
- return -1;
- }
-
return 0;
}
@@ -1442,6 +1434,17 @@ virNetDevGetVirtualFunctionInfo(const char *vfname, char **pfname,
if (virNetDevGetPhysicalFunction(vfname, pfname) < 0)
return -1;
+ if (!*pfname) {
+ /* The SRIOV standard does not require VF netdevs to have the
+ * netdev assigned to a PF, but our method of retrieving
+ * VFINFO does.
+ */
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("The PF device for VF %s has no network device name, cannot get virtual function info"),
+ vfname);
+ return -1;
+ }
+
if (virNetDevGetVirtualFunctionIndex(*pfname, vfname, vf) < 0)
goto cleanup;
@@ -3204,12 +3207,8 @@ virNetDevSwitchdevFeature(const char *ifname,
if ((is_vf = virNetDevIsVirtualFunction(ifname)) < 0)
return ret;
- if (is_vf == 1) {
- /* Ignore error if PF does not have netdev assigned.
- * In that case pfname == NULL. */
- if (virNetDevGetPhysicalFunction(ifname, &pfname) < 0)
- virResetLastError();
- }
+ if (is_vf == 1 && virNetDevGetPhysicalFunction(ifname, &pfname) < 0)
+ return ret;
pci_device_ptr = pfname ? virNetDevGetPCIDevice(pfname) :
virNetDevGetPCIDevice(ifname);
--
2.29.2
3 years, 7 months