~raharper/cloud-init:fix/growpart-logging-locking

Last commit made on 2020-02-20
Get this branch:
git clone -b fix/growpart-logging-locking https://git.launchpad.net/~raharper/cloud-init
Only Ryan Harper can upload to this branch. If you are Ryan Harper please log in for upload directions.

Branch merges

Branch information

Name:
fix/growpart-logging-locking
Repository:
lp:~raharper/cloud-init

Recent commits

28651b8... by Ryan Harper

cc_growpart: log growpart stdout to console and cloud-init.log (skip stderr duplication)

8d214e6... by Ryan Harper

cc_growpart: handle growpart NOCHANGE scenario

If the partition cannot grow, then growpart will exit with 1 and
emit the NOCHANGE message to stdout. Allow growpart to exit
0 or 1 so we can parse the output for these expected scenarios.
All other exit codes are growpart exceptions. Add unittest for
both the changed and nochanged scenarios through the resize() method.

0d061a9... by Ryan Harper

cc_growpart: refactor ResizeGrowPart to parse output

Now that we're logging growpart output, utilize this data to report the
before, after size values of the device after resizing. Add a get_size
method to the Resize objects, Gpart retains use of the original get_size
method which opens and seeks to end of the file. For growpart we drop
the --dry-run, and instead capture the stdout, stderr of the result and
parse the before and after size values from there.

Add a unittest to verify parsing and error handling.

3f470e8... by Ryan Harper

Drop flocking in get_size

ce35d03... by Ryan Harper

cc_growpart: Add verbosity, locking and realpath translation

Growpart has its own internal logic for selecting which underlying
tools to use to modify the target device partition table. This
information is not visible in cloud-init logging which makes it difficult
to understand what may have occurred when debugging. Adding the
'--verbose' flag and logging the output will emit useful information
about which tool was used (sfdisk vs. sgdisk).

On some platforms the target device may point to a symbolic link,
e.g. /dev/disk/by-partuuid/XXXX; These symbolic links may be
unavailable during partition changes due to udev behavior. Use
os.path.realpath to expand the symbolic links to the real device
path (e.g. /dev/sda1) as this value use used in the get_size() method
cc_growpart uses to compare before and after device values.

Lastly get_size() will now make use of flock (1) to take a shared
lock against the device it will attempt to obtain the size preventing
cc_growpart from reading the size value while udev or other processes
are making changes.

LP: #1834875

c90932f... by Chad Smith

docs: mount_default_files is a list of 6 items, not 7 (#212)

ecffd25... by Ryan Harper

azurecloud: fix issues with instances not starting (#205)

The azurecloud platform did not always start instances
during collect runs. This was a result of two issues. First
the image class _instance method did not invoke the start()
method which then allowed collect stage to attempt to run
scripts without an endpoint. Second, azurecloud used the
image_id as both an instance handle (which is typically
vmName in azure api) as well as an image handle (for image
capture). Resolve this by adding a .vm_name property to
the AzureCloudInstance and reference this property in
AzureCloudImage.

Also in this branch

- Fix error encoding user-data when value is None
- Add additional logging in AzureCloud platform
- Update logging format to print pathname,funcName and line number
  This greatly eases debugging.

LP: #1861921

81c7477... by Ryan Harper

unittest: fix stderr leak in cc_set_password random unittest output. (#208)

890aca4... by Ryan Harper

cc_disk_setup: add swap filesystem force flag (#207)

616d0a6... by =?utf-8?q?Igor_Gali=C4=87?= <email address hidden>

import sysvinit patches from freebsd-ports tree (#161)

bugzilla ref: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224361
svn rev: https://svnweb.freebsd.org/ports?view=revision&revision=457768