Re: [Bacula-users] Problems with 'Automatic Volume Labeling'

2007-11-01 Thread Michael Lang
Arno Lehmann wrote:
 Hi,

 23.10.2007 12:14,, Rich wrote::
   
 On 2007.10.23. 11:40, Arno Lehmann wrote:
 
 Hello,
   
 ...
 
 My only solution for this right now is to estimate how much space the 
 Backup will use, and label the Volumes
 before the Job runs, but as you can imagine thats annoying ...
 
 Yes.

   
 is there anything i'm missing that this happens ?
 thanks for any hint ...
 
 I'd first suggest to drop the LabelFormat directive. It's deprecated 
 and will vanish some day.

 Instead, use a python event to provide names for new volumes.
   
 umh. i must have missed this... will it really be dropped ? as i am 
 using it, i don't fancy learning python just to replicate its functionality.
 

 Well... it won't be dropped anytime soon, but I recall Kern stating 
 that he won't touch that code anymore, so once he needs to rework the 
 code related to automatic volume labeling, it might be gone.

 I couldn't say how likely that is, though - might be tomorrow, or in 
 ten years.

   
 i am using this parameter to create single file per backup job and give 
 them meaningful names - would it indeed at some point get replaced by a 
 requirement to script in python ?
 

 That requirement, by the way, is not very problematic. The sample 
 given in the manual should almost work out of the box, and python is 
 easier to learn than Baculas variable substitution language :-)

   
 This is described in the manual, for example 
 http://www.bacula.org/dev-manual/Python_Scripting.html#SECTION00356
   
 ...
 

 Anyway - I'm operating Bacula installations using the LabelFormat 
 option as well, and those work correctly. But then, these 
 installations haven't labeled a volume for more than a year now, as 
 their pools have reached their maximum number of volumes by now. It 
 might be that there is a bug somewhere, which noone noticed yet.

 You could try to set up a test pool and job, where you limit the 
 volumes to, say, 10MB, use the most simple form of LabelFormat, i.e. 
 Label- or something, and assign a newly created storage device to it.

 Then, run a job, preferrably with debug output enabled, and see what 
 happens.

 That should eliminate the chance that some misconfiguration crept into 
 your catalog, and it should give a good set of debug files to analyze 
 quickly.
   
dont shoot, but ill try to use the python way you recommended :)
but thanks anyway.

Greetz mIke

 Arno

   


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] Problems with 'Automatic Volume Labeling'

2007-10-24 Thread Rich
On 2007.10.23. 22:02, Arno Lehmann wrote:
...
 That requirement, by the way, is not very problematic. The sample 
 given in the manual should almost work out of the box, and python is 
 easier to learn than Baculas variable substitution language :-)

i do not agree with that ;)

 This is described in the manual, for example 
 http://www.bacula.org/dev-manual/Python_Scripting.html#SECTION00356
 ...

i'm now trying to understand at least something in all this...

1. the example has a section that is not simply stating noop, but is 
preceded by it :

   def JobInit(self, job):
  noop = 1
  if (job.JobId  2):
 startid = job.run(run kernsave)
 job.JobReport = Python started new Job: jobid=%d\n % startid
  print name=%s version=%s conf=%s working=%s % (bacula.Name, 
bacula.Version, bacula.ConfigFile, bacula.WorkingDir)

manual says If you do not want a particular event, simply replace the 
existing code with a noop = 1.

what does this section do then ? is preceding it with noop = 1 also 
disabling it ?

2. the volume label itself.
i guess i should leave at least parts of def JobStart, right ?
it creates JobEvents class, which in turn includes what seems to be the 
correct section - def NewVolume.

i suppose this line should be modified :
Vol = TestA-%d % numvol

later two other lines have same string :

job.JobReport = Exists=%d TestA-%d % (job.DoesVolumeExist(Vol), numvol)
job.VolumeName=TestA-%d % numvol

must i replace all of these strings ? if yes, can't they just be 
referenced from the first string, Vol ?

now, as for constructing the volume labal string... it seems that most 
variables map to something job. - like job.Pool, job.Job, job.Level etc.

how would i use these variables to define the label ?

i am trying to imitate a volume label like
${Pool}_${Job}-${Level}-${Year}.${Month:p/2/0/r}.${Day:p/2/0/r}-${Hour:p/2/0/r}.${Minute:p/2/0/r}

which would also require variables like year, month etc. how can i 
include those ?

i'm really lost with all this, but this probably is the best time to do 
this as i have set up a test system before attempting a large upgrade, 
so postponing the change can come back to me later...
...
 Arno
-- 
  Rich

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] Problems with 'Automatic Volume Labeling'

2007-10-24 Thread Arno Lehmann
Hi,

