acda74
From 8e1bca7aacacedb0aa34eef1723f1d2d13958c10 Mon Sep 17 00:00:00 2001
acda74
Message-Id: <8e1bca7aacacedb0aa34eef1723f1d2d13958c10@dist-git>
acda74
From: Michal Privoznik <mprivozn@redhat.com>
acda74
Date: Mon, 13 Feb 2023 16:05:04 +0100
acda74
Subject: [PATCH] qemu_passt: Report error when getting passt PID failed
acda74
acda74
If qemuPasstGetPid() fails, or the passt's PID is -1 then
acda74
qemuPasstSetupCgroup() returns early without any error message
acda74
set. Report an appropriate error.
acda74
acda74
Resolves: https://bugzilla.redhat.com/2169244
acda74
acda74
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
acda74
Reviewed-by: Laine Stump <laine@redhat.com>
acda74
(cherry picked from commit 598a73335d70b4ef70b84f9730d708c116f88b15)
acda74
Signed-off-by: Laine Stump <laine@redhat.com>
acda74
---
acda74
 src/qemu/qemu_passt.c | 5 ++++-
acda74
 1 file changed, 4 insertions(+), 1 deletion(-)
acda74
acda74
diff --git a/src/qemu/qemu_passt.c b/src/qemu/qemu_passt.c
acda74
index 0f09bf3db8..78830fdc26 100644
acda74
--- a/src/qemu/qemu_passt.c
acda74
+++ b/src/qemu/qemu_passt.c
acda74
@@ -125,8 +125,11 @@ qemuPasstSetupCgroup(virDomainObj *vm,
acda74
 {
acda74
     pid_t pid = (pid_t) -1;
acda74
 
acda74
-    if (qemuPasstGetPid(vm, net, &pid) < 0 || pid <= 0)
acda74
+    if (qemuPasstGetPid(vm, net, &pid) < 0 || pid <= 0) {
acda74
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
acda74
+                       _("Could not get process ID of passt"));
acda74
         return -1;
acda74
+    }
acda74
 
acda74
     return virCgroupAddProcess(cgroup, pid);
acda74
 }
acda74
-- 
acda74
2.39.2
acda74