From: Eric Bollengier Date: Tue, 4 Sep 2007 17:41:15 +0000 (+0000) Subject: ebl Add Nigel Stepp patch for item 20 X-Git-Tag: Release-7.0.0~5745 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=72e6159af1f291177fb49804ae6e34d67dafec19;p=bacula%2Fbacula ebl Add Nigel Stepp patch for item 20 git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5452 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/patches/testing/project-allvols.patch b/bacula/patches/testing/project-allvols.patch new file mode 100644 index 0000000000..1307bc6808 --- /dev/null +++ b/bacula/patches/testing/project-allvols.patch @@ -0,0 +1,175 @@ +Index: src/dird/ua_update.c +=================================================================== +--- src/dird/ua_update.c (revision 5406) ++++ src/dird/ua_update.c (working copy) +@@ -402,6 +402,42 @@ + } + } + ++static void update_all_vols(UAContext *ua) ++{ ++ int i, num_pools; ++ uint32_t *ids; ++ POOL_DBR pr; ++ MEDIA_DBR mr; ++ ++ memset(&pr, 0, sizeof(pr)); ++ memset(&mr, 0, sizeof(mr)); ++ ++ if (!db_get_pool_ids(ua->jcr, ua->db, &num_pools, &ids)) { ++ ua->error_msg(_("Error obtaining pool ids. ERR=%s\n"), db_strerror(ua->db)); ++ return; ++ } ++ ++ for (i=0; ijcr, ua->db, &pr)) { /* ***FIXME*** use acl? */ ++ ua->warning_msg(_("Updating all pools, but skipped PoolId=%d. ERR=%s\n"), db_strerror(ua->db)); ++ continue; ++ } ++ ++ set_pool_dbr_defaults_in_media_dbr(&mr, &pr); ++ mr.PoolId = pr.PoolId; ++ ++ if (!db_update_media_defaults(ua->jcr, ua->db, &mr)) { ++ ua->error_msg(_("Error updating Volume records: ERR=%s"), db_strerror(ua->db)); ++ } else { ++ ua->info_msg(_("All Volume defaults updated from \"%s\" Pool record.\n"), ++ pr.Name); ++ } ++ } ++ ++ free(ids); ++} ++ + static void update_volenabled(UAContext *ua, char *val, MEDIA_DBR *mr) + { + mr->Enabled = get_enabled(ua, val); +@@ -455,6 +491,7 @@ + for (i=0; kw[i]; i++) { + int j; + POOL_DBR pr; ++ + if ((j=find_arg_with_value(ua, kw[i])) > 0) { + /* If all from pool don't select a media record */ + if (i != AllFromPool && !select_media_dbr(ua, &mr)) { +@@ -514,6 +551,12 @@ + } + } + ++ /* Allow user to simply update all volumes */ ++ if (find_arg(ua, NT_("allvolume")) > 0) { ++ update_all_vols(ua); ++ return 1; ++ } ++ + for ( ; !done; ) { + start_prompt(ua, _("Parameters to modify:\n")); + add_prompt(ua, _("Volume Status")); /* 0 */ +@@ -529,13 +572,15 @@ + add_prompt(ua, _("Pool")); /* 10 */ + add_prompt(ua, _("Volume from Pool")); /* 11 */ + add_prompt(ua, _("All Volumes from Pool")); /* 12 */ +- add_prompt(ua, _("Enabled")), /* 13 */ +- add_prompt(ua, _("RecyclePool")), /* 14 */ +- add_prompt(ua, _("Done")); /* 15 */ ++ add_prompt(ua, _("Volumes from all Pools")); /* 13 */ ++ add_prompt(ua, _("Enabled")), /* 14 */ ++ add_prompt(ua, _("RecyclePool")), /* 15 */ ++ add_prompt(ua, _("Done")); /* 16 */ + i = do_prompt(ua, "", _("Select parameter to modify"), NULL, 0); + +- /* For All Volumes from Pool and Done, we don't need a Volume record */ +- if (i != 12 && i != 15) { ++ /* For All Volumes, All Volumes from Pool, and Done, we don't need ++ * a Volume record */ ++ if ( i != 12 && i != 13 && i != 16) { + if (!select_media_dbr(ua, &mr)) { /* Get Volume record */ + return 0; + } +@@ -692,6 +737,10 @@ + return 1; + + case 13: ++ update_all_vols(ua); ++ return 1; ++ ++ case 14: + ua->info_msg(_("Current Enabled is: %d\n"), mr.Enabled); + if (!get_cmd(ua, _("Enter new Enabled: "))) { + return 0; +@@ -708,7 +757,7 @@ + update_volenabled(ua, ua->cmd, &mr); + break; + +- case 14: ++ case 15: + memset(&pr, 0, sizeof(POOL_DBR)); + pr.PoolId = mr.RecyclePoolId; + if (db_get_pool_record(ua->jcr, ua->db, &pr)) { +Index: src/qt-console/medialist/medialist.h +=================================================================== +--- src/qt-console/medialist/medialist.h (revision 5406) ++++ src/qt-console/medialist/medialist.h (working copy) +@@ -60,6 +60,7 @@ + void pruneVolume(); + void relabelVolume(); + void allVolumesFromPool(); ++ void allVolumes(); + void volumeFromPool(); + + private: +Index: src/qt-console/medialist/medialist.ui +=================================================================== +--- src/qt-console/medialist/medialist.ui (revision 5406) ++++ src/qt-console/medialist/medialist.ui (working copy) +@@ -99,6 +99,23 @@ + Update all Volumes From Pool + + ++ ++ ++ :/images/cartridge-edit.png ++ ++ ++ Update all Volumes from Pool ++ ++ ++ Update all Volumes from Pool ++ ++ ++ Update all Volumes from Pool ++ ++ ++ Update all Volumes from Pool ++ ++ + + + :/images/cartridge-edit.png +Index: src/qt-console/medialist/medialist.cpp +=================================================================== +--- src/qt-console/medialist/medialist.cpp (revision 5406) ++++ src/qt-console/medialist/medialist.cpp (working copy) +@@ -251,6 +251,7 @@ + /* connect to the action specific to this pages class */ + connect(actionRefreshMediaList, SIGNAL(triggered()), this, + SLOT(populateTree())); ++ connect(actionAllVolumes, SIGNAL(triggered()), this, SLOT(allVolumes())); + connect(actionAllVolumesFromPool, SIGNAL(triggered()), this, SLOT(allVolumesFromPool())); + connect(actionVolumeFromPool, SIGNAL(triggered()), this, SLOT(volumeFromPool())); + } +@@ -340,6 +341,13 @@ + populateTree(); + } + ++void MediaList::allVolumes() ++{ ++ QString cmd = "update volume allvolume"; ++ consoleCommand(cmd); ++ populateTree(); ++} ++ + /* + * Called from the signal of the context sensitive menu to purge! + */ diff --git a/bacula/projects b/bacula/projects index 3653905742..173de4bb62 100644 --- a/bacula/projects +++ b/bacula/projects @@ -679,7 +679,7 @@ Item 19: Automatic disabling of devices Item 20: An option to operate on all pools with update vol parameters Origin: Dmitriy Pinchukov Date: 16 August 2006 - Status: + Status: Patch made by Nigel Stepp What: When I do update -> Volume parameters -> All Volumes from Pool, then I have to select pools one by one. I'd like