24.10.2007 13:15,, Rich wrote::
 On 2007.10.23. 22:02, Arno Lehmann wrote:
 ...
 That requirement, by the way, is not very problematic. The sample 
 given in the manual should almost work out of the box, and python is 
 easier to learn than Baculas variable substitution language :-)
 
 i do not agree with that ;)

Feel free to... I'm not a person to try to persuade anyone :-)

 This is described in the manual, for example 
 http://www.bacula.org/dev-manual/Python_Scripting.html#SECTION00356
 ...
 
 i'm now trying to understand at least something in all this...
 
 1. the example has a section that is not simply stating noop, but is 
 preceded by it :
 
def JobInit(self, job):
   noop = 1
   if (job.JobId  2):
  startid = job.run(run kernsave)
  job.JobReport = Python started new Job: jobid=%d\n % startid
   print name=%s version=%s conf=%s working=%s % (bacula.Name, 
 bacula.Version, bacula.ConfigFile, bacula.WorkingDir)
 
 manual says If you do not want a particular event, simply replace the 
 existing code with a noop = 1.

Well... the manual is imperfect here.

The key thing is that, in python, each method needs a body, and even 
if you don't want any action taken by it. So the construct of noop = 
1 is a more or less standard way of creating a method without any 
functionality.

 what does this section do then ? is preceding it with noop = 1 also 
 disabling it ?

No. To disable it, you'd have to remove the actual code (which only 
prints a message for JobId=1, by the way).

 2. the volume label itself.
 i guess i should leave at least parts of def JobStart, right ?
 it creates JobEvents class, which in turn includes what seems to be the 
 correct section - def NewVolume.
 
 i suppose this line should be modified :
 Vol = TestA-%d % numvol

In NewVolume, a method of the class JobEvents, yes.
Here the actual volume name is created.

 later two other lines have same string :
 
 job.JobReport = Exists=%d TestA-%d % (job.DoesVolumeExist(Vol), numvol)
 job.VolumeName=TestA-%d % numvol
 
 must i replace all of these strings ?

No.

 if yes, can't they just be 
 referenced from the first string, Vol ?

Yes.

 now, as for constructing the volume labal string... it seems that most 
 variables map to something job. - like job.Pool, job.Job, job.Level etc.
 
 how would i use these variables to define the label ?
 
 i am trying to imitate a volume label like
 ${Pool}_${Job}-${Level}-${Year}.${Month:p/2/0/r}.${Day:p/2/0/r}-${Hour:p/2/0/r}.${Minute:p/2/0/r}
 
 which would also require variables like year, month etc. how can i 
 include those ?

By using python's methods. The module datetime offers date objects, 
which can be used to print the current month, for example. The 
strftime method could be used to get the year, month and day nicely 
formatted as a string.

The pool and job name can be accessed using Baculas job methods, 
similar to the example.

In a real-world script, you should ensure you create unique names 
using the DoesVolumeExist method, by the way.

 i'm really lost with all this, but this probably is the best time to do 
 this as i have set up a test system before attempting a large upgrade, 
 so postponing the change can come back to me later...
 ...

As always... right.

Unfortunately, as I don't actually use python events myself (grin) I 
can't provide another working example.

Arno

 Arno

-- 
Arno Lehmann
IT-Service Lehmann
www.its-lehmann.de

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] Problems with 'Automatic Volume Labeling'

2007-10-23 Thread Arno Lehmann
Hello,

23.10.2007 09:25,, Michael Lang wrote::
 Hi everyone,
 
 i have a question regarding 'Automatic Volume Labeling', a short 
 explanation of what i'm trying to do ...
 
 i'm responsible for a small company, the backup is done to external 
 disks. There are different Pools writing
 the Backup to specific disks labeling them with a syntax like:
 
 Label Format= 
 Pool-Weekly-${Year}-${Month:p/2/0/r}-${Day:p/2/0/r}-${NumVols:+1:p/4/0/r}
 
 which if no use able media exists is labeled on the device like 
 'Pool-Weekly-2007-10-23-0001'. So far so good,
 but this only happens once, means the 'Maximum Volume Bytes' is set to 
 204800 (2GB) to ensure, it doesn't
 matter where the external Disk is attached, the files are readable.
 If a Backup Job requires more than one Media, the first get's labeled 
 and for every new Media required during the
 Backup Job, Bacula asks the Operator to label a new Media.
 
 My only solution for this right now is to estimate how much space the 
 Backup will use, and label the Volumes
 before the Job runs, but as you can imagine thats annoying ...

Yes.

 is there anything i'm missing that this happens ?
 thanks for any hint ...

I'd first suggest to drop the LabelFormat directive. It's deprecated 
and will vanish some day.

