[rhel7/master] Multiple loops shouldn't be fatal (#980510)

Vratislav Podzimek vpodzime at redhat.com
Tue Jan 6 18:38:23 UTC 2015


On Tue, 2015-01-06 at 10:25 -0800, Brian C. Lane wrote:
> Backing files can have multiple loops associated with them without
> problems. Raising an error here causes a crash when using an iso for
> both stage2 and for the repo (eg. boot with
> inst.repo=hd:/dev/sdb1:/path-to-dvd.iso).
> 
> Instead just use the first loop device in the list as the name.
> 
> Resolves: rhbz#980510
> ---
>  blivet/devicelibs/loop.py | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/blivet/devicelibs/loop.py b/blivet/devicelibs/loop.py
> index 0b374a2..1600ed8 100644
> --- a/blivet/devicelibs/loop.py
> +++ b/blivet/devicelibs/loop.py
> @@ -55,8 +55,9 @@ def get_loop_name(path):
>      args = ["-j", path]
>      buf = losetup(args, capture=True)
>      if len(buf.splitlines()) > 1:
> -        # there should never be more than one loop device listed
> -        raise LoopError("multiple loops associated with %s" % path)
> +        # If there are multiple loop devices use the first one
> +        buf = buf.splitlines()[0]
> +        log.warning("multiple loops associated with %s. Using %s" % (path, buf))
It would be nicer to do splitlines() only once and then check+use the
result. But the change genrally looks good to me.

-- 
Vratislav Podzimek

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



More information about the anaconda-patches mailing list