]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: drop support for agent connections on PTYs
authorDaniel P. Berrangé <berrange@redhat.com>
Wed, 12 Feb 2020 11:45:10 +0000 (11:45 +0000)
committerDaniel P. Berrangé <berrange@redhat.com>
Thu, 5 Mar 2020 12:22:52 +0000 (12:22 +0000)
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.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
src/qemu/qemu_agent.c

index cd25ef6cd3d7f60a42ce4772ca8b1f0d32875f48..9f3fb9732f1356fbced5fba19f362a8a0cf79aec 100644 (file)
@@ -224,30 +224,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,
@@ -706,22 +682,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;