From nobody Sun May 19 17:58:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1692170148; cv=none; d=zohomail.com; s=zohoarc; b=WMP0gq2A0x2F+Ph+qWgdcAZa7hROxpDXyKGb/PccKt1VeEyQfFovrybnmKdeZgMXpWqjD+F4Gg6Lx43sYl3AkxtnIZoPG1I/AseH16IlKaGHXsClrDgoLz+WJnFbBkHbsJiELAZnJxogK6/FC+TqYhJGzWXHQBVQJQwyDQGGq2U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692170148; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ybN7SQTZzPm+nvvqEOFNj9iF7Q+BSRHguWfOzLeCGnU=; b=Gg3jLKdzScz0aSGxZ4BHx7ObvoHP7VX28hwfigfck/FDAMsNLN5Pt7Wq2PhYtqiCEjNIjxUGWTADPDjlDLdwAa0zLIQbuKf+oDTOXuijH8//dy3qA0JAMeUJtRPhXl9rmdW8/TKOd+i8GXe3bJU4Z+ckYGok8y2Pxekz60mKqps= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1692170148367167.04203368082028; Wed, 16 Aug 2023 00:15:48 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-279-N8Zs9qsFNDy9u_iqEbTW-Q-1; Wed, 16 Aug 2023 03:15:44 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 85103101A528; Wed, 16 Aug 2023 07:15:42 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id BB7032166B2E; Wed, 16 Aug 2023 07:15:41 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 213621946A41; Wed, 16 Aug 2023 07:15:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 8A48D194658C for ; Wed, 16 Aug 2023 07:15:25 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 3743D2026D76; Wed, 16 Aug 2023 07:15:25 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id B79952026D4B for ; Wed, 16 Aug 2023 07:15:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692170147; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ybN7SQTZzPm+nvvqEOFNj9iF7Q+BSRHguWfOzLeCGnU=; b=IrnTvQKWVbtWxSY8LoyXvORo8WoGFU6WUOMylKvjzXk543ISLeIS/5Fj1tirzTr60Wmli9 +bjbRw0EuGTRiijcedwQ0jqE56SkywhIuu5a0oX9a3yOBoX7fnpDcXiKWGSZzChmH2UjxI XmwxVpy2q+745qSu9ozDgjp9rTFQPYo= X-MC-Unique: N8Zs9qsFNDy9u_iqEbTW-Q-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/2] qemu: Generate shorter channel target paths Date: Wed, 16 Aug 2023 09:15:21 +0200 Message-ID: <140dc1efe8944bc0637ff8539715bce6ea432f37.1692170064.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1692170149753100002 Content-Type: text/plain; charset="utf-8"; x-default="true" A device is basically an UNIX socket into guest. Whatever is sent from the host, appears in the guest and vice versa. But because of that, the length of the path to the socket is important (underscored by fact that we derive the path from domain short name). But there are still cases where we might not fit into UNIX_PATH_MAX limit (usually 108 characters), because the path is derived also from other variables, e.g. XDG_CONFIG_HOME for session domains. There are two components though, that are needless: "/target/" and "domain-" prefix. Drop them. This is safe to do, because running domains have their path saved in status XML and even though paths are dropped on migration, they are not part of guest ABI and thus we are free to change them. Signed-off-by: Michal Privoznik Reviewed-by: Pavel Hrdina --- libvirt.spec.in | 1 - src/qemu/qemu_conf.c | 6 +++--- src/qemu/qemu_domain.c | 15 +++++++++------ .../qemuhotplug-qemu-agent-detach.xml | 2 +- .../qemuhotplug-base+qemu-agent-detach.xml | 2 +- .../qemuhotplug-base+qemu-agent.xml | 2 +- .../qemuhotplug-base-live+qemu-agent-detach.xml | 2 +- .../qemuhotplug-base-live+qemu-agent.xml | 2 +- .../qemuxml2argvdata/channel-unix-source-path.xml | 4 ++++ .../channel-unix-source-path-active.xml | 5 +++++ .../channel-unix-source-path-inactive.xml | 4 ++++ tests/testutilsqemu.c | 2 +- 12 files changed, 31 insertions(+), 16 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 17d5f5ff4a..3b179d1fd9 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -2136,7 +2136,6 @@ exit 0 %ghost %dir %{_rundir}/libvirt/qemu/swtpm/ %dir %attr(0751, %{qemu_user}, %{qemu_group}) %{_localstatedir}/lib/libvir= t/qemu/ %dir %attr(0751, %{qemu_user}, %{qemu_group}) %{_localstatedir}/lib/libvir= t/qemu/channel/ -%dir %attr(0751, %{qemu_user}, %{qemu_group}) %{_localstatedir}/lib/libvir= t/qemu/channel/target/ %dir %attr(0751, %{qemu_user}, %{qemu_group}) %{_localstatedir}/lib/libvir= t/qemu/checkpoint/ %dir %attr(0751, %{qemu_user}, %{qemu_group}) %{_localstatedir}/lib/libvir= t/qemu/dump/ %dir %attr(0751, %{qemu_user}, %{qemu_group}) %{_localstatedir}/lib/libvir= t/qemu/nvram/ diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index bd984448a3..532fe36be3 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -151,7 +151,7 @@ virQEMUDriverConfig *virQEMUDriverConfigNew(bool privil= eged, cfg->snapshotDir =3D g_strdup_printf("%s/snapshot", cfg->libDir); cfg->checkpointDir =3D g_strdup_printf("%s/checkpoint", cfg->libDi= r); cfg->autoDumpPath =3D g_strdup_printf("%s/dump", cfg->libDir); - cfg->channelTargetDir =3D g_strdup_printf("%s/channel/target", cfg= ->libDir); + cfg->channelTargetDir =3D g_strdup_printf("%s/channel", cfg->libDi= r); cfg->nvramDir =3D g_strdup_printf("%s/nvram", cfg->libDir); cfg->memoryBackingDir =3D g_strdup_printf("%s/ram", cfg->libDir); } else if (privileged) { @@ -173,7 +173,7 @@ virQEMUDriverConfig *virQEMUDriverConfigNew(bool privil= eged, cfg->snapshotDir =3D g_strdup_printf("%s/snapshot", cfg->libDir); cfg->checkpointDir =3D g_strdup_printf("%s/checkpoint", cfg->libDi= r); cfg->autoDumpPath =3D g_strdup_printf("%s/dump", cfg->libDir); - cfg->channelTargetDir =3D g_strdup_printf("%s/channel/target", cfg= ->libDir); + cfg->channelTargetDir =3D g_strdup_printf("%s/channel", cfg->libDi= r); cfg->nvramDir =3D g_strdup_printf("%s/nvram", cfg->libDir); cfg->memoryBackingDir =3D g_strdup_printf("%s/ram", cfg->libDir); cfg->swtpmStorageDir =3D g_strdup_printf("%s/lib/libvirt/swtpm", @@ -201,7 +201,7 @@ virQEMUDriverConfig *virQEMUDriverConfigNew(bool privil= eged, cfg->checkpointDir =3D g_strdup_printf("%s/qemu/checkpoint", cfg->configBaseDir); cfg->autoDumpPath =3D g_strdup_printf("%s/qemu/dump", cfg->configB= aseDir); - cfg->channelTargetDir =3D g_strdup_printf("%s/qemu/channel/target", + cfg->channelTargetDir =3D g_strdup_printf("%s/qemu/channel", cfg->configBaseDir); cfg->nvramDir =3D g_strdup_printf("%s/qemu/nvram", cfg->configBase= Dir); cfg->memoryBackingDir =3D g_strdup_printf("%s/qemu/ram", cfg->conf= igBaseDir); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 029238a9d7..224350dabc 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1780,7 +1780,7 @@ qemuDomainSetPrivatePaths(virQEMUDriver *driver, priv->libDir =3D g_strdup_printf("%s/domain-%s", cfg->libDir, domn= ame); =20 if (!priv->channelTargetDir) - priv->channelTargetDir =3D g_strdup_printf("%s/domain-%s", + priv->channelTargetDir =3D g_strdup_printf("%s/%s", cfg->channelTargetDir, do= mname); =20 return 0; @@ -5405,13 +5405,16 @@ qemuDomainDefaultNetModel(const virDomainDef *def, * Clear auto generated unix socket paths: * * libvirt 1.2.18 and older: - * {cfg->channelTargetDir}/{dom-name}.{target-name} + * {cfg->channelTargetDir}/target/{dom-name}.{target-name} * * libvirt 1.2.19 - 1.3.2: - * {cfg->channelTargetDir}/domain-{dom-name}/{target-name} + * {cfg->channelTargetDir}/target/domain-{dom-name}/{target-name} * - * libvirt 1.3.3 and newer: - * {cfg->channelTargetDir}/domain-{dom-id}-{short-dom-name}/{target-na= me} + * libvirt 1.3.3 - 9.7.0: + * {cfg->channelTargetDir}/target/domain-{dom-id}-{short-dom-name}/{ta= rget-name} + * + * libvirt 9.7.0 and newer: + * {cfg->channelTargetDir}/{dom-id}-{short-dom-name}/{target-name} * * The unix socket path was stored in config XML until libvirt 1.3.0. * If someone specifies the same path as we generate, they shouldn't do it. @@ -5437,7 +5440,7 @@ qemuDomainChrDefDropDefaultPath(virDomainChrDef *chr, cfg =3D virQEMUDriverGetConfig(driver); =20 virBufferEscapeRegex(&buf, "^%s", cfg->channelTargetDir); - virBufferAddLit(&buf, "/([^/]+\\.)|(domain-[^/]+/)"); + virBufferAddLit(&buf, "/(target/)?([^/]+\\.)|(domain-[^/]+/)|([0-9]+-[= ^/]+/)"); virBufferEscapeRegex(&buf, "%s$", chr->target.name); =20 regexp =3D virBufferContentAndReset(&buf); diff --git a/tests/qemuhotplugtestdevices/qemuhotplug-qemu-agent-detach.xml= b/tests/qemuhotplugtestdevices/qemuhotplug-qemu-agent-detach.xml index 0c3c70a78e..7871de59c4 100644 --- a/tests/qemuhotplugtestdevices/qemuhotplug-qemu-agent-detach.xml +++ b/tests/qemuhotplugtestdevices/qemuhotplug-qemu-agent-detach.xml @@ -1,5 +1,5 @@ - +
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base+qemu-agent-detac= h.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base+qemu-agent-detach.xml index 728af3391e..bf2afb67d9 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base+qemu-agent-detach.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base+qemu-agent-detach.xml @@ -39,7 +39,7 @@
- +
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base+qemu-agent.xml b= /tests/qemuhotplugtestdomains/qemuhotplug-base+qemu-agent.xml index 728af3391e..31917cee92 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base+qemu-agent.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base+qemu-agent.xml @@ -39,7 +39,7 @@
- +
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+qemu-agent-= detach.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+qemu-agent-= detach.xml index 728af3391e..bf2afb67d9 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+qemu-agent-detach.= xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+qemu-agent-detach.= xml @@ -39,7 +39,7 @@
- +
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+qemu-agent.= xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+qemu-agent.xml index 0e4c3907bf..00191a9cb8 100644 --- a/tests/qemuhotplugtestdomains/qemuhotplug-base-live+qemu-agent.xml +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+qemu-agent.xml @@ -42,7 +42,7 @@
- +
diff --git a/tests/qemuxml2argvdata/channel-unix-source-path.xml b/tests/qe= muxml2argvdata/channel-unix-source-path.xml index f24c636147..db0e99c3d1 100644 --- a/tests/qemuxml2argvdata/channel-unix-source-path.xml +++ b/tests/qemuxml2argvdata/channel-unix-source-path.xml @@ -24,6 +24,10 @@ + + + + diff --git a/tests/qemuxml2xmloutdata/channel-unix-source-path-active.xml b= /tests/qemuxml2xmloutdata/channel-unix-source-path-active.xml index 0d6a0295f8..68835ceb15 100644 --- a/tests/qemuxml2xmloutdata/channel-unix-source-path-active.xml +++ b/tests/qemuxml2xmloutdata/channel-unix-source-path-active.xml @@ -41,6 +41,11 @@
+ + + +
+