From nobody Sat May 18 03:46:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1690193508; cv=none; d=zohomail.com; s=zohoarc; b=WhRob3XHFN5vcsDaj0Pa+XXxnVJwR8k3s8NlLAPggGxRypuezzR438DSjL9Bo8a09ysqF+ehoxol7uMYwd52Lm1NBaJ5f41QOxWInhZy1a76n9l2e+KBEvB2cUqSapowl7KA4KdVf6E1ppBGxEBsWvnj+o1kRwAE7MloEjmrsjI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690193508; 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=xUyR0cYDdCNC/4r02XssbAl9R2EHZIqRSSeFI7bVRDY=; b=jYwA/t6QrX3C14NeioRKU2GZurZDLQWffLH6EsGHQWu0af6CoFOeSpnQkxd9aO0HhZN44v/38Fa7v8VV8QXNkGljNGkDq+eQ4V0EbpJCyjyammbeZarVg/pW4MYYqsBIFYSXhQ4Z55w2PCP5S3gf6xG+zT8KCwF1QezLRBLxi+s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1690193508473671.071054963019; Mon, 24 Jul 2023 03:11: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-364-sf7U-VEfM6O5Tj7-nHQHWg-1; Mon, 24 Jul 2023 06:11:45 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 33A288870D9; Mon, 24 Jul 2023 10:11:43 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1928D40C2071; Mon, 24 Jul 2023 10:11:43 +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 88D57194658F; Mon, 24 Jul 2023 10:11:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 29B521946588 for ; Mon, 24 Jul 2023 10:11:41 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 1CA0540C206F; Mon, 24 Jul 2023 10:11:41 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9DA8E40C2063 for ; Mon, 24 Jul 2023 10:11:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690193507; 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=xUyR0cYDdCNC/4r02XssbAl9R2EHZIqRSSeFI7bVRDY=; b=bpDKs6Dd9/ZdzHIgGM0WGqf1Ct7rplSY5cdOc/eMfii5DKmyXsj9qnQdVtGk+XbcuKgOUl pButG09OFOYWqz7KKtaxN7jobN18SULtSpPP9c8KyCoAXf+uE6wq56NFXGnN1Mgb9gO+3J z733xlc1oaGAo9NTX5mKwHkqG872vZg= X-MC-Unique: sf7U-VEfM6O5Tj7-nHQHWg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2 1/2] qemu: Generate shorter channel target paths Date: Mon, 24 Jul 2023 12:11:36 +0200 Message-ID: <58e63bb2d0fe77e6cd7161824517654d4fe1baa1.1690193388.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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.1 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: 1690193509394100002 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 --- 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 1f77cd90b7..8aee709e42 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -2125,7 +2125,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 6eea8a9fa5..fba5185c1e 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; @@ -5396,13 +5396,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.4.0: + * {cfg->channelTargetDir}/target/domain-{dom-id}-{short-dom-name}/{ta= rget-name} + * + * libvirt 9.6.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. @@ -5428,7 +5431,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 @@
+ + + +
+