From nobody Sun May 5 14:28:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; envelope-from=libvir-list-bounces@redhat.com; helo=mx6-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) by mx.zohomail.com with SMTPS id 1489051829329632.0828040579049; Thu, 9 Mar 2017 01:30:29 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v299RDSo062114; Thu, 9 Mar 2017 04:27:13 -0500 Received: from smtp.corp.redhat.com (int-mx16.intmail.prod.int.phx2.redhat.com [10.5.11.28]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v299RCfO012015 for ; Thu, 9 Mar 2017 04:27:12 -0500 Received: by smtp.corp.redhat.com (Postfix) id 345B92D654; Thu, 9 Mar 2017 09:27:12 +0000 (UTC) Received: from antique-work.brq.redhat.com (dhcp129-175.brq.redhat.com [10.34.129.175]) by smtp.corp.redhat.com (Postfix) with ESMTP id B0D512D653 for ; Thu, 9 Mar 2017 09:27:11 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Thu, 9 Mar 2017 10:27:08 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.74 on 10.5.11.28 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 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 --- Notes: Version 2: - store autoGenerated as bool src/conf/domain_conf.c | 19 ++++++++++++++++++- src/qemu/qemu_domain.c | 3 ++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 97d42fe993..c0c1549a65 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,18 @@ virDomainGraphicsListenDefParseXML(virDomainGraphi= csListenDefPtr def, def->fromConfig =3D tmp !=3D 0; } =20 + if (autoGenerated && + flags & VIR_DOMAIN_DEF_PARSE_STATUS) { + if (STREQ(autoGenerated, "yes")) { + def->autoGenerated =3D true; + } else if (STRNEQ(autoGenerated, "no")) { + virReportError(VIR_ERR_XML_ERROR, + _("Invalid autoGenerated value: %s"), + autoGenerated); + goto error; + } + } + ret =3D 0; error: if (ret < 0) @@ -11671,6 +11684,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 +22908,11 @@ 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'%s'", + def->autoGenerated ? "yes" : "no"); + } =20 virBufferAddLit(buf, "/>\n"); } diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 4d184d3030..1a42fcf1b3 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2567,11 +2567,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.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 14:28:53 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 1489051824699663.1355498782774; Thu, 9 Mar 2017 01:30:24 -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 v299REdu055129; Thu, 9 Mar 2017 04:27:14 -0500 Received: from smtp.corp.redhat.com (int-mx16.intmail.prod.int.phx2.redhat.com [10.5.11.28]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v299RDrO012027 for ; Thu, 9 Mar 2017 04:27:13 -0500 Received: by smtp.corp.redhat.com (Postfix) id 076FB2D654; Thu, 9 Mar 2017 09:27:13 +0000 (UTC) Received: from antique-work.brq.redhat.com (dhcp129-175.brq.redhat.com [10.34.129.175]) by smtp.corp.redhat.com (Postfix) with ESMTP id 816AA2D653 for ; Thu, 9 Mar 2017 09:27:12 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Thu, 9 Mar 2017 10:27:09 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.74 on 10.5.11.28 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 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 --- Notes: Version 2: - no change 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 c0c1549a65..a58f997621 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -23134,6 +23134,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.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list