[libvirt] [PATCH v3 0/5] Introduce VIR_ERR_DEVICE_MISSING
by Chen Hanxiao
Use Introduce VIR_ERR_DEVICE_MISSING for hotplug and detach device
error message.
Chen Hanxiao (5):
qemu: Add some more details for hotplug errors when device not found
qemu: Introduce VIR_ERR_DEVICE_MISSING
qemu: Use VIR_ERR_DEVICE_MISSING for various hotplug messages
qemu: Use VIR_ERR_DEVICE_MISSING for various DetachDeviceConfig
messages
news: Add VIR_ERR_DEVICE_MISSING change as improvements
docs/news.xml | 5 +++++
include/libvirt/virterror.h | 1 +
src/conf/domain_conf.c | 8 ++++----
src/libvirt_private.syms | 2 ++
src/qemu/qemu_driver.c | 20 +++++++++----------
src/qemu/qemu_hotplug.c | 47 ++++++++++++++++++++++++++++-----------------
src/util/virerror.c | 6 ++++++
7 files changed, 57 insertions(+), 32 deletions(-)
--
2.14.3
6 years, 9 months
[libvirt] [PATCH] qemu: Add USB and memory balloon by default for aarch64/virt guests
by Andrea Bolognani
Basically all existing guest types, regardless of the architectur,
get both a USB controller and a virtio memory balloon by default.
s390 guests are an exception, for the very good reason that they
don't support USB at all; the other exception is aarch64/virt
guests, but in the latter case isn't a compelling reason for them
to deviate from the widely adopted convention, especially since:
* x86/q35 guests, which aarch64/virt guests are for the most
part identical to, add these devices by default;
* it's trivial to opt out of both default devices by setting
model='none';
* higher level applications such as Nova expect at least the
USB controller to be present.
So add it by default for newly-defined guests. Existing guests
will, of course, be left unchanged.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1538637
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
src/qemu/qemu_domain.c | 34 +++++++++++++++++++++++++++++-----
1 file changed, 29 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 6b4bd3cca..f1c3b3d1e 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2630,7 +2630,8 @@ qemuDomainDefAddImplicitInputDevice(virDomainDef *def)
static int
qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
- virQEMUCapsPtr qemuCaps)
+ virQEMUCapsPtr qemuCaps,
+ unsigned int parseFlags)
{
bool addDefaultUSB = true;
int usbModel = -1; /* "default for machinetype" */
@@ -2680,10 +2681,33 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
case VIR_ARCH_ARMV7L:
case VIR_ARCH_AARCH64:
- addDefaultUSB = false;
- addDefaultMemballoon = false;
- if (qemuDomainIsVirt(def))
+ if (qemuDomainIsVirt(def)) {
+ /* All mach-virt guests get a PCIe Root, if supported by
+ * the QEMU binary */
addPCIeRoot = virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_GPEX);
+ }
+
+ if (qemuDomainIsVirt(def) &&
+ parseFlags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE) {
+ /* In addition to PCIe Root, newly-defined mach-virt guests
+ * also get a couple more devices so that they're more similar
+ * to guests on other architectures, notably x86/q35:
+ *
+ * 1) a USB3 controller, if supported by the QEMU binary;
+ * 2) a virtio memory balloon, as per the defaults defined
+ * above.
+ */
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QEMU_XHCI))
+ usbModel = VIR_DOMAIN_CONTROLLER_MODEL_USB_QEMU_XHCI;
+ else
+ addDefaultUSB = false;
+ } else {
+ /* Other ARM guests (and existing mach-virt guests, in order
+ * to preserve guest ABI compatibility) don't get a PCIe Root,
+ * a USB controller or a memory balloon */
+ addDefaultUSB = false;
+ addDefaultMemballoon = false;
+ }
break;
case VIR_ARCH_PPC64:
@@ -3187,7 +3211,7 @@ qemuDomainDefPostParse(virDomainDefPtr def,
goto cleanup;
}
- if (qemuDomainDefAddDefaultDevices(def, qemuCaps) < 0)
+ if (qemuDomainDefAddDefaultDevices(def, qemuCaps, parseFlags) < 0)
goto cleanup;
if (qemuCanonicalizeMachine(def, qemuCaps) < 0)
--
2.14.3
6 years, 9 months
[libvirt] [PATCH v2 00/11] Add admin protocol support for virtlogd/virtlockd
by Daniel P. Berrange
The initial admin protocol support was only integrated into libvirtd.
This series extracts that code so that it is reusable with all the
daemons we have (and more than we'll get).
In v2:
- Fixed completely broken post-exec restart support for admin servers
- Misc fixes from v1 review
Daniel P. Berrange (11):
admin: move admins server impl/dispatch into src/admin directory
libvirtd: rename virNetServerClient callback impls to match type names
admin: add support for post-exec restart callbacks
util: add virGetUNIXSocketPath helper
rpc: clarify "void *" values passed to client callbacks
rpc: pass virNetServer to post-exec restart callback in typesafe
manner
rpc: annotate various parameters as being required to be non-NULL
rpc: add method for checking if a named server exists
rpc: refactor virNetServer setup for post-exec restarts
logd: add support for admin protocol in virtlogd
lockd: add support for admin protocol in virtlockd
.gitignore | 1 +
cfg.mk | 10 +-
daemon/Makefile.am | 33 +---
daemon/libvirtd.c | 10 +-
daemon/libvirtd.h | 10 --
daemon/remote.c | 6 +-
daemon/remote.h | 6 +-
po/POTFILES.in | 6 +-
src/Makefile.am | 33 +++-
{daemon => src/admin}/admin_server.c | 4 +-
{daemon => src/admin}/admin_server.h | 6 +-
.../admin.c => src/admin/admin_server_dispatch.c | 48 ++++--
.../admin.h => src/admin/admin_server_dispatch.h | 18 +-
src/libvirt-admin.c | 23 ++-
src/libvirt_private.syms | 1 +
src/libvirt_remote.syms | 2 +-
src/locking/lock_daemon.c | 186 +++++++++++++++-----
src/locking/lock_daemon_config.c | 3 +
src/locking/lock_daemon_config.h | 1 +
src/locking/test_virtlockd.aug.in | 4 +
src/locking/virtlockd-admin.socket.in | 10 ++
src/locking/virtlockd.aug | 1 +
src/locking/virtlockd.conf | 6 +
src/locking/virtlockd.service.in | 1 +
src/logging/log_daemon.c | 188 ++++++++++++++++-----
src/logging/log_daemon_config.c | 3 +
src/logging/log_daemon_config.h | 1 +
src/logging/test_virtlogd.aug.in | 4 +
src/logging/virtlogd-admin.socket.in | 10 ++
src/logging/virtlogd.aug | 1 +
src/logging/virtlogd.service.in | 1 +
src/rpc/virnetdaemon.c | 164 ++++++++++--------
src/rpc/virnetdaemon.h | 20 ++-
src/rpc/virnetserver.c | 6 +-
src/rpc/virnetserver.h | 7 +-
src/rpc/virnetserverclient.c | 14 +-
src/rpc/virnetserverclient.h | 23 ++-
src/rpc/virnetserverprogram.h | 3 -
src/util/virutil.c | 45 +++++
src/util/virutil.h | 1 +
tests/virnetdaemontest.c | 37 +++-
41 files changed, 670 insertions(+), 287 deletions(-)
rename {daemon => src/admin}/admin_server.c (99%)
rename {daemon => src/admin}/admin_server.h (96%)
rename daemon/admin.c => src/admin/admin_server_dispatch.c (92%)
rename daemon/admin.h => src/admin/admin_server_dispatch.h (59%)
create mode 100644 src/locking/virtlockd-admin.socket.in
create mode 100644 src/logging/virtlogd-admin.socket.in
--
2.14.3
6 years, 9 months
[libvirt] [PATCH] qemu: Expose rx/tx_queue_size in qemu.conf too
by Michal Privoznik
In 2074ef6cd4a2 and c56cdf259 (and friends) we've added two
attributes to virtio NICs: rx_queue_size and tx_queue_size.
However, sysadmins might want to set these on per-host basis but
don't necessarily have an access to domain XML (e.g. because they
are generated by some other app). So let's expose them under
qemu.conf (the settings from domain XML still take precedence as
they are more specific ones).
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
docs/formatdomain.html.in | 12 +++++++++--
src/qemu/libvirtd_qemu.aug | 4 ++++
src/qemu/qemu.conf | 7 +++++++
src/qemu/qemu_command.c | 42 ++++++++++++++++++++++++++++++--------
src/qemu/qemu_command.h | 3 ++-
src/qemu/qemu_conf.c | 4 ++++
src/qemu/qemu_conf.h | 3 +++
src/qemu/qemu_hotplug.c | 2 +-
src/qemu/test_libvirtd_qemu.aug.in | 2 ++
9 files changed, 66 insertions(+), 13 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index d272cc1ba..c0107ab4b 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -5373,7 +5373,11 @@ qemu-kvm -net nic,model=? /dev/null
some restrictions on actual value. For instance, latest
QEMU (as of 2016-09-01) requires value to be a power of two
from [256, 1024] range.
- <span class="since">Since 2.3.0 (QEMU and KVM only)</span><br/><br/>
+ <span class="since">Since 2.3.0 (QEMU and KVM only)</span>
+ Then, <span class="since">Since 4.1.0</span> the default value can be
+ set in <code>qemu.conf</code> file and thus overrides hypervisor
+ default.
+ <br/><br/>
<b>In general you should leave this option alone, unless you
are very certain you know what you are doing.</b>
@@ -5389,7 +5393,11 @@ qemu-kvm -net nic,model=? /dev/null
range. In addition to that, this may work only for a subset of
interface types, e.g. aforementioned QEMU enables this option
only for <code>vhostuser</code> type.
- <span class="since">Since 3.7.0 (QEMU and KVM only)</span><br/><br/>
+ <span class="since">Since 3.7.0 (QEMU and KVM only)</span>
+ Then, <span class="since">Since 4.1.0</span> the default value can be
+ set in <code>qemu.conf</code> file and thus overrides hypervisor
+ default.
+ <br/><br/>
<b>In general you should leave this option alone, unless you
are very certain you know what you are doing.</b>
diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug
index c19bf3a43..084290296 100644
--- a/src/qemu/libvirtd_qemu.aug
+++ b/src/qemu/libvirtd_qemu.aug
@@ -118,6 +118,9 @@ module Libvirtd_qemu =
let vxhs_entry = bool_entry "vxhs_tls"
| str_entry "vxhs_tls_x509_cert_dir"
+ let virtio_entry = int_entry "rx_queue_size"
+ | int_entry "tx_queue_size"
+
(* Each entry in the config is one of the following ... *)
let entry = default_tls_entry
| vnc_entry
@@ -137,6 +140,7 @@ module Libvirtd_qemu =
| gluster_debug_level_entry
| memory_entry
| vxhs_entry
+ | virtio_entry
let comment = [ label "#comment" . del /#[ \t]*/ "# " . store /([^ \t\n][^\n]*)?/ . del /\n/ "\n" ]
let empty = [ label "#empty" . eol ]
diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
index 43dd561cc..a945ebdd5 100644
--- a/src/qemu/qemu.conf
+++ b/src/qemu/qemu.conf
@@ -775,3 +775,10 @@
# This directory is used for memoryBacking source if configured as file.
# NOTE: big files will be stored here
#memory_backing_dir = "/var/lib/libvirt/qemu/ram"
+
+# The following two values set the default RX/TX ring buffer size for virtio
+# interfaces. These values are taken unless overridden in domain XML. Please
+# note that QEMU accepts 256, 512 and 1024 only. These values correspond to
+# those from domain XML.
+#rx_queue_size = 1024
+#tx_queue_size = 1024
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index b8aede32d..771c12445 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3693,7 +3693,8 @@ qemuBuildNicStr(virDomainNetDefPtr net,
char *
-qemuBuildNicDevStr(virDomainDefPtr def,
+qemuBuildNicDevStr(virQEMUDriverConfigPtr cfg,
+ virDomainDefPtr def,
virDomainNetDefPtr net,
int vlan,
unsigned int bootindex,
@@ -3813,21 +3814,40 @@ qemuBuildNicDevStr(virDomainDefPtr def,
virBufferAsprintf(&buf, ",mq=on,vectors=%zu", 2 * vhostfdSize + 2);
}
}
- if (usingVirtio && net->driver.virtio.rx_queue_size) {
- if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_RX_QUEUE_SIZE)) {
+ if (usingVirtio) {
+ unsigned int rx_queue_size = net->driver.virtio.rx_queue_size;
+
+ if (rx_queue_size == 0 &&
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_RX_QUEUE_SIZE))
+ rx_queue_size = cfg->rx_queue_size;
+
+
+ if (rx_queue_size &&
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_RX_QUEUE_SIZE)) {
+ net->driver.virtio.rx_queue_size = rx_queue_size;
+ virBufferAsprintf(&buf, ",rx_queue_size=%u", rx_queue_size);
+ } else if (rx_queue_size) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("virtio rx_queue_size option is not supported with this QEMU binary"));
goto error;
}
- virBufferAsprintf(&buf, ",rx_queue_size=%u", net->driver.virtio.rx_queue_size);
}
- if (usingVirtio && net->driver.virtio.tx_queue_size) {
- if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_TX_QUEUE_SIZE)) {
+ if (usingVirtio) {
+ unsigned int tx_queue_size = net->driver.virtio.tx_queue_size;
+
+ if (tx_queue_size == 0 &&
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_TX_QUEUE_SIZE))
+ tx_queue_size = cfg->tx_queue_size;
+
+ if (tx_queue_size &&
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_TX_QUEUE_SIZE)) {
+ net->driver.virtio.tx_queue_size = tx_queue_size;
+ virBufferAsprintf(&buf, ",tx_queue_size=%u", tx_queue_size);
+ } else if (tx_queue_size) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("virtio tx_queue_size option is not supported with this QEMU binary"));
goto error;
}
- virBufferAsprintf(&buf, ",tx_queue_size=%u", net->driver.virtio.tx_queue_size);
}
if (usingVirtio && net->mtu) {
@@ -8489,7 +8509,7 @@ qemuBuildVhostuserCommandLine(virQEMUDriverPtr driver,
virCommandAddArg(cmd, netdev);
VIR_FREE(netdev);
- if (!(nic = qemuBuildNicDevStr(def, net, -1, bootindex,
+ if (!(nic = qemuBuildNicDevStr(cfg, def, net, -1, bootindex,
queues, qemuCaps))) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Error generating NIC -device string"));
@@ -8526,6 +8546,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
int **nicindexes,
bool chardevStdioLogd)
{
+ virQEMUDriverConfigPtr cfg;
int ret = -1;
char *nic = NULL, *host = NULL;
int *tapfd = NULL;
@@ -8587,6 +8608,8 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
return -1;
}
+ cfg = virQEMUDriverGetConfig(driver);
+
switch (actualType) {
case VIR_DOMAIN_NET_TYPE_NETWORK:
case VIR_DOMAIN_NET_TYPE_BRIDGE:
@@ -8782,7 +8805,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
virCommandAddArgList(cmd, "-netdev", host, NULL);
}
if (qemuDomainSupportsNicdev(def, net)) {
- if (!(nic = qemuBuildNicDevStr(def, net, vlan, bootindex,
+ if (!(nic = qemuBuildNicDevStr(cfg, def, net, vlan, bootindex,
vhostfdSize, qemuCaps)))
goto cleanup;
virCommandAddArgList(cmd, "-device", nic, NULL);
@@ -8826,6 +8849,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
VIR_FREE(host);
VIR_FREE(tapfdName);
VIR_FREE(vhostfdName);
+ virObjectUnref(cfg);
return ret;
}
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index bdde6f918..85f7bd1b4 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -90,7 +90,8 @@ char *qemuBuildNicStr(virDomainNetDefPtr net,
int vlan);
/* Current, best practice */
-char *qemuBuildNicDevStr(virDomainDefPtr def,
+char *qemuBuildNicDevStr(virQEMUDriverConfigPtr cfg,
+ virDomainDefPtr def,
virDomainNetDefPtr net,
int vlan,
unsigned int bootindex,
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index af503d31c..2fa96431f 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -912,6 +912,10 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
if (virConfGetValueString(conf, "memory_backing_dir", &cfg->memoryBackingDir) < 0)
goto cleanup;
+ if (virConfGetValueUInt(conf, "rx_queue_size", &cfg->rx_queue_size) < 0 ||
+ virConfGetValueUInt(conf, "tx_queue_size", &cfg->tx_queue_size) < 0)
+ goto cleanup;
+
ret = 0;
cleanup:
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index a553e30e2..3f38a76c2 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -206,6 +206,9 @@ struct _virQEMUDriverConfig {
bool vxhsTLS;
char *vxhsTLSx509certdir;
+
+ unsigned int rx_queue_size;
+ unsigned int tx_queue_size;
};
/* Main driver state */
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 6b245bd6a..18b460704 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1116,7 +1116,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
for (i = 0; i < vhostfdSize; i++)
VIR_FORCE_CLOSE(vhostfd[i]);
- if (!(nicstr = qemuBuildNicDevStr(vm->def, net, vlan, 0,
+ if (!(nicstr = qemuBuildNicDevStr(cfg, vm->def, net, vlan, 0,
queueSize, priv->qemuCaps)))
goto try_remove;
diff --git a/src/qemu/test_libvirtd_qemu.aug.in b/src/qemu/test_libvirtd_qemu.aug.in
index 688e5b9fd..4fc4e2f4e 100644
--- a/src/qemu/test_libvirtd_qemu.aug.in
+++ b/src/qemu/test_libvirtd_qemu.aug.in
@@ -100,3 +100,5 @@ module Test_libvirtd_qemu =
{ "1" = "mount" }
}
{ "memory_backing_dir" = "/var/lib/libvirt/qemu/ram" }
+{ "rx_queue_size" = "1024" }
+{ "tx_queue_size" = "1024" }
--
2.13.6
6 years, 9 months
[libvirt] [PATCH v2 0/6] Last CAT fixups v2
by Martin Kletzander
Few finishing touches for the Cache Allocation Technology. This series
copies the default group's mask to newly created groups, fixes a
possible wrong memory access, and cleans up after domains even if daemon
was restarted.
Martin Kletzander (6):
util: Add helpers for getting resctrl group allocs
util: Use default group's mask for unspecified resctrl allocations
util: Don't overwrite mask in virResctrlAllocFindUnused
qemu: Restore machinename even without cgroups
util: Extract path formatting into virResctrlAllocDeterminePath
qemu: Restore resctrl alloc data after restart
src/libvirt_private.syms | 1 +
src/qemu/qemu_cgroup.c | 4 -
src/qemu/qemu_process.c | 11 +++
src/util/virresctrl.c | 219 +++++++++++++++++++++++++++++------------------
src/util/virresctrl.h | 4 +
5 files changed, 152 insertions(+), 87 deletions(-)
--
2.15.1
6 years, 9 months
[libvirt] [PATCH] tools: unlink bash completion files before symlinking
by Daniel P. Berrangé
"ln" will not replace an existing symlink, so if you run 'make install'
twice, the second time will get an error:
ln: failed to create symbolic link 'virsh': File exists
We must always remove the symlink target first.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
Pushed as a build fix
tools/Makefile.am | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/Makefile.am b/tools/Makefile.am
index e173f56347..4c33e78a1d 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -425,6 +425,7 @@ install-bash-completion:
$(INSTALL_SCRIPT) $(srcdir)/bash-completion/vsh \
"$(DESTDIR)$(BASH_COMPLETIONS_DIR)/vsh"
( cd $(DESTDIR)$(BASH_COMPLETIONS_DIR) && \
+ rm -f virsh virt-admin && \
$(LN_S) vsh virsh && \
$(LN_S) vsh virt-admin )
--
2.14.3
6 years, 9 months
[libvirt] [PATCH] cpu: Add support for al57 Intel features
by Shaohe Feng
We can start qemu with a "cpu,+la57" to set 57-bit vitrual address
space. So VM can be aware that it need to enable 5-level paging.
Corresponding QEMU commits:
al57 6c7c3c21f95dd9af8a0691c0dd29b07247984122
---
src/cpu/cpu_map.xml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
index e5da7a8..922a195 100644
--- a/src/cpu/cpu_map.xml
+++ b/src/cpu/cpu_map.xml
@@ -285,6 +285,9 @@
<feature name='ospke'>
<cpuid eax_in='0x07' ecx_in='0x00' ecx='0x00000010'/>
</feature>
+ <feature name='la57'>
+ <cpuid eax_in='0x07' ecx_in='0x00' ecx='0x00010000'/>
+ </feature>
<feature name='avx512-4vnniw'>
<cpuid eax_in='0x07' ecx_in='0x00' edx='0x00000004'/>
--
2.7.4
6 years, 9 months
[libvirt] [PATCH 00/10] Enable direct use of secondary drivers
by Daniel P. Berrangé
Currently the secondary drivers can only be used if you have a
connection to a primary hypervisor driver. This series introduces
explicit URIs that allow opening a connection that only talks to a
specific secondary driver. In the future these URIs will resolve to
individual daemons containing those drivers.
This also allows us to fix long standing problems with most code that
uses secrets internally. We need to pass a virConnectPtr into such code
but some call stacks don't have a connection available. In some cases we
open a temporary connection to the QEMU driver, but this is suboptimal
for deployments without the QEMU driver present.
Daniel P. Berrangé (10):
storage: move driver registration back to end of the file
storage: allow opening with storage:///system and storage:///session
URIs
network: move driver registration back to end of the file
network: allow opening with network:///system and network:///session
URIs
nwfilter: allow opening with nwfilter:///system URI
interface: allow opening with interface:///system and
interface:///session URIs
nodedev: allow opening with nodedev:///system and nodedev:///session
URIs
secret: allow opening with secret:///system and secret:///session URIs
storage: open secret driver connection at time of use
storage: remove virConnectPtr from all backend functions
src/interface/interface_backend_netcf.c | 98 ++++++++-
src/interface/interface_backend_udev.c | 97 ++++++++-
src/network/bridge_driver.c | 185 +++++++++++++----
src/network/bridge_driver_platform.h | 3 +
src/node_device/node_device_driver.c | 73 ++++++-
src/node_device/node_device_driver.h | 9 +
src/node_device/node_device_hal.c | 18 ++
src/node_device/node_device_udev.c | 19 ++
src/nwfilter/nwfilter_driver.c | 83 ++++++++
src/secret/secret_driver.c | 95 +++++++++
src/storage/storage_backend.h | 45 ++--
src/storage/storage_backend_disk.c | 30 +--
src/storage/storage_backend_fs.c | 15 +-
src/storage/storage_backend_gluster.c | 9 +-
src/storage/storage_backend_iscsi.c | 24 +--
src/storage/storage_backend_logical.c | 38 ++--
src/storage/storage_backend_mpath.c | 5 +-
src/storage/storage_backend_rbd.c | 53 ++---
src/storage/storage_backend_scsi.c | 46 +++--
src/storage/storage_backend_sheepdog.c | 33 ++-
src/storage/storage_backend_vstorage.c | 10 +-
src/storage/storage_backend_zfs.c | 15 +-
src/storage/storage_driver.c | 351 ++++++++++++++++++++------------
src/storage/storage_util.c | 146 ++++++-------
src/storage/storage_util.h | 39 ++--
tests/storagevolxml2argvtest.c | 7 +-
26 files changed, 1047 insertions(+), 499 deletions(-)
--
2.14.3
6 years, 9 months
[libvirt] [PATCH] util: use union for sockaddr structs to avoid aliasing
by Daniel P. Berrangé
From: "Daniel P. Berrange" <berrange(a)redhat.com>
Some platforms/toolchains will complain about casting
sockaddr_storage to sockaddr_un because it breaks strict
aliasing rule
../../src/util/virutil.c: In function 'virGetUNIXSocketPath':
../../src/util/virutil.c:2005: error: dereferencing pointer 'un' does break strict-aliasing rules [-Wstrict-aliasing]
Change the code to use a union, in the same way that the
virsocketaddr.h header does.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
Pushed as (yet another) CI build fix
src/util/virutil.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/src/util/virutil.c b/src/util/virutil.c
index c23fa8f92e..cd6fbf2f30 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -1985,30 +1985,33 @@ virGetListenFDs(void)
#ifdef HAVE_SYS_UN_H
char *virGetUNIXSocketPath(int fd)
{
- struct sockaddr_storage ss = { 0 };
- struct sockaddr_un *un = (struct sockaddr_un *)&ss;
- socklen_t len = sizeof(ss);
+ union {
+ struct sockaddr sa;
+ struct sockaddr_storage ss;
+ struct sockaddr_un un;
+ } addr = { .ss = { 0 } };
+ socklen_t len = sizeof(addr.ss);
char *path;
- if (getsockname(fd, (struct sockaddr *)&ss, &len) < 0) {
+ if (getsockname(fd, &addr.sa, &len) < 0) {
virReportSystemError(errno, _("Unable to get address of FD %d"), fd);
return NULL;
}
- if (ss.ss_family != AF_UNIX) {
+ if (addr.ss.ss_family != AF_UNIX) {
virReportSystemError(EINVAL, _("FD %d is not a UNIX socket, has af=%d"),
- fd, ss.ss_family);
+ fd, addr.ss.ss_family);
return NULL;
}
- if (un->sun_path[0] == '\0')
- un->sun_path[0] = '@';
+ if (addr.un.sun_path[0] == '\0')
+ addr.un.sun_path[0] = '@';
- if (VIR_ALLOC_N(path, sizeof(un->sun_path) + 1) < 0)
+ if (VIR_ALLOC_N(path, sizeof(addr.un.sun_path) + 1) < 0)
return NULL;
- memcpy(path, un->sun_path, sizeof(un->sun_path));
- path[sizeof(un->sun_path)] = '\0';
+ memcpy(path, addr.un.sun_path, sizeof(addr.un.sun_path));
+ path[sizeof(addr.un.sun_path)] = '\0';
return path;
}
--
2.14.3
6 years, 9 months
[libvirt] [PATCH] Fixed virGetUNIXSocketPath stub on Win32
by Daniel P. Berrangé
The _() macro was not terminated and an argument needs to be marked as
unused.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
Pushed as a win32 build fix
src/util/virutil.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/util/virutil.c b/src/util/virutil.c
index 8352e0f1f1..c23fa8f92e 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -2014,10 +2014,10 @@ char *virGetUNIXSocketPath(int fd)
#else /* HAVE_SYS_UN_H */
-char *virGetUNIXSocketPath(int fd)
+char *virGetUNIXSocketPath(int fd ATTRIBUTE_UNUSED)
{
virReportSystemError(ENOSYS, "%s",
- _("UNIX sockets not supported on this platform");
+ _("UNIX sockets not supported on this platform"));
return NULL;
}
--
2.14.3
6 years, 9 months