
On 6/2/21 10:46 AM, Michal Privoznik wrote:
The iscsi-direct storage pool backend works merely like this: a connection is established to the target (usually done via virStorageBackendISCSIDirectSetConnection()), intended action is executed (e.g. reporting LUNs, volume wiping), and at the end the connection is closed via virISCSIDirectDisconnect().
The problem is that virISCSIDirectDisconnect() reports its own errors which may overwrite error that occurred during LUN reporting, or volume wiping or whatever.
To fix this, use virErrorPreserveLast() + virErrorRestore() combo, which either preserves previously reported error message, or is NOP if there's no error reported.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1797879 Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- src/storage/storage_backend_iscsi_direct.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) Reviewed-by: Ján Tomko <jtomko@redhat.com>
Jano