On a Monday in 2020, Bihong Yu wrote:
From 187323ce736dcd9b1a177d552630b0c6859a4798 Mon Sep 17 00:00:00 2001From: Bihong Yu <yubihong@xxxxxxxxxx> Date: Tue, 14 Jul 2020 15:44:05 +0800 Subject: [PATCH] qemu: pre-create the dbus directory in qemuStateInitialize There are races condiction to make '/run/libvirt/qemu/dbus' directory in virDirCreateNoFork() while concurrent start VMs, and get "failed to create directory '/run/libvirt/qemu/dbus': File exists" error message. pre-create the dbus directory in qemuStateInitialize. Signed-off-by:Bihong Yu <yubihong@xxxxxxxxxx> --- src/qemu/qemu_dbus.c | 4 +--- src/qemu/qemu_dbus.h | 2 +- src/qemu/qemu_driver.c | 4 ++++ src/qemu/qemu_process.c | 3 --- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_dbus.c b/src/qemu/qemu_dbus.c index 51f6c94..0e0306a 100644 --- a/src/qemu/qemu_dbus.c +++ b/src/qemu/qemu_dbus.c @@ -34,10 +34,8 @@ VIR_LOG_INIT("qemu.dbus"); int -qemuDBusPrepareHost(virQEMUDriverPtr driver) +qemuDBusPreparePath(virQEMUDriverConfigPtr cfg)
Instead of renaming this function, we can just remove it completely
{ - g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); -
return virDirCreate(cfg->dbusStateDir, 0770, cfg->user, cfg->group, VIR_DIR_CREATE_ALLOW_EXIST);
This virDirCreate call would then fit nicely after virFileMakePath(cfg->slirpStateDir), which is where all the other directories are created.
}
Jano
Attachment:
signature.asc
Description: PGP signature