From nobody Tue May 7 12:25:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1629902615; cv=none; d=zohomail.com; s=zohoarc; b=nYkXWiFSo2AwhkjksIU46RQnJgIpG3HE9KJr619a/s2gsa/OjcAbFUVQ6tqe6MkRSr4eNy8pVGsmTgp9DQ/f226xZ6bZQRPv1UPNGi6o+McoEIs56sBrd9X8F9TuKGtn+p5ySGtezqucq4ByI16ADmZ5ZAuXYxxq51VmRFfJ+Hs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629902615; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=DhKx+X1/KgjJeBf1AiH5y9fdmX4A2Dg4UaVbg0bD6h8=; b=kLM9x7U/bq8E2D4n2Uz1YPabyPAvoPnlZLbW+fQMw5GtgbzTeQLr7SeOeZILBm0A52Li95oilcfgeAWkOVGYZajZ8yk18NnfSMtcCglzQ+mfpuFfTIw6/ucYL4VDNmTi7+Vk6USMISA6/vUB1xIqgFwAxzfbTqCnVLSJhrRMF8I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1629902614993807.7722435758136; Wed, 25 Aug 2021 07:43:34 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-237-GdkR53Y0OM62eA4F9y55Og-1; Wed, 25 Aug 2021 10:43:32 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 56A5087D541; Wed, 25 Aug 2021 14:43:26 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5FB9B19C59; Wed, 25 Aug 2021 14:43:24 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A3065181A0F7; Wed, 25 Aug 2021 14:43:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17PEhJSv024791 for ; Wed, 25 Aug 2021 10:43:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id DB39560C05; Wed, 25 Aug 2021 14:43:19 +0000 (UTC) Received: from antique-laptop.redhat.com (unknown [10.40.208.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4750460C0F for ; Wed, 25 Aug 2021 14:43:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629902613; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=DhKx+X1/KgjJeBf1AiH5y9fdmX4A2Dg4UaVbg0bD6h8=; b=gGmFD+T/ZK6Q1vAfUgN+zAdGy3h5eRTRh8iTbKuxyakthBcEeD611S/0gTHhzEaWuLn6Wq IUqmVasg4DZGfJ23HmY7Ta8vY8msMF/+q3+uVbzt+iQFRl+YotHfNez/ONSQsXgDoyevgG BCZ4iC4egOjKM0fcgCVgVpiymnsR6Oo= X-MC-Unique: GdkR53Y0OM62eA4F9y55Og-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH] src: fix generation of default resource partition Date: Wed, 25 Aug 2021 16:43:14 +0200 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1629902616456100003 Content-Type: text/plain; charset="utf-8" Now that resource structure can have appid as well we need to adapt code that creates default resource partition if not provided by user. Otherwise starting a VM with appid defined would fail with following error: error: unsupported configuration: Resource partition '(null)' must star= t with '/' Fixes: 38b5f4faabccf681439d99e5394954c6ef7a5a40 Signed-off-by: Pavel Hrdina Reviewed-by: Michal Privoznik --- src/lxc/lxc_process.c | 10 ++++------ src/qemu/qemu_cgroup.c | 12 ++++-------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index cfa009f14e..d262128a50 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -1258,13 +1258,11 @@ int virLXCProcessStart(virConnectPtr conn, return -1; } =20 - if (!vm->def->resource) { - virDomainResourceDef *res =3D g_new0(virDomainResourceDef, 1); + if (!vm->def->resource) + vm->def->resource =3D g_new0(virDomainResourceDef, 1); =20 - res->partition =3D g_strdup("/machine"); - - vm->def->resource =3D res; - } + if (!vm->def->resource->partition) + vm->def->resource->partition =3D g_strdup("/machine"); =20 logfile =3D g_strdup_printf("%s/%s.log", cfg->logDir, vm->def->name); =20 diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index 42dba1750d..6d4a82b3cd 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -949,15 +949,11 @@ qemuInitCgroup(virDomainObj *vm, virCgroupFree(priv->cgroup); priv->cgroup =3D NULL; =20 - if (!vm->def->resource) { - virDomainResourceDef *res; + if (!vm->def->resource) + vm->def->resource =3D g_new0(virDomainResourceDef, 1); =20 - res =3D g_new0(virDomainResourceDef, 1); - - res->partition =3D g_strdup("/machine"); - - vm->def->resource =3D res; - } + if (!vm->def->resource->partition) + vm->def->resource->partition =3D g_strdup("/machine"); =20 if (!g_path_is_absolute(vm->def->resource->partition)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, --=20 2.31.1