@@ -221,7 +221,12 @@ func (p *btrfsPool) removeVolume(root string) error {
221
221
222
222
qgroupID := fmt .Sprintf ("0/%d" , info .ID )
223
223
if err := p .utils .QGroupDestroy (ctx , qgroupID , p .Path ()); err != nil {
224
- return errors .Wrapf (err , "failed to delete qgroup %s" , qgroupID )
224
+ // we log here and not return an error because
225
+ // - qgroup deletion can fail because it is still used by the system
226
+ // even if the volume is gone
227
+ // - failure to delete a qgroup is not a fatal error
228
+ log .Warn ().Err (err ).Str ("group-id" , qgroupID ).Msg ("failed to delete qgroup" )
229
+ return nil
225
230
}
226
231
227
232
return nil
@@ -265,6 +270,7 @@ func (p *btrfsPool) Usage() (usage Usage, err error) {
265
270
return
266
271
}
267
272
273
+ // TODO: we need to run this periodically for each pool
268
274
func (p * btrfsPool ) maintenance () error {
269
275
// this method cleans up all the unused
270
276
// qgroups that could exists on a filesystem
@@ -292,7 +298,7 @@ func (p *btrfsPool) maintenance() error {
292
298
if ! ok {
293
299
log .Debug ().Str ("id" , qgroupID ).Msg ("destroy qgroup" )
294
300
if err := p .utils .QGroupDestroy (ctx , qgroupID , p .Path ()); err != nil {
295
- return err
301
+ log . Warn (). Err ( err ). Str ( "group-id" , qgroupID ). Msg ( "failed to destroy unused group" )
296
302
}
297
303
}
298
304
}
0 commit comments