~smoser/cloud-utils:feature/1799953-lvm-support

Last commit made on 2020-07-16
Get this branch:
git clone -b feature/1799953-lvm-support https://git.launchpad.net/~smoser/cloud-utils
Only Scott Moser can upload to this branch. If you are Scott Moser please log in for upload directions.

Branch merges

Branch information

Name:
feature/1799953-lvm-support
Repository:
lp:~smoser/cloud-utils

Recent commits

62f2f4d... by Scott Moser

Add test for growpart lvm resize.

The new test seems to work on my system with lvm on a partitioned loop
device.

526bdd6... by Scott Moser

Growpart: add support for resizing an lvm pv after growing the partition.

If lvm is available and lvm knows that the partition is part of a PV,
then resize tell lvm to grow the PV.

LP: #1799953

dbda22e... by Scott Moser

Make resize functions return, so unlock_disk_and_settle is called.

Previously, the resize functions (resize_sfdisk_dos, resize_sfdisk_gpt,
resize_sgdisk_gpt) would not return. Instead, they reported the
change/nochange/changed result and exited.

This meant that unlock_disk_and_settle was not being called except in
the failure case.

2dabc1a... by Paride Legovini

IMDSv2 session token support (#1)

LP: #1870244

Co-authored-by: fred-vogt <email address hidden>

c764723... by Paride Legovini

growpart: parse the kernel version in a more robust way (#2)

The old version didn't support kernel versions (uname -r) like:

 - 4.19.97+
 - 5.4.3.2
 - 6

LP: #1881014

018faaf... by Paride Legovini

Fix some pylint, flake8, shellcheck issues and add basic CI (#4)

Add a basic CI job which checks the code against:

- flake8
- pylint
- shellcheck

using tox and fix the errors/warnings spotted by the job itself.

3d6d512... by Scott Moser

growpart: Do not fail if only sgdisk is available.

Previously growpart would fail if sgdisk was available bug sfdisk
was not. This was mostly just because of the order in which support
was added. We never had a scenario where *only* sgdisk was available.

The change here is:
 * effectively cache the value of 'has_cmd sfdisk' or 'has_cmd sgdisk'
   in global variables SFDISK and SGDISK respectively.
 * set SFDISK_VERSION=0 when sfdisk is not available.

630a772... by Scott Moser

growpart: Fix reading sector size with newer sgdisk versions.

sgdisk seems to have changed its output from:
 Logical sector size: <value>
to
 Sector size (logical): <value>

This adds support for reading either one.
If it fails to determine the sector size, it will emit an error
and assume assume 512.

The change came in sgdisk 1.0.2.
In reading code, it will now output one of:

   Sector size (logical/physical): <logical>/<physical> bytes
or
   Sector size (logical): <logical> bytes

d2976bb... by Scott Moser

growpart: Fail on unknown values of GROWPART_RESIZER.

Growpart's selection of sfdisk or sgdisk can be influenced by
the environment variable 'GROWPART_RESIZER', which defaults to 'auto'.

If the value was set to some unknown value, it emit an error message
and effectively use 'auto'. The change here is to fail on unknown
values.

55b089a... by Scott Moser

debian/tests: fix GROWPART_RESIZER value in 'runtests' function.

The 'runtests' function was setting GROWPART_RESIZER to
'gdisk', not 'sgdisk'.

growpart's current behavior is to ignore unknown values. It would
end up just testing sfdisk and passing.

Instead what we do here is
 - fix the value to 'sgdisk'
 - explicitly skip the test for sgdisk/dos