create_pool(NULL, db, pool, POOL_OP_UPDATE); /* update request */
}
+ /* Loop over all pools for updating RecyclePool */
+ foreach_res(pool, R_POOL) {
+ update_pool_recyclepool(NULL, db, pool);
+ }
+
STORE *store;
foreach_res(store, R_STORAGE) {
STORAGE_DBR sr;
void set_pool_dbr_defaults_in_media_dbr(MEDIA_DBR *mr, POOL_DBR *pr);
bool set_pooldbr_recyclepoolid(JCR *jcr, B_DB *db, POOL_DBR *pr, POOL *pool);
void set_pooldbr_from_poolres(POOL_DBR *pr, POOL *pool, e_pool_op op);
+int update_pool_recyclepool(JCR *jcr, B_DB *db, POOL *pool);
/* ua_input.c */
int get_cmd(UAContext *ua, const char *prompt);
}
}
+/* set/update Pool.RecyclePoolId in Catalog */
+int update_pool_recyclepool(JCR *jcr, B_DB *db, POOL *pool)
+{
+ POOL_DBR pr;
+
+ if (!pool->RecyclePool) {
+ return 1;
+ }
+
+ memset(&pr, 0, sizeof(POOL_DBR));
+ bstrncpy(pr.Name, pool->name(), sizeof(pr.Name));
+
+ if (!db_get_pool_record(jcr, db, &pr)) {
+ return -1; /* not exists in database */
+ }
+
+ set_pooldbr_from_poolres(&pr, pool, POOL_OP_UPDATE);
+
+ if (!set_pooldbr_recyclepoolid(jcr, db, &pr, pool)) {
+ return -1; /* error */
+ }
+
+ if (!db_update_pool_record(jcr, db, &pr)) {
+ return -1; /* error */
+ }
+ return 1;
+}
+
+/* set POOL_DBR.RecyclePoolId from Pool resource
+ * works with set_pooldbr_from_poolres
+ */
bool set_pooldbr_recyclepoolid(JCR *jcr, B_DB *db, POOL_DBR *pr, POOL *pool)
{
POOL_DBR rpool;
}
set_pooldbr_from_poolres(&pr, pool, op);
- set_pooldbr_recyclepoolid(jcr, db, &pr, pool);
if (!db_create_pool_record(jcr, db, &pr)) {
return -1; /* error */