From: Daniel P. Berrangé Date: Wed, 12 Feb 2020 11:45:10 +0000 (+0000) Subject: qemu: drop support for agent connections on PTYs X-Git-Tag: v6.2.0-rc1~276 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=78f66a12ea5325991ea55a3ed9b015a647a58cc0;p=thirdparty%2Flibvirt.git qemu: drop support for agent connections on PTYs 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é --- 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;