From: norbert.bizet Date: Mon, 6 Nov 2023 15:31:51 +0000 (-0500) Subject: Cloud Storage: Fix #10525 Add device name to the transfer fields X-Git-Tag: Beta-15.0.1~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=def3f0c28fc93adf4695ee94b729b4c3ced32a3e;p=thirdparty%2Fbacula.git Cloud Storage: Fix #10525 Add device name to the transfer fields --- diff --git a/bacula/src/stored/cloud_dev.c b/bacula/src/stored/cloud_dev.c index 0a0bf6dcd..ab43506cb 100644 --- a/bacula/src/stored/cloud_dev.c +++ b/bacula/src/stored/cloud_dev.c @@ -462,6 +462,7 @@ bool cloud_dev::upload_part_to_cloud(DCR *dcr, const char *VolumeName, uint32_t upload_engine, cache_fname,/* cache_fname is duplicated in the transfer constructor*/ VolumeName, /* VolumeName is duplicated in the transfer constructor*/ + name(), /* device name() is duplicated in the transfer constructor*/ upart, driver, dcr->jcr->JobId, @@ -568,6 +569,7 @@ transfer *cloud_dev::download_part_to_cache(DCR *dcr, const char *VolumeName, ui download_engine, cache_fname,/* cache_fname is duplicated in the transfer constructor*/ VolumeName, /* VolumeName is duplicated in the transfer constructor*/ + name(), /* device name() is duplicated in the transfer constructor*/ dpart, driver, dcr->jcr->JobId, diff --git a/bacula/src/stored/cloud_transfer_mgr.c b/bacula/src/stored/cloud_transfer_mgr.c index 44e4d9a6f..336db34b6 100644 --- a/bacula/src/stored/cloud_transfer_mgr.c +++ b/bacula/src/stored/cloud_transfer_mgr.c @@ -38,7 +38,8 @@ static const char *transfer_state_name[] = {"created", "queued", "process", "do * funct : function to process * arg : argument passed to the function * cache_fname : cache file name is duplicated in the transfer constructor - * volume_name : volume name is duplicated in the transfer constructor + * volume_name : volume name is duplicated in the transfer constructor + * device_name : device name is duplicated in the transfer constructor * part : part index * driver : pointer to the cloud_driver * dcr : pointer to DCR @@ -47,6 +48,7 @@ transfer::transfer(uint64_t size, transfer_engine* funct, const char *cache_fname, const char *volume_name, + const char *device_name, uint32_t part, cloud_driver *driver, uint32_t JobId, @@ -67,6 +69,7 @@ transfer::transfer(uint64_t size, m_debug_retry(true), m_cache_fname(bstrdup(cache_fname)), /* cache fname is duplicated*/ m_volume_name(bstrdup(volume_name)), /* volume name is duplicated*/ + m_device_name(bstrdup(device_name)), /* device name is duplicated*/ m_part(part), m_driver(driver), m_job_id(JobId), @@ -98,6 +101,7 @@ transfer::~transfer() pthread_mutex_destroy(&m_mutex); pthread_mutex_destroy(&m_stat_mutex); + free(m_device_name); free(m_volume_name); free(m_cache_fname); if (m_use_count > 0) { @@ -274,6 +278,7 @@ void transfer::append_api_status(OutputWriter &ow) if (m_state > TRANS_STATE_PROCESSED) { ow.get_output(OT_START_OBJ, + OT_STRING,"device_name", NPRTB(m_device_name), OT_STRING,"volume_name", NPRTB(m_volume_name), OT_INT32, "part", m_part, OT_INT32, "jobid", m_job_id, @@ -287,6 +292,7 @@ void transfer::append_api_status(OutputWriter &ow) OT_END); } else { ow.get_output(OT_START_OBJ, + OT_STRING,"device_name", NPRTB(m_device_name), OT_STRING,"volume_name", NPRTB(m_volume_name), OT_INT32, "part", m_part, OT_INT32, "jobid", m_job_id, @@ -585,6 +591,7 @@ transfer *transfer_manager::get_xfer(uint64_t size, transfer_engine *funct, POOLMEM *cache_fname, const char *volume_name, + const char *device_name, uint32_t part, cloud_driver *driver, uint32_t JobId, @@ -608,6 +615,7 @@ transfer *transfer_manager::get_xfer(uint64_t size, funct, cache_fname,/* cache_fname is duplicated in the transfer constructor*/ volume_name, /* volume_name is duplicated in the transfer constructor*/ + device_name,/* device_name is duplicated in the transfer constructor*/ part, driver, JobId, diff --git a/bacula/src/stored/cloud_transfer_mgr.h b/bacula/src/stored/cloud_transfer_mgr.h index 70433d08e..cba6521d4 100644 --- a/bacula/src/stored/cloud_transfer_mgr.h +++ b/bacula/src/stored/cloud_transfer_mgr.h @@ -113,6 +113,7 @@ public: /* variables */ char *m_cache_fname; char *m_volume_name; + char *m_device_name; uint32_t m_part; cloud_driver *m_driver; uint32_t m_job_id; @@ -155,6 +156,7 @@ public: transfer_engine *funct, const char *cache_fname, const char *volume_name, + const char *device_name, uint32_t part, cloud_driver *driver, uint32_t JobId, @@ -295,6 +297,7 @@ public: transfer_engine *funct, POOLMEM *cache_fname, const char *volume_name, + const char *device_name, uint32_t part, cloud_driver *driver, uint32_t JobId, diff --git a/bacula/src/stored/file_driver.c b/bacula/src/stored/file_driver.c index c6e897f66..ba1b03701 100644 --- a/bacula/src/stored/file_driver.c +++ b/bacula/src/stored/file_driver.c @@ -377,7 +377,7 @@ bool file_driver::move_cloud_part(const char *VolumeName, uint32_t apart , const rtn = true; } else { exists = 1; - transfer xfer(statbuf.st_size, NULL, cloud_source_name, VolumeName, apart, NULL, 0, NULL, NULL); + transfer xfer(statbuf.st_size, NULL, cloud_source_name, VolumeName, dev->name(), apart, NULL, 0, NULL, NULL); rtn = put_object(&xfer, cloud_source_name, cloud_dest_name, &upload_limit); Mmsg(err,"%s",rtn ? to:xfer.m_message); }