From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTP id F35635A0082 for ; Tue, 14 Feb 2023 12:51:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676375489; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lIW8SBkzl10f26p2Zp9/SS6Bo6iv16l6yctgTW/oXFQ=; b=bi1svJnbxcMojDgxM67Qa6Saqynw4shSZNfN02HRTmhhrT7UIKVGP88BoiYpTAiV5ISk4L 8OhSwMWZdIe+9nKErQyKdFVxosDqmYDugh65Sw3C3g5UrsXeo93HOvGY8N0zkkhsXAZHPG nPlCTTWEaUPteb+NRs8Yzk4QBcIgE78= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-270-AZd1Iq4TM8mo9W6ccaaVSw-1; Tue, 14 Feb 2023 06:51:27 -0500 X-MC-Unique: AZd1Iq4TM8mo9W6ccaaVSw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 738781C068C5 for ; Tue, 14 Feb 2023 11:51:27 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA9E01415108; Tue, 14 Feb 2023 11:51:26 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 3/4] qemu_passt: Report error when getting passt PID failed Date: Tue, 14 Feb 2023 12:51:21 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation Message-ID-Hash: M26TCBMSRCICF4KPOS6SZZQUEE774ZHM X-Message-ID-Hash: M26TCBMSRCICF4KPOS6SZZQUEE774ZHM X-Mailman-Approved-At: Tue, 14 Feb 2023 14:06:27 +0100 CC: sbrivio@redhat.com, passt-dev@passt.top X-Mailman-Version: 3.3.3 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: If qemuPasstGetPid() fails, or the passt's PID is -1 then qemuPasstSetupCgroup() returns early without any error message set. Report an appropriate error. Signed-off-by: Michal Privoznik --- 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.1