public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Michal Privoznik <mprivozn@redhat.com>
To: libvir-list@redhat.com
Cc: sbrivio@redhat.com, passt-dev@passt.top
Subject: [PATCH 1/4] Revert "qemu: allow passt to self-daemonize"
Date: Tue, 14 Feb 2023 12:51:19 +0100	[thread overview]
Message-ID: <77f3fc97d2343f25b85a2cc2295fc6f022c984d7.1676374699.git.mprivozn@redhat.com> (raw)
In-Reply-To: <cover.1676374699.git.mprivozn@redhat.com>

This reverts commit 0c4e716835eaf2a575bd063fde074c0fc7c4e4d4.

This patch was pushed by my mistake. Even though it got ACKed on
the list, I've raised couple of issues with it. They will be
fixed in next commits.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/qemu/qemu_passt.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_passt.c b/src/qemu/qemu_passt.c
index f640a69c00..0f09bf3db8 100644
--- a/src/qemu/qemu_passt.c
+++ b/src/qemu/qemu_passt.c
@@ -141,23 +141,24 @@ qemuPasstStart(virDomainObj *vm,
     g_autofree char *passtSocketName = qemuPasstCreateSocketPath(vm, net);
     g_autoptr(virCommand) cmd = NULL;
     g_autofree char *pidfile = qemuPasstCreatePidFilename(vm, net);
-    g_autofree char *errbuf = NULL;
     char macaddr[VIR_MAC_STRING_BUFLEN];
     size_t i;
     pid_t pid = (pid_t) -1;
     int exitstatus = 0;
     int cmdret = 0;
+    VIR_AUTOCLOSE errfd = -1;
 
     cmd = virCommandNew(PASST);
 
     virCommandClearCaps(cmd);
-    virCommandSetErrorBuffer(cmd, &errbuf);
+    virCommandSetPidFile(cmd, pidfile);
+    virCommandSetErrorFD(cmd, &errfd);
+    virCommandDaemonize(cmd);
 
     virCommandAddArgList(cmd,
                          "--one-off",
                          "--socket", passtSocketName,
                          "--mac-addr", virMacAddrFormat(&net->mac, macaddr),
-                         "--pid", pidfile,
                          NULL);
 
     if (net->mtu) {
@@ -263,7 +264,7 @@ qemuPasstStart(virDomainObj *vm,
 
     if (cmdret < 0 || exitstatus != 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Could not start 'passt': %s"), errbuf);
+                       _("Could not start 'passt'. exitstatus: %d"), exitstatus);
         goto error;
     }
 
-- 
@@ -141,23 +141,24 @@ qemuPasstStart(virDomainObj *vm,
     g_autofree char *passtSocketName = qemuPasstCreateSocketPath(vm, net);
     g_autoptr(virCommand) cmd = NULL;
     g_autofree char *pidfile = qemuPasstCreatePidFilename(vm, net);
-    g_autofree char *errbuf = NULL;
     char macaddr[VIR_MAC_STRING_BUFLEN];
     size_t i;
     pid_t pid = (pid_t) -1;
     int exitstatus = 0;
     int cmdret = 0;
+    VIR_AUTOCLOSE errfd = -1;
 
     cmd = virCommandNew(PASST);
 
     virCommandClearCaps(cmd);
-    virCommandSetErrorBuffer(cmd, &errbuf);
+    virCommandSetPidFile(cmd, pidfile);
+    virCommandSetErrorFD(cmd, &errfd);
+    virCommandDaemonize(cmd);
 
     virCommandAddArgList(cmd,
                          "--one-off",
                          "--socket", passtSocketName,
                          "--mac-addr", virMacAddrFormat(&net->mac, macaddr),
-                         "--pid", pidfile,
                          NULL);
 
     if (net->mtu) {
@@ -263,7 +264,7 @@ qemuPasstStart(virDomainObj *vm,
 
     if (cmdret < 0 || exitstatus != 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Could not start 'passt': %s"), errbuf);
+                       _("Could not start 'passt'. exitstatus: %d"), exitstatus);
         goto error;
     }
 
-- 
2.39.1


  reply	other threads:[~2023-02-14 11:51 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-14 11:51 [PATCH 0/4] qemu_passt: Don't let passt fork off Michal Privoznik
2023-02-14 11:51 ` Michal Privoznik [this message]
2023-02-15  7:06   ` [PATCH 1/4] Revert "qemu: allow passt to self-daemonize" Laine Stump
2023-02-14 11:51 ` [PATCH 2/4] qemu_extdevice: Make qemuExtDevicesHasDevice() check def->nets Michal Privoznik
2023-02-15  7:22   ` Laine Stump
2023-02-15 15:23     ` Michal Prívozník
2023-02-14 11:51 ` [PATCH 3/4] qemu_passt: Report error when getting passt PID failed Michal Privoznik
2023-02-15  7:24   ` Laine Stump
2023-02-14 11:51 ` [PATCH 4/4] qemu_passt: Don't let passt fork off Michal Privoznik
2023-02-14 13:02   ` Stefano Brivio
2023-02-14 15:30     ` Michal Prívozník
2023-02-14 16:22       ` Stefano Brivio
2023-02-15  7:50     ` Laine Stump
2023-02-15 17:04       ` Michal Prívozník
2023-02-15 18:22         ` Laine Stump
2023-02-15 18:30         ` Stefano Brivio
2023-02-16  8:52           ` Michal Prívozník
2023-02-16  9:07             ` Peter Krempa
2023-02-16  9:15             ` Stefano Brivio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=77f3fc97d2343f25b85a2cc2295fc6f022c984d7.1676374699.git.mprivozn@redhat.com \
    --to=mprivozn@redhat.com \
    --cc=libvir-list@redhat.com \
    --cc=passt-dev@passt.top \
    --cc=sbrivio@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).