[libvirt] [RFC] handling hostdev save/load net config for non SR-IOV devices
by Daniel Henrique Barboza
Hi,
I have a PoC that enables partial coldplug assignment of multifunction
PCI devices with managed mode. At this moment, Libvirt can't handle
this scenario - the code will detach only the hostdevs from the XML,
when in fact the whole IOMMU needs to be detached. This can be
verified by the fact that Libvirt handles the unmanaged scenario
well, as long as the user detaches the whole IOMMU beforehand.
I have played with 2 approaches. The one I am planning to contribute
back is a change inside virHostdevGetPCIHostDeviceList(), that
adds the extra PCI devices for detach/re-attach in case a PCI
Multifunction device in managed mode is presented in the XML.
Now, there's a catch. Inside both virHostdevPreparePCIDevices()
and virHostdevReAttachPCIDevices() there are code to save/restore
the network configuration for SR-IOV devices. These functions iterates
in the hostdevs list, instead of the pcidevs list I'm changing. The final
result, given that the current conditions used for SR-IOV matches the
conditions for multifunction PCI devices as well, is that not all virtual
functions will get their network configuration saved/restored.
For example, a guest that uses 3 of 4 functions of a PCI MultiFunction
card, let's say functions 0,1 and 3. The code will handle the detach
of all the IOMMU, including the function 2 that isn't declared in the
XML. However, since function 2 isn't a hostdev, its network config
will not be restored after the VM shutdown.
Now comes the question: how much effort should be spent into making
the network config of all the functions be restored? Is this a blocker
for the whole code to be accepted or, given it is proper documented
somewhere, it can be done later on?
Thanks,
DHB
5 years, 5 months
[libvirt] [PATCH] network: Link with libxml2
by Michal Privoznik
Since fb9f6ce6253 we are including a libxml header file in the
network driver but never link with it. This hasn't caused an
immediate problem because in the end the network driver links
with libvirt.la. But apparently, it's causing a build issue on
old Ubuntu.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Pushed under trivial & build breaker rules.
src/network/Makefile.inc.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/network/Makefile.inc.am b/src/network/Makefile.inc.am
index 52270049d5..23cf39b6f4 100644
--- a/src/network/Makefile.inc.am
+++ b/src/network/Makefile.inc.am
@@ -47,7 +47,7 @@ libvirt_driver_network_impl_la_CFLAGS = \
$(AM_CFLAGS) \
$(NULL)
libvirt_driver_network_impl_la_SOURCES = $(NETWORK_DRIVER_SOURCES)
-libvirt_driver_network_impl_la_LIBADD = $(DBUS_LIBS)
+libvirt_driver_network_impl_la_LIBADD = $(DBUS_LIBS) $(LIBXML_LIBS)
libexec_PROGRAMS += libvirt_leaseshelper
libvirt_leaseshelper_SOURCES = $(NETWORK_LEASES_HELPER_SOURCES)
--
2.21.0
5 years, 5 months
[libvirt] [PATCH] logging: pass binary name not logfile name when enabling logging
by Daniel P. Berrangé
Instead of having each caller pass in the desired logfile name, pass in
the binary name instead. The logging code can then just derive a logfile
name by appending ".log".
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/locking/lock_daemon.c | 2 +-
src/logging/log_daemon.c | 2 +-
src/remote/remote_daemon.c | 2 +-
src/util/virlog.c | 20 ++++++++++----------
4 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c
index bc2fb4a7fb..7cdcd61722 100644
--- a/src/locking/lock_daemon.c
+++ b/src/locking/lock_daemon.c
@@ -532,7 +532,7 @@ virLockDaemonSetupLogging(virLockDaemonConfigPtr config,
/* Define the default output. This is only applied if there was no setting
* from either the config or the environment.
*/
- if (virLogSetDefaultOutput("virtlockd.log", godaemon, privileged) < 0)
+ if (virLogSetDefaultOutput("virtlockd", godaemon, privileged) < 0)
return -1;
if (virLogGetNbOutputs() == 0)
diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c
index 014596b280..c8de7aa687 100644
--- a/src/logging/log_daemon.c
+++ b/src/logging/log_daemon.c
@@ -467,7 +467,7 @@ virLogDaemonSetupLogging(virLogDaemonConfigPtr config,
/* Define the default output. This is only applied if there was no setting
* from either the config or the environment.
*/
- if (virLogSetDefaultOutput("virtlogd.log", godaemon, privileged) < 0)
+ if (virLogSetDefaultOutput("virtlogd", godaemon, privileged) < 0)
return -1;
if (virLogGetNbOutputs() == 0)
diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c
index fdc9e4333a..ffdd3b84ad 100644
--- a/src/remote/remote_daemon.c
+++ b/src/remote/remote_daemon.c
@@ -610,7 +610,7 @@ daemonSetupLogging(struct daemonConfig *config,
/* Define the default output. This is only applied if there was no setting
* from either the config or the environment.
*/
- if (virLogSetDefaultOutput("libvirtd.log", godaemon, privileged) < 0)
+ if (virLogSetDefaultOutput("libvirtd", godaemon, privileged) < 0)
return -1;
if (virLogGetNbOutputs() == 0)
diff --git a/src/util/virlog.c b/src/util/virlog.c
index 248ce19902..da433878df 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -175,7 +175,7 @@ virLogSetDefaultOutputToJournald(void)
static int
-virLogSetDefaultOutputToFile(const char *filename, bool privileged)
+virLogSetDefaultOutputToFile(const char *binary, bool privileged)
{
int ret = -1;
char *logdir = NULL;
@@ -183,8 +183,8 @@ virLogSetDefaultOutputToFile(const char *filename, bool privileged)
if (privileged) {
if (virAsprintf(&virLogDefaultOutput,
- "%d:file:%s/log/libvirt/%s", virLogDefaultPriority,
- LOCALSTATEDIR, filename) < 0)
+ "%d:file:%s/log/libvirt/%s.log", virLogDefaultPriority,
+ LOCALSTATEDIR, binary) < 0)
goto cleanup;
} else {
if (!(logdir = virGetUserCacheDirectory()))
@@ -197,8 +197,8 @@ virLogSetDefaultOutputToFile(const char *filename, bool privileged)
}
umask(old_umask);
- if (virAsprintf(&virLogDefaultOutput, "%d:file:%s/%s",
- virLogDefaultPriority, logdir, filename) < 0)
+ if (virAsprintf(&virLogDefaultOutput, "%d:file:%s/%s.log",
+ virLogDefaultPriority, logdir, binary) < 0)
goto cleanup;
}
@@ -211,19 +211,19 @@ virLogSetDefaultOutputToFile(const char *filename, bool privileged)
/*
* virLogSetDefaultOutput:
- * @filename: the file that the output should be redirected to (only needed
- * when @godaemon equals true
+ * @binary: the binary for which logging is performed. The log file name
+ * will be derived from the binary name, with ".log" appended.
* @godaemon: whether we're running daemonized
* @privileged: whether we're running with root privileges or not (session)
*
* Decides on what the default output (journald, file, stderr) should be
- * according to @filename, @godaemon, @privileged. This function should be run
+ * according to @binary, @godaemon, @privileged. This function should be run
* exactly once at daemon startup, so no locks are used.
*
* Returns 0 on success, -1 in case of a failure.
*/
int
-virLogSetDefaultOutput(const char *filename, bool godaemon, bool privileged)
+virLogSetDefaultOutput(const char *binary, bool godaemon, bool privileged)
{
bool have_journald = access("/run/systemd/journal/socket", W_OK) >= 0;
@@ -237,7 +237,7 @@ virLogSetDefaultOutput(const char *filename, bool godaemon, bool privileged)
return virLogSetDefaultOutputToStderr();
}
- return virLogSetDefaultOutputToFile(filename, privileged);
+ return virLogSetDefaultOutputToFile(binary, privileged);
}
--
2.21.0
5 years, 5 months
[libvirt] [PATCH 0/5] network: xmlns dnsmasq option passthrough
by Cole Robinson
There's several unresolved RFEs for the <network> bridge
driver that are essentially requests to add XML wrappers
for underlying dnsmasq options.
This series adds a dnsmasq xmlns namespace for <network>
XML that allows passing option strings directly to the
generated dnsmasq config file. It will allow motivated
users to work around libvirt until those types of RFEs
are properly implemented.
Cole Robinson (5):
conf: Add virNetworkXMLOption
conf: Add network xmlopt argument
conf: Add virNetworkXMLNamespace
network: wire up dnsmasq option xmlns
docs: formatnetwork: Document xmlns:dnsmasq
docs/formatnetwork.html.in | 22 +++
docs/schemas/network.rng | 11 ++
src/conf/domain_conf.c | 2 +-
src/conf/network_conf.c | 91 +++++++--
src/conf/network_conf.h | 51 ++++-
src/conf/virnetworkobj.c | 50 +++--
src/conf/virnetworkobj.h | 13 +-
src/esx/esx_network_driver.c | 4 +-
src/libvirt_private.syms | 1 +
src/network/bridge_driver.c | 182 ++++++++++++++++--
src/network/bridge_driver.h | 12 ++
src/network/bridge_driver_platform.h | 2 +
src/qemu/qemu_process.c | 2 +-
src/test/test_driver.c | 11 +-
src/vbox/vbox_network.c | 4 +-
tests/Makefile.am | 14 +-
.../networkxml2confdata/dnsmasq-options.conf | 18 ++
tests/networkxml2confdata/dnsmasq-options.xml | 15 ++
tests/networkxml2conftest.c | 8 +-
tests/networkxml2firewalltest.c | 2 +-
tests/networkxml2xmlin/dnsmasq-options.xml | 15 ++
tests/networkxml2xmlout/dnsmasq-options.xml | 17 ++
tests/networkxml2xmltest.c | 11 +-
tests/networkxml2xmlupdatetest.c | 4 +-
24 files changed, 478 insertions(+), 84 deletions(-)
create mode 100644 tests/networkxml2confdata/dnsmasq-options.conf
create mode 100644 tests/networkxml2confdata/dnsmasq-options.xml
create mode 100644 tests/networkxml2xmlin/dnsmasq-options.xml
create mode 100644 tests/networkxml2xmlout/dnsmasq-options.xml
--
2.21.0
5 years, 5 months
[libvirt] [PATCH 0/2] util: Fix memleak after (legacy) blockjob (blockdev-add saga spin-off)
by Peter Krempa
While verifying that legacy block jobs are not broken I've found a
memleak.
Peter Krempa (2):
util: storage: Clean up label use in virStorageFileGetMetadataInternal
util: storage: Don't leak metadata on repeated calls of
virStorageFileGetMetadata
src/util/virstoragefile.c | 36 +++++++++++++++++++-----------------
1 file changed, 19 insertions(+), 17 deletions(-)
--
2.21.0
5 years, 5 months
[libvirt] [PATCH 0/2] tools: Introduce virshNodedevCapabilityNameCompleter
by Michal Privoznik
Yet again, couple of patches I have on my local branch for the feature
I'm working on and which can go separately.
Michal Prívozník (2):
virsh-completer: Separate comma list construction into a function
tools: Introduce virshNodedevCapabilityNameCompleter
tools/virsh-completer.c | 147 ++++++++++++++++++++++++++++------------
tools/virsh-completer.h | 4 ++
tools/virsh-nodedev.c | 1 +
3 files changed, 109 insertions(+), 43 deletions(-)
--
2.21.0
5 years, 5 months
[libvirt] [PATCH] util: command: Ignore bitmap errors when enumerating file descriptors to close
by Peter Krempa
virCommandMassCloseGetFDsLinux fails when running libvird on valgrind
with the following message:
libvirt: error : internal error: unable to set FD as open: 1024
This is because valgrind opens few file descriptors beyond the limit:
65701125 lr-x------. 1 root root 64 Jul 18 14:48 1024 -> /home/pipo/build/libvirt/gcc/src/.libs/libvirtd
65701126 lrwx------. 1 root root 64 Jul 18 14:48 1025 -> '/tmp/valgrind_proc_3849_cmdline_186612e3 (deleted)'
65701127 lrwx------. 1 root root 64 Jul 18 14:48 1026 -> '/tmp/valgrind_proc_3849_auxv_186612e3 (deleted)'
65701128 lrwx------. 1 root root 64 Jul 18 14:48 1027 -> /dev/pts/11
65701129 lr-x------. 1 root root 64 Jul 18 14:48 1028 -> 'pipe:[65689522]'
65701130 l-wx------. 1 root root 64 Jul 18 14:48 1029 -> 'pipe:[65689522]'
65701131 lr-x------. 1 root root 64 Jul 18 14:48 1030 -> /tmp/vgdb-pipe-from-vgdb-to-3849-by-root-on-angien
Ignore bitmap errors in this case since we'd leak those FD's anyways in
the previous scenario.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/util/vircommand.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/src/util/vircommand.c b/src/util/vircommand.c
index 5141611ca4..4501c96bbf 100644
--- a/src/util/vircommand.c
+++ b/src/util/vircommand.c
@@ -446,12 +446,7 @@ virCommandMassCloseGetFDsLinux(virCommandPtr cmd ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virBitmapSetBit(fds, fd) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("unable to set FD as open: %d"),
- fd);
- goto cleanup;
- }
+ ignore_value(virBitmapSetBit(fds, fd));
}
if (rc < 0)
--
2.21.0
5 years, 5 months
[libvirt] [PATCH] libvirt_private.syms: Properly expose virPCI* function from virpci.h
by Michal Privoznik
There are couple of functions that are meant to be exposed but
are missing syms file adjustment.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Pushed under trivial rule.
src/libvirt_private.syms | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 9640e91eaa..1d9eb17a86 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2614,6 +2614,7 @@ virObjectUnref;
# util/virpci.h
virPCIDeviceAddressAsString;
virPCIDeviceAddressEqual;
+virPCIDeviceAddressFree;
virPCIDeviceAddressGetIOMMUGroupAddresses;
virPCIDeviceAddressGetIOMMUGroupNum;
virPCIDeviceAddressGetSysfsFile;
@@ -2625,6 +2626,7 @@ virPCIDeviceCopy;
virPCIDeviceDetach;
virPCIDeviceFileIterate;
virPCIDeviceFree;
+virPCIDeviceGetAddress;
virPCIDeviceGetConfigPath;
virPCIDeviceGetDriverPathAndName;
virPCIDeviceGetIOMMUGroupDev;
@@ -2664,11 +2666,14 @@ virPCIDeviceSetUsedBy;
virPCIDeviceUnbind;
virPCIDeviceWaitForCleanup;
virPCIEDeviceInfoFree;
+virPCIELinkSpeedTypeFromString;
+virPCIELinkSpeedTypeToString;
virPCIGetDeviceAddressFromSysfsLink;
virPCIGetHeaderType;
virPCIGetMdevTypes;
virPCIGetNetName;
virPCIGetPhysicalFunction;
+virPCIGetSysfsFile;
virPCIGetVirtualFunctionIndex;
virPCIGetVirtualFunctionInfo;
virPCIGetVirtualFunctions;
--
2.21.0
5 years, 5 months
[libvirt] [dockerfiles PATCH 0/3] Add libosinfo-related projects
by Andrea Bolognani
See patch 2/3 for more information.
Andrea Bolognani (3):
refresh: Store projects in a more convenient format
refresh: Add libosinfo-related projects
Refresh after adding libosinfo-related projects
buildenv-centos-7.Dockerfile | 11 +++++++++
buildenv-debian-10-cross-aarch64.Dockerfile | 15 ++++++++++++
buildenv-debian-10-cross-armv6l.Dockerfile | 15 ++++++++++++
buildenv-debian-10-cross-armv7l.Dockerfile | 15 ++++++++++++
buildenv-debian-10-cross-i686.Dockerfile | 15 ++++++++++++
buildenv-debian-10-cross-mips.Dockerfile | 15 ++++++++++++
buildenv-debian-10-cross-mips64el.Dockerfile | 15 ++++++++++++
buildenv-debian-10-cross-mipsel.Dockerfile | 15 ++++++++++++
buildenv-debian-10-cross-ppc64le.Dockerfile | 15 ++++++++++++
buildenv-debian-10-cross-s390x.Dockerfile | 15 ++++++++++++
buildenv-debian-10.Dockerfile | 15 ++++++++++++
buildenv-debian-9-cross-aarch64.Dockerfile | 15 ++++++++++++
buildenv-debian-9-cross-armv6l.Dockerfile | 15 ++++++++++++
buildenv-debian-9-cross-armv7l.Dockerfile | 15 ++++++++++++
buildenv-debian-9-cross-mips.Dockerfile | 15 ++++++++++++
buildenv-debian-9-cross-mips64el.Dockerfile | 15 ++++++++++++
buildenv-debian-9-cross-mipsel.Dockerfile | 15 ++++++++++++
buildenv-debian-9-cross-ppc64le.Dockerfile | 15 ++++++++++++
buildenv-debian-9-cross-s390x.Dockerfile | 15 ++++++++++++
buildenv-debian-9.Dockerfile | 15 ++++++++++++
buildenv-debian-sid-cross-aarch64.Dockerfile | 15 ++++++++++++
buildenv-debian-sid-cross-armv6l.Dockerfile | 15 ++++++++++++
buildenv-debian-sid-cross-armv7l.Dockerfile | 15 ++++++++++++
buildenv-debian-sid-cross-i686.Dockerfile | 15 ++++++++++++
buildenv-debian-sid-cross-mips.Dockerfile | 15 ++++++++++++
buildenv-debian-sid-cross-mips64el.Dockerfile | 15 ++++++++++++
buildenv-debian-sid-cross-mipsel.Dockerfile | 15 ++++++++++++
buildenv-debian-sid-cross-ppc64le.Dockerfile | 15 ++++++++++++
buildenv-debian-sid-cross-s390x.Dockerfile | 15 ++++++++++++
buildenv-debian-sid.Dockerfile | 15 ++++++++++++
buildenv-fedora-29.Dockerfile | 15 ++++++++++++
buildenv-fedora-30.Dockerfile | 15 ++++++++++++
buildenv-fedora-rawhide.Dockerfile | 24 +++++++++++++++++++
buildenv-ubuntu-16.Dockerfile | 15 ++++++++++++
buildenv-ubuntu-18.Dockerfile | 15 ++++++++++++
refresh | 17 +++++++++----
36 files changed, 543 insertions(+), 4 deletions(-)
--
2.21.0
5 years, 5 months