Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1780508 Signed-off-by: Kristina Hanicova <khanicov@xxxxxxxxxx> --- src/qemu/qemu_hotplug.c | 3 +-- src/qemu/qemu_namespace.c | 10 ++++++++-- src/qemu/qemu_namespace.h | 3 ++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index d2a354d026..7002623924 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -3225,9 +3225,8 @@ qemuDomainAttachInputDevice(virQEMUDriver *driver, if (qemuBuildInputDevStr(&devstr, vm->def, input, priv->qemuCaps) < 0) goto cleanup; - if (qemuDomainNamespaceSetupInput(vm, input) < 0) + if (qemuDomainNamespaceSetupInput(vm, input, &teardowndevice) < 0) goto cleanup; - teardowndevice = true; if (qemuSetupInputCgroup(vm, input) < 0) goto cleanup; diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c index 154968acbd..22bdda229a 100644 --- a/src/qemu/qemu_namespace.c +++ b/src/qemu/qemu_namespace.c @@ -1600,9 +1600,11 @@ qemuDomainNamespaceTeardownRNG(virDomainObj *vm, int qemuDomainNamespaceSetupInput(virDomainObj *vm, - virDomainInputDef *input) + virDomainInputDef *input, + bool *created) { g_autoptr(virGSListString) paths = NULL; + int ret = 0; if (!qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT)) return 0; @@ -1610,8 +1612,12 @@ qemuDomainNamespaceSetupInput(virDomainObj *vm, if (qemuDomainSetupInput(input, &paths) < 0) return -1; - if (qemuNamespaceMknodPaths(vm, paths) < 0) + if ((ret = qemuNamespaceMknodPaths(vm, paths)) < 0) return -1; + + if (ret == 0) + *created = true; + return 0; } diff --git a/src/qemu/qemu_namespace.h b/src/qemu/qemu_namespace.h index 771d7873ef..5d9af123a9 100644 --- a/src/qemu/qemu_namespace.h +++ b/src/qemu/qemu_namespace.h @@ -80,7 +80,8 @@ int qemuDomainNamespaceTeardownRNG(virDomainObj *vm, virDomainRNGDef *rng); int qemuDomainNamespaceSetupInput(virDomainObj *vm, - virDomainInputDef *input); + virDomainInputDef *input, + bool *created); int qemuDomainNamespaceTeardownInput(virDomainObj *vm, virDomainInputDef *input); -- 2.31.1