From 78f66a12ea5325991ea55a3ed9b015a647a58cc0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Wed, 12 Feb 2020 11:45:10 +0000 Subject: [PATCH] qemu: drop support for agent connections on PTYs MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 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 Signed-off-by: Daniel P. Berrangé --- 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 cd25ef6cd3..9f3fb9732f 100644 --- a/src/qemu/qemu_agent.c +++ b/src/qemu/qemu_agent.c @@ -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; -- 2.39.5