From: John Ferlan Date: Fri, 8 Feb 2019 15:25:27 +0000 (-0500) Subject: util: Fix virStorageBackendSCSINewLun error handling X-Git-Tag: v5.1.0-rc1~130 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b330600a6955e3807d81cc400b163cc4df6fcf51;p=thirdparty%2Flibvirt.git util: Fix virStorageBackendSCSINewLun error handling Commit a523770c3 added @retval return processing for virStorageBackendUpdateVolInfo in order to allow a -2 to be return; however, upon successful completion @retval = 0 and if either the virStorageBackendSCSISerial or the virStoragePoolObjAddVol failed, the method would return 0, but not add the @vol to the pool. So let's just reset retval = -1 and continue processing. Signed-off-by: John Ferlan Reviewed-by: Erik Skultety Reviewed-by: Ján Tomko --- diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index fa364941c5..e4913b3405 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -3869,6 +3869,9 @@ virStorageBackendSCSINewLun(virStoragePoolObjPtr pool, VIR_STORAGE_VOL_READ_NOERROR)) < 0) goto cleanup; + /* Reset retval for proper error handling */ + retval = -1; + vol->key = virStorageBackendSCSISerial(vol->target.path, (def->source.adapter.type == VIR_STORAGE_ADAPTER_TYPE_FC_HOST));