From nobody Sun Apr 28 20:46:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) client-ip=209.132.183.37; envelope-from=libvir-list-bounces@redhat.com; helo=mx5-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) by mx.zohomail.com with SMTPS id 1488213255541619.6282721275912; Mon, 27 Feb 2017 08:34:15 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1RGVCqT029319; Mon, 27 Feb 2017 11:31:12 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1RGV9kK020442 for ; Mon, 27 Feb 2017 11:31:09 -0500 Received: from antique-work.brq.redhat.com (dhcp129-175.brq.redhat.com [10.34.129.175]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1RGV7JS017199 for ; Mon, 27 Feb 2017 11:31:09 -0500 From: Pavel Hrdina To: libvir-list@redhat.com Date: Mon, 27 Feb 2017 17:31:05 +0100 Message-Id: <2ce0877a1b2f33d270b9e8d041af9142d942fe8c.1488212953.git.phrdina@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/2] conf: store "autoGenerated" for graphics listen in status XML 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When libvirtd is started we call qemuDomainRecheckInternalPaths to detect whether a domain has VNC socket path generated by libvirt based on option from qemu.conf. However if we are parsing status XML for running domain the existing socket path can be generated also if the config XML uses the new element without specifying any socket. The current code doesn't make difference how the socket was generated and always marks it as "fromConfig". We need to store the "autoGenerated" value in the status XML in order to preserve that information. The difference between "fromConfig" and "autoGenerated" is important for migration, because if the socket is based on "fromConfig" we don't print it into the migratable XML and we assume that user has properly configured qemu.conf on both hosts. However if the socket is based on "autoGenerated" it means that a new feature was used and therefore we need to leave the socket in migratable XML to make sure that if this feature is not supported on destination the migration will fail. Signed-off-by: Pavel Hrdina --- src/conf/domain_conf.c | 17 ++++++++++++++++- src/qemu/qemu_domain.c | 3 ++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 97d42fe993..db1890f8a7 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -11543,6 +11543,7 @@ virDomainGraphicsListenDefParseXML(virDomainGraphic= sListenDefPtr def, char *network =3D virXMLPropString(node, "network"); char *socketPath =3D virXMLPropString(node, "socket"); char *fromConfig =3D virXMLPropString(node, "fromConfig"); + char *autoGenerated =3D virXMLPropString(node, "autoGenerated"); char *addressCompat =3D NULL; char *socketCompat =3D NULL; const char *graphicsType =3D virDomainGraphicsTypeToString(graphics->t= ype); @@ -11662,6 +11663,17 @@ virDomainGraphicsListenDefParseXML(virDomainGraphi= csListenDefPtr def, def->fromConfig =3D tmp !=3D 0; } =20 + if (autoGenerated && + flags & VIR_DOMAIN_DEF_PARSE_STATUS) { + if (virStrToLong_i(autoGenerated, NULL, 10, &tmp) < 0) { + virReportError(VIR_ERR_XML_ERROR, + _("Invalid autoGenerated value: %s"), + autoGenerated); + goto error; + } + def->autoGenerated =3D tmp !=3D 0; + } + ret =3D 0; error: if (ret < 0) @@ -11671,6 +11683,7 @@ virDomainGraphicsListenDefParseXML(virDomainGraphic= sListenDefPtr def, VIR_FREE(network); VIR_FREE(socketPath); VIR_FREE(fromConfig); + VIR_FREE(autoGenerated); VIR_FREE(addressCompat); VIR_FREE(socketCompat); return ret; @@ -22894,8 +22907,10 @@ virDomainGraphicsListenDefFormat(virBufferPtr buf, virBufferEscapeString(buf, " socket=3D'%s'", def->socket); } =20 - if (flags & VIR_DOMAIN_DEF_FORMAT_STATUS) + if (flags & VIR_DOMAIN_DEF_FORMAT_STATUS) { virBufferAsprintf(buf, " fromConfig=3D'%d'", def->fromConfig); + virBufferAsprintf(buf, " autoGenerated=3D'%d'", def->autoGenerated= ); + } =20 virBufferAddLit(buf, "/>\n"); } diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index c187214dc3..2bd6affe33 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2541,11 +2541,12 @@ qemuDomainRecheckInternalPaths(virDomainDefPtr def, /* This will happen only if we parse XML from old libvirts whe= re * unix socket was available only for VNC graphics. In this * particular case we should follow the behavior and if we rem= ove - * the auto-generated socket base on config option from qemu.c= onf + * the auto-generated socket based on config option from qemu.= conf * we need to change the listen type to address. */ if (graphics->type =3D=3D VIR_DOMAIN_GRAPHICS_TYPE_VNC && glisten->type =3D=3D VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKE= T && glisten->socket && + !glisten->autoGenerated && STRPREFIX(glisten->socket, cfg->libDir)) { if (flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) { VIR_FREE(glisten->socket); --=20 2.11.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 20:46:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) client-ip=209.132.183.25; envelope-from=libvir-list-bounces@redhat.com; helo=mx4-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by mx.zohomail.com with SMTPS id 1488213291720968.8104936230542; Mon, 27 Feb 2017 08:34:51 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1RGVs9X001497; Mon, 27 Feb 2017 11:31:54 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1RGVAJj020450 for ; Mon, 27 Feb 2017 11:31:10 -0500 Received: from antique-work.brq.redhat.com (dhcp129-175.brq.redhat.com [10.34.129.175]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1RGV7JT017199 for ; Mon, 27 Feb 2017 11:31:09 -0500 From: Pavel Hrdina To: libvir-list@redhat.com Date: Mon, 27 Feb 2017 17:31:06 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/2] conf: properly skip graphics listen element in migratable XML 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We should skip only if the 'socket' path is specified because if there is no 'socket' path we need to keep that element in migratable XML. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1366088 Signed-off-by: Pavel Hrdina --- src/conf/domain_conf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index db1890f8a7..4c72cf0573 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -23132,6 +23132,7 @@ virDomainGraphicsDefFormat(virBufferPtr buf, * thus we can generate it in the migrateble XML. */ if (def->type =3D=3D VIR_DOMAIN_GRAPHICS_TYPE_VNC && def->listens[i].type =3D=3D VIR_DOMAIN_GRAPHICS_LISTEN_TYP= E_SOCKET && + def->listens[i].socket && !def->listens[i].autoGenerated) continue; =20 --=20 2.11.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list