From nobody Sat May 18 05:53:15 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=1689173422; cv=none; d=zohomail.com; s=zohoarc; b=XLSnuE7XcgT1iFlv+uBLYPPYL5YmvMWMx7S54H3x403oDj8pGIPK9wccCAruVqdAcW4A4O0Vwm54EgIOAKwOT3Gx18tT0+cIp5ss281LH6StDfAEwJHZzCySQSzwE1sJ6QD/T9dpe6bzVqU9v9wJ2NZaCSMwTaB/igBzDw4kKbA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689173422; 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=pqVUH20zmDEY1yM2ZIZaz8d4rn3plZ7QZbVu4k0YY9Y=; b=aPHPVwZ52xumDE+MQQ+pptZs9kfg2ecH7nHVqeN05h4aspcSWwhgiVHoGKJ2zC12HfLxQIluv4DBLf3/O9t0yENRp9qLjW7Af0jFEQYGKE7/ZSTCzI2N7fe79r2eSOimdKdZRlqFvLPLRflKXL9YcoS9yXNDGrWMzQRzc005CoM= 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 1689173422299704.6105599423796; Wed, 12 Jul 2023 07:50:22 -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-651-uTgqyC7bMqGxFoN2RlJrxg-1; Wed, 12 Jul 2023 10:50:19 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6ED591044593; Wed, 12 Jul 2023 14:50:16 +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 5955C492C13; Wed, 12 Jul 2023 14:50:16 +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 3564F194658F; Wed, 12 Jul 2023 14:50:16 +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 2986C1946594 for ; Wed, 12 Jul 2023 14:49:59 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 9031940C206F; Wed, 12 Jul 2023 14:49:59 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1D36540C2063 for ; Wed, 12 Jul 2023 14:49:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689173421; 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=pqVUH20zmDEY1yM2ZIZaz8d4rn3plZ7QZbVu4k0YY9Y=; b=VrVOKYXnCcdnoG53015BINdwh0BYcQ6C4BnTMwFrZ7f/ApvJN+i4rhBV0jlCI5Q+jh/1z5 7RIup5bmFT7osNg0hB5fOv47u9VaG/xTrV6xchWcJL7amfUScmlxVeCD2pA+fMDho1RwfG 34Oitw3d9JQREmoPazOyX9cIIsHyaW0= X-MC-Unique: uTgqyC7bMqGxFoN2RlJrxg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/4] qemu: Generate shorter channel target paths Date: Wed, 12 Jul 2023 16:49:53 +0200 Message-ID: <7b387b02912e05fe2f0899606ca0885eecec4df5.1689173148.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.10 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: 1689173423201100001 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 is one component though, that's needless: "/target/". Drop it. 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 | 9 ++++++--- .../qemuhotplug-qemu-agent-detach.xml | 2 +- .../qemuhotplug-base-live+qemu-agent-detach.xml | 2 +- .../qemuhotplug-base-live+qemu-agent.xml | 2 +- tests/qemuxml2argvdata/channel-unix-source-path.xml | 4 ++++ .../channel-unix-source-path-active.xml | 5 +++++ .../channel-unix-source-path-inactive.xml | 4 ++++ 9 files changed, 25 insertions(+), 10 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 94587638c3..b4844351ba 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; @@ -5352,9 +5352,12 @@ qemuDomainDefaultNetModel(const virDomainDef *def, * libvirt 1.2.19 - 1.3.2: * {cfg->channelTargetDir}/domain-{dom-name}/{target-name} * - * libvirt 1.3.3 and newer: + * libvirt 1.3.3 - 9.4.0: * {cfg->channelTargetDir}/domain-{dom-id}-{short-dom-name}/{target-na= me} * + * 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. * @@ -5379,7 +5382,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..2e5cbfe09c 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-live+qemu-agent-= detach.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-live+qemu-agent-= detach.xml index 728af3391e..0469760737 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..8635a686e9 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 @@
+ + + +
+