From nobody Mon Apr 29 05:40:20 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1505211796573592.935346403814; Tue, 12 Sep 2017 03:23:16 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7DC5C6DDCD; Tue, 12 Sep 2017 10:23:15 +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 5B9AF5E1D6; Tue, 12 Sep 2017 10:23:15 +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 25E3F1864DBB; Tue, 12 Sep 2017 10:23:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v8CA8dCa012861 for ; Tue, 12 Sep 2017 06:08:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6FFBA60BEB; Tue, 12 Sep 2017 10:08:39 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 930386062A; Tue, 12 Sep 2017 10:08:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7DC5C6DDCD Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 12 Sep 2017 12:09:44 +0200 Message-Id: <969a14ba3a13df435cbde395957bba6e689bf0eb.1505210917.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 1/3] util: error: Add helpers for saving and restoring of last error 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 12 Sep 2017 10:23:16 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Some cleanup paths overwrite a usefull error message with a less useful one and we then try to preserve the original message. The handlers added in this patch will simplify the operations since they are designed right for the purpose. --- src/libvirt_private.syms | 2 ++ src/util/virerror.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ src/util/virerror.h | 3 +++ 3 files changed, 50 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index f30a04b14..62e05186d 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1604,6 +1604,8 @@ ebtablesRemoveForwardAllowIn; virDispatchError; virErrorCopyNew; virErrorInitialize; +virErrorPreserveLast; +virErrorRestore; virErrorSetErrnoFromLastError; virLastErrorIsSystemErrno; virRaiseErrorFull; diff --git a/src/util/virerror.c b/src/util/virerror.c index a5a2d6ed1..1f15c5dbb 100644 --- a/src/util/virerror.c +++ b/src/util/virerror.c @@ -371,6 +371,51 @@ virSaveLastError(void) return to; } + +/** + * virErrorPreserveLast: + * @saveerr: pointer to virErrorPtr for storing last error object + * + * Preserves the currently set last error (for the thread) into @saveerr s= o that + * it can be restored via virErrorRestore(). @saveerr must be passed to + * virErrorRestore() + */ +void +virErrorPreserveLast(virErrorPtr *saveerr) +{ + int saved_errno =3D errno; + virErrorPtr lasterr =3D virGetLastError(); + + *saveerr =3D NULL; + + if (lasterr) + *saveerr =3D virErrorCopyNew(lasterr); + + errno =3D saved_errno; +} + + +/** + * virErrorRestore: + * @savederr: error object holding saved error + * + * Restores the error passed via @savederr and clears associated memory. + */ +void +virErrorRestore(virErrorPtr *savederr) +{ + int saved_errno =3D errno; + + if (!*savederr) + return; + + virSetError(*savederr); + virFreeError(*savederr); + *savederr =3D NULL; + errno =3D saved_errno; +} + + /** * virResetError: * @err: pointer to the virError to clean up diff --git a/src/util/virerror.h b/src/util/virerror.h index 234864812..54530d081 100644 --- a/src/util/virerror.h +++ b/src/util/virerror.h @@ -196,4 +196,7 @@ void virErrorSetErrnoFromLastError(void); bool virLastErrorIsSystemErrno(int errnum); +void virErrorPreserveLast(virErrorPtr *saveerr); +void virErrorRestore(virErrorPtr *savederr); + #endif --=20 2.14.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 05:40:20 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1505211783972688.8758526750933; Tue, 12 Sep 2017 03:23:03 -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 BFAB180F94; Tue, 12 Sep 2017 10:23:02 +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 95A546E214; Tue, 12 Sep 2017 10:23:02 +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 5353C185735D; Tue, 12 Sep 2017 10:23:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v8CA8eWI012872 for ; Tue, 12 Sep 2017 06:08:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8F43860841; Tue, 12 Sep 2017 10:08:40 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD1E26BF7B; Tue, 12 Sep 2017 10:08:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com BFAB180F94 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 12 Sep 2017 12:09:45 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 2/3] qemu: hotplug: Use new helpers for storing libvirt errors 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.27]); Tue, 12 Sep 2017 10:23:03 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The helpers allow to simplify restoring original errors in most cases. --- src/qemu/qemu_hotplug.c | 93 +++++++++++++++------------------------------= ---- 1 file changed, 28 insertions(+), 65 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index b365078ec..35d73f74e 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -433,7 +433,7 @@ qemuDomainAttachVirtioDiskDevice(virConnectPtr conn, return ret; exit_monitor: - orig_err =3D virSaveLastError(); + virErrorPreserveLast(&orig_err); if (driveAdded && qemuMonitorDriveDel(priv->mon, drivealias) < 0) { VIR_WARN("Unable to remove drive %s (%s) after failed " "qemuMonitorAddDevice", drivealias, drivestr); @@ -444,11 +444,7 @@ qemuDomainAttachVirtioDiskDevice(virConnectPtr conn, ignore_value(qemuMonitorDelObject(priv->mon, encinfo->s.aes.alias)= ); if (qemuDomainObjExitMonitor(driver, vm) < 0) releaseaddr =3D false; - if (orig_err) { - virSetError(orig_err); - virFreeError(orig_err); - } - + virErrorRestore(&orig_err); virDomainAuditDisk(vm, NULL, disk->src, "attach", false); @@ -722,7 +718,7 @@ qemuDomainAttachSCSIDisk(virConnectPtr conn, return ret; exit_monitor: - orig_err =3D virSaveLastError(); + virErrorPreserveLast(&orig_err); if (driveAdded && qemuMonitorDriveDel(priv->mon, drivealias) < 0) { VIR_WARN("Unable to remove drive %s (%s) after failed " "qemuMonitorAddDevice", drivealias, drivestr); @@ -732,10 +728,7 @@ qemuDomainAttachSCSIDisk(virConnectPtr conn, if (encobjAdded) ignore_value(qemuMonitorDelObject(priv->mon, encinfo->s.aes.alias)= ); ignore_value(qemuDomainObjExitMonitor(driver, vm)); - if (orig_err) { - virSetError(orig_err); - virFreeError(orig_err); - } + virErrorRestore(&orig_err); virDomainAuditDisk(vm, NULL, disk->src, "attach", false); @@ -819,16 +812,13 @@ qemuDomainAttachUSBMassStorageDevice(virQEMUDriverPtr= driver, return ret; exit_monitor: - orig_err =3D virSaveLastError(); + virErrorPreserveLast(&orig_err); if (driveAdded && qemuMonitorDriveDel(priv->mon, drivealias) < 0) { VIR_WARN("Unable to remove drive %s (%s) after failed " "qemuMonitorAddDevice", drivealias, drivestr); } ignore_value(qemuDomainObjExitMonitor(driver, vm)); - if (orig_err) { - virSetError(orig_err); - virFreeError(orig_err); - } + virErrorRestore(&orig_err); virDomainAuditDisk(vm, NULL, disk->src, "attach", false); @@ -1356,7 +1346,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, if (!virDomainObjIsActive(vm)) goto cleanup; - originalError =3D virSaveLastError(); + virErrorPreserveLast(&originalError); if (vlan < 0) { if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV)) { char *netdev_name; @@ -1387,8 +1377,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, VIR_FREE(hostnet_name); } } - virSetError(originalError); - virFreeError(originalError); + virErrorRestore(&originalError); goto cleanup; } @@ -1562,7 +1551,7 @@ qemuDomainDelTLSObjects(virQEMUDriverPtr driver, if (!tlsAlias && !secAlias) return; - orig_err =3D virSaveLastError(); + virErrorPreserveLast(&orig_err); if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) goto cleanup; @@ -1576,10 +1565,7 @@ qemuDomainDelTLSObjects(virQEMUDriverPtr driver, ignore_value(qemuDomainObjExitMonitor(driver, vm)); cleanup: - if (orig_err) { - virSetError(orig_err); - virFreeError(orig_err); - } + virErrorRestore(&orig_err); } @@ -1621,12 +1607,9 @@ qemuDomainAddTLSObjects(virQEMUDriverPtr driver, return qemuDomainObjExitMonitor(driver, vm); error: - orig_err =3D virSaveLastError(); + virErrorPreserveLast(&orig_err); ignore_value(qemuDomainObjExitMonitor(driver, vm)); - if (orig_err) { - virSetError(orig_err); - virFreeError(orig_err); - } + virErrorRestore(&orig_err); qemuDomainDelTLSObjects(driver, vm, asyncJob, secAlias, tlsAlias); return -1; @@ -1788,15 +1771,12 @@ int qemuDomainAttachRedirdevDevice(virConnectPtr co= nn, return ret; exit_monitor: - orig_err =3D virSaveLastError(); + virErrorPreserveLast(&orig_err); /* detach associated chardev on error */ if (chardevAdded) ignore_value(qemuMonitorDetachCharDev(priv->mon, charAlias)); ignore_value(qemuDomainObjExitMonitor(driver, vm)); - if (orig_err) { - virSetError(orig_err); - virFreeError(orig_err); - } + virErrorRestore(&orig_err); qemuDomainDelTLSObjects(driver, vm, QEMU_ASYNC_JOB_NONE, secAlias, tlsAlias); goto audit; @@ -2051,15 +2031,12 @@ int qemuDomainAttachChrDevice(virConnectPtr conn, return ret; exit_monitor: - orig_err =3D virSaveLastError(); + virErrorPreserveLast(&orig_err); /* detach associated chardev on error */ if (chardevAttached) qemuMonitorDetachCharDev(priv->mon, charAlias); ignore_value(qemuDomainObjExitMonitor(driver, vm)); - if (orig_err) { - virSetError(orig_err); - virFreeError(orig_err); - } + virErrorRestore(&orig_err); qemuDomainDelTLSObjects(driver, vm, QEMU_ASYNC_JOB_NONE, secAlias, tlsAlias); @@ -2202,17 +2179,14 @@ qemuDomainAttachRNGDevice(virConnectPtr conn, return ret; exit_monitor: - orig_err =3D virSaveLastError(); + virErrorPreserveLast(&orig_err); if (objAdded) ignore_value(qemuMonitorDelObject(priv->mon, objAlias)); if (rng->backend =3D=3D VIR_DOMAIN_RNG_BACKEND_EGD && chardevAdded) ignore_value(qemuMonitorDetachCharDev(priv->mon, charAlias)); if (qemuDomainObjExitMonitor(driver, vm) < 0) releaseaddr =3D false; - if (orig_err) { - virSetError(orig_err); - virFreeError(orig_err); - } + virErrorRestore(&orig_err); qemuDomainDelTLSObjects(driver, vm, QEMU_ASYNC_JOB_NONE, secAlias, tlsAlias); @@ -2349,15 +2323,12 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver, return ret; exit_monitor: - orig_err =3D virSaveLastError(); + virErrorPreserveLast(&orig_err); if (objAdded) ignore_value(qemuMonitorDelObject(priv->mon, objalias)); if (qemuDomainObjExitMonitor(driver, vm) < 0) mem =3D NULL; - if (orig_err) { - virSetError(orig_err); - virFreeError(orig_err); - } + virErrorRestore(&orig_err); if (!mem) goto audit; @@ -2368,10 +2339,9 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver, mem =3D NULL; /* reset the mlock limit */ - orig_err =3D virSaveLastError(); + virErrorPreserveLast(&orig_err); ignore_value(qemuDomainAdjustMaxMemLock(vm)); - virSetError(orig_err); - virFreeError(orig_err); + virErrorRestore(&orig_err); goto audit; } @@ -2561,17 +2531,14 @@ qemuDomainAttachHostSCSIDevice(virConnectPtr conn, return ret; exit_monitor: - orig_err =3D virSaveLastError(); + virErrorPreserveLast(&orig_err); if (driveAdded && qemuMonitorDriveDel(priv->mon, drivealias) < 0) { VIR_WARN("Unable to remove drive %s (%s) after failed " "qemuMonitorAddDevice", drvstr, devstr); } ignore_value(qemuDomainObjExitMonitor(driver, vm)); - if (orig_err) { - virSetError(orig_err); - virFreeError(orig_err); - } + virErrorRestore(&orig_err); virDomainAuditHostdev(vm, hostdev, "attach", false); @@ -2846,7 +2813,7 @@ qemuDomainAttachShmemDevice(virQEMUDriverPtr driver, return ret; exit_monitor: - orig_err =3D virSaveLastError(); + virErrorPreserveLast(&orig_err); if (release_backing) { if (shmem->server.enabled) ignore_value(qemuMonitorDetachCharDev(priv->mon, charAlias)); @@ -2857,10 +2824,7 @@ qemuDomainAttachShmemDevice(virQEMUDriverPtr driver, if (qemuDomainObjExitMonitor(driver, vm) < 0) release_address =3D false; - if (orig_err) { - virSetError(orig_err); - virFreeError(orig_err); - } + virErrorRestore(&orig_err); goto audit; } @@ -2948,10 +2912,9 @@ qemuDomainChangeNetFilter(virDomainObjPtr vm, _("failed to add new filter rules to '%s' " "- attempting to restore old rules"), olddev->ifname); - errobj =3D virSaveLastError(); + virErrorPreserveLast(&errobj); ignore_value(virDomainConfNWFilterInstantiate(vm->def->uuid, oldde= v)); - virSetError(errobj); - virFreeError(errobj); + virErrorRestore(&errobj); return -1; } return 0; --=20 2.14.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 05:40:20 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1505211771612713.6274273589839; Tue, 12 Sep 2017 03:22:51 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 7E430356CC; Tue, 12 Sep 2017 10:22:50 +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 5CA3C6FB7C; Tue, 12 Sep 2017 10:22:50 +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 F04E818045C2; Tue, 12 Sep 2017 10:22:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v8CA8f99012882 for ; Tue, 12 Sep 2017 06:08:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 88C5717CFA; Tue, 12 Sep 2017 10:08:41 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id DD8CF60841; Tue, 12 Sep 2017 10:08:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7E430356CC Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 12 Sep 2017 12:09:46 +0200 Message-Id: <17e04cbd3f794905654ed85c6da6cb27ba5dbe5b.1505210917.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 3/3] qemu: Restore errors when rolling back disk image state 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 12 Sep 2017 10:22:51 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Some operations done to rollback disk image labelling and locking might overwrite (or clear) the actual error. Remember the original error when tearing down disk access so that it's not obscured. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1461301 --- src/qemu/qemu_hotplug.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 35d73f74e..7dd6e5fd9 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -94,6 +94,7 @@ qemuDomainPrepareDisk(virQEMUDriverPtr driver, virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver); int ret =3D -1; virStorageSourcePtr origsrc =3D NULL; + virErrorPtr orig_err =3D NULL; if (overridesrc) { origsrc =3D disk->src; @@ -102,6 +103,7 @@ qemuDomainPrepareDisk(virQEMUDriverPtr driver, /* just tear down the disk access */ if (teardown) { + virErrorPreserveLast(&orig_err); ret =3D 0; goto rollback_cgroup; } @@ -145,6 +147,8 @@ qemuDomainPrepareDisk(virQEMUDriverPtr driver, if (origsrc) disk->src =3D origsrc; + virErrorRestore(&orig_err); + virObjectUnref(cfg); return ret; --=20 2.14.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list