[PATCH v2 3/7] vircommand: Don't set nonblocking FDs in virCommandDoAsyncIO()

Michal Privoznik mprivozn at redhat.com
Tue Mar 22 16:02:02 UTC 2022

Back in  2013 (v1.0.3-rc1~235) when I introduced
virCommandDoAsyncIO() things were way different than today. We
had one event loop for everything and asynchronous IO for
virCommand was handled by the event loop. Therefore, it made
sense to enable VIR_EXEC_NONBLOCK flag alongside with
VIR_EXEC_ASYNC_IO. Well, sort of - a blocking FD can still be put
into poll().

Anyway, this was reimplemented in v1.0.3-rc1~127 when a separate
thread is created that handles IO. Therefore, there's no need to
enable VIR_EXEC_NONBLOCK flag anymore. There's a separate API to
request that flag: virCommandNonblockingFDs().

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
 src/util/vircommand.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/util/vircommand.c b/src/util/vircommand.c
index 5f22bd0ac3..ebd986cb13 100644
--- a/src/util/vircommand.c
+++ b/src/util/vircommand.c
@@ -3105,7 +3105,6 @@ virCommandFree(virCommand *cmd)
  *      ...
- * The libvirt's event loop is used for handling stdios of @cmd.
  * Since current implementation uses strlen to determine length
  * of data to be written to @cmd's stdin, don't pass any binary
  * data. If you want to re-run command, you need to call this and
@@ -3117,7 +3116,7 @@ virCommandDoAsyncIO(virCommand *cmd)
     if (virCommandHasError(cmd))
+    cmd->flags |= VIR_EXEC_ASYNC_IO;

More information about the libvir-list mailing list