From patchwork Thu Jul 29 21:28:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 488741 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:1185:0:0:0:0 with SMTP id f5csp2531478jas; Thu, 29 Jul 2021 14:28:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRt75T44EoMXs/d+/QPp2gN73nXzG2FQ6kdLCfjp0CMPgG617/f2Afzb1e3jJQ/SBETv15 X-Received: by 2002:a17:906:f11:: with SMTP id z17mr6561366eji.385.1627594133860; Thu, 29 Jul 2021 14:28:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627594133; cv=none; d=google.com; s=arc-20160816; b=qN+hEUGh2lluSGMOyQURhJTo/exX1pzJH8Ysj7mB9F4hOIcAjFnKZX1R+ZLDRKdWNv oMwyYmLrwf/IcHlUwqYmnigNOGBkUbeUlVDg0J7XguMm1BFpLosT/qvirVHFgshi8FS4 F3/JgVRFqs6GVe64Wc97e7+R0CD43Hi8A2fLb08UuSm/7mjIgCeXT61LeKPpnVa01bpy Kvv3Om2plBuCRnx1BF1gSBXpQCM5tARxJ/BYOB6y2OzvKiD+nSvz9haCR1Czj8eExNJO Vz8tx+wUrN+97/1jgzMNE4MKYnpT39bu4u8UzfyuFOE7/+FVn9WjQcQn2KNJil0a35mE +koA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:errors-to:sender :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:mime-version:user-agent:date:message-id:to :subject:from:delivered-to:dkim-signature; bh=9ngkjgEj/WFn//rrf3D6oPDn+zlbkBehasv58zbBL8A=; b=T4Z206mp0qh71ror9GUGdSYo2zfVY6C+7lvvisms6ciQp0mzOUCL+pUmrG59VvUErn 134WU/YKIGt1R36z+YZs4ricH8lHFiEzO0rI/SoFKc6vNgwseOrxrYJO1/hI+cw4q9gF a9hRyVAtQBp5lYVgMIPRNLLTViPxJEBXjyq68WQ4AA7QgCCkSamvwSq255qVSRAOLOlb vWtDOIroM/1EqCPUmQQ75vFXK3SavNuufH/zI49PmNe8wEGNr0UaNszmck5JCXV4CxIu kc6N9W2yzXxO1aLj4B4t3pMpQdfROMGx3SqtdQCtn9IGKTgNZm6EDCe32+54M4w+lnhN MYQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Mt5Fa1VB; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com. [170.10.133.124]) by mx.google.com with ESMTPS id t22si3592683edr.23.2021.07.29.14.28.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Jul 2021 14:28:53 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Mt5Fa1VB; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1627594132; 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=9ngkjgEj/WFn//rrf3D6oPDn+zlbkBehasv58zbBL8A=; b=Mt5Fa1VBH+8mch5U2g5cCuXIzCNSuqborEQ0F0FWxjhy/TGh51/XJiiFpImrndnSReoPf0 GA0wmvy3sACEwmJYQdM0PxlFcCn2Y15BsVQ7TORcJS4c6d5015L5sTx5wRO1vEoV+CyU74 vzgOlkU79qz5xMe+ModEgLB8TEaoch8= 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-384-EWVDjmJ4MoSoqYbnkuukYQ-1; Thu, 29 Jul 2021 17:28:50 -0400 X-MC-Unique: EWVDjmJ4MoSoqYbnkuukYQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5E2FA185302F; Thu, 29 Jul 2021 21:28:44 +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 A4D273AC1; Thu, 29 Jul 2021 21:28:42 +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 34F5E180B7A2; Thu, 29 Jul 2021 21:28:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 16TLSapE028157 for ; Thu, 29 Jul 2021 17:28:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id C77F110023B0; Thu, 29 Jul 2021 21:28:36 +0000 (UTC) Delivered-To: libvir-list@redhat.com Received: from [10.22.17.47] (unknown [10.22.17.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8239B10A3951 for ; Thu, 29 Jul 2021 21:28:32 +0000 (UTC) From: Cole Robinson Subject: lxc container startup error and RFC patch To: libvirt mailing list Message-ID: <699f3b58-af98-124a-1cf4-daccd103897f@redhat.com> Date: Thu, 29 Jul 2021 17:28:32 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.79 on 10.5.11.15 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-Language: en-US Hi all, I'm seeing LXC container startup failures. This is with libvirt git, fedora 34 host with systemd-248.6-1.fc34.x86_64 (I didn't confirm with other versions). Reproducer: sudo virt-install --connect lxc:/// --name test-container --memory 128 --boot init=/bin/sh Starting install... ERROR error from service: GDBus.Error:org.freedesktop.machine1.NoMachineForPID: PID 2145047 does not belong to any known machine libvirt 7.0.0 works but 7.1.0+ does not. The root error seems to predate that, showing up in syslog, but commit 9c1693eff made it fatal: commit 9c1693eff427661616ce1bd2795688f87288a412 Author: Pavel Hrdina Date: Fri Feb 5 16:17:35 2021 +0100 vircgroup: use DBus call to systemd for some APIs The error comes from virSystemdGetMachineByPID. The PID that shows up in the above error message does not match the leader PID as reported by machinectl. This change fixes the error but I don't know if it's correct or if it has other implications: Maybe something else isn't working elsewhere. Clearly we try to add both pids to the systemd machine, but virSystemdGetMachineByPID is not working to match the non-leader pid, which is the one that the LXC driver knows about. Thoughts? Can anyone else reproduce? Thanks, Cole diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index 066e013ed4..54ecb1316b 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -866,12 +866,12 @@ static int virLXCControllerSetupCgroupLimits(virLXCController *ctrl) nodeset = virDomainNumatuneGetNodeset(ctrl->def->numa, auto_nodeset, -1); if (!(ctrl->cgroup = virLXCCgroupCreate(ctrl->def, - ctrl->initpid, + getpid(), ctrl->nnicindexes, ctrl->nicindexes))) goto cleanup; - if (virCgroupAddMachineProcess(ctrl->cgroup, getpid()) < 0) + if (virCgroupAddMachineProcess(ctrl->cgroup, ctrl->initpid) < 0) goto cleanup; /* Add all qemu-nbd tasks to the cgroup */