From: norbert.bizet Date: Fri, 15 Dec 2023 10:02:58 +0000 (-0500) Subject: cloud storage: Fix #10291 Assume that driver ls can return an error when scanning... X-Git-Tag: Beta-15.0.1~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f309a4adbe7b9241e1486763c4e415a2a0fcad25;p=thirdparty%2Fbacula.git cloud storage: Fix #10291 Assume that driver ls can return an error when scanning an unexistant cloud volume and loosen the conditions that handle this case --- diff --git a/bacula/scripts/aws_cloud_driver.in b/bacula/scripts/aws_cloud_driver.in index 3ef711336..e82113f12 100755 --- a/bacula/scripts/aws_cloud_driver.in +++ b/bacula/scripts/aws_cloud_driver.in @@ -90,9 +90,6 @@ def ls(): # forward out stds logging.info("ls outputing {0}".format(output)) sys.stdout.write(output) - if proc.returncode == 1: - # possible to ls unexisting path. In this case, return code will be 1. - return 0 return proc.returncode except Exception as e: exc = traceback.format_exception_only(type(e), e)[0] diff --git a/bacula/src/stored/cloud_dev.c b/bacula/src/stored/cloud_dev.c index c2da2543d..e743b7d96 100644 --- a/bacula/src/stored/cloud_dev.c +++ b/bacula/src/stored/cloud_dev.c @@ -1621,7 +1621,7 @@ bool cloud_dev::probe_cloud_proxy(DCR *dcr,const char *VolName, bool force) cancel_cb.arg = dcr; if (!driver->get_cloud_volume_parts_list(VolName, &cloud_parts, &cancel_cb, errmsg)) { Dmsg2(dbglvl, "Cannot get cloud sizes for Volume=%s Err=%s\n", VolName, errmsg); - return false; + /* Non critical error: it's possible that no part exist on cloud of even that the volume doesn't exist or has been sweeped */ } /* then, add the content of cloud_parts in the proxy table */ @@ -2782,9 +2782,7 @@ bool cloud_dev::upload_cache(DCR *dcr, const char *VolumeName, uint32_t truncate cancel_cb.fct = DCR_cancel_cb; cancel_cb.arg = dcr; if (!driver->get_cloud_volume_parts_list(VolumeName, &cloud_parts, &cancel_cb, err)) { - Qmsg2(dcr->jcr, M_ERROR, 0, "Error while uploading parts for volume %s. %s\n", VolumeName, err); - ret = false; - goto bail_out; + Qmsg2(dcr->jcr, M_WARNING, 0, "Non-critical error while listing volume parts for volume %s. %s\n", VolumeName, err); } if (!get_cache_volume_parts_list(dcr, VolumeName, &cache_parts)) { @@ -2813,13 +2811,17 @@ bool cloud_dev::upload_cache(DCR *dcr, const char *VolumeName, uint32_t truncate Mmsg(fname, "%s/part.%d", vol_dir, i); Dmsg1(dbglvl, "Do upload of %s\n", fname); bool do_truncate = (truncate==TRUNC_AFTER_UPLOAD) || (truncate==TRUNC_CONF_DEFAULT && (trunc_opt == TRUNC_AFTER_UPLOAD)); - if (!upload_part_to_cloud(dcr, VolumeName, i, do_truncate)) { - if (errmsg[0]) { - Qmsg(dcr->jcr, M_ERROR, 0, "%s", errmsg); + if (cache_parts[i]) { + if (!upload_part_to_cloud(dcr, VolumeName, i, do_truncate)) { + if (errmsg[0]) { + Qmsg(dcr->jcr, M_ERROR, 0, "%s", errmsg); + } + ret = false; + } else { + Qmsg(dcr->jcr, M_INFO, 0, "Uploaded cache %s\n", fname); } - ret = false; } else { - Qmsg(dcr->jcr, M_INFO, 0, "Uploaded cache %s\n", fname); + Qmsg(dcr->jcr, M_WARNING, 0, "Part %s not found in cache. Upload skipped.\n", fname); } } bail_out: diff --git a/bacula/src/stored/dircmd.c b/bacula/src/stored/dircmd.c index 3610cb30b..d9bea49d9 100644 --- a/bacula/src/stored/dircmd.c +++ b/bacula/src/stored/dircmd.c @@ -840,7 +840,7 @@ static bool cloud_list_cmd(JCR *jcr) } else { ilist parts(100, not_owned_by_alist); if (!dcr->dev->get_cloud_volume_parts_list(dcr, volname, &parts, errmsg)) { - dir->fsend(_("3900 Error cannot get cloud Volume list. ERR=%s\n"), errmsg); + dir->fsend(_("3900 Error cannot get cloud parts list. ERR=%s\n"), errmsg); free_dcr(dcr); goto bail_out; }