From dabff45cbba94d6dedf7319ba3f225d4bebef010 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Tue, 7 Feb 2023 10:34:40 +0100 Subject: [PATCH 2/3] qemu_process: Produce better debug message wrt domain namespaces When going through debug log of a domain startup process, one can meet the following line: debug : qemuProcessLaunch:7668 : Building mount namespace But this is in fact wrong. Firstly, domain namespaces are just enabled in domain's privateData. Secondly, the debug message says nothing about actual state of namespace - whether it was enabled or not. Therefore, move the debug printing into qemuProcessEnableDomainNamespaces() and tweak it so that the actual value is reflected. Signed-off-by: Michal Privoznik Reviewed-by: Jim Fehlig (cherry picked from commit 697c16e39ae9a9e18ce7cad0729bf2293b12a307) --- src/qemu/qemu_process.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) Index: libvirt-9.0.0/src/qemu/qemu_process.c =================================================================== --- libvirt-9.0.0.orig/src/qemu/qemu_process.c +++ libvirt-9.0.0/src/qemu/qemu_process.c @@ -7399,11 +7399,17 @@ qemuProcessEnableDomainNamespaces(virQEM virDomainObj *vm) { g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); + const char *state = "disabled"; if (virBitmapIsBitSet(cfg->namespaces, QEMU_DOMAIN_NS_MOUNT) && qemuDomainEnableNamespace(vm, QEMU_DOMAIN_NS_MOUNT) < 0) return -1; + if (qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT)) + state = "enabled"; + + VIR_DEBUG("Mount namespace for domain name=%s is %s", + vm->def->name, state); return 0; } @@ -7720,8 +7726,6 @@ qemuProcessLaunch(virConnectPtr conn, qemuDomainLogContextMarkPosition(logCtxt); - VIR_DEBUG("Building mount namespace"); - if (qemuProcessEnableDomainNamespaces(driver, vm) < 0) goto cleanup;