From nobody Sun Feb 8 10:04:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1561461455; cv=none; d=zoho.com; s=zohoarc; b=ejDfPYtZbq8iS1knOzPo3Hya5fMkSIdt9XSis1gXOXzgNyw7dNU91F5dulpkuIQkfuofpyY9kHEHx0cEdwX7U3ZMsKwcFBvTgaB195WU29FarMUN4Ag70MHokvs+HGJQ+2YyxDh+BIBoPjtHvFKxDgAQvOk4lcxDw5zFwx9KIow= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561461455; 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:ARC-Authentication-Results; bh=oHURQokQMLHXL/h/phqtZdcSYcMDAeWU7Ear8OqS+xY=; b=K8HyIikPTHTfsbbPSyiGBp8NIZiJ6NOAOsahjMfnEVQOPknp9kgoJOl+2l3GN7K2D3sMLUmbawjbuJHay5UcHjQELLfqLQ0md3fFio84GIp/H3WR+Nxzrk/cd68Zquj1Qb6JoF2dDDUPQAFljgifPRh6pnR4mqBk4twitvO75yM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1561461455240240.51497108328886; Tue, 25 Jun 2019 04:17:35 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5C90A3084039; Tue, 25 Jun 2019 11:17:33 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2B944600CD; Tue, 25 Jun 2019 11:17:32 +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 E102D206D8; Tue, 25 Jun 2019 11:17:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5PBGYjv029420 for ; Tue, 25 Jun 2019 07:16:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4100D5D71B; Tue, 25 Jun 2019 11:16:34 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id C00545D717 for ; Tue, 25 Jun 2019 11:16:33 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Tue, 25 Jun 2019 13:16:24 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 5/7] util: vircgroupv2: separate return values of virCgroupV2EnableController 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Tue, 25 Jun 2019 11:17:33 +0000 (UTC) Content-Type: text/plain; charset="utf-8" In order to skip controllers that we are not able to activate we need to return different return value so the caller can decide what to do. Signed-off-by: Pavel Hrdina --- Notes: Introduced in v2 src/util/vircgroupv2.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c index 3f4548b532..133a8e0e66 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -353,22 +353,37 @@ virCgroupV2PathOfController(virCgroupPtr group, } =20 =20 +/** + * virCgroupV2EnableController: + * + * Returns: -1 on fatal error + * -2 if we failed to write into cgroup.subtree_control + * 0 on success + */ static int virCgroupV2EnableController(virCgroupPtr parent, int controller) { VIR_AUTOFREE(char *) val =3D NULL; + VIR_AUTOFREE(char *) path =3D NULL; =20 if (virAsprintf(&val, "+%s", virCgroupV2ControllerTypeToString(controller)) < 0) { return -1; } =20 - if (virCgroupSetValueStr(parent, controller, - "cgroup.subtree_control", val) < 0) { + if (virCgroupPathOfController(parent, controller, + "cgroup.subtree_control", &path) < 0) { return -1; } =20 + if (virFileWriteStr(path, val, 0) < 0) { + virReportSystemError(errno, + _("Failed to enable controller '%s' for '%s'"= ), + val, path); + return -2; + } + return 0; } =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list