* Handle strings and directory strings
*/
if (job_items[i].handler == store_str ||
+ job_items[i].handler == store_storage_mngr ||
job_items[i].handler == store_dir) {
def_svalue = (char **)((char *)(job->jobdefs) + offset);
Dmsg5(400, "Job \"%s\", field \"%s\" def_svalue=%s item %d offset=%u\n",
return globals->socket->get(timeout);
}
-/* Store a storage group policy */
-void store_storage_mngr(LEX *lc, RES_ITEM *item, int index, int pass)
-{
- lex_get_token(lc, T_STRING);
- if (pass == 1) {
- if (*(item->value)) {
- scan_err5(lc, _("Attempt to redefine \"%s\" from \"%s\" to \"%s\" referenced on line %d : %s\n"),
- item->name, *(item->value), lc->str, lc->line_no, lc->line);
- return;
- }
-
- if (!StorageManager::check_policy(lc->str)) {
- scan_err0(lc, _("Invalid storage policy!\n"));
- return;
- }
-
- *(item->value) = bstrdup(lc->str);
- }
- scan_to_eol(lc);
- set_bit(index, res_all.hdr.item_present);
-}
-
bool CLIENT::getBSOCK_state(POOLMEM *&buf)
{
P(globals_mutex);
#define GetFileSetResWithName(x) ((FILESET *)GetResWithName(R_FILESET, (x)))
#define GetCatalogResWithName(x) ((CAT *)GetResWithName(R_CATALOG, (x)))
-/* Director daemon's specific */
-void store_storage_mngr(LEX *lc, RES_ITEM *item, int index, int pass);
-
/* Imported subroutines */
void store_jobtype(LEX *lc, RES_ITEM *item, int index, int pass);
void store_level(LEX *lc, RES_ITEM *item, int index, int pass);
/* Forward delcaration */
class STORE;
-/* Not so many policies for now...
- * Some ideas for next ones:
- * - Round robin
- * - Most free space
- * - Least CPU usage
- * - Least network usage
- * - A lot more
- *
- * Some protocol/interface changes will be needed to query all of the storages from
- * the list about it's current status, depending of policy used.
- */
-static char const *storage_mngmt_policy[] = {
- "LeastUsed",
- "ListedOrder",
- NULL
-};
/*
* Helper class to make managing each storage type (write/read) easier.
StorageManager(const char *policy);
- /* Helper to validate if policy user wants to use is a valid one */
- static bool check_policy(const char *policy) {
- int i = 0;
- while (storage_mngmt_policy[i]) {
- if (strcasecmp(policy, storage_mngmt_policy[i]) == 0) {
- return true;
- }
- i++;
- }
- return false;
- }
/************ READ STORAGE HELPERS ************/
STORE *get_rstore();
display_res(hpkt);
} else if (hpkt.ritem->handler == store_str ||
hpkt.ritem->handler == store_name ||
+ hpkt.ritem->handler == store_storage_mngr ||
hpkt.ritem->handler == store_password ||
hpkt.ritem->handler == store_strname ||
hpkt.ritem->handler == store_dir) {
set_bit(index, res_all.hdr.item_present);
}
+/* Not so many policies for now...
+ * Some ideas for next ones:
+ * - Most free space
+ * - Least CPU usage
+ * - Least network usage
+ * - ...
+ *
+ * Some protocol/interface changes will be needed to query all of the storages from
+ * the list about it's current status, depending of policy used.
+ */
+static char const *storage_mngmt_policy[] = {
+ "LeastUsed",
+ "ListedOrder",
+ NULL
+};
+
+/* Helper to validate if policy user wants to use is a valid one */
+static bool check_policy(const char *policy) {
+ int i = 0;
+ while (storage_mngmt_policy[i]) {
+ if (strcasecmp(policy, storage_mngmt_policy[i]) == 0) {
+ return true;
+ }
+ i++;
+ }
+ return false;
+}
+
+/* Store a storage group policy */
+void store_storage_mngr(LEX *lc, RES_ITEM *item, int index, int pass)
+{
+ lex_get_token(lc, T_STRING);
+ if (pass == 1) {
+ if (*(item->value)) {
+ scan_err5(lc, _("Attempt to redefine \"%s\" from \"%s\" to \"%s\" referenced on line %d : %s\n"),
+ item->name, *(item->value), lc->str, lc->line_no, lc->line);
+ return;
+ }
+
+ if (!check_policy(lc->str)) {
+ scan_err0(lc, _("Invalid storage policy!\n"));
+ return;
+ }
+
+
+ *(item->value) = bstrdup(lc->str);
+ }
+ scan_to_eol(lc);
+ set_bit(index, res_all.hdr.item_present);
+}
/*
*
void store_label(LEX *lc, RES_ITEM *item, int index, int pass);
void store_coll_type(LEX *lc, RES_ITEM *item, int index, int pass);
+
+/* Director daemon's specific routines */
+void store_storage_mngr(LEX *lc, RES_ITEM *item, int index, int pass);
+
/* ***FIXME*** eliminate these globals */
extern int32_t r_first;
extern int32_t r_last;