#640 Issue closed: NSR POOLNAME variable

Labels: enhancement

keilma opened issue at 2015-08-20 06:15:

Hi,

we've already discussed this on the mailing list. There should a possibility to define a NSRPOOLNAME variable for overriding the pool name. When mminfo does not return any results the default pool is used. When using the default pool und there is no device in it the backup fails with this message:

98519:save: Unable to setup direct save with server mknw01.marcelk.brs.local: no matching devices for save of client `mkrear.marcelk.brs.local'; check storage nodes, devices or pools.
90018:save: Cannot open a save session with NetWorker server 'mknw01.marcelk.brs.local': no matching devices for save of client `mkrear.marcelk.brs.local'; check storage nodes, devices or pools

And if I have some backups of one client in more than one pool, with the mminfo query only the oldest backup is used - maybe this pool does not exists any more.

Kind regards
Marcel

schlomo commented at 2015-08-20 13:37:

Please try the fix from the issue_640 branch:

git clone git@github.com:rear/rear.git
git checkout issue_640
make rpm

(or deb as you need).

keilma commented at 2015-08-20 14:46:

Hi Schlomo,

thank you, worked!

I discovered one strange thing with this branch:

  • At the end of the script no pool is printed and this worked with my old version:

    pool retent name

Shall I create a new issue for that?

Kind regards
Marcel

schlomo commented at 2015-08-20 15:57:

@keilma let's keep everything related to my changes here. Can you please be more specific? Is this an error or a cosmetic thing? Can you please try to look into the scripts I changed and see if you can find the cause? Thanks a lot!

keilma commented at 2015-08-20 18:07:

@schlomo I think it's a NetWorker problem and not a problem with the current branch. Lets take a look at a normal mminfo query:

[root@mkrear ~]# mminfo -s mknw01 -a -q client=mkrear -r pool,name
pool name
dd160_ALL /var/lib/rear/
...

In the script you use this grep command:

++ grep -E '/var/lib/rear/recovery/cfg2html/mkrear.marcelk.brs.local.html|/var/lib/rear/output/rear-mkrear.iso'

I think that don't match when the name/save set is /var/lib/rear/, correct?
You haven't modified the save command, so I will dig a bit deeper tomorrow why the save set is named /var/lib/rear.

An idea could be to use the -N switch of save to give the save set a good name:

   -N name
          The symbolic name of this save set.  By default, the most common prefix of the path arguments is used as the save set name. If the -N option is used when saving any
          of the SYSTEM save sets (SYSTEM STATE, SYSTEM FILES, and SYSTEM DB), the path must also be specified and must match the name value assigned with the -N option.

Regards
Marcel

keilma commented at 2015-08-20 19:00:

@schlomo the problem is giving "save" more than one file to save:

[root@mkrear ~]# save -s mknw01 -e day -b dd160_ALL /var/lib/rear/recovery/cfg2html/mkrear.marcelk.brs.local.html
[root@mkrear testfolder]# mminfo -s mknw01 -q client=mkrear -r savetime,name
mknw01.DD.003 mkrear.marcelk.brs.local 08/20/2015 852 KB manual /var/lib/rear/recovery/cfg2html/mkrear.marcelk.brs.local.html

[root@mkrear ~]# save -s mknw01 -e day -b dd160_ALL /var/lib/rear/output/rear-mkrear.iso
[root@mkrear testfolder]# mminfo -s mknw01 -q client=mkrear -r savetime,name
08/20/2015 /var/lib/rear/output/rear-mkrear.iso

[root@mkrear ~]# save -s mknw01 -e day -b dd160_ALL /var/lib/rear/output/rear-mkrear.iso /var/lib/rear/recovery/cfg2html/mkrear.marcelk.brs.local.html
[root@mkrear testfolder]# mminfo -s mknw01 -q client=mkrear -r savetime,name
08/20/2015 /var/lib/rear/

[root@mkrear ~]# save -N ReaR_Files -s mknw01 -e day -b dd160_ALL /var/lib/rear/output/rear-mkrear.iso /var/lib/rear/recovery/cfg2html/mkrear.marcelk.brs.local.html
[root@mkrear testfolder]# mminfo -s mknw01 -q client=mkrear -r savetime,name
08/20/2015 ReaR_Files

With the correct names this is the output and the end of rear is:

pool retent name

dd160_ALL 08/21/15 /var/lib/rear/output/rear-mkrear.iso
dd160_ALL 08/21/15 /var/lib/rear/recovery/cfg2html/mkrear.marcelk.brs.local.html

Regards
Marcel

keilma commented at 2015-08-20 19:03:

Forgot in my previous post: I'm using "USE_CFG2HTML=y"

schlomo commented at 2015-08-20 19:08:

@keilma so you are telling me that BACKUP=NSR and USE_CFG2HTML=y are not compatible? If so then please open a new issue for that.

I am basically waiting for your final feedback if I should merge this branch upstream or if you want more changes/fixes.

keilma commented at 2015-08-21 06:06:

@schlomo no, they are compatible, but your grep command does not work because the save set ("name") is getting a other name when save is used with two files. I will open a new issue for that.

You can merge this branch, it worked and is a nice enhancement.

Regards
Marcel

schlomo commented at 2015-08-21 08:39:

CFG2HTML topic moved to #643

tomglx commented at 2015-09-10 07:39:

This change only fixes part of the problem. Sometimes the used mminfo just doesn't give use the right
pool. I'm administering a slightly bigger networker scenario and that just doesn't cut it. There can be
multiple pools used by a client. Like a pool for database backups, one for clones of backups and so on. So one at least must have the option to oversteer the result of the mminfo command, not a fallback. I'm in need for a NSR_POOL_NAME option that does exactly that.
I've also refined the mminfo command for the location where the root filesystem was last saved and I've tried to exclude nearline volumes focusing the search on the primary save pool.
Here is my Version of a patch

 NSRSERVER=$(cat $VAR_DIR/recovery/nsr_server )
 CLIENTNAME=$(hostname)
-POOLNAME="$( mminfo -s $NSRSERVER -a -q "client=$CLIENTNAME" -r "pool" | head -1 )"
+if [[ -z "$NSR_POOL_NAME" ]]
+then
+       POOLNAME="$( mminfo -ot -s $NSRSERVER -a -q "client=$CLIENTNAME,name=/" -r "avail,pool" | \
+                       awk '$1 ~ "n" { print $2; exit; }' )"
+else
+       POOLNAME="$NSR_POOL_NAME"
+fi
 [[ -z "$POOLNAME" ]] && POOLNAME="Default"
-[[ -z "$RETENTION_TIME" ]] && RETENTION_TIME="1 day"
+[[ -z "$NSR_RETENTION_TIME" ]] && NSR_RETENTION_TIME="1 day"

 Log "Saving files '${NSR_RESULT_FILES[@]}' with save"
-save -s $NSRSERVER -c $CLIENTNAME -b "$POOLNAME" -y "$RETENTION_TIME" "${NSR_RESULT_FILES[@]}" 1>&8
+save -s $NSRSERVER -c $CLIENTNAME -b "$POOLNAME" -y "$NSR_RETENTION_TIME" "${NSR_RESULT_FILES[@]}" 1>&8
 StopIfError "Could not save result files with save"

Regards, Thomas

gdha commented at 2015-09-19 09:29:

@tomglx Code in script output/NSR/default/95_nsr_save_result_files.sh has been adjusted (8ea497d). Could you verify it is ok? thx Gratien

tomglx commented at 2015-09-19 13:19:

@gdha : Looks ok to me. Thank you very much.


[Export of Github issue for rear/rear.]