[libvirt] [PATCH v5] util: Set SIGPIPE to a no-op handler in virFork
by Wang Yechao
Libvirtd has set SIGPIPE to ignored, and virFork resets all signal
handlers to the defaults. But child process may write logs to
stderr/stdout, that may generate SIGPIPE if journald has stopped.
So set SIGPIPE to a dummy no-op handler before unmask signals in
virFork. And there is no need to set SIGPIPE ignored before running
hooks in virExec. At last, set SIGPIPE to defaults before execve.
Signed-off-by: Wang Yechao <wang.yechao255(a)zte.com.cn>
---
v3 patch:
https://www.redhat.com/archives/libvir-list/2019-October/msg00934.html
Changes in v4:
- don't block SIGPIPE, ignore it when invoke VIR_FORCE_CLOSE and virCommandMassClose
Changes in v5:
- chang from SIG_IGN to a no-op handler in child process
---
src/util/vircommand.c | 27 ++++++++++-----------------
1 file changed, 10 insertions(+), 17 deletions(-)
diff --git a/src/util/vircommand.c b/src/util/vircommand.c
index 93b3dd2..c13739c 100644
--- a/src/util/vircommand.c
+++ b/src/util/vircommand.c
@@ -217,6 +217,8 @@ virCommandFDSet(virCommandPtr cmd,
#ifndef WIN32
+static void virDummyHandler(int sig G_GNUC_UNUSED) {}
+
/**
* virFork:
*
@@ -312,6 +314,9 @@ virFork(void)
ignore_value(sigaction(i, &sig_action, NULL));
}
+ sig_action.sa_handler = virDummyHandler;
+ ignore_value(sigaction(SIGPIPE, &sig_action, NULL));
+
/* Unmask all signals in child, since we've no idea what the
* caller's done with their signal mask and don't want to
* propagate that to children */
@@ -550,7 +555,7 @@ virExec(virCommandPtr cmd)
g_autofree char *binarystr = NULL;
const char *binary = NULL;
int ret;
- struct sigaction waxon, waxoff;
+ struct sigaction sig_action;
g_autofree gid_t *groups = NULL;
int ngroups;
@@ -718,21 +723,6 @@ virExec(virCommandPtr cmd)
}
}
- /* virFork reset all signal handlers to the defaults.
- * This is good for the child process, but our hook
- * risks running something that generates SIGPIPE,
- * so we need to temporarily block that again
- */
- memset(&waxoff, 0, sizeof(waxoff));
- waxoff.sa_handler = SIG_IGN;
- sigemptyset(&waxoff.sa_mask);
- memset(&waxon, 0, sizeof(waxon));
- if (sigaction(SIGPIPE, &waxoff, &waxon) < 0) {
- virReportSystemError(errno, "%s",
- _("Could not disable SIGPIPE"));
- goto fork_error;
- }
-
if (virProcessSetMaxMemLock(0, cmd->maxMemLock) < 0)
goto fork_error;
if (virProcessSetMaxProcesses(0, cmd->maxProcesses) < 0)
@@ -783,7 +773,10 @@ virExec(virCommandPtr cmd)
if (virCommandHandshakeChild(cmd) < 0)
goto fork_error;
- if (sigaction(SIGPIPE, &waxon, NULL) < 0) {
+ memset(&sig_action, 0, sizeof(sig_action));
+ sig_action.sa_handler = SIG_DFL;
+ sigemptyset(&sig_action.sa_mask);
+ if (sigaction(SIGPIPE, &sig_action, NULL) < 0) {
virReportSystemError(errno, "%s",
_("Could not re-enable SIGPIPE"));
goto fork_error;
--
1.8.3.1
5 years
[libvirt] [PATCHv2 0/2] util: set bridge device MAC address explicitly
by Laine Stump
From: Laine Stump <laine(a)redhat.com>
I just sent a single patch for this, then realized there was a small
prerequisite patch also needed. So 1/2 is the prerequisite patch, and 2/2 is identical to the single patch I sent previously.
Laine Stump (2):
util: allow sending mac addr to virNetNewLink without ifindex
util: set bridge device MAC address explicitly during
virNetDevBridgeCreate
src/network/bridge_driver.c | 2 +-
src/util/virnetdevbridge.c | 43 ++++++++++++++++++++++++++++++-------
src/util/virnetdevbridge.h | 2 +-
src/util/virnetlink.c | 9 ++++++--
4 files changed, 44 insertions(+), 12 deletions(-)
--
2.23.0
5 years
[libvirt] [PATCH RFC 00/11] qemu: Introduce support for ARM CPU features
by Andrea Bolognani
This series is RFC because the corresponding QEMU patches[1] have
not been merged yet, and since QEMU is currently in the middle of
the 4.1.0 freeze we can't really expect to merge them until 5.7.0
anyway.
With that in mind, a few patches are somewhat independent of the
rest and could, after some minor tweaking, could go in even right
now: 1/11 is really a no brainer, and 3/11 - 5/11 are also fairly
reasonable candidates for that treatment.
[1] https://lists.nongnu.org/archive/html/qemu-devel/2019-06/msg04945.html
Andrea Bolognani (11):
tests: Update replies for QEMU 2.12.0 on aarch64
tests: Add replies for QEMU 4.1.0 on aarch64
qemu: Rename virQEMUCapsObjectPropsMaxX86CPU
qemu: Introduce QEMU_CAPS_ARM_MAX_CPU
qemu: Query max-arm-cpu properties
qemu: Update query-cpu-model-expansion check
qemu: Perform full expansion on ARM
cpu_map: Introduce ARM CPU features
cpu: Validate ARM CPU features
tests: Introduce tests for ARM CPU features
news: Update for ARM CPU features
docs/news.xml | 9 +
src/cpu/cpu_arm.c | 171 ++
src/cpu_map/arm_features.xml | 21 +
src/cpu_map/index.xml | 4 +
src/qemu/qemu_capabilities.c | 18 +-
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 3 +-
.../caps_2.12.0.aarch64.replies | 324 ++-
.../caps_2.12.0.aarch64.xml | 5 +-
.../caps_4.0.0.aarch64.replies | 159 +-
.../caps_4.0.0.aarch64.xml | 1 +
...h64.replies => caps_4.1.0.aarch64.replies} | 2205 ++++++++++-------
...0.0.aarch64.xml => caps_4.1.0.aarch64.xml} | 53 +-
.../aarch64-features-sve.aarch64-latest.args | 32 +
.../qemuxml2argvdata/aarch64-features-sve.xml | 20 +
.../aarch64-features-wrong.xml | 17 +
tests/qemuxml2argvtest.c | 7 +
17 files changed, 2085 insertions(+), 965 deletions(-)
create mode 100644 src/cpu_map/arm_features.xml
copy tests/qemucapabilitiesdata/{caps_4.0.0.aarch64.replies => caps_4.1.0.aarch64.replies} (96%)
copy tests/qemucapabilitiesdata/{caps_4.0.0.aarch64.xml => caps_4.1.0.aarch64.xml} (80%)
create mode 100644 tests/qemuxml2argvdata/aarch64-features-sve.aarch64-latest.args
create mode 100644 tests/qemuxml2argvdata/aarch64-features-sve.xml
create mode 100644 tests/qemuxml2argvdata/aarch64-features-wrong.xml
--
2.21.0
5 years
[libvirt] [PATCH v3 REBASE 2 00/12] hostdev: handle usb detach/attach on node
by Nikolay Shirokovskiy
Diff to v2[1] version:
- add 'replug' attribute for hostdev element to allow replug semantics
- avoid accuiring domain lock in event loop thread on udev events as
suggested by Peter
- nit picks after review by Daniel Henrique Barboza
* is used to mark patches that were 'Reviewed-by' by Daniel (sometimes
with very minor changes to take into account new replug flag).
Can be applied on:
commit bf0e7bdeeb790bc6ba5732623be0d9ff26a5961a
Author: Peter Krempa <pkrempa(a)redhat.com>
Date: Thu Oct 24 15:50:50 2019 +0200
util: xml: Make virXMLFormatElement void
[1] https://www.redhat.com/archives/libvir-list/2019-September/msg00321.html
Nikolay Shirokovskiy (12):
conf: add replug option for usb hostdev
qemu: track hostdev delete intention
*qemu: support host usb device unplug
*qemu: support usb hostdev plugging back
qemu: handle host usb device add/del udev events
*qemu: handle libvirtd restart after host usb device unplug
*qemu: handle race on device deletion and usb host device plugging
qemu: hotplug: update device list on device deleted event
*qemu: handle host usb device plug/unplug when libvirtd is down
*qemu: don't mess with non mandatory hostdevs on reattaching
qemu: handle detaching of unplugged hostdev
*conf: parse hostdev missing flag
docs/formatdomain.html.in | 10 +-
docs/schemas/domaincommon.rng | 5 +
src/conf/domain_conf.c | 62 +++
src/conf/domain_conf.h | 17 +
src/qemu/Makefile.inc.am | 2 +
src/qemu/qemu_conf.h | 3 +
src/qemu/qemu_domain.c | 2 +
src/qemu/qemu_domain.h | 2 +
src/qemu/qemu_driver.c | 404 +++++++++++++++++-
src/qemu/qemu_hotplug.c | 104 ++++-
src/qemu/qemu_hotplug.h | 3 +-
src/qemu/qemu_process.c | 60 +++
src/util/virhostdev.c | 2 +
tests/qemuhotplugtest.c | 2 +-
tests/qemuxml2argvdata/hostdev-usb-replug.xml | 36 ++
.../qemuxml2xmloutdata/hostdev-usb-replug.xml | 40 ++
tests/qemuxml2xmltest.c | 1 +
17 files changed, 733 insertions(+), 22 deletions(-)
create mode 100644 tests/qemuxml2argvdata/hostdev-usb-replug.xml
create mode 100644 tests/qemuxml2xmloutdata/hostdev-usb-replug.xml
--
2.23.0
5 years
[libvirt] [PATCH 0/9] support use of precreated tap devices from unprivileged libvirtd
by Laine Stump
This resolves https://bugzilla.redhat.com/1723367
It has become more popular to run libvirtd in an unprivileged
environment (e.g. inside a container), but until now the only possible
types of network connection for a qemu started by an unprivileged
libvirtd were:
1) a usermode slirp connection
2) a tap device connection to a bridge handled by running
qemu-bridge-helper (a suid-root utility distributed with qemu)
3) a host network card assigned to the guest using VFIO (this requires
special setup by a privileged process though)
This patch series remedies that by making it possible for libvirtd to
use a tap device that has been pre-created (*and* properly setup) by
some other process beforehand.
In order to use this, you must have a standard tap, or macvtap device
that has been set to be owned by the uid that will be running
libvirtd, has its MAC address already set, and has been set online
(IFF_UP). For example, here are the commands to create a standard tap
device named "mytap0", attach it to the host bridge device "br0" and
prepare it for use by a libvirtd that is running as user "laine":
ip tuntap add mode tap user laine group laine name mytap0
ip link set mytap0 up
ip link set mytap0 master br0
(You may want to set a specific MAC address for the tap device, but as
long as it *doesn't* match the MAC address used by the guest emulated
device, it really doesn't matter)
You can now add the following <interface> to a domain definition:
<interface type='ethernet'>
<model type='virtio'/>
<mac address='52:54:00:11:11:11'/>
<target dev='mytap0' managed='no'/>
</interface>
and start up the guest.
A similar set of commands to create a macvtap device named
"mymacvtap0" with MAC addres 52:54:00:11:11:11 connected to the host
device "en2" would be something like this:
ip link add link en2 name mymacvtap0 address 52:54:00:11:11:11 \
type macvtap mode bridge
ip link set mymacvtap0 up
The XML would be identical, except the name of the device
<interface type='ethernet'>
<model type='virtio'/>
<mac address='52:54:00:11:11:11'/>
<target dev='mymacvtap0' managed='no'/>
</interface>
(Note that in the case of macvtap, the precreated device must *match*
the MAC address of the emulated guest device).
If libvirtd is given a precreated device, that device will *not* be
explicitly deleted when qemu is finished with it - the caller must
take care of that.
Laine Stump (9):
util: new function virNetDevMacVLanIsMacvtap()
util: make a couple virNetDevMacVlan*() functions public
qemu: reorganize qemuInterfaceEthernetConnect()
conf: use virXMLFormatElement for interface <target>
conf: new "managed" attribute for target dev of <interface
type='ethernet'>
qemu: support unmanaged target tap dev for <interface type='ethernet'>
qemu: support unmanaged macvtap devices with <interface
type='ethernet'>
qemu: explicitly delete standard tap devices only on platforms that
require it
docs: update news file
docs/formatdomain.html.in | 48 +++++++---
docs/news.xml | 13 +++
docs/schemas/domaincommon.rng | 5 ++
src/conf/domain_conf.c | 55 +++++++++---
src/conf/domain_conf.h | 1 +
src/libvirt_private.syms | 3 +
src/qemu/qemu_interface.c | 89 ++++++++++++-------
src/qemu/qemu_process.c | 6 +-
src/util/virnetdev.h | 2 +-
src/util/virnetdevmacvlan.c | 35 ++++++--
src/util/virnetdevmacvlan.h | 12 +++
.../net-eth-unmanaged-tap.args | 32 +++++++
.../net-eth-unmanaged-tap.xml | 35 ++++++++
tests/qemuxml2argvmock.c | 16 +++-
tests/qemuxml2argvtest.c | 1 +
.../net-eth-unmanaged-tap.xml | 40 +++++++++
tests/qemuxml2xmltest.c | 1 +
17 files changed, 329 insertions(+), 65 deletions(-)
create mode 100644 tests/qemuxml2argvdata/net-eth-unmanaged-tap.args
create mode 100644 tests/qemuxml2argvdata/net-eth-unmanaged-tap.xml
create mode 100644 tests/qemuxml2xmloutdata/net-eth-unmanaged-tap.xml
--
2.21.0
5 years
[libvirt] [PULL 0/9] Ide patches
by John Snow
The following changes since commit 68d8ef4ec540682c3538d4963e836e43a211dd17:
Merge remote-tracking branch 'remotes/stsquad/tags/pull-tcg-plugins-281019-4' into staging (2019-10-30 14:10:32 +0000)
are available in the Git repository at:
https://github.com/jnsnow/qemu.git tags/ide-pull-request
for you to fetch changes up to c35564caf20e8d3431786dddf0fa513daa7d7f3c:
hd-geo-test: Add tests for lchs override (2019-10-31 06:11:34 -0400)
----------------------------------------------------------------
Pull request
----------------------------------------------------------------
John Snow (1):
IDE: deprecate ide-drive
Sam Eiderman (8):
block: Refactor macros - fix tabbing
block: Support providing LCHS from user
bootdevice: Add interface to gather LCHS
scsi: Propagate unrealize() callback to scsi-hd
bootdevice: Gather LCHS from all relevant devices
bootdevice: Refactor get_boot_devices_list
bootdevice: FW_CFG interface for LCHS values
hd-geo-test: Add tests for lchs override
qemu-deprecated.texi | 5 +
include/hw/block/block.h | 22 +-
include/hw/scsi/scsi.h | 1 +
include/sysemu/sysemu.h | 4 +
bootdevice.c | 147 +++++++--
hw/block/virtio-blk.c | 6 +
hw/ide/qdev.c | 10 +-
hw/nvram/fw_cfg.c | 14 +-
hw/scsi/scsi-bus.c | 16 +
hw/scsi/scsi-disk.c | 12 +
tests/hd-geo-test.c | 551 ++++++++++++++++++++++++++++++++++
tests/Makefile.include | 2 +-
tests/qemu-iotests/051.pc.out | 6 +-
13 files changed, 753 insertions(+), 43 deletions(-)
--
2.21.0
5 years
[libvirt] [PATCH 0/2] Doc fix and news entry for Xen ACPI support
by Jim Fehlig
I was jetlagged and not thinking clearly when I pushed Marek's patches that add support for specifying ACPI firmware path in the libxl driver. I pushed them outside of my usual dev setup hence misssed Reviewed-by: tags and forgot to update the docs with s/5.8.0/5.9.0/. There's nothing I can do about the former, but the latter can be fixed with trivial patch 1. Patch 2 adds a news entry.
Jim Fehlig (2):
docs: Fix version that introduced Xen support for ACPI firmware
news: Add entry for ACPI firmware support in Xen
docs/formatdomain.html.in | 2 +-
docs/news.xml | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
--
2.23.0
5 years
[libvirt] [PULL v2 0/9] Ide patches
by John Snow
The following changes since commit 68d8ef4ec540682c3538d4963e836e43a211dd17:
Merge remote-tracking branch 'remotes/stsquad/tags/pull-tcg-plugins-281019-4' into staging (2019-10-30 14:10:32 +0000)
are available in the Git repository at:
https://github.com/jnsnow/qemu.git tags/ide-pull-request
for you to fetch changes up to dc237c45aee52f268369dc6a485c623f1232e1d3:
hd-geo-test: Add tests for lchs override (2019-10-31 11:47:43 -0400)
----------------------------------------------------------------
Pull request
----------------------------------------------------------------
John Snow (1):
IDE: deprecate ide-drive
Sam Eiderman (8):
block: Refactor macros - fix tabbing
block: Support providing LCHS from user
bootdevice: Add interface to gather LCHS
scsi: Propagate unrealize() callback to scsi-hd
bootdevice: Gather LCHS from all relevant devices
bootdevice: Refactor get_boot_devices_list
bootdevice: FW_CFG interface for LCHS values
hd-geo-test: Add tests for lchs override
qemu-deprecated.texi | 5 +
include/hw/block/block.h | 22 +-
include/hw/scsi/scsi.h | 1 +
include/sysemu/sysemu.h | 4 +
bootdevice.c | 147 +++++++--
hw/block/virtio-blk.c | 6 +
hw/ide/qdev.c | 10 +-
hw/nvram/fw_cfg.c | 14 +-
hw/scsi/scsi-bus.c | 16 +
hw/scsi/scsi-disk.c | 12 +
tests/hd-geo-test.c | 551 ++++++++++++++++++++++++++++++++++
tests/Makefile.include | 2 +-
tests/qemu-iotests/051.pc.out | 6 +-
13 files changed, 753 insertions(+), 43 deletions(-)
--
2.21.0
5 years
[libvirt] [PATCH v2] storage: improve the while loop virStorageBackendFileSystemIsMounted
by Yi Li
Move virStorageBackendFileSystemGetPoolSource outside of the while loop
Signed-off-by: Yi Li <yili(a)winhong.com>
---
src/storage/storage_backend_fs.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index 02b8248..92516c8 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -258,10 +258,10 @@ virStorageBackendFileSystemIsMounted(virStoragePoolObjPtr pool)
goto cleanup;
}
- while ((getmntent_r(mtab, &ent, buf, sizeof(buf))) != NULL) {
- if (!(src = virStorageBackendFileSystemGetPoolSource(pool)))
- goto cleanup;
+ if ((src = virStorageBackendFileSystemGetPoolSource(pool)) == NULL)
+ goto cleanup;
+ while ((getmntent_r(mtab, &ent, buf, sizeof(buf))) != NULL) {
/* compare both mount destinations and sources to be sure the mounted
* FS pool is really the one we're looking for
*/
@@ -274,12 +274,13 @@ virStorageBackendFileSystemIsMounted(virStoragePoolObjPtr pool)
goto cleanup;
}
- VIR_FREE(src);
}
ret = 0;
cleanup:
+ if (src)
+ VIR_FREE(src);
VIR_FORCE_FCLOSE(mtab);
return ret;
}
--
2.7.5
5 years