[libvirt PATCH 00/15] Use g_auto* in src/cpu/*.
by Tim Wiederhake
Mostly mechanical changes, the most "interesting" patches are the first (wher=
e should
the `G_DEFINE_AUTOPTR_CLEANUP_FUN` go?) and the last (removing call to `g_str=
freev`, as
it should not be necessary).
As an added benefit, this removes all `goto` usage in this directory.
Tim Wiederhake (15):
cpu_map: Use g_auto* in loadData
cpu_map: Use g_auto* in cpuMapLoadInclude
cpu_map: Use g_auto* in loadIncludes
cpu: Use g_auto* in virCPUCompareXML
cpu: Use g_auto* in virCPUGetHost
cpu_ppc64: Turn structs ppc64_{vendor,model,map} into typedefs
cpu_ppc64: Use g_auto* in ppc64ModelCopy
cpu_ppc64: Use g_auto* in ppc64VendorParse
cpu_ppc64: Use g_auto* in ppc64ModelParse
cpu_ppc64: Use g_auto* in ppc64LoadMap
cpu_ppc64: Use g_auto* in ppc64Compute
cpu_ppc64: Use g_auto* in ppc64DriverDecode
cpu_ppc64: Use g_auto* in virCPUppc64GetHost
cpu_ppc64: Use g_auto* in virCPUppc64Baseline
cpu_ppc64: Use g_auto* in virCPUppc64DriverGetModels
src/cpu/cpu.c | 31 ++----
src/cpu/cpu_map.c | 60 ++++------
src/cpu/cpu_ppc64.c | 260 +++++++++++++++++---------------------------
3 files changed, 133 insertions(+), 218 deletions(-)
--=20
2.26.2
4 years, 3 months
[libvirt PATCH] remove HAL node device driver
by Pavel Hrdina
There was one attempt a year ago done by me to drop HAL [1] but it was
never resolved. There was another time when Dan suggested to drop HAL
driver [2] but it was decided to keep it around in case device
assignment will be implemented for FreeBSD and the fact that
virt-manager uses node device driver [3].
I checked git history and code and it doesn't look like bhyve supports
device assignment so from that POV it should not block removing HAL.
The argument about virt-manager is not strong as well because libvirt
installed from FreeBSD packages doesn't have HAL support so it will not
affect these users as well [4].
The only users affected by this change would be the ones compiling
libvirt from GIT on FreeBSD.
I looked into alternatives and there is libudev-devd package on FreeBSD
but unfortunately it doesn't work as it doesn't list any devices when
used with libvirt. It provides libudev APIs using devd.
I also looked into devd directly and it provides some APIs but there are
no APIs for device monitoring and events so that would have to be
somehow done by libvirt.
Main motivation for dropping HAL support is to replace libdbus with GLib
dbus implementation and it cannot be done with HAL driver present in
libvirt because HAL APIs heavily depends on symbols provided by libdbus.
[1] <https://www.redhat.com/archives/libvir-list/2019-May/msg00203.html>
[2] <https://www.redhat.com/archives/libvir-list/2016-April/msg00992.html>
[3] <https://www.redhat.com/archives/libvir-list/2016-April/msg00994.html>
[4] <https://svnweb.freebsd.org/ports/head/devel/libvirt/Makefile?view=markup>
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
meson.build | 9 +-
meson_options.txt | 1 -
src/node_device/meson.build | 5 -
src/node_device/node_device_driver.c | 10 +-
src/node_device/node_device_driver.h | 5 -
src/node_device/node_device_hal.c | 843 ---------------------------
src/node_device/node_device_hal.h | 22 -
7 files changed, 3 insertions(+), 892 deletions(-)
delete mode 100644 src/node_device/node_device_hal.c
delete mode 100644 src/node_device/node_device_hal.h
diff --git a/meson.build b/meson.build
index 1aad385ad1..d9c91d88dd 100644
--- a/meson.build
+++ b/meson.build
@@ -1079,12 +1079,6 @@ glusterfs_dep = dependency('glusterfs-api', version: '>=' + glusterfs_version, r
gnutls_version = '3.2.0'
gnutls_dep = dependency('gnutls', version: '>=' + gnutls_version)
-hal_version = '0.5.0'
-hal_dep = dependency('hal', version: '>=' + hal_version, required: get_option('hal'))
-if hal_dep.found()
- conf.set('WITH_HAL', 1)
-endif
-
# Check for BSD kvm (kernel memory interface)
if host_machine.system() == 'freebsd'
kvm_dep = cc.find_library('kvm')
@@ -1728,7 +1722,7 @@ if not get_option('driver_network').disabled() and conf.has('WITH_LIBVIRTD') and
conf.set('WITH_NETWORK', 1)
endif
-if hal_dep.found() or udev_dep.found()
+if udev_dep.found()
conf.set('WITH_NODE_DEVICES', 1)
endif
@@ -2433,7 +2427,6 @@ libs_summary = {
'glib_dep': glib_dep.found(),
'glusterfs': glusterfs_dep.found(),
'gnutls': gnutls_dep.found(),
- 'hal': hal_dep.found(),
'libiscsi': libiscsi_dep.found(),
'libnl': libnl_dep.found(),
'libpcap': libpcap_dep.found(),
diff --git a/meson_options.txt b/meson_options.txt
index 7838630c1e..c8886e1430 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -23,7 +23,6 @@ option('firewalld', type: 'feature', value: 'auto', description: 'firewalld supp
option('firewalld_zone', type: 'feature', value: 'auto', description: 'whether to install firewalld libvirt zone')
option('fuse', type: 'feature', value: 'auto', description: 'fuse support')
option('glusterfs', type: 'feature', value: 'auto', description: 'glusterfs support')
-option('hal', type: 'feature', value: 'auto', description: 'hal support')
option('libiscsi', type: 'feature', value: 'auto', description: 'libiscsi support')
option('libpcap', type: 'feature', value: 'auto', description: 'libpcap support')
option('libssh', type: 'feature', value: 'auto', description: 'libssh support')
diff --git a/src/node_device/meson.build b/src/node_device/meson.build
index 5953c6b8ed..c4e4c3906b 100644
--- a/src/node_device/meson.build
+++ b/src/node_device/meson.build
@@ -4,10 +4,6 @@ node_device_driver_sources = [
stateful_driver_source_files += files(node_device_driver_sources)
-if conf.has('WITH_HAL')
- node_device_driver_sources += 'node_device_hal.c'
-endif
-
if conf.has('WITH_UDEV')
node_device_driver_sources += 'node_device_udev.c'
endif
@@ -22,7 +18,6 @@ if conf.has('WITH_NODE_DEVICES')
],
dependencies: [
access_dep,
- hal_dep,
libnl_dep,
pciaccess_dep,
src_dep,
diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index e89c8b0ee5..d5f5611361 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -35,7 +35,6 @@
#include "node_device_conf.h"
#include "node_device_event.h"
#include "node_device_driver.h"
-#include "node_device_hal.h"
#include "node_device_util.h"
#include "virvhba.h"
#include "viraccessapicheck.h"
@@ -97,14 +96,13 @@ int nodeConnectIsAlive(virConnectPtr conn G_GNUC_UNUSED)
return 1;
}
-#if defined (__linux__) && ( defined (WITH_HAL) || defined(WITH_UDEV))
+#if defined (__linux__) && defined(WITH_UDEV)
/* NB: It was previously believed that changes in driver name were
* relayed to libvirt as "change" events by udev, and the udev event
* notification is setup to recognize such events and effectively
* recreate the device entry in the cache. However, neither the kernel
* nor udev sends such an event, so it is necessary to manually update
- * the driver name for a device each time its entry is used, both for
- * udev *and* HAL backends.
+ * the driver name for a device each time its entry is used.
*/
static int
nodeDeviceUpdateDriverName(virNodeDeviceDefPtr def)
@@ -925,9 +923,5 @@ nodedevRegister(void)
{
#ifdef WITH_UDEV
return udevNodeRegister();
-#else
-# ifdef WITH_HAL
- return halNodeRegister();
-# endif
#endif
}
diff --git a/src/node_device/node_device_driver.h b/src/node_device/node_device_driver.h
index be5d397828..2113d2b0a5 100644
--- a/src/node_device/node_device_driver.h
+++ b/src/node_device/node_device_driver.h
@@ -28,11 +28,6 @@
#define LINUX_NEW_DEVICE_WAIT_TIME 60
-#ifdef WITH_HAL
-int
-halNodeRegister(void);
-#endif
-
#ifdef WITH_UDEV
int
udevNodeRegister(void);
diff --git a/src/node_device/node_device_hal.c b/src/node_device/node_device_hal.c
deleted file mode 100644
index 53a49ba2aa..0000000000
--- a/src/node_device/node_device_hal.c
+++ /dev/null
@@ -1,843 +0,0 @@
-/*
- * node_device_hal.c: node device enumeration - HAL-based implementation
- *
- * Copyright (C) 2011-2015 Red Hat, Inc.
- * Copyright (C) 2008 Virtual Iron Software, Inc.
- * Copyright (C) 2008 David F. Lively
- *
- * 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 <libhal.h>
-
-#include "node_device_conf.h"
-#include "node_device_driver.h"
-#include "node_device_hal.h"
-#include "virerror.h"
-#include "driver.h"
-#include "datatypes.h"
-#include "viralloc.h"
-#include "viruuid.h"
-#include "virfile.h"
-#include "virpci.h"
-#include "virpidfile.h"
-#include "virlog.h"
-#include "virdbus.h"
-#include "virstring.h"
-#include "virutil.h"
-
-#include "configmake.h"
-
-#define VIR_FROM_THIS VIR_FROM_NODEDEV
-
-VIR_LOG_INIT("node_device.node_device_hal");
-
-/*
- * Host device enumeration (HAL implementation)
- */
-
-#define DRV_STATE_HAL_CTX(ds) ((LibHalContext *)((ds)->privateData))
-
-
-static const char *
-hal_name(const char *udi)
-{
- const char *name = strrchr(udi, '/');
- if (name)
- return name + 1;
- return udi;
-}
-
-
-static int
-get_str_prop(LibHalContext *ctxt, const char *udi,
- const char *prop, char **val_p)
-{
- char *val = libhal_device_get_property_string(ctxt, udi, prop, NULL);
-
- if (val) {
- if (*val) {
- *val_p = val;
- return 0;
- } else {
- /* Treat empty strings as NULL values */
- VIR_FREE(val);
- }
- }
-
- return -1;
-}
-
-static int
-get_int_prop(LibHalContext *ctxt, const char *udi,
- const char *prop, int *val_p)
-{
- DBusError err;
- int val;
- int rv;
-
- dbus_error_init(&err);
- val = libhal_device_get_property_int(ctxt, udi, prop, &err);
- rv = dbus_error_is_set(&err);
- dbus_error_free(&err);
- if (rv == 0)
- *val_p = val;
-
- return rv;
-}
-
-static int
-get_bool_prop(LibHalContext *ctxt, const char *udi,
- const char *prop, int *val_p)
-{
- DBusError err;
- int val;
- int rv;
-
- dbus_error_init(&err);
- val = libhal_device_get_property_bool(ctxt, udi, prop, &err);
- rv = dbus_error_is_set(&err);
- dbus_error_free(&err);
- if (rv == 0)
- *val_p = val;
-
- return rv;
-}
-
-static int
-get_uint64_prop(LibHalContext *ctxt, const char *udi,
- const char *prop, unsigned long long *val_p)
-{
- DBusError err;
- unsigned long long val;
- int rv;
-
- dbus_error_init(&err);
- val = libhal_device_get_property_uint64(ctxt, udi, prop, &err);
- rv = dbus_error_is_set(&err);
- dbus_error_free(&err);
- if (rv == 0)
- *val_p = val;
-
- return rv;
-}
-
-static int
-gather_pci_cap(LibHalContext *ctx, const char *udi,
- virNodeDevCapDataPtr d)
-{
- char *sysfs_path;
-
- if (get_str_prop(ctx, udi, "pci.linux.sysfs_path", &sysfs_path) == 0) {
- char *p = strrchr(sysfs_path, '/');
- if (p) {
- ignore_value(virStrToLong_ui(p+1, &p, 16, &d->pci_dev.domain));
- ignore_value(virStrToLong_ui(p+1, &p, 16, &d->pci_dev.bus));
- ignore_value(virStrToLong_ui(p+1, &p, 16, &d->pci_dev.slot));
- ignore_value(virStrToLong_ui(p+1, &p, 16, &d->pci_dev.function));
- }
-
- if (virNodeDeviceGetPCIDynamicCaps(sysfs_path, &d->pci_dev) < 0) {
- VIR_FREE(sysfs_path);
- return -1;
- }
- VIR_FREE(sysfs_path);
- }
-
- (void)get_int_prop(ctx, udi, "pci.vendor_id", (int *)&d->pci_dev.vendor);
- if (get_str_prop(ctx, udi, "pci.vendor", &d->pci_dev.vendor_name) != 0)
- (void)get_str_prop(ctx, udi, "info.vendor", &d->pci_dev.vendor_name);
- (void)get_int_prop(ctx, udi, "pci.product_id", (int *)&d->pci_dev.product);
- if (get_str_prop(ctx, udi, "pci.product", &d->pci_dev.product_name) != 0)
- (void)get_str_prop(ctx, udi, "info.product", &d->pci_dev.product_name);
-
- return 0;
-}
-
-
-static int
-gather_usb_cap(LibHalContext *ctx, const char *udi,
- virNodeDevCapDataPtr d)
-{
- (void)get_int_prop(ctx, udi, "usb.interface.number",
- (int *)&d->usb_if.number);
- (void)get_int_prop(ctx, udi, "usb.interface.class",
- (int *)&d->usb_if.klass);
- (void)get_int_prop(ctx, udi, "usb.interface.subclass",
- (int *)&d->usb_if.subclass);
- (void)get_int_prop(ctx, udi, "usb.interface.protocol",
- (int *)&d->usb_if.protocol);
- (void)get_str_prop(ctx, udi, "usb.interface.description",
- &d->usb_if.description);
- return 0;
-}
-
-
-static int
-gather_usb_device_cap(LibHalContext *ctx, const char *udi,
- virNodeDevCapDataPtr d)
-{
- (void)get_int_prop(ctx, udi, "usb_device.bus_number",
- (int *)&d->usb_dev.bus);
- (void)get_int_prop(ctx, udi, "usb_device.linux.device_number",
- (int *)&d->usb_dev.device);
- (void)get_int_prop(ctx, udi, "usb_device.vendor_id",
- (int *)&d->usb_dev.vendor);
- if (get_str_prop(ctx, udi, "usb_device.vendor",
- &d->usb_dev.vendor_name) != 0)
- (void)get_str_prop(ctx, udi, "info.vendor", &d->usb_dev.vendor_name);
- (void)get_int_prop(ctx, udi, "usb_device.product_id",
- (int *)&d->usb_dev.product);
- if (get_str_prop(ctx, udi, "usb_device.product",
- &d->usb_dev.product_name) != 0)
- (void)get_str_prop(ctx, udi, "info.product", &d->usb_dev.product_name);
- return 0;
-}
-
-
-static int
-gather_net_cap(LibHalContext *ctx, const char *udi,
- virNodeDevCapDataPtr d)
-{
- unsigned long long dummy;
- (void)get_str_prop(ctx, udi, "net.interface", &d->net.ifname);
- (void)get_str_prop(ctx, udi, "net.address", &d->net.address);
- if (get_uint64_prop(ctx, udi, "net.80203.mac_address",
- &dummy) == 0)
- d->net.subtype = VIR_NODE_DEV_CAP_NET_80203;
- else if (get_uint64_prop(ctx, udi, "net.80211.mac_address",
- &dummy) == 0)
- d->net.subtype = VIR_NODE_DEV_CAP_NET_80211;
- else
- d->net.subtype = VIR_NODE_DEV_CAP_NET_LAST;
-
- return 0;
-}
-
-
-static int
-gather_scsi_host_cap(LibHalContext *ctx, const char *udi,
- virNodeDevCapDataPtr d)
-{
- (void)get_int_prop(ctx, udi, "scsi_host.host", (int *)&d->scsi_host.host);
-
- return virNodeDeviceGetSCSIHostCaps(&d->scsi_host);
-}
-
-
-static int
-gather_scsi_cap(LibHalContext *ctx, const char *udi,
- virNodeDevCapDataPtr d)
-{
- (void)get_int_prop(ctx, udi, "scsi.host", (int *)&d->scsi.host);
- (void)get_int_prop(ctx, udi, "scsi.bus", (int *)&d->scsi.bus);
- (void)get_int_prop(ctx, udi, "scsi.target", (int *)&d->scsi.target);
- (void)get_int_prop(ctx, udi, "scsi.lun", (int *)&d->scsi.lun);
- (void)get_str_prop(ctx, udi, "scsi.type", &d->scsi.type);
- return 0;
-}
-
-
-static int
-gather_storage_cap(LibHalContext *ctx, const char *udi,
- virNodeDevCapDataPtr d)
-{
- int val;
- (void)get_str_prop(ctx, udi, "block.device", &d->storage.block);
- (void)get_str_prop(ctx, udi, "storage.bus", &d->storage.bus);
- (void)get_str_prop(ctx, udi, "storage.drive_type", &d->storage.drive_type);
- (void)get_str_prop(ctx, udi, "storage.model", &d->storage.model);
- (void)get_str_prop(ctx, udi, "storage.vendor", &d->storage.vendor);
- (void)get_str_prop(ctx, udi, "storage.serial", &d->storage.serial);
- if (get_bool_prop(ctx, udi, "storage.removable", &val) == 0 && val) {
- d->storage.flags |= VIR_NODE_DEV_CAP_STORAGE_REMOVABLE;
- if (get_bool_prop(ctx, udi, "storage.removable.media_available",
- &val) == 0 && val) {
- d->storage.flags |=
- VIR_NODE_DEV_CAP_STORAGE_REMOVABLE_MEDIA_AVAILABLE;
- (void)get_uint64_prop(ctx, udi, "storage.removable.media_size",
- &d->storage.removable_media_size);
- }
- } else {
- (void)get_uint64_prop(ctx, udi, "storage.size", &d->storage.size);
- }
- if (get_bool_prop(ctx, udi, "storage.hotpluggable", &val) == 0 && val)
- d->storage.flags |= VIR_NODE_DEV_CAP_STORAGE_HOTPLUGGABLE;
- return 0;
-}
-
-static int
-gather_scsi_generic_cap(LibHalContext *ctx, const char *udi,
- virNodeDevCapDataPtr d)
-{
- (void)get_str_prop(ctx, udi, "scsi_generic.device", &d->sg.path);
- return 0;
-}
-
-
-static int
-gather_system_cap(LibHalContext *ctx, const char *udi,
- virNodeDevCapDataPtr d)
-{
- char *uuidstr;
-
- (void)get_str_prop(ctx, udi, "system.product", &d->system.product_name);
- (void)get_str_prop(ctx, udi, "system.hardware.vendor",
- &d->system.hardware.vendor_name);
- (void)get_str_prop(ctx, udi, "system.hardware.version",
- &d->system.hardware.version);
- (void)get_str_prop(ctx, udi, "system.hardware.serial",
- &d->system.hardware.serial);
- if (get_str_prop(ctx, udi, "system.hardware.uuid", &uuidstr) == 0) {
- ignore_value(virUUIDParse(uuidstr, d->system.hardware.uuid));
- VIR_FREE(uuidstr);
- }
- (void)get_str_prop(ctx, udi, "system.firmware.vendor",
- &d->system.firmware.vendor_name);
- (void)get_str_prop(ctx, udi, "system.firmware.version",
- &d->system.firmware.version);
- (void)get_str_prop(ctx, udi, "system.firmware.release_date",
- &d->system.firmware.release_date);
- return 0;
-}
-
-
-struct _caps_tbl_entry {
- const char *cap_name;
- virNodeDevCapType type;
- int (*gather_fn)(LibHalContext *ctx,
- const char *udi,
- virNodeDevCapDataPtr data);
-};
-
-typedef struct _caps_tbl_entry caps_tbl_entry;
-
-static caps_tbl_entry caps_tbl[] = {
- { "system", VIR_NODE_DEV_CAP_SYSTEM, gather_system_cap },
- { "pci", VIR_NODE_DEV_CAP_PCI_DEV, gather_pci_cap },
- { "usb", VIR_NODE_DEV_CAP_USB_INTERFACE, gather_usb_cap },
- { "usb_device", VIR_NODE_DEV_CAP_USB_DEV, gather_usb_device_cap },
- { "net", VIR_NODE_DEV_CAP_NET, gather_net_cap },
- { "scsi_host", VIR_NODE_DEV_CAP_SCSI_HOST, gather_scsi_host_cap },
- { "scsi", VIR_NODE_DEV_CAP_SCSI, gather_scsi_cap },
- { "storage", VIR_NODE_DEV_CAP_STORAGE, gather_storage_cap },
- { "scsi_generic", VIR_NODE_DEV_CAP_SCSI_GENERIC, gather_scsi_generic_cap },
-};
-
-
-/* qsort/bsearch string comparator */
-static int
-cmpstringp(const void *p1, const void *p2)
-{
- /* from man 3 qsort */
- return strcmp(* (char * const *) p1, * (char * const *) p2);
-}
-
-
-static int
-gather_capability(LibHalContext *ctx, const char *udi,
- const char *cap_name,
- virNodeDevCapsDefPtr *caps_p)
-{
- caps_tbl_entry *entry;
-
- entry = bsearch(&cap_name, caps_tbl, G_N_ELEMENTS(caps_tbl),
- sizeof(caps_tbl[0]), cmpstringp);
-
- if (entry) {
- virNodeDevCapsDefPtr caps;
- if (VIR_ALLOC(caps) < 0)
- return ENOMEM;
- caps->data.type = entry->type;
- if (entry->gather_fn) {
- int rv = (*entry->gather_fn)(ctx, udi, &caps->data);
- if (rv != 0) {
- virNodeDevCapsDefFree(caps);
- return rv;
- }
- }
- caps->next = *caps_p;
- *caps_p = caps;
- }
-
- return 0;
-}
-
-
-static int
-gather_capabilities(LibHalContext *ctx, const char *udi,
- virNodeDevCapsDefPtr *caps_p)
-{
- char *bus_name = NULL;
- virNodeDevCapsDefPtr caps = NULL;
- char **hal_cap_names = NULL;
- int rv;
- size_t i;
-
- if (STREQ(udi, "/org/freedesktop/Hal/devices/computer")) {
- rv = gather_capability(ctx, udi, "system", &caps);
- if (rv != 0)
- goto failure;
- }
-
- if (get_str_prop(ctx, udi, "info.subsystem", &bus_name) == 0 ||
- get_str_prop(ctx, udi, "linux.subsystem", &bus_name) == 0) {
- rv = gather_capability(ctx, udi, bus_name, &caps);
- if (rv != 0)
- goto failure;
- }
-
- hal_cap_names = libhal_device_get_property_strlist(ctx, udi,
- "info.capabilities",
- NULL);
- if (hal_cap_names) {
- for (i = 0; hal_cap_names[i]; i++) {
- if (! (bus_name && STREQ(hal_cap_names[i], bus_name))) {
- rv = gather_capability(ctx, udi, hal_cap_names[i], &caps);
- if (rv != 0)
- goto failure;
- }
- }
- for (i = 0; hal_cap_names[i]; i++)
- VIR_FREE(hal_cap_names[i]);
- VIR_FREE(hal_cap_names);
- }
- VIR_FREE(bus_name);
-
- *caps_p = caps;
- return 0;
-
- failure:
- VIR_FREE(bus_name);
- if (hal_cap_names) {
- for (i = 0; hal_cap_names[i]; i++)
- VIR_FREE(hal_cap_names[i]);
- VIR_FREE(hal_cap_names);
- }
- while (caps) {
- virNodeDevCapsDefPtr next = caps->next;
- virNodeDevCapsDefFree(caps);
- caps = next;
- }
- return rv;
-}
-
-static void
-dev_create(const char *udi)
-{
- LibHalContext *ctx;
- char *parent_key = NULL;
- virNodeDeviceObjPtr obj = NULL;
- virNodeDeviceDefPtr def = NULL;
- virNodeDeviceDefPtr objdef;
- const char *name = hal_name(udi);
- int rv;
- char *devicePath = NULL;
-
- nodeDeviceLock();
- ctx = DRV_STATE_HAL_CTX(driver);
-
- if (VIR_ALLOC(def) < 0)
- goto failure;
-
- def->name = g_strdup(name);
-
- if (get_str_prop(ctx, udi, "info.parent", &parent_key) == 0) {
- def->parent = g_strdup(hal_name(parent_key));
- VIR_FREE(parent_key);
- }
-
- rv = gather_capabilities(ctx, udi, &def->caps);
- if (rv != 0) goto failure;
-
- if (def->caps == NULL)
- goto cleanup;
-
- /* Some devices don't have a path in sysfs, so ignore failure */
- (void)get_str_prop(ctx, udi, "linux.sysfs_path", &devicePath);
-
- if (!(obj = virNodeDeviceObjListAssignDef(driver->devs, def))) {
- VIR_FREE(devicePath);
- goto failure;
- }
- objdef = virNodeDeviceObjGetDef(obj);
-
- objdef->sysfs_path = devicePath;
-
- virNodeDeviceObjEndAPI(&obj);
-
- nodeDeviceUnlock();
- return;
-
- failure:
- VIR_DEBUG("FAILED TO ADD dev %s", name);
- cleanup:
- virNodeDeviceDefFree(def);
- nodeDeviceUnlock();
-}
-
-static void
-dev_refresh(const char *udi)
-{
- const char *name = hal_name(udi);
- virNodeDeviceObjPtr obj;
-
- if ((obj = virNodeDeviceObjListFindByName(driver->devs, name))) {
- /* Simply "rediscover" device -- incrementally handling changes
- * to sub-capabilities (like net.80203) is nasty ... so avoid it.
- */
- virNodeDeviceObjListRemove(driver->devs, obj);
- virObjectUnref(obj);
- dev_create(udi);
- } else {
- VIR_DEBUG("no device named %s", name);
- }
-}
-
-static void
-device_added(LibHalContext *ctx G_GNUC_UNUSED,
- const char *udi)
-{
- VIR_DEBUG("%s", hal_name(udi));
- dev_create(udi);
-}
-
-
-static void
-device_removed(LibHalContext *ctx G_GNUC_UNUSED,
- const char *udi)
-{
- const char *name = hal_name(udi);
- virNodeDeviceObjPtr obj;
-
- obj = virNodeDeviceObjListFindByName(driver->devs, name);
- VIR_DEBUG("%s", name);
- if (obj)
- virNodeDeviceObjListRemove(driver->devs, obj);
- else
- VIR_DEBUG("no device named %s", name);
- virObjectUnref(obj);
-}
-
-
-static void
-device_cap_added(LibHalContext *ctx,
- const char *udi, const char *cap)
-{
- const char *name = hal_name(udi);
- virNodeDeviceObjPtr obj;
- virNodeDeviceDefPtr def;
-
- VIR_DEBUG("%s %s", cap, name);
- if ((obj = virNodeDeviceObjListFindByName(driver->devs, name))) {
- def = virNodeDeviceObjGetDef(obj);
- (void)gather_capability(ctx, udi, cap, &def->caps);
- virNodeDeviceObjEndAPI(&obj);
- } else {
- VIR_DEBUG("no device named %s", name);
- }
-}
-
-
-static void
-device_cap_lost(LibHalContext *ctx G_GNUC_UNUSED,
- const char *udi,
- const char *cap)
-{
- const char *name = hal_name(udi);
- VIR_DEBUG("%s %s", cap, name);
-
- dev_refresh(udi);
-}
-
-
-static void
-device_prop_modified(LibHalContext *ctx G_GNUC_UNUSED,
- const char *udi,
- const char *key,
- dbus_bool_t is_removed G_GNUC_UNUSED,
- dbus_bool_t is_added G_GNUC_UNUSED)
-{
- const char *name = hal_name(udi);
- VIR_DEBUG("%s %s", name, key);
-
- dev_refresh(udi);
-}
-
-
-static int
-nodeStateInitialize(bool privileged G_GNUC_UNUSED,
- const char *root,
- virStateInhibitCallback callback G_GNUC_UNUSED,
- void *opaque G_GNUC_UNUSED)
-{
- LibHalContext *hal_ctx = NULL;
- char **udi = NULL;
- int num_devs;
- size_t i;
- int ret = VIR_DRV_STATE_INIT_ERROR;
- DBusConnection *sysbus;
- DBusError err;
-
- if (root != NULL) {
- virReportError(VIR_ERR_INVALID_ARG, "%s",
- _("Driver does not support embedded mode"));
- return -1;
- }
-
- /* Ensure caps_tbl is sorted by capability name */
- qsort(caps_tbl, G_N_ELEMENTS(caps_tbl), sizeof(caps_tbl[0]),
- cmpstringp);
-
- if (VIR_ALLOC(driver) < 0)
- return VIR_DRV_STATE_INIT_ERROR;
-
- driver->lockFD = -1;
- if (virMutexInit(&driver->lock) < 0) {
- VIR_FREE(driver);
- return VIR_DRV_STATE_INIT_ERROR;
- }
-
- if (virCondInit(&driver->initCond) < 0) {
- virReportSystemError(errno, "%s",
- _("Unable to initialize condition variable"));
- virMutexDestroy(&driver->lock);
- VIR_FREE(driver);
- return VIR_DRV_STATE_INIT_ERROR;
- }
-
- nodeDeviceLock();
-
- if (privileged) {
- driver->stateDir = g_strdup_printf("%s/libvirt/nodedev", RUNSTATEDIR);
- } else {
- g_autofree char *rundir = NULL;
-
- rundir = virGetUserRuntimeDirectory();
- driver->stateDir = g_strdup_printf("%s/nodedev/run", rundir);
- }
-
- if (virFileMakePathWithMode(driver->stateDir, S_IRWXU) < 0) {
- virReportSystemError(errno, _("cannot create state directory '%s'"),
- driver->stateDir);
- goto failure;
- }
-
- if ((driver->lockFD =
- virPidFileAcquire(driver->stateDir, "driver", false, getpid())) < 0)
- goto failure;
-
- if (!(driver->devs = virNodeDeviceObjListNew()))
- goto failure;
-
- dbus_error_init(&err);
- if (!(sysbus = virDBusGetSystemBus())) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("DBus not available, disabling HAL driver: %s"),
- virGetLastErrorMessage());
- ret = VIR_DRV_STATE_INIT_SKIPPED;
- goto failure;
- }
-
- hal_ctx = libhal_ctx_new();
- if (hal_ctx == NULL) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("libhal_ctx_new returned NULL"));
- goto failure;
- }
-
- if (!libhal_ctx_set_dbus_connection(hal_ctx, sysbus)) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("libhal_ctx_set_dbus_connection failed"));
- goto failure;
- }
- if (!libhal_ctx_init(hal_ctx, &err)) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("libhal_ctx_init failed, haldaemon is probably "
- "not running"));
- /* We don't want to show a fatal error here,
- otherwise entire libvirtd shuts down when
- hald isn't running */
- ret = VIR_DRV_STATE_INIT_SKIPPED;
- goto failure;
- }
-
- /* Populate with known devices */
- driver->privateData = hal_ctx;
-
- /* We need to unlock state now, since setting these callbacks cause
- * a dbus RPC call, and while this call is waiting for the reply,
- * a signal may already arrive, triggering the callback and thus
- * requiring the lock !
- */
- nodeDeviceUnlock();
-
- /* Register HAL event callbacks */
- if (!libhal_ctx_set_device_added(hal_ctx, device_added) ||
- !libhal_ctx_set_device_removed(hal_ctx, device_removed) ||
- !libhal_ctx_set_device_new_capability(hal_ctx, device_cap_added) ||
- !libhal_ctx_set_device_lost_capability(hal_ctx, device_cap_lost) ||
- !libhal_ctx_set_device_property_modified(hal_ctx, device_prop_modified) ||
- !libhal_device_property_watch_all(hal_ctx, &err)) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("setting up HAL callbacks failed"));
- goto failure;
- }
-
- udi = libhal_get_all_devices(hal_ctx, &num_devs, &err);
- if (udi == NULL) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("libhal_get_all_devices failed"));
- goto failure;
- }
- for (i = 0; i < num_devs; i++) {
- dev_create(udi[i]);
- VIR_FREE(udi[i]);
- }
- VIR_FREE(udi);
-
- nodeDeviceLock();
- driver->initialized = true;
- nodeDeviceUnlock();
- virCondBroadcast(&driver->initCond);
-
- return VIR_DRV_STATE_INIT_COMPLETE;
-
- failure:
- if (dbus_error_is_set(&err)) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("%s: %s"), err.name, err.message);
- dbus_error_free(&err);
- }
- virNodeDeviceObjListFree(driver->devs);
- if (hal_ctx)
- (void)libhal_ctx_free(hal_ctx);
- nodeDeviceUnlock();
- VIR_FREE(driver);
-
- return ret;
-}
-
-
-static int
-nodeStateCleanup(void)
-{
- if (driver) {
- nodeDeviceLock();
- LibHalContext *hal_ctx = DRV_STATE_HAL_CTX(driver);
- virNodeDeviceObjListFree(driver->devs);
- (void)libhal_ctx_shutdown(hal_ctx, NULL);
- (void)libhal_ctx_free(hal_ctx);
- if (driver->lockFD != -1)
- virPidFileRelease(driver->stateDir, "driver", driver->lockFD);
-
- VIR_FREE(driver->stateDir);
- nodeDeviceUnlock();
- virCondDestroy(&driver->initCond);
- virMutexDestroy(&driver->lock);
- VIR_FREE(driver);
- return 0;
- }
- return -1;
-}
-
-
-static int
-nodeStateReload(void)
-{
- DBusError err;
- char **udi = NULL;
- int num_devs;
- size_t i;
- LibHalContext *hal_ctx;
-
- VIR_INFO("Reloading HAL device state");
- nodeDeviceLock();
- VIR_INFO("Removing existing objects");
- virNodeDeviceObjListFree(driver->devs);
- nodeDeviceUnlock();
-
- hal_ctx = DRV_STATE_HAL_CTX(driver);
- VIR_INFO("Creating new objects");
- dbus_error_init(&err);
- udi = libhal_get_all_devices(hal_ctx, &num_devs, &err);
- if (udi == NULL) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("libhal_get_all_devices failed"));
- return -1;
- }
- for (i = 0; i < num_devs; i++) {
- dev_create(udi[i]);
- VIR_FREE(udi[i]);
- }
- VIR_FREE(udi);
- VIR_INFO("HAL device reload complete");
-
- return 0;
-}
-
-
-static virNodeDeviceDriver halNodeDeviceDriver = {
- .name = "HAL",
- .nodeNumOfDevices = nodeNumOfDevices, /* 0.5.0 */
- .nodeListDevices = nodeListDevices, /* 0.5.0 */
- .connectListAllNodeDevices = nodeConnectListAllNodeDevices, /* 0.10.2 */
- .nodeDeviceLookupByName = nodeDeviceLookupByName, /* 0.5.0 */
- .nodeDeviceLookupSCSIHostByWWN = nodeDeviceLookupSCSIHostByWWN, /* 1.0.2 */
- .nodeDeviceGetXMLDesc = nodeDeviceGetXMLDesc, /* 0.5.0 */
- .nodeDeviceGetParent = nodeDeviceGetParent, /* 0.5.0 */
- .nodeDeviceNumOfCaps = nodeDeviceNumOfCaps, /* 0.5.0 */
- .nodeDeviceListCaps = nodeDeviceListCaps, /* 0.5.0 */
- .nodeDeviceCreateXML = nodeDeviceCreateXML, /* 0.6.5 */
- .nodeDeviceDestroy = nodeDeviceDestroy, /* 0.6.5 */
-};
-
-
-static virHypervisorDriver halHypervisorDriver = {
- .name = "nodedev",
- .connectOpen = nodeConnectOpen, /* 4.1.0 */
- .connectClose = nodeConnectClose, /* 4.1.0 */
- .connectIsEncrypted = nodeConnectIsEncrypted, /* 4.1.0 */
- .connectIsSecure = nodeConnectIsSecure, /* 4.1.0 */
- .connectIsAlive = nodeConnectIsAlive, /* 4.1.0 */
-};
-
-
-static virConnectDriver halConnectDriver = {
- .localOnly = true,
- .uriSchemes = (const char *[]){ "nodedev", NULL },
- .hypervisorDriver = &halHypervisorDriver,
- .nodeDeviceDriver = &halNodeDeviceDriver,
-};
-
-
-static virStateDriver halStateDriver = {
- .name = "HAL",
- .stateInitialize = nodeStateInitialize, /* 0.5.0 */
- .stateCleanup = nodeStateCleanup, /* 0.5.0 */
- .stateReload = nodeStateReload, /* 0.5.0 */
-};
-
-int
-halNodeRegister(void)
-{
- if (virRegisterConnectDriver(&halConnectDriver, false) < 0)
- return -1;
- if (virSetSharedNodeDeviceDriver(&halNodeDeviceDriver) < 0)
- return -1;
- return virRegisterStateDriver(&halStateDriver);
-}
diff --git a/src/node_device/node_device_hal.h b/src/node_device/node_device_hal.h
deleted file mode 100644
index 5e9c25ae34..0000000000
--- a/src/node_device/node_device_hal.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * node_device_hal.h: node device enumeration - HAL-based implementation
- *
- * Copyright (C) 2009 Red Hat, Inc.
- *
- * 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
--
2.26.2
4 years, 3 months
[PATCH 00/12] assorted cleanups in cpu_ppc64.c
by Daniel Henrique Barboza
Hi,
While reading and studying cpu_ppc64.c I noticed that it
lacks the 'sophistication' that cpu_x86.c and cpu_arm.c
enjoys. This is my attempt to tidy it up a bit, adding some
typedefs and g_auto* cleanups to make it more up to par
with cpu_x86.c
Daniel Henrique Barboza (12):
cpu_ppc64.c: use typedefs for 'struct ppc64_vendor'
cpu_ppc64.c: register AUTOPTR_CLEANUP_FUNC for virCPUppc64VendorPtr
cpu_ppc64.c: modernize ppc64VendorParse()
cpu_ppc64.c: use typedefs for 'struct ppc64_model'
cpu_ppc64.c: register AUTOPTR_CLEANUP_FUNC for virCPUppc64ModelPtr
cpu_ppc64.c: use g_autopr() with virCPUppc64ModelPtr
cpu_ppc64.c: use typedefs for 'struct ppc64_map'
cpu_ppc64.c: register AUTOPTR_CLEANUP_FUNC for virCPUppc64MapPtr
cpu_ppc64.c: use g_autopr() with virCPUppc64MapPtr
cpu_ppc64.c: use g_autoptr() in virCPUppc64GetHost()
cpu_ppc64.c: use g_autofree() whenever possible
cpu_ppc64.c: use g_autoptr() whenever possible
src/cpu/cpu_ppc64.c | 245 ++++++++++++++++++--------------------------
1 file changed, 98 insertions(+), 147 deletions(-)
--
2.26.2
4 years, 3 months
[libvirt PATCH] src/storage/meson: fix vir_storage_file_gluster module dependencies
by Pavel Hrdina
The correct key for dependencies for virt_modules hash is `deps`.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/storage/meson.build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/storage/meson.build b/src/storage/meson.build
index 18ea0f3fb5..b4cefe9a89 100644
--- a/src/storage/meson.build
+++ b/src/storage/meson.build
@@ -187,7 +187,7 @@ if conf.has('WITH_STORAGE_GLUSTER')
'sources': [
files(storage_file_gluster_sources),
],
- 'dependenciec': [
+ 'deps': [
glusterfs_dep,
],
'install_dir': storage_file_install_dir,
--
2.26.2
4 years, 3 months
[PATCH 0/1] Support Windows 10 Arm64 ISO installations
by Jan-Marek Glogowski
This patch was originally submitted via
https://gitlab.com/libvirt/libvirt/-/merge_requests/19
That merge request contains additional information, if you find the
commit message of the patch lacking in some way. It did pass CI and
the test suite four weeks ago, seems small enough, and the rebase
had no conflicts, so I didn't run the tests again on current master.
And based on the comment from Peter Krempa in that merge request,
it probably needs further discussion with QEMU developers.
FWIW: while the installer generally works, I'm experiencing massive
timeouts from the "Out of Box Experience" (OOBE) part of the
Windows configuration after the install. And the latest ISOs don't
even start in QEMU (5.1 and older) for me on Debian, so I used 1909
instead of the 2004 ISO "releases". I'm running the aarch64 system
QEMU on x86_64 Debian Buster with my current QEMU build.
Jan-Marek Glogowski (1):
QEMU: support USB cdrom devices
src/qemu/qemu_command.c | 21 ++++++++++++++++++-
src/qemu/qemu_command.h | 1 +
src/qemu/qemu_domain.c | 2 +-
.../disk-cdrom-bus-other.x86_64-latest.args | 12 +++++------
4 files changed, 28 insertions(+), 8 deletions(-)
--
2.20.1
4 years, 3 months
[libvirt PATCH] conf: Add support for GlusterFS volumes as disk
by Vincent Vanlaer
While libvirt has support for GlusterFS pools and volumes, they cannot
be added to a domain. This commit adds the necessary translation between
the pool definition and the disk definition, allowing volumes in a domain
to be backed by a gluster pool.
Signed-off-by: Vincent Vanlaer <libvirt(a)volkihar.be>
---
src/conf/domain_conf.c | 32 +++++++++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 72ac4f4191..c872d02200 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -32620,6 +32620,32 @@ virDomainDiskTranslateISCSIDirect(virStorageSourcePtr src,
}
+static int
+virDomainDiskTranslateGluster(virStorageSourcePtr src,
+ virStoragePoolDefPtr pooldef)
+{
+ size_t i;
+
+ src->srcpool->actualtype = VIR_STORAGE_TYPE_NETWORK;
+ src->protocol = VIR_STORAGE_NET_PROTOCOL_GLUSTER;
+
+ src->nhosts = pooldef->source.nhost;
+ src->hosts = g_new0(virStorageNetHostDef, src->nhosts);
+
+ for (i = 0; i < src->nhosts; i++) {
+ src->hosts[i].socket = NULL;
+ src->hosts[i].transport = VIR_STORAGE_NET_HOST_TRANS_TCP;
+ src->hosts[i].name = g_strdup(pooldef->source.hosts[i].name);
+ src->hosts[i].port = pooldef->source.hosts[i].port;
+ }
+
+ src->volume = g_strdup(pooldef->source.name);
+ src->path = g_strdup_printf("%s/%s", pooldef->source.dir, src->srcpool->volume);
+
+ return 0;
+}
+
+
static int
virDomainStorageSourceTranslateSourcePool(virStorageSourcePtr src,
virConnectPtr conn)
@@ -32736,10 +32762,14 @@ virDomainStorageSourceTranslateSourcePool(virStorageSourcePtr src,
}
break;
+ case VIR_STORAGE_POOL_GLUSTER:
+ if (virDomainDiskTranslateGluster(src, pooldef) < 0)
+ return -1;
+ break;
+
case VIR_STORAGE_POOL_MPATH:
case VIR_STORAGE_POOL_RBD:
case VIR_STORAGE_POOL_SHEEPDOG:
- case VIR_STORAGE_POOL_GLUSTER:
case VIR_STORAGE_POOL_LAST:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("using '%s' pools for backing 'volume' disks "
--
2.28.0
4 years, 3 months
[libvirt PATCH] check for NULL before calling g_regex_unref
by Ján Tomko
g_regex_unref reports an error if called with a NULL argument.
We have two cases in the code where we (possibly) call it on a NULL
argument. The interesting one is in virDomainQemuMonitorEventCleanup.
Based on VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_REGEX, we unref
data->regex, which has two problems:
* On the client side, flags is -1 so the comparison is true even if no
regex was used, reproducible by:
$ virsh qemu-monitor-event --timeout 1
which results in an ugly error:
(process:1289846): GLib-CRITICAL **: 14:58:42.631: g_regex_unref: assertion 'regex != NULL' failed
* On the server side, we only create the regex if both the flag and the
string are present, so it's possible to trigger this message by:
$ virsh qemu-monitor-event --regex --timeout 1
Use a non-NULL comparison instead of the flag to decide whether we need
to unref the regex.
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
Fixes: 71efb59a4de7c51b1bc889a316f1796ebf55738f
https://bugzilla.redhat.com/show_bug.cgi?id=1861176
---
src/conf/domain_event.c | 2 +-
tests/vboxsnapshotxmltest.c | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
index 33fbf10406..d3acde0236 100644
--- a/src/conf/domain_event.c
+++ b/src/conf/domain_event.c
@@ -2194,7 +2194,7 @@ virDomainQemuMonitorEventCleanup(void *opaque)
virDomainQemuMonitorEventData *data = opaque;
VIR_FREE(data->event);
- if (data->flags & VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_REGEX)
+ if (data->regex)
g_regex_unref(data->regex);
if (data->freecb)
(data->freecb)(data->opaque);
diff --git a/tests/vboxsnapshotxmltest.c b/tests/vboxsnapshotxmltest.c
index 7e3f85cc58..d2beb7858d 100644
--- a/tests/vboxsnapshotxmltest.c
+++ b/tests/vboxsnapshotxmltest.c
@@ -135,7 +135,8 @@ mymain(void)
DO_TEST("2disks-3snap-brother");
cleanup:
- g_regex_unref(testSnapshotXMLVariableLineRegex);
+ if (testSnapshotXMLVariableLineRegex)
+ g_regex_unref(testSnapshotXMLVariableLineRegex);
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
--
2.26.2
4 years, 3 months
[PATCH v5 0/4] qemu: Support rbd namespace in rbd source name
by Han Han
v4: https://www.redhat.com/archives/libvir-list/2020-August/msg00351.html
Difference from v4:
- rebase to last master tree
- parse namspace from name attribute and update the documents
- add caps test xml for 5.2.0 x86_64
- adapt to DO_TEST_CAPS_ARCH_LATEST in qemuxml2xmltest in case of the
test failure caused by missing caps test xml of 5.x at s390.
git branch: https://gitlab.com/hhan2/libvirt/-/tree/rbd-namespace-v5
Han Han (4):
qemu_capabilities: Add QEMU_CAPS_RBD_NAMESPACE
conf: Support to parse rbd namespace from source name
qemu: Implement rbd namespace to the source name attribute
news: qemu: Support rbd namespace
NEWS.rst | 8 ++++
docs/formatdomain.rst | 12 ++++--
src/conf/domain_conf.c | 35 ++++++++++++++--
src/qemu/qemu_block.c | 1 +
src/qemu/qemu_capabilities.c | 4 ++
src/qemu/qemu_capabilities.h | 3 ++
src/qemu/qemu_domain.c | 8 ++++
src/util/virstoragefile.c | 1 +
src/util/virstoragefile.h | 1 +
.../caps_5.0.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 +
.../caps_5.0.0.riscv64.xml | 1 +
.../caps_5.0.0.x86_64.xml | 1 +
.../caps_5.1.0.x86_64.xml | 1 +
.../caps_5.2.0.x86_64.xml | 1 +
...k-network-rbd-namespace.x86_64-latest.args | 41 +++++++++++++++++++
.../disk-network-rbd-namespace.xml | 33 +++++++++++++++
tests/qemuxml2argvtest.c | 1 +
...sk-network-rbd-namespace.x86_64-latest.xml | 41 +++++++++++++++++++
tests/qemuxml2xmltest.c | 1 +
20 files changed, 189 insertions(+), 7 deletions(-)
create mode 100644 tests/qemuxml2argvdata/disk-network-rbd-namespace.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/disk-network-rbd-namespace.xml
create mode 100644 tests/qemuxml2xmloutdata/disk-network-rbd-namespace.x86_64-latest.xml
--
2.28.0
4 years, 3 months
large number of hot plug disks
by Alexander Wels
Hi,
I am working on a project, and one of the requirements is that I can
hotplug a large number of disks. Think several dozens to potentially 100+.
The guest OS will be some linux flavor so it should have no problem with a
large number of disks.
During my experimentation I quickly ran into the "No available PCI slots"
limit. I found https://libvirt.org/pci-hotplug.html explaining to me why
the limit is there. Now I could add a bunch of pcie-root-ports ahead of
time, but there is likely a limit to that as well. So before I go down some
crazy paths, I figured I would ask on here if there is a better plan than
adding a bunch of root ports for adding a large number of hotplugged disks?
Thanks,
Alexander
4 years, 3 months
[libvirt PATCH] docs: Rephrase the video 'none' type to clarify the reasoning
by Erik Skultety
Signed-off-by: Erik Skultety <eskultet(a)redhat.com>
---
docs/formatdomain.rst | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
This is a tiny follow-up improvement resulting from [1] as I felt the paragraph
wasn't clear enough + there were a couple of typographical issues.
[1] https://www.redhat.com/archives/libvir-list/2020-September/msg00329.html
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index 1979dfb8d3..cf3ccbecc5 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -5784,13 +5784,16 @@ A video device.
value "vga", "cirrus", "vmvga", "xen", "vbox", "qxl" ( :since:`since 0.8.6`
), "virtio" ( :since:`since 1.3.0` ), "gop" ( :since:`since 3.2.0` ), "bochs"
( :since:`since 5.6.0` ), "ramfb" ( :since:`since 5.9.0` ), or "none" (
- :since:`since 4.6.0` , depending on the hypervisor features available. The
- purpose of the type ``none`` is to instruct libvirt not to add a default
- video device in the guest (see the paragraph above). This legacy behaviour
- can be inconvenient in cases where GPU mediated devices are meant to be the
- only rendering device within a guest and so specifying another ``video``
- device along with type ``none``. Refer to Host device assignment to see how
- to add a mediated device into a guest.
+ :since:`since 4.6.0`) , depending on the hypervisor features available.
+
+ Note: The purpose of the type ``none`` is to instruct libvirt not to add a
+ default video device in the guest (see the ``video`` element description
+ above), since such behaviour is inconvenient in cases where GPU mediated
+ devices are meant to be the only rendering device within a guest. If this
+ is your use case specify a ``none`` type ``video`` device in the XML to stop
+ the default behaviour. Refer to `Host device assignment
+ <#host-device-assignment>`__ to see how to add a mediated device into a
+ guest.
You can provide the amount of video memory in kibibytes (blocks of 1024
bytes) using ``vram``. This is supported only for guest type of "vz", "qemu",
--
2.26.2
4 years, 3 months