[PATCH 1/5][blivet] Handle nested btrfs subvolumes correctly. (#1016959)

Vratislav Podzimek vpodzime at redhat.com
Mon Nov 25 10:25:47 UTC 2013


On Fri, 2013-11-22 at 10:00 -0600, David Lehman wrote:
> Subvolumes are nested. That is to say that removing subvolume foo
> will also remove subvolumes foo/bar and foo/bar/baz.
> ---
>  blivet/devicelibs/btrfs.py | 12 +++++++++---
>  blivet/devices.py          | 14 ++++++++++++--
>  blivet/devicetree.py       | 17 ++++++++++++++++-
>  3 files changed, 37 insertions(+), 6 deletions(-)
> 
> diff --git a/blivet/devicelibs/btrfs.py b/blivet/devicelibs/btrfs.py
> index 2f0cee4..bde165d 100644
> --- a/blivet/devicelibs/btrfs.py
> +++ b/blivet/devicelibs/btrfs.py
> @@ -32,6 +32,9 @@ _ = lambda x: gettext.ldgettext("blivet", x)
>  import logging
>  log = logging.getLogger("blivet")
>  
> +# this is the volume id btrfs always assigns to the top-level volume/tree
> +MAIN_VOLUME_ID = 5
> +
>  def btrfs(args, capture=False):
>      if capture:
>          exec_func = util.capture_output
> @@ -98,15 +101,18 @@ def create_snapshot(source, dest):
>  def scan_device(path):
>      return btrfs(["device", "scan", path])
>  
> +_subvol_list_regex = r'ID (\d+) gen \d+ parent (\d+) top level \d+ path (.+)\n'
I think this should be all uppercase as a constant and compiled.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list