[blivet][master] Get rid of the has_lvm function

Anne Mulhern amulhern at redhat.com
Thu Jan 22 14:45:18 UTC 2015



----- Original Message -----
> From: "Vratislav Podzimek" <vpodzime at redhat.com>
> To: anaconda-patches at lists.fedorahosted.org
> Sent: Wednesday, January 21, 2015 8:49:28 AM
> Subject: [blivet][master] Get rid of the has_lvm function
> 
> It's only used in the tests and since blivet requires lvm tools to be
> installed
> I doubt any (user) code uses it.
> 
> Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
> ---
>  blivet/devicelibs/lvm.py          | 8 --------
>  tests/devicelibs_test/lvm_test.py | 9 ---------
>  2 files changed, 17 deletions(-)
> 
> diff --git a/blivet/devicelibs/lvm.py b/blivet/devicelibs/lvm.py
> index 7e2dbef..290e64d 100644
> --- a/blivet/devicelibs/lvm.py
> +++ b/blivet/devicelibs/lvm.py
> @@ -50,14 +50,6 @@ ThPoolProfile = namedtuple("ThPoolProfile", ["name",
> "desc"])
>  KNOWN_THPOOL_PROFILES = (ThPoolProfile("thin-generic", N_("Generic")),
>                           ThPoolProfile("thin-performance",
>                           N_("Performance")))
>  
> -def has_lvm():
> -    if util.find_program_in_path("lvm"):
> -        for line in open("/proc/devices").readlines():
> -            if "device-mapper" in line.split():
> -                return True
> -
> -    return False
> -
>  # Start config_args handling code
>  #
>  # Theoretically we can handle all that can be handled with the LVM --config
> diff --git a/tests/devicelibs_test/lvm_test.py
> b/tests/devicelibs_test/lvm_test.py
> index 8f776b2..d88c451 100755
> --- a/tests/devicelibs_test/lvm_test.py
> +++ b/tests/devicelibs_test/lvm_test.py
> @@ -254,15 +254,6 @@ class LVMAsRootTestCase(LVMAsRootTestCaseBase):
>          self.assertEqual(lvm.lvs(vg_name="wrong-vg-name"), {})
>  
>          ##
> -        ## has_lvm
> -        ##
> -        # pass
> -        self.assertEqual(lvm.has_lvm(), True)
> -
> -        # fail
> -        # TODO
> -
> -        ##
>          ## lvremove
>          ##
>          # pass
> --
> 2.1.0
> 
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> 

The application availability branch I'm working on now has a purpose
of dynamically detecting availability of tools. Right now the work I
have done is all in formats, but we expect to wrap around devicelibs
stuff as well. At that point we should be able to drop the Requires
lvm tools to a Suggests.

It might be that has_lvm() is wrong, but it's possibly still the best
reference for how to detect availability of lvm tools, so I'ld feel
better about leaving it in, if possible.

- mulhern



More information about the anaconda-patches mailing list