[libvirt PATCH 01/11] qemu: drop support for agent connections on PTYs

Daniel P. Berrangé berrange at redhat.com
Fri Feb 14 12:51:59 UTC 2020


Libvirt has never configured the QEMU agent to support
running on a PTY implicitly. In theory an end user may
have written such an XML config, but this is reasonably
unlikely since when a bare <channel> is provided, libvirt
will auto-expand it to a UNIX socket backend.

With this change a user who has use the PTY backend will
have to switch to the UNIX backend if they wish to use
libvirt APIs for interacting with the agent. This will
not have guest ABI impact.

Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
---
 src/qemu/qemu_agent.c | 36 ++----------------------------------
 1 file changed, 2 insertions(+), 34 deletions(-)

diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index 7d01d21a11..7ca5975a76 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -223,30 +223,6 @@ qemuAgentOpenUnix(const char *monitor)
     return -1;
 }
 
-static int
-qemuAgentOpenPty(const char *monitor)
-{
-    int monfd;
-
-    if ((monfd = open(monitor, O_RDWR | O_NONBLOCK)) < 0) {
-        virReportSystemError(errno,
-                             _("Unable to open monitor path %s"), monitor);
-        return -1;
-    }
-
-    if (virSetCloseExec(monfd) < 0) {
-        virReportSystemError(errno, "%s",
-                             _("Unable to set monitor close-on-exec flag"));
-        goto error;
-    }
-
-    return monfd;
-
- error:
-    VIR_FORCE_CLOSE(monfd);
-    return -1;
-}
-
 
 static int
 qemuAgentIOProcessEvent(qemuAgentPtr mon,
@@ -705,22 +681,14 @@ qemuAgentOpen(virDomainObjPtr vm,
     mon->vm = vm;
     mon->cb = cb;
 
-    switch (config->type) {
-    case VIR_DOMAIN_CHR_TYPE_UNIX:
-        mon->fd = qemuAgentOpenUnix(config->data.nix.path);
-        break;
-
-    case VIR_DOMAIN_CHR_TYPE_PTY:
-        mon->fd = qemuAgentOpenPty(config->data.file.path);
-        break;
-
-    default:
+    if (config->type != VIR_DOMAIN_CHR_TYPE_UNIX) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("unable to handle monitor type: %s"),
                        virDomainChrTypeToString(config->type));
         goto cleanup;
     }
 
+    mon->fd = qemuAgentOpenUnix(config->data.nix.path);
     if (mon->fd == -1)
         goto cleanup;
 
-- 
2.24.1




More information about the libvir-list mailing list