On Mon, Feb 27, 2017 at 11:31:38AM -0500, Jean-Louis Martineau wrote:
> Jon,
>
> Can you try the attached patch?
I'm running the zmanda pre-builts and do not have a build
system set up here.
>
> On 25/02/17 01:58 PM, Jon LaBadie wrote:
> > I'm getting a lot of these messages in my nightly report
> >
> > planner: Last full dump of cyber.jgcomp.com:Home on tape DS1-084
> > overwritten in 1 run.
> > planner: Last full dump of cyber.jgcomp.com:Vault on tape DS1-079
> > overwritten in 1 run.
> >
> > It made little sense as there are many full dumps or these
> > various DLEs sprinkled back to tape DS1-000. And, although
> > there were about 10 unused tapes remaining, I added a bunch
> > more which had no effect on the "will be overwritten" messages.
> >
> > Then I looked at the tapelist and found 2 different formats.
> > This is certainly due to my switching from CentOS packages
> > (amanda 3.3.3.) to Zmanda pre-built binaries for RHEL (amanda
> > 3.4.1).
> >
> > Previously labeled tapes have a 4 column layout but when the
> > new amanda version uses a tape, it modifies that layout to a
> > 7 column format adding "POOL", "STORAGE", and "CONFIG" columns.
> > Now my tapelist has 4 contiguous groups.
> >
> > recently labeled unused 7 column layout
> > previously labeled unused 4 column layout
> > previously labeled used 7 column layout
> > previously labeled used 4 column layout
> >
> > Why does the planner think it will overwrite the last full dumps?
> >
> > Would simply adding the additional 7 fields to the tapelist
> > correct this error or would other things have to change also?
> It should fix the issue.
> >
> > Would adding the extra columns adversely affect anything else?
> no.
I didn't think so, I'll make the change and check tonights results.
Jon
>
> Jean-Louis
> diff --git a/server-src/planner.c b/server-src/planner.c
> index 3464810..4d2b55b 100644
> --- a/server-src/planner.c
> +++ b/server-src/planner.c
> @@ -1291,6 +1291,8 @@ static int when_overwrite(
> int nb_in_storage;
> int runtapes;
> storage_t *st;
> + policy_s *po;
> + int retention_tapes;
>
> if ((tp = lookup_tapelabel(label)) == NULL)
> return 1; /* "shouldn't happen", but trigger warning message */
> @@ -1308,13 +1310,17 @@ static int when_overwrite(
> }
> if (!st)
> return 1;
> + po = lookup_policy(storage_get_policy(st));
> + if (!po)
> + return 1;
> + retention_tapes = policy_get_retention_tapes(po);
> runtapes = storage_get_runtapes(st);
> if (runtapes == 0) runtapes = 1;
>
> - nb = tape_overwrite(tp);
> - nb_in_storage = nb_tape_in_storage(tp->storage);
> - if (conf_tapecycle+1 > nb_in_storage)
> - nb += (conf_tapecycle+1 - nb_in_storage);
> + nb = tape_overwrite(st, tp);
> + nb_in_storage = nb_tape_in_storage(st);
> + if (retention_tapes > nb_in_storage)
> + nb += (retention_tapes - nb_in_storage + 1);
>
> tp->when_overwrite = (nb - 1) / runtapes;
> if (tp->when_overwrite < 0)
> diff --git a/server-src/tapefile.c b/server-src/tapefile.c
> index 7e0d81f..63f8ebf 100644
> --- a/server-src/tapefile.c
> +++ b/server-src/tapefile.c
> @@ -1175,14 +1175,21 @@ get_retention_type(
>
> int
> tape_overwrite(
> + storage_t *st,
> tape_t *tp)
> {
> tape_t *tp1;
> int nb_tapes = 0;
>
> for (tp1 = tp; tp1 != NULL; tp1 = tp1->next) {
> - if (!tp1->retention && tp1->storage && tp->storage &&
> - g_str_equal(tp->storage, tp1->storage)) {
> + if (!tp1->retention &&
> + (((!tp1->storage || !tp->storage) &&
> + match_labelstr(storage_get_labelstr(st),
> + storage_get_autolabel(st),
> + tp1->label, tp1->barcode, tp1->meta,
> + storage_name(st))) ||
> + (tp1->storage && tp->storage &&
> + g_str_equal(tp->storage, tp1->storage)))) {
> nb_tapes++;
> }
> }
> @@ -1191,14 +1198,18 @@ tape_overwrite(
>
> int
> nb_tape_in_storage(
> - char *storage_name)
> + storage_t *st)
> {
> tape_t *tp;
> int nb_tapes = 0;
> -
> + char *storage = storage_name(st);
> for (tp = tape_list; tp != NULL; tp = tp->next) {
> - if ((!storage_name && !tp->storage) ||
> - (storage_name && tp->storage &&
> g_str_equal(storage_name,tp->storage))) {
> + if (((!storage || !tp->storage) &&
> + match_labelstr(storage_get_labelstr(st),
> + storage_get_autolabel(st),
> + tp->label, tp->barcode, tp->meta,
> + storage_name(st))) ||
> + (storage && tp->storage && g_str_equal(storage, tp->storage))) {
> nb_tapes++;
> }
> }
> diff --git a/server-src/tapefile.h b/server-src/tapefile.h
> index 4af86da..547f8ef 100644
> --- a/server-src/tapefile.h
> +++ b/server-src/tapefile.h
> @@ -35,6 +35,7 @@
> #define TAPEFILE_H
>
> #include "amanda.h"
> +#include "conffile.h"
>
> typedef enum {
> RETENTION_NO = 0,
> @@ -110,7 +111,7 @@ int volume_is_reusable(const char *label);
> int guess_runs_from_tapelist(void);
> gchar **list_new_tapes(char *storage_n, int nb);
> RetentionType get_retention_type(char *pool, char *label);
> -int tape_overwrite(tape_t *tp);
> -int nb_tape_in_storage(char *storage_name);
> +int tape_overwrite(storage_t *st, tape_t *tp);
> +int nb_tape_in_storage(storage_t *st);
>
> #endif /* !TAPEFILE_H */
>>> End of included message <<<
--
Jon H. LaBadie [email protected]
11226 South Shore Rd. (703) 787-0688 (H)
Reston, VA 20190 (703) 935-6720 (C)