From nobody Thu Nov 21 17:59:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1732119349; cv=none; d=zohomail.com; s=zohoarc; b=GTIsBgjA3PYdU9fNpmHkVr7DqSr6NPyKVAtrkU5mavy09TXHIpzGATkXR4icM4G1pEYKqtphwTf/kbXfdCsQ6nN5wbsvq19EgAhZ22Qw1qu9QV5zNxWl209gSYcOXy4K28jGlOUHYCnEVciLfJOmZJhjeCuIEDiUjehW80TQ1IY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732119349; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=Bzxd/3jCbB65ynzhto7ECdCOYUHXSBhOFBZ3r98RZ28=; b=CLx5NtpsyV4fhgk2WPWDRrVdGdizXRwzez4eHRfxoi9ejhEjNqDb01TNnYFccncNKSmKBrq+j3klv2WFzur4djD4NtIeuBIwcFSOgM6FhuczHVqsDF4Hb5pkZXNKNZUHqcezBwAn+/kdwI3WsZOj4zHMD84HxoWLLcFtapUyKg0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1732119349026329.4828071615033; Wed, 20 Nov 2024 08:15:49 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id BE861128D; Wed, 20 Nov 2024 11:15:47 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 97C0B151C; Wed, 20 Nov 2024 11:10:13 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 676021518; Wed, 20 Nov 2024 11:10:05 -0500 (EST) Received: from relay.virtuozzo.com (relay.virtuozzo.com [130.117.225.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id F3ADC154F for ; Wed, 20 Nov 2024 11:09:48 -0500 (EST) Received: from [130.117.225.1] (helo=vz9-barybin-2.ch-qa.vzint.dev) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1tDn0x-0005yc-1S; Wed, 20 Nov 2024 16:53:11 +0100 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=MIME-Version:Message-ID:Date:Subject:From: Content-Type; bh=Vye28wu07v02JTRsB9t2kcR3+02Oo3DfeymOu1whKb8=; b=xFYd+wtMGPpD r61CHrAer/lipZNRLPXcA5xFcBvLX09JY9vHVXZoby45Ia8z83s3HrIDcnl108Oh88l47MQBuH1yj q78h8KN27Xfob0hviq0T9boApKLjXiYlNd9NhlVD8xscEFsQR/pkF6kbRM2l3dcBi5MhvDhZSgXxv aDZCUVkLFizvXIXKsRO10ZdLUb71m/tIFWZan9ITVEJFna4TrdhZQK7xH8MwejqxJNe8zXBOUJ9xx td+7hymlYVnToBXp+tEXbJYu+zymfSD90NAhBHAs3WNi7PGLk4KFTPteXBQDyb32QuEs97iInYLBk 7LwEifQfTLyA5F1Qb+hzgw==; To: devel@lists.libvirt.org Subject: [PATCH 11/15] qemu: put data-file path to VM's cgroup and namespace Date: Wed, 20 Nov 2024 18:48:46 +0300 Message-ID: <20241120155229.1259-12-nikolai.barybin@virtuozzo.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241120155229.1259-1-nikolai.barybin@virtuozzo.com> References: <20241120155229.1259-1-nikolai.barybin@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: NTK2KQSFOVDRNSPWXQCXLD7FOD3A4LTJ X-Message-ID-Hash: NTK2KQSFOVDRNSPWXQCXLD7FOD3A4LTJ X-MailFrom: nikolai.barybin@virtuozzo.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: den@openvz.org, Nikolai Barybin X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: From: Nikolai Barybin via Devel Reply-To: Nikolai Barybin X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1732119349385116600 Content-Type: text/plain; charset="utf-8" Signed-off-by: Nikolai Barybin Reviewed-by: Peter Krempa --- src/qemu/qemu_cgroup.c | 13 ++++++++++++- src/qemu/qemu_namespace.c | 7 +++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index be4b9a38ff..f3c85d65e8 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -232,7 +232,14 @@ int qemuSetupImageCgroup(virDomainObj *vm, virStorageSource *src) { - return qemuSetupImageCgroupInternal(vm, src, false); + if (qemuSetupImageCgroupInternal(vm, src, false) < 0) + return -1; + + if (src->dataFileStore && + qemuSetupImageCgroupInternal(vm, src->dataFileStore, false) < 0) + return -1; + + return 0; } =20 =20 @@ -321,6 +328,10 @@ qemuSetupImageChainCgroup(virDomainObj *vm, if (qemuSetupImageCgroupInternal(vm, next, forceReadonly) < 0) return -1; =20 + if (next->dataFileStore && + qemuSetupImageCgroupInternal(vm, next->dataFileStore, forceRea= donly) < 0) + return -1; + /* setup only the top level image for read-write */ forceReadonly =3D true; } diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c index 0ebc115524..9fc13ee759 100644 --- a/src/qemu/qemu_namespace.c +++ b/src/qemu/qemu_namespace.c @@ -272,6 +272,13 @@ qemuDomainSetupDisk(virStorageSource *src, } else { GSList *targetPaths =3D NULL; =20 + if (next->dataFileStore && + !virStorageSourceIsEmpty(next->dataFileStore) && + virStorageSourceIsLocalStorage(next->dataFileStore)) { + g_autofree char *dataFilePath =3D g_strdup(next->dataFileS= tore->path); + *paths =3D g_slist_prepend(*paths, g_steal_pointer(&dataFi= lePath)); + } + if (virStorageSourceIsEmpty(next) || !virStorageSourceIsLocalStorage(next)) { /* Not creating device. Just continue. */ --=20 2.43.5