View Issue Details

IDProjectCategoryView StatusLast Update
0001212bareos-core[All Projects] bconsolepublic2020-04-23 14:31
ReporterhostedpowerAssigned Toarogge 
PrioritylowSeverityminorReproducibilityalways
Status assignedResolutionopen 
PlatformLinuxOSDebianOS Version9
Product Version19.2.6 
Fixed in Version 
Summary0001212: Can no longer prune volumes
DescriptionWe have a script to prune volumes but since 19.2.x it returns error:

for pool, vols in con.call('list volumes')['volumes'].items():
    for v in vols:
        if v['volstatus'] == 'Full' or v['volstatus'] == 'Used':
            print("Pruning %s" % v['volumename'])
            con.call('prune volume=%s yes' % v['volumename'])

bareos.exceptions.JsonRpcErrorReceivedException: failed: {u'jsonrpc': u'2.0', u'id': None, u'error': {u'message': u'failed', u'code': 1, u'data': {u'messages': {u'info': [u'The current Volume retention period is: 3 months 10 days \n']}, u'result': {}}}}

Did anythong change in bconsole or is this a bug?



TagsNo tags attached.
bareos-master: impact
bareos-master: action
bareos-19.2: impact
bareos-19.2: action
bareos-18.2: impact
bareos-18.2: action
bareos-17.2: impact
bareos-17.2: action
bareos-16.2: impact
bareos-16.2: action
bareos-15.2: impact
bareos-15.2: action
bareos-14.2: impact
bareos-14.2: action
bareos-13.2: impact
bareos-13.2: action
bareos-12.4: impact
bareos-12.4: action

Activities

arogge

arogge

2020-04-17 15:20

developer   ~0003947

This seems to be broken in 19.2.
I'm trying to find out which change introduced the problem so I can fix it. Can you tell my what exactly was the version you were running before (where the script worked)?
Thank you!
arogge

arogge

2020-04-17 16:09

developer   ~0003948

The problem was in the python-bareos library now handling errors differently.
I have attached a newer version of the script that should work with 19.2. This version should handle the retention message correctly.
I removed the functionality with the volume truncation as it should not be required. You can add it back if you want to. You may need to handle the exception when there were no volumes to be truncated.

prune_all_vol19.py (1,101 bytes)
hostedpower

hostedpower

2020-04-17 16:38

reporter   ~0003949

ok this part works!! Thanks!! :)

I'm checking:

for s in con.call('.storages')['storages']:
    if s['enabled']:
      print ('Truncating volumes on storage %s' % s['name'])
      con.call('truncate volstatus=Purged storage=%s yes' % s['name'])

But that also gives exception, I don't know how to handle this in a smart way , any hints on how to properly interpret and handle exceptions here? :)
hostedpower

hostedpower

2020-04-22 21:43

reporter   ~0003956

looking into this, if we don't explicitely truncate like you said, will the volumes be cleared/emptied? I think it did not and that's why is was added in the first place or what am I missing here? :)
arogge

arogge

2020-04-23 12:48

developer   ~0003960

The usual mode of operation is that volumes are overwritten when they were pruned.
hostedpower

hostedpower

2020-04-23 12:51

reporter   ~0003961

that wouldn't be bad, but it seems they build up too much sometimes, keeping more volumes with data than needed...
hostedpower

hostedpower

2020-04-23 14:31

reporter   ~0003962

Just added it as a test and it cleared up quite some extra space. My code is however not clean:

for s in con.call('.storages')['storages']:
    if s['enabled']:
        print ('Truncating volumes on storage %s' % s['name'])
        try:
            con.call('truncate volstatus=Purged storage=%s yes' % s['name'])
            print("truncated")
        except JsonRpcErrorReceivedException as e:
            print("excepted")


(It always excepts it seems, yet it executes properly)

Issue History

Date Modified Username Field Change
2020-03-16 15:11 hostedpower New Issue
2020-04-17 15:20 arogge Assigned To => arogge
2020-04-17 15:20 arogge Status new => feedback
2020-04-17 15:20 arogge Note Added: 0003947
2020-04-17 16:09 arogge File Added: prune_all_vol19.py
2020-04-17 16:09 arogge Note Added: 0003948
2020-04-17 16:38 hostedpower Note Added: 0003949
2020-04-17 16:38 hostedpower Status feedback => assigned
2020-04-22 21:43 hostedpower Note Added: 0003956
2020-04-23 12:48 arogge Note Added: 0003960
2020-04-23 12:51 hostedpower Note Added: 0003961
2020-04-23 14:31 hostedpower Note Added: 0003962