From nobody Fri Apr 26 19:07:51 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1581507843203586.6858216333837; Wed, 12 Feb 2020 03:44:03 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-401--3KAXX0NPPWt9xdZeZVvFg-1; Wed, 12 Feb 2020 06:43:59 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 422E01088387; Wed, 12 Feb 2020 11:43:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 054D95DA87; Wed, 12 Feb 2020 11:43:53 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id BDD5B866BD; Wed, 12 Feb 2020 11:43:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01CBfEWQ016511 for ; Wed, 12 Feb 2020 06:41:14 -0500 Received: by smtp.corp.redhat.com (Postfix) id B61845DA84; Wed, 12 Feb 2020 11:41:14 +0000 (UTC) Received: from domokun.gsslab.fab.redhat.com (unknown [10.33.8.110]) by smtp.corp.redhat.com (Postfix) with ESMTP id 26D2E5D9E2; Wed, 12 Feb 2020 11:41:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581507841; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=pqt7FCfr/QK6NYm8PRQNJh7rLRiPaL9Vwt+x+zcaGac=; b=AnKtpRrpDuSG8CK+npVa9IDLMEaLVxcd2586lbSFMXk7geFagoXg9IUZaduOcsX5VqUy8v XTmue/V+8rwYpBUvkazGzfQ32qq2fxstQpdFQ0PONJ8j2mvwaqO/Wwh4tzLfos4pBTwKSR 4WGSBDaGKQ/kpP+hDGjiAGfcpCzgihM= From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v2] qemu: drop support for monitor connections on PTYs Date: Wed, 12 Feb 2020 11:41:08 +0000 Message-Id: <20200212114108.3041280-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: -3KAXX0NPPWt9xdZeZVvFg-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Libvirt switched to using a UNIX socket for monitors in 2009 for version 0.7.0. It seems unlikely that there is a running QEMU process that hasn't been restarted for 11 years while also taking a libvirt upgrade. Therefore we can drop support for opening a PTY for the QEMU monitor. Signed-off-by: Daniel P. Berrang=C3=A9 --- In v2: - Now with all changes actually committed src/qemu/qemu_monitor.c | 60 +++++++---------------------------------- 1 file changed, 9 insertions(+), 51 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 802ad20aa1..008d4a0e75 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -77,7 +77,6 @@ struct _qemuMonitor { * =3D 0: not registered * < 0: an error occurred during the registration of @fd */ int watch; - int hasSendFD; =20 virDomainObjPtr vm; =20 @@ -303,21 +302,6 @@ qemuMonitorOpenUnix(const char *monitor, } =20 =20 -static int -qemuMonitorOpenPty(const char *monitor) -{ - int monfd; - - if ((monfd =3D open(monitor, O_RDWR)) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to open monitor path %s"), monitor); - return -1; - } - - return monfd; -} - - /* This method processes data that has been received * from the monitor. Looking for async events and * replies/errors. @@ -434,12 +418,6 @@ qemuMonitorIOWrite(qemuMonitorPtr mon) if (!mon->msg || mon->msg->txOffset =3D=3D mon->msg->txLength) return 0; =20 - if (mon->msg->txFD !=3D -1 && !mon->hasSendFD) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Monitor does not support sending of file descrip= tors")); - return -1; - } - buf =3D mon->msg->txBuffer + mon->msg->txOffset; len =3D mon->msg->txLength - mon->msg->txOffset; if (mon->msg->txFD =3D=3D -1) @@ -707,7 +685,6 @@ qemuMonitorIO(int watch, int fd, int events, void *opaq= ue) static qemuMonitorPtr qemuMonitorOpenInternal(virDomainObjPtr vm, int fd, - bool hasSendFD, qemuMonitorCallbacksPtr cb, void *opaque) { @@ -736,7 +713,6 @@ qemuMonitorOpenInternal(virDomainObjPtr vm, goto cleanup; } mon->fd =3D fd; - mon->hasSendFD =3D hasSendFD; mon->vm =3D virObjectRef(vm); mon->waitGreeting =3D true; mon->cb =3D cb; @@ -810,7 +786,6 @@ qemuMonitorOpen(virDomainObjPtr vm, void *opaque) { int fd =3D -1; - bool hasSendFD =3D false; qemuMonitorPtr ret =3D NULL; =20 timeout +=3D QEMU_DEFAULT_MONITOR_WAIT; @@ -819,28 +794,18 @@ qemuMonitorOpen(virDomainObjPtr vm, * deleted until the monitor gets its own reference. */ virObjectRef(vm); =20 - switch (config->type) { - case VIR_DOMAIN_CHR_TYPE_UNIX: - hasSendFD =3D true; - virObjectUnlock(vm); - fd =3D qemuMonitorOpenUnix(config->data.nix.path, - vm->pid, retry, timeout); - virObjectLock(vm); - break; - - case VIR_DOMAIN_CHR_TYPE_PTY: - virObjectUnlock(vm); - fd =3D qemuMonitorOpenPty(config->data.file.path); - virObjectLock(vm); - break; - - default: + if (config->type !=3D VIR_DOMAIN_CHR_TYPE_UNIX) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unable to handle monitor type: %s"), virDomainChrTypeToString(config->type)); - break; + goto cleanup; } =20 + virObjectUnlock(vm); + fd =3D qemuMonitorOpenUnix(config->data.nix.path, + vm->pid, retry, timeout); + virObjectLock(vm); + if (fd < 0) goto cleanup; =20 @@ -850,7 +815,7 @@ qemuMonitorOpen(virDomainObjPtr vm, goto cleanup; } =20 - ret =3D qemuMonitorOpenInternal(vm, fd, hasSendFD, cb, opaque); + ret =3D qemuMonitorOpenInternal(vm, fd, cb, opaque); cleanup: if (!ret) VIR_FORCE_CLOSE(fd); @@ -865,7 +830,7 @@ qemuMonitorOpenFD(virDomainObjPtr vm, qemuMonitorCallbacksPtr cb, void *opaque) { - return qemuMonitorOpenInternal(vm, sockfd, true, cb, opaque); + return qemuMonitorOpenInternal(vm, sockfd, cb, opaque); } =20 =20 @@ -2675,13 +2640,6 @@ qemuMonitorSendFileHandle(qemuMonitorPtr mon, return -1; } =20 - if (!mon->hasSendFD) { - virReportError(VIR_ERR_OPERATION_UNSUPPORTED, - _("qemu is not using a unix socket monitor, " - "cannot send fd %s"), fdname); - return -1; - } - return qemuMonitorJSONSendFileHandle(mon, fdname, fd); } =20 --=20 2.24.1