From nobody Mon Apr 29 20:40:05 2024 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 153676856300545.67637286543754; Wed, 12 Sep 2018 09:09:23 -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 5B51619D23B; Wed, 12 Sep 2018 16:09:21 +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 0F3FD600C2; Wed, 12 Sep 2018 16:09:21 +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 ACB7B4A463; Wed, 12 Sep 2018 16:09:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8CG99nE012086 for ; Wed, 12 Sep 2018 12:09:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id A18BB74BBB; Wed, 12 Sep 2018 16:09:09 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-52.phx2.redhat.com [10.3.116.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6032E2AA9F for ; Wed, 12 Sep 2018 16:09:09 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Wed, 12 Sep 2018 12:08:59 -0400 Message-Id: <20180912160903.17500-2-jferlan@redhat.com> In-Reply-To: <20180912160903.17500-1-jferlan@redhat.com> References: <20180912160903.17500-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/5] storage: Clean up stateFile if refreshPool fails 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 12 Sep 2018 16:09:22 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" If the virStoragePoolRefresh fails and we call stopPool, the code neglected to clean up the state file leading to the next libvirtd restart attempting to start the pool. For a transient pool this could make it unexpectedly reappear. Signed-off-by: John Ferlan --- src/storage/storage_driver.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 8943df1f84..1dbeb213e3 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -1174,8 +1174,13 @@ storagePoolRefresh(virStoragePoolPtr pool, =20 virStoragePoolObjClearVols(obj); if (backend->refreshPool(obj) < 0) { + char *stateFile =3D virFileBuildPath(driver->stateDir, def->name, = ".xml"); + + if (stateFile) + unlink(stateFile); if (backend->stopPool) backend->stopPool(obj); + VIR_FREE(stateFile); =20 event =3D virStoragePoolEventLifecycleNew(def->name, def->uuid, --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 20:40:05 2024 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1536768567113627.8251367216783; Wed, 12 Sep 2018 09:09:27 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 45BEFC05FF7E; Wed, 12 Sep 2018 16:09: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 0A76B4115; Wed, 12 Sep 2018 16:09:25 +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 AE3C24A46C; Wed, 12 Sep 2018 16:09:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8CG9Ab4012091 for ; Wed, 12 Sep 2018 12:09:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id 17AC674BBB; Wed, 12 Sep 2018 16:09:10 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-52.phx2.redhat.com [10.3.116.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA8E02AA9F for ; Wed, 12 Sep 2018 16:09:09 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Wed, 12 Sep 2018 12:09:00 -0400 Message-Id: <20180912160903.17500-3-jferlan@redhat.com> In-Reply-To: <20180912160903.17500-1-jferlan@redhat.com> References: <20180912160903.17500-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/5] storage: Clean up storagePoolUpdateStateCallback processing 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 12 Sep 2018 16:09:25 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Alter the code path to remove the need to to go cleanup and thus remove the label completely. Signed-off-by: John Ferlan --- src/storage/storage_driver.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 1dbeb213e3..d0e7e6904c 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -111,15 +111,15 @@ storagePoolUpdateStateCallback(virStoragePoolObjPtr o= bj, virStorageBackendPtr backend; char *stateFile; =20 - if (!(stateFile =3D virFileBuildPath(driver->stateDir, def->name, ".xm= l"))) - goto cleanup; - if ((backend =3D virStorageBackendForType(def->type)) =3D=3D NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Missing backend %d"), def->type); - goto cleanup; + return; } =20 + if (!(stateFile =3D virFileBuildPath(driver->stateDir, def->name, ".xm= l"))) + return; + /* Backends which do not support 'checkPool' are considered * inactive by default. */ if (backend->checkPool && @@ -151,8 +151,7 @@ storagePoolUpdateStateCallback(virStoragePoolObjPtr obj, if (!virStoragePoolObjIsActive(obj)) virStoragePoolUpdateInactive(&obj); =20 - cleanup: - if (!active && stateFile) + if (!active) ignore_value(unlink(stateFile)); VIR_FREE(stateFile); =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 20:40:05 2024 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 153676855504229.77119729905246; Wed, 12 Sep 2018 09:09:15 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 39B0A8762D; Wed, 12 Sep 2018 16:09:13 +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 D4BFF308BDA2; Wed, 12 Sep 2018 16:09:12 +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 035224BB75; Wed, 12 Sep 2018 16:09:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8CG9AOd012096 for ; Wed, 12 Sep 2018 12:09:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id 852CA2AA9F; Wed, 12 Sep 2018 16:09:10 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-52.phx2.redhat.com [10.3.116.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 417B0862EB for ; Wed, 12 Sep 2018 16:09:10 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Wed, 12 Sep 2018 12:09:01 -0400 Message-Id: <20180912160903.17500-4-jferlan@redhat.com> In-Reply-To: <20180912160903.17500-1-jferlan@redhat.com> References: <20180912160903.17500-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/5] storage: Create error label path for storagePoolCreateXML 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.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 12 Sep 2018 16:09:14 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Rather than duplicate the error code, let's create an error label to keep code common. Signed-off-by: John Ferlan --- src/storage/storage_driver.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index d0e7e6904c..5a8871bd07 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -730,12 +730,8 @@ storagePoolCreateXML(virConnectPtr conn, } =20 if (backend->startPool && - backend->startPool(obj) < 0) { - virStoragePoolObjRemove(driver->pools, obj); - virObjectUnref(obj); - obj =3D NULL; - goto cleanup; - } + backend->startPool(obj) < 0) + goto error; =20 stateFile =3D virFileBuildPath(driver->stateDir, def->name, ".xml"); =20 @@ -746,10 +742,7 @@ storagePoolCreateXML(virConnectPtr conn, unlink(stateFile); if (backend->stopPool) backend->stopPool(obj); - virStoragePoolObjRemove(driver->pools, obj); - virObjectUnref(obj); - obj =3D NULL; - goto cleanup; + goto error; } =20 event =3D virStoragePoolEventLifecycleNew(def->name, @@ -768,6 +761,12 @@ storagePoolCreateXML(virConnectPtr conn, virObjectEventStateQueue(driver->storageEventState, event); virStoragePoolObjEndAPI(&obj); return pool; + + error: + virStoragePoolObjRemove(driver->pools, obj); + virObjectUnref(obj); + obj =3D NULL; + goto cleanup; } =20 static virStoragePoolPtr --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 20:40:05 2024 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1536768563537338.55467037539097; Wed, 12 Sep 2018 09:09:23 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6069119D323; Wed, 12 Sep 2018 16:09:21 +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 0B21C30912F5; Wed, 12 Sep 2018 16:09:21 +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 ACB23181A130; Wed, 12 Sep 2018 16:09:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8CG9BiV012104 for ; Wed, 12 Sep 2018 12:09:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id F19C974BBB; Wed, 12 Sep 2018 16:09:10 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-52.phx2.redhat.com [10.3.116.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id AE2022AA9F for ; Wed, 12 Sep 2018 16:09:10 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Wed, 12 Sep 2018 12:09:02 -0400 Message-Id: <20180912160903.17500-5-jferlan@redhat.com> In-Reply-To: <20180912160903.17500-1-jferlan@redhat.com> References: <20180912160903.17500-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/5] storage: Introduce storagePoolRefreshFailCleanup 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.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 12 Sep 2018 16:09:22 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Create a common pool refresh failure handling method as the same code is repeated multiple times. Signed-off-by: John Ferlan --- src/storage/storage_driver.c | 38 +++++++++++++++++------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 5a8871bd07..8aa3191f7b 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -79,6 +79,18 @@ static void storageDriverUnlock(void) } =20 =20 +static void +storagePoolRefreshFailCleanup(virStorageBackendPtr backend, + virStoragePoolObjPtr obj, + const char *stateFile) +{ + if (stateFile) + ignore_value(unlink(stateFile)); + if (backend->stopPool) + backend->stopPool(obj); +} + + /** * virStoragePoolUpdateInactive: * @poolptr: pointer to a variable holding the pool object pointer @@ -127,6 +139,7 @@ storagePoolUpdateStateCallback(virStoragePoolObjPtr obj, virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to initialize storage pool '%s': %s"), def->name, virGetLastErrorMessage()); + ignore_value(unlink(stateFile)); active =3D false; } =20 @@ -137,8 +150,7 @@ storagePoolUpdateStateCallback(virStoragePoolObjPtr obj, if (active) { virStoragePoolObjClearVols(obj); if (backend->refreshPool(obj) < 0) { - if (backend->stopPool) - backend->stopPool(obj); + storagePoolRefreshFailCleanup(backend, obj, stateFile); virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to restart storage pool '%s': %s"), def->name, virGetLastErrorMessage()); @@ -151,8 +163,6 @@ storagePoolUpdateStateCallback(virStoragePoolObjPtr obj, if (!virStoragePoolObjIsActive(obj)) virStoragePoolUpdateInactive(&obj); =20 - if (!active) - ignore_value(unlink(stateFile)); VIR_FREE(stateFile); =20 return; @@ -199,10 +209,7 @@ storageDriverAutostartCallback(virStoragePoolObjPtr ob= j, if (!stateFile || virStoragePoolSaveState(stateFile, def) < 0 || backend->refreshPool(obj) < 0) { - if (stateFile) - unlink(stateFile); - if (backend->stopPool) - backend->stopPool(obj); + storagePoolRefreshFailCleanup(backend, obj, stateFile); virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to autostart storage pool '%s': %s"), def->name, virGetLastErrorMessage()); @@ -738,10 +745,7 @@ storagePoolCreateXML(virConnectPtr conn, virStoragePoolObjClearVols(obj); if (!stateFile || virStoragePoolSaveState(stateFile, def) < 0 || backend->refreshPool(obj) < 0) { - if (stateFile) - unlink(stateFile); - if (backend->stopPool) - backend->stopPool(obj); + storagePoolRefreshFailCleanup(backend, obj, stateFile); goto error; } =20 @@ -939,10 +943,7 @@ storagePoolCreate(virStoragePoolPtr pool, virStoragePoolObjClearVols(obj); if (!stateFile || virStoragePoolSaveState(stateFile, def) < 0 || backend->refreshPool(obj) < 0) { - if (stateFile) - unlink(stateFile); - if (backend->stopPool) - backend->stopPool(obj); + storagePoolRefreshFailCleanup(backend, obj, stateFile); goto cleanup; } =20 @@ -1174,10 +1175,7 @@ storagePoolRefresh(virStoragePoolPtr pool, if (backend->refreshPool(obj) < 0) { char *stateFile =3D virFileBuildPath(driver->stateDir, def->name, = ".xml"); =20 - if (stateFile) - unlink(stateFile); - if (backend->stopPool) - backend->stopPool(obj); + storagePoolRefreshFailCleanup(backend, obj, stateFile); VIR_FREE(stateFile); =20 event =3D virStoragePoolEventLifecycleNew(def->name, --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 20:40:05 2024 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1536768567206706.9166374426084; Wed, 12 Sep 2018 09:09:27 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4054530014BD; Wed, 12 Sep 2018 16:09:25 +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 EC4412015AC0; Wed, 12 Sep 2018 16:09: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 A13F318005DF; Wed, 12 Sep 2018 16:09:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8CG9Bob012111 for ; Wed, 12 Sep 2018 12:09:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6B57474BBB; Wed, 12 Sep 2018 16:09:11 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-52.phx2.redhat.com [10.3.116.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 283CE2AA9F for ; Wed, 12 Sep 2018 16:09:11 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Wed, 12 Sep 2018 12:09:03 -0400 Message-Id: <20180912160903.17500-6-jferlan@redhat.com> In-Reply-To: <20180912160903.17500-1-jferlan@redhat.com> References: <20180912160903.17500-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/5] storage: Save error during refresh failure processing 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.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Wed, 12 Sep 2018 16:09:25 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" https://bugzilla.redhat.com/show_bug.cgi?id=3D1614283 Save the error from the refresh failure because the stopPool processing may overwrite the error or even worse clear it due to calling an external libvirt API that resets the last error such as is the case with the SCSI pool which may call virGetConnectNodeDev (see commit decaeb288) in order to process deleting an NPIV vport. Signed-off-by: John Ferlan --- src/storage/storage_driver.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 8aa3191f7b..f032d0dfdd 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -84,10 +84,16 @@ storagePoolRefreshFailCleanup(virStorageBackendPtr back= end, virStoragePoolObjPtr obj, const char *stateFile) { + virErrorPtr orig_err =3D virSaveLastError(); + if (stateFile) ignore_value(unlink(stateFile)); if (backend->stopPool) backend->stopPool(obj); + if (orig_err) { + virSetError(orig_err); + virFreeError(orig_err); + } } =20 =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list