libvirt/SOURCES/libvirt-qemu_passt-Report-error-when-getting-passt-PID-failed.patch
2023-05-09 05:28:02 +00:00

41 lines
1.3 KiB
Diff

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