From nobody Wed May 8 07:54:32 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=1604669435; cv=none; d=zohomail.com; s=zohoarc; b=bAG+q3Ty5B8LwRMRmISfO0x3uGqF79aZ9wLlH9chONr/aZSklEnCaysPs33XTofFiwBDINFRLkzIK9DsJbQtDeRYcBw9pWiMq9GGjBZJYW/jtEn8SzVQ9E6JMKek6PGiC4cQh4lb58HVDLGTD45uNPAGRQMNR7kKrEX/ILCUfpY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604669435; 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=GT1AojTeBF1QfWu0G5xoflntevEQDeTI2GaI/vJ56Dk=; b=hvKzmn6VCNzLN5v1wKhAK5g/PTUUJohJzS3nmFu7qY2X1hhsk1L3mzqOMEqbOJiAtTp0CA2TMmLD2zDY1yire9gjetuiLe7biP4IWIKJBvjQQUOuwB1K/0+L2XXNuHnIiu0NO9hgCEtJOk542slFeurGsFlk/SSOqfJUcVodF/Y= 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) header.from= 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 1604669435948618.7354262943129; Fri, 6 Nov 2020 05:30:35 -0800 (PST) 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-111-e27HM4IyPByOHm4LWA7Waw-1; Fri, 06 Nov 2020 08:30:32 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4C4A1100F7A4; Fri, 6 Nov 2020 13:30:25 +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 494331002C29; Fri, 6 Nov 2020 13:30: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 A8295922ED; Fri, 6 Nov 2020 13:30:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0A6DUKhR020304 for ; Fri, 6 Nov 2020 08:30:20 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8D7F65D98F; Fri, 6 Nov 2020 13:30:20 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.192.76]) by smtp.corp.redhat.com (Postfix) with ESMTP id EFB8B5D9CA for ; Fri, 6 Nov 2020 13:30:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604669434; 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=GT1AojTeBF1QfWu0G5xoflntevEQDeTI2GaI/vJ56Dk=; b=e0+k5jX/n1w370xQ318i6BMhNJRSoDZbqciMl8SlwYLHi/YUavste5yUNxJMfZ8M8upryN GqCbd9odTWjBEpdX3C0/YKR41HujA8yxx8eWSxii0RJhhKh1XmmxFUCnm0Z9GUUm99zRW7 oC3tWX8rLpECbDs2qY7crP0iZSrw3RE= X-MC-Unique: e27HM4IyPByOHm4LWA7Waw-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] lxc: Cleanup after failed startup Date: Fri, 6 Nov 2020 14:30:13 +0100 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.22 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) Content-Type: text/plain; charset="utf-8" If starting an container fails, the virLXCProcessStop() is called. But since vm->def->id is not set until libvirt_lxc is spawned (the domain's ID is PID of that process), virLXCProcessStop() returns early as virDomainObjIsActive() returns false. But doing so leaves behind resources reserved for the containers during the startup process. Most notably, hostdevs are not re-attached to the host, the domain's transient XML is not removed, etc. Signed-off-by: Michal Privoznik --- src/lxc/lxc_process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index c5a710fc3f..08c82b0e9a 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -855,7 +855,7 @@ int virLXCProcessStop(virLXCDriverPtr driver, vm->def->name, (int)vm->pid, (int)reason); if (!virDomainObjIsActive(vm)) { VIR_DEBUG("VM '%s' not active", vm->def->name); - return 0; + goto cleanup; } =20 priv =3D vm->privateData; --=20 2.26.2