Instead, use a python event to provide names for new volumes.

This is described in the manual, for example 
http://www.bacula.org/dev-manual/Python_Scripting.html#SECTION00356

After trying this it would be time for a more detailed problem report 
(if the problem persist), preferrably including the version of Bacula 
you're running...

Arno

 kind regards
 Michael Lang
 


-- 
Arno Lehmann
IT-Service Lehmann
www.its-lehmann.de

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] Problems with 'Automatic Volume Labeling'

2007-10-23 Thread Rich
On 2007.10.23. 11:40, Arno Lehmann wrote:
 Hello,

...
 My only solution for this right now is to estimate how much space the 
 Backup will use, and label the Volumes
 before the Job runs, but as you can imagine thats annoying ...
 
 Yes.
 
 is there anything i'm missing that this happens ?
 thanks for any hint ...
 
 I'd first suggest to drop the LabelFormat directive. It's deprecated 
 and will vanish some day.
 
 Instead, use a python event to provide names for new volumes.

umh. i must have missed this... will it really be dropped ? as i am 
using it, i don't fancy learning python just to replicate its functionality.

i am using this parameter to create single file per backup job and give 
them meaningful names - would it indeed at some point get replaced by a 
requirement to script in python ?

 This is described in the manual, for example 
 http://www.bacula.org/dev-manual/Python_Scripting.html#SECTION00356
...
-- 
  Rich

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] Problems with 'Automatic Volume Labeling'

2007-10-23 Thread Chris Sarginson
Rich wrote:
 
 umh. i must have missed this... will it really be dropped ? as i am 
 using it, i don't fancy learning python just to replicate its functionality.
 

Unless I misunderstood this 
[http://www.mail-archive.com/bacula-users@lists.sourceforge.net/msg09517.html] 
(and I hope I havent) then this will not be dropped, per say, but some 
of the extra functionality will be written out.

I use this function to create volumes as IP_IP_IP_IP- - I assume that 
this basic method will still be available - you just wont be able to 
substitute in variables.

-- 
Kind regards

Chris Sarginson
Technical Support
UKFast.Net Ltd

(t) 0870 111 8866
(f) 0870 458 4545

The UK's Best Hosting Provider ISPA Awards 2007, 2006 and 2005

Dedicated Servers - Managed Hosting - Domain Names- http://www.ukfast.net

UKFast.Net Ltd, City Tower, Piccadilly Plaza, Manchester, M1 4BT
Registered in England. Number 384 5616

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


Re: [Bacula-users] Problems with 'Automatic Volume Labeling'

2007-10-23 Thread Arno Lehmann
Hi,

23.10.2007 12:14,, Rich wrote::
 On 2007.10.23. 11:40, Arno Lehmann wrote:
 Hello,
 
 ...
 My only solution for this right now is to estimate how much space the 
 Backup will use, and label the Volumes
 before the Job runs, but as you can imagine thats annoying ...
 Yes.

 is there anything i'm missing that this happens ?
 thanks for any hint ...
 I'd first suggest to drop the LabelFormat directive. It's deprecated 
 and will vanish some day.

 Instead, use a python event to provide names for new volumes.
 
 umh. i must have missed this... will it really be dropped ? as i am 
 using it, i don't fancy learning python just to replicate its functionality.

Well... it won't be dropped anytime soon, but I recall Kern stating 
that he won't touch that code anymore, so once he needs to rework the 
code related to automatic volume labeling, it might be gone.

I couldn't say how likely that is, though - might be tomorrow, or in 
ten years.

 i am using this parameter to create single file per backup job and give 
 them meaningful names - would it indeed at some point get replaced by a 
 requirement to script in python ?

That requirement, by the way, is not very problematic. The sample 
given in the manual should almost work out of the box, and python is 
easier to learn than Baculas variable substitution language :-)

 This is described in the manual, for example 
 http://www.bacula.org/dev-manual/Python_Scripting.html#SECTION00356
 ...

Anyway - I'm operating Bacula installations using the LabelFormat 
option as well, and those work correctly. But then, these 
installations haven't labeled a volume for more than a year now, as 
their pools have reached their maximum number of volumes by now. It 
might be that there is a bug somewhere, which noone noticed yet.

You could try to set up a test pool and job, where you limit the 
volumes to, say, 10MB, use the most simple form of LabelFormat, i.e. 
Label- or something, and assign a newly created storage device to it.

Then, run a job, preferrably with debug output enabled, and see what 
happens.

That should eliminate the chance that some misconfiguration crept into 
your catalog, and it should give a good set of debug files to analyze 
quickly.

Arno

-- 
Arno Lehmann
IT-Service Lehmann
www.its-lehmann.de

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users