← Back to team overview

curtin-dev team mailing list archive

Re: [Merge] ~dbungert/curtin:ask-about-swap into curtin:master

 

Thanks for this. I guess the only change here is that the reason the swap file "may not work" is now logged at debug in the force case vs warning. I don't think that's very significant.

Diff comments:

> diff --git a/curtin/swap.py b/curtin/swap.py
> index 5aea0b8..7acc69e 100644
> --- a/curtin/swap.py
> +++ b/curtin/swap.py
> @@ -93,18 +93,21 @@ def get_target_kernel_version(target):
>  
>  def can_use_swapfile(target, fstype):
>      if fstype is None:
> -        raise RuntimeError(
> -            'Unknown target filesystem type, may not support swapfiles')
> -    if fstype in ['btrfs', 'xfs']:
> +        LOG.debug('Unknown target filesystem type, may not support swapfiles')
> +        return False
> +    elif fstype == 'btrfs':
>          # check kernel version
>          pkg_ver = get_target_kernel_version(target)
>          if not pkg_ver:
> -            raise RuntimeError('Failed to read target kernel version')
> -        if fstype == 'btrfs' and pkg_ver['major'] < 5:
> -            raise RuntimeError(
> -                'btrfs requiers kernel version 5.0+ to use swapfiles')
> -    elif fstype in ['zfs']:
> -        raise RuntimeError('ZFS cannot use swapfiles')
> +            LOG.debug('Failed to read target kernel version')
> +            return False
> +        if pkg_ver['major'] < 5:

You know how I react to code like this :-)

> +            LOG.debug('btrfs requires kernel version 5.0+ to use swapfiles')
> +            return False
> +    elif fstype == 'zfs':
> +        LOG.debug('ZFS cannot use swapfiles')
> +        return False
> +    return True
>  
>  
>  def setup_swapfile(target, fstab=None, swapfile=None, size=None, maxsize=None,


-- 
https://code.launchpad.net/~dbungert/curtin/+git/curtin/+merge/444944
Your team curtin developers is requested to review the proposed merge of ~dbungert/curtin:ask-about-swap into curtin:master.



References