From nobody Fri May 16 12:22:08 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1496068330917458.1692252943815; Mon, 29 May 2017 07:32:10 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 49276C057FA7; Mon, 29 May 2017 14:32:08 +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 1EB614DA84; Mon, 29 May 2017 14:32:08 +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 B93AC4A491; Mon, 29 May 2017 14:32:07 +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 v4TEVteP016361 for ; Mon, 29 May 2017 10:31:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id 104E31850F; Mon, 29 May 2017 14:31:55 +0000 (UTC) Received: from antique-work.brq.redhat.com (dhcp129-230.brq.redhat.com [10.34.129.230]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8BBE31850C for ; Mon, 29 May 2017 14:31:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 49276C057FA7 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 49276C057FA7 From: Pavel Hrdina To: libvir-list@redhat.com Date: Mon, 29 May 2017 16:31:48 +0200 Message-Id: <8031595bd0a83e35d46edadc1c52424cbe275e0f.1496068215.git.phrdina@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 2/4] qemu: introduce chardevStdioLogd to qemu private data 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 29 May 2017 14:32:09 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" In QEMU driver we can use virtlogd as stdio handler for source backend of char devices if current QEMU is new enough and it's enabled in qemu.conf. We should store this information while starting a guest because the config option may change while the guest is running. Signed-off-by: Pavel Hrdina Reviewed-by: John Ferlan --- Notes: new in v2 src/qemu/qemu_domain.c | 6 ++++++ src/qemu/qemu_domain.h | 3 +++ src/qemu/qemu_process.c | 9 +++++++++ 3 files changed, 18 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0a85ee9d74..b0e3df7009 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1873,6 +1873,9 @@ qemuDomainObjPrivateXMLFormat(virBufferPtr buf, virBufferEscapeString(buf, "\n", priv->channelTargetDir); =20 + if (priv->chardevStdioLogd) + virBufferAddLit(buf, ""); + return 0; } =20 @@ -2141,6 +2144,9 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, if (qemuDomainSetPrivatePathsOld(driver, vm) < 0) goto error; =20 + priv->chardevStdioLogd =3D virXPathBoolean("boolean(./chardevStdioLogd= )", + ctxt) =3D=3D 1; + return 0; =20 error: diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index aebd91ad37..9fb7c339a3 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -293,6 +293,9 @@ struct _qemuDomainObjPrivate { /* Used when fetching/storing the current 'tls-creds' migration settin= g */ /* (not to be saved in our private XML). */ char *migTLSAlias; + + /* If true virtlogd is used as stdio handler for character devices. */ + bool chardevStdioLogd; }; =20 # define QEMU_DOMAIN_PRIVATE(vm) \ diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index be031b56b9..77c2e5f6d3 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5367,6 +5367,7 @@ qemuProcessPrepareDomain(virConnectPtr conn, size_t i; char *nodeset =3D NULL; qemuDomainObjPrivatePtr priv =3D vm->privateData; + virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver); virCapsPtr caps; =20 if (!(caps =3D virQEMUDriverGetCapabilities(driver, false))) @@ -5403,6 +5404,13 @@ qemuProcessPrepareDomain(virConnectPtr conn, } } =20 + /* Whether we should use virtlogd as stdio handler for character + * devices source backend. */ + if (cfg->stdioLogD && + virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_CHARDEV_FILE_APPEND)) { + priv->chardevStdioLogd =3D true; + } + /* * Normally PCI addresses are assigned in the virDomainCreate * or virDomainDefine methods. We might still need to assign @@ -5466,6 +5474,7 @@ qemuProcessPrepareDomain(virConnectPtr conn, cleanup: VIR_FREE(nodeset); virObjectUnref(caps); + virObjectUnref(cfg); return ret; } =20 --=20 2.13.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list