From nobody Sun Feb 8 17:42:12 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.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; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1490875387370788.0620197196218; Thu, 30 Mar 2017 05:03:07 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 950E37E9F4; Thu, 30 Mar 2017 12:03:05 +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 5D68778420; Thu, 30 Mar 2017 12:03:05 +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 05FC418523CE; Thu, 30 Mar 2017 12:03:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2UC30Fe009544 for ; Thu, 30 Mar 2017 08:03:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 14C667DA0A; Thu, 30 Mar 2017 12:03:00 +0000 (UTC) Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id 56E9F71C9A; Thu, 30 Mar 2017 12:02:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 950E37E9F4 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 950E37E9F4 From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 30 Mar 2017 14:03:47 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 3/3] storage: driver: Remove unavailable transient pools after restart 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: , MIME-Version: 1.0 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 30 Mar 2017 12:03:06 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" If a transient storage pool is deemed inactive after libvirtd restart it would not be deleted from the list. Reuse virStoragePoolUpdateInactive along with a refactor necessary to properly update the state. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1242801 --- src/storage/storage_driver.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 618b640a2..fea769887 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -105,31 +105,28 @@ virStoragePoolUpdateInactive(virStoragePoolObjPtr *po= olptr) static void storagePoolUpdateState(virStoragePoolObjPtr pool) { - bool active; + bool active =3D false; virStorageBackendPtr backend; - int ret =3D -1; char *stateFile; if (!(stateFile =3D virFileBuildPath(driver->stateDir, pool->def->name, ".xml"))) - goto error; + goto cleanup; if ((backend =3D virStorageBackendForType(pool->def->type)) =3D=3D NUL= L) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Missing backend %d"), pool->def->type); - goto error; + goto cleanup; } /* Backends which do not support 'checkPool' are considered - * inactive by default. - */ - active =3D false; + * inactive by default. */ if (backend->checkPool && backend->checkPool(pool, &active) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to initialize storage pool '%s': %s"), pool->def->name, virGetLastErrorMessage()); - goto error; + active =3D false; } /* We can pass NULL as connection, most backends do not use @@ -144,17 +141,18 @@ storagePoolUpdateState(virStoragePoolObjPtr pool) virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to restart storage pool '%s': %s"), pool->def->name, virGetLastErrorMessage()); - goto error; + active =3D false; } } pool->active =3D active; - ret =3D 0; - error: - if (ret < 0) { - if (stateFile) - unlink(stateFile); - } + + if (!pool->active) + virStoragePoolUpdateInactive(&pool); + + cleanup: + if (!active && stateFile) + ignore_value(unlink(stateFile)); VIR_FREE(stateFile); return; --=20 2.12.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list