[PATCH atomic-rhel-7.1] rescue: find root partition of ostree (atomic) installations (#1152041)

Anne Mulhern amulhern at redhat.com
Tue Jan 20 14:45:57 UTC 2015





----- Original Message -----
> From: "Radek Vykydal" <rvykydal at redhat.com>
> To: anaconda-patches at lists.fedorahosted.org
> Sent: Monday, January 19, 2015 8:19:42 AM
> Subject: [PATCH atomic-rhel-7.1] rescue: find root partition of ostree	(atomic) installations (#1152041)
> 
> This patch is targeted for RHEL Atomic Host 7.1 which is using 7.0 anaconda
> plus patches in atomic-rhel-7.1 dist-git branch. So the patch should go to
> rhel7-branch in 7.2 dev.
> 
> ---
>  pyanaconda/rescue.py | 37 +++++++++++++++++++++++++++++++++++++
>  1 file changed, 37 insertions(+)
> 
> diff --git a/pyanaconda/rescue.py b/pyanaconda/rescue.py
> index e0c4e13..fbf3f06 100644
> --- a/pyanaconda/rescue.py
> +++ b/pyanaconda/rescue.py
> @@ -264,6 +264,42 @@ def _unlock_devices(intf, storage):
>                          device.format.passphrase = None
>                          try_passphrase = None
>  
> +def findExistingOstreePartitions(devicetree):
> +    import blivet
> +    if not os.path.exists(blivet.getTargetPhysicalRoot()):
> +        util.makedirs(blivet.getTargetPhysicalRoot())
> +
> +    roots = []
> +    for device in devicetree.leaves:
> +        if not device.format.linuxNative or not device.format.mountable or \
> +           not device.controllable:
> +            continue
> +
> +        try:
> +            device.setup()
> +        except Exception: # pylint: disable=broad-except
> +            log.warning("setup of %s failed", [device.name])

Why is device.name between list brackets?

> +            continue
> +
> +        options = device.format.options + ",ro"

bcl is right...device.format.options could be "".

> +        try:
> +            device.format.mount(options=options,
> mountpoint=iutil.getSysroot())
> +        except Exception: # pylint: disable=broad-except
> +            log.warning("mount of %s as %s failed", device.name,
> device.format.type)
> +            device.teardown()
> +            continue
> +
> +        if not os.access(iutil.getSysroot() + "/ostree", os.R_OK):
> +            device.teardown(recursive=True)
> +            continue
> +
> +        name = _("Ostree on %s") % device.name
> +        roots.append(blivet.Root(mounts=None, swaps=None, name=device.name))
> +
> +    return roots
> +
> +
> +
>  def doRescue(intf, rescue_mount, ksdata):
>      import blivet
>  
> @@ -323,6 +359,7 @@ def doRescue(intf, rescue_mount, ksdata):
>      blivet.storageInitialize(sto, ksdata, [])
>      _unlock_devices(intf, sto)
>      roots = blivet.findExistingInstallations(sto.devicetree)
> +    roots.extend(findExistingOstreePartitions(sto.devicetree))
>  
>      if not roots:
>          root = None
> --
> 1.9.3
> 
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> 

- mulhern


More information about the anaconda-patches mailing list