{NULL, NULL, {0}, 0, 0, 0}
};
+/*
+ * Console Resource
+ *
+ * name handler value code flags default_value
+ */
+static RES_ITEM tenant_items[] = {
+ {"Name", store_name, ITEM(res_tenant.hdr.name), 0, ITEM_REQUIRED, 0},
+ {"Description", store_str, ITEM(res_tenant.hdr.desc), 0, 0, 0},
+ {"MaximumVolumeBytes", store_size64, ITEM(res_tenant.MaxVolBytes), 0, 0, 0},
+ {"MaximumClients", store_int32, ITEM(res_tenant.MaxClients), 0, 0, 0},
+ {"WarningVolumeBytes", store_size64, ITEM(res_tenant.WarnVolBytes), 0, 0, 0},
+ {"MaximumJobs", store_int32, ITEM(res_tenant.MaxJobs), 0, 0, 0},
+ {"MaximumStorages", store_int32, ITEM(res_tenant.MaxStorages), 0, 0, 0},
+ {"Isolated", store_bool, ITEM(res_tenant.Isolated), 0, 0, 0},
+ {"Enabled", store_bool, ITEM(res_tenant.Enabled), 0, ITEM_DEFAULT, true},
+ {NULL, NULL, {0}, 0, 0, 0}
+};
/*
* Console Resource
*
{"Console", con_items, R_CONSOLE},
{"JobDefs", job_items, R_JOBDEFS},
{"Statistics", collector_items, R_COLLECTOR},
+ {"Tenant", tenant_items, R_TENANT},
{"Device", NULL, R_DEVICE}, /* info obtained from SD */
{"Autochanger", store_items, R_AUTOCHANGER}, /* alias for R_STORAGE */
{NULL, NULL, 0}
recurse = false;
}
switch (type) {
+ case R_TENANT:
+ sendit(sock, _("Tenant: name=%s MaxJobs=%d MaxClients=%d MaxVolBytes=%lld Enabled=%d\n"),
+ ares->name, res->res_tenant.MaxJobs, res->res_tenant.MaxClients,
+ res->res_tenant.MaxVolBytes, res->res_tenant.Enabled);
+ break;
case R_DIRECTOR:
sendit(sock, _("Director: name=%s MaxJobs=%d FDtimeout=%s SDtimeout=%s AutoPrune=%d\n"),
ares->name, res->res_dir.MaxConcurrentJobs,
free(res->res_dir.customerid);
}
break;
+ case R_TENANT:
case R_DEVICE:
case R_COUNTER:
break;
* The following code is only executed during pass 1
*/
switch (type) {
+ case R_TENANT:
+ size = sizeof(TENANT);
+ break;
case R_DIRECTOR:
size = sizeof(DIRRES);
break;
case R_MSGS:
case R_FILESET:
case R_DEVICE:
+ case R_TENANT:
break;
/*
type = R_STORAGE; /* force Storage type */
if ((res = (URES *)GetResWithName(type, res_all.res_store.hdr.name)) == NULL) {
Mmsg(config->m_errmsg, _("Cannot find Storage resource %s\n"),
- res_all.res_dir.hdr.name);
+ res_all.res_store.hdr.name);
return false;
}
/* we must explicitly copy the device alist pointer */
break;
case R_JOB:
case R_JOBDEFS:
- if ((res = (URES *)GetResWithName(type, res_all.res_dir.hdr.name)) == NULL) {
+ if ((res = (URES *)GetResWithName(type, res_all.res_job.hdr.name)) == NULL) {
Mmsg(config->m_errmsg, _("Cannot find Job resource %s\n"),
- res_all.res_dir.hdr.name);
+ res_all.res_job.hdr.name);
return false;
}
res->res_job.messages = res_all.res_job.messages;
R_CONSOLE,
R_JOBDEFS,
R_COLLECTOR,
+ R_TENANT,
R_DEVICE, /* This is the real last device class */
R_AUTOCHANGER, /* Alias for R_STORAGE after R_LAST */
class DEVICE;
class RUNSCRIPT;
class CAT;
+class TENANT;
/*
* Director Resource
inline char *POOL::name() const { return hdr.name; }
+/*
+ * Tenant Resource
+ */
+class TENANT {
+public:
+ RES hdr;
+ int32_t MaxClients; /* Maximum clients allowed */
+ uint64_t MaxVolBytes; /* Maximum bytes allowed */
+ uint64_t WarnVolBytes; /* Print warnings after X bytes */
+ int32_t MaxJobs; /* Maximum job resources allowed */
+ int32_t MaxStorages; /* Maximum Storage resources allowed */
+ int32_t Isolated; /* Subtenants can have visibility among them */
+ int32_t Enabled; /* Enabled or not */
+ /* Methods */
+ char *name() const;
+};
+
+inline char *TENANT::name() const { return hdr.name; }
+
/* Define the Union of all the above
* resource structure definitions.
*/
union URES {
DIRRES res_dir;
+ TENANT res_tenant;
CONRES res_con;
CLIENT res_client;
STORE res_store;
void clearall();
};
+
#define GetPoolResWithName(x) ((POOL *)GetResWithName(R_POOL, (x)))
#define GetStoreResWithName(x) ((STORE *)GetResWithName(R_STORAGE, (x)))
#define GetSchedResWithName(x) ((SCHED *)GetResWithName(R_SCHEDULE, (x)))