Skip to content

Commit

Permalink
Destroy qgroup as part of share deletion.
Browse files Browse the repository at this point in the history
  • Loading branch information
schakrava committed Jun 27, 2015
1 parent 8e621a6 commit 4e71b76
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/rockstor/fs/btrfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,10 @@ def remove_share(pool, pool_device, share_name):
subvol_mnt_pt = root_pool_mnt + '/' + share_name
if (not is_subvol(subvol_mnt_pt)):
return
qgroup = ('0/%s' % share_id(pool, pool_device, share_name))
delete_cmd = [BTRFS, 'subvolume', 'delete', subvol_mnt_pt]
run_command(delete_cmd)
return qgroup_destroy(qgroup, root_pool_mnt)


def remove_snap(pool, pool_device, share_name, snap_name):
Expand Down Expand Up @@ -460,6 +462,15 @@ def qgroup_id(pool, disk_name, share_name):
return '0/' + sid


def qgroup_destroy(qid, mnt_pt):
o, e, rc = run_command([BTRFS, 'qgroup', 'show', mnt_pt])
for l in o:
if (re.match(qid, l) is not None and
l.split()[0] == qid):
return run_command([BTRFS, 'qgroup', 'destroy', qid, mnt_pt])
return False


def update_quota(pool, pool_device, qgroup, size_bytes):
pool_device = '/dev/' + pool_device
root_pool_mnt = mount_root(pool, pool_device)
Expand Down

0 comments on commit 4e71b76

Please sign in to comment.