if (wstore_group) {
/* Apply policy for the write storage list */
jcr->store_mngr->apply_policy(true);
- Jmsg(jcr, M_INFO, 0, _("Possible storage choices: %s\n"),
- jcr->store_mngr->print_wlist());
+ Dmsg1(100, "Possible storage choices: %s\n", jcr->store_mngr->print_wlist());
iter_no = 2;
}
for (int iter=0; iter<iter_no; iter++) {
if (wstore_group) {
if (iter == 0) {
- Jmsg(jcr, M_INFO, 0, _("Trying to start job on any storage from the list without "
- "waiting for busy devices first.\n"));
+ Dmsg0(100, "Trying to start job on any storage from the list without "
+ "waiting for busy devices first.\n");
} else {
- Jmsg(jcr, M_INFO, 0, _("All devices are currently busy, need to wait at each try of storage reservation.\n"));
+ Dmsg0(100, "All devices are currently busy, need to wait at each try of storage reservation.\n");
}
}
* Start conversation with Storage daemon
*/
if (!connect_to_storage_daemon(jcr, 10, SDConnectTimeout, 1)) {
- Jmsg(jcr, M_INFO, 0, _("Failed connect to the storage: %s\n"),
- jcr->store_mngr->get_wstore()->name());
+ Dmsg1(100, "Failed connect to the storage: %s\n", jcr->store_mngr->get_wstore()->name());
continue;
} else {
- Jmsg(jcr, M_INFO, 0, _("Connected to the storage: %s\n"),
- jcr->store_mngr->get_wstore()->name());
+ Dmsg1(100, "Connected to the storage: %s\n", jcr->store_mngr->get_wstore()->name());
}
alist wlist;
* because we have only 2 iterations (so 'iter' variable is either 0 or 1)
*/
if (!start_storage_daemon_job(jcr, NULL, &wlist, wstore_group ? (bool)iter : true)) {
- Jmsg(jcr, M_INFO, 0, _("Failed to start job on the storage: %s\n"),
- jcr->store_mngr->get_wstore()->name());
+ Dmsg1(100, "Failed to start job on the storage: %s\n", jcr->store_mngr->get_wstore()->name());
continue;
} else {
- Jmsg(jcr, M_INFO, 0, _("Started job on storage: %s\n"),
- jcr->store_mngr->get_wstore()->name());
+ Jmsg(jcr, M_INFO, 0, _("Selected storage: %s, StorageGroupPolicy: \"%s\"\n"),
+ jcr->store_mngr->get_wstore()->name(), jcr->store_mngr->get_policy_name());
sd_job_started = true;
break;
}
{"Level", store_level, ITEM(res_job.JobLevel), 0, 0, 0},
{"Messages", store_res, ITEM(res_job.messages), R_MSGS, ITEM_REQUIRED, 0},
{"Storage", store_alist_res, ITEM(res_job.storage), R_STORAGE, 0, 0},
- {"StoragePolicy", store_storage_mngr, ITEM(res_job.storage_policy), 0, 0, 0},
+ {"StorageGroupPolicy", store_storage_mngr, ITEM(res_job.storage_policy), 0, 0, 0},
{"Pool", store_res, ITEM(res_job.pool), R_POOL, ITEM_REQUIRED, 0},
{"NextPool", store_res, ITEM(res_job.next_pool), R_POOL, 0, 0},
{"FullBackupPool", store_res, ITEM(res_job.full_pool), R_POOL, 0, 0},
if (job->storage_policy) {
if (strcmp(job->storage_policy, "LeastUsed") == 0) {
jcr->store_mngr = New(LeastUsedStore());
+ } else if (strcmp(job->storage_policy, "ListedOrder") == 0) {
+ jcr->store_mngr = New(ListedOrderStore());
}
} else {
- jcr->store_mngr = New(SimpleStoreMngr());
+ jcr->store_mngr = New(ListedOrderStore());
}
set_jcr_default_store(jcr, job);
}
-StorageManager::StorageManager() {
+StorageManager::StorageManager(const char *policy) {
+ this->policy = bstrdup(policy);
rstore.set_rw(false);
wstore.set_rw(true);
};
*/
static char const *storage_mngmt_policy[] = {
"LeastUsed",
+ "ListedOrder",
NULL
};
protected:
storage rstore; /* Read storage */
storage wstore; /* Write storage */
+ const char *policy;
public:
virtual void apply_policy(bool write_store) = 0;
virtual ~StorageManager() {
reset_rwstorage();
+ free(policy);
};
- StorageManager();
+ StorageManager(const char *policy);
/* Helper to validate if policy user wants to use is a valid one */
static bool check_policy(const char *policy) {
/************ GENERIC STORAGE HELPERS ************/
void reset_rwstorage();
+
+ const char *get_policy_name() {
+ return policy;
+ }
};
/*
public:
void apply_policy(bool write_store);
- LeastUsedStore() {
+ LeastUsedStore() : StorageManager("LeastUsed") {
}
~LeastUsedStore() {
/*
* Default policy for the storage group. It uses first available storage from the list.
*/
-class SimpleStoreMngr : public StorageManager {
+class ListedOrderStore : public StorageManager {
private:
public:
/* Do nothing for now */
}
- SimpleStoreMngr() {
+ ListedOrderStore(): StorageManager("ListedOrder") {
}
- ~SimpleStoreMngr() {
+ ~ListedOrderStore() {
}
};