← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1692087] Re: check_partition_layout has false positives when partitioned with gpt

 

This bug was fixed in the package cloud-init - 0.7.9-153-g16a7302f-
0ubuntu1~17.04.1

---------------
cloud-init (0.7.9-153-g16a7302f-0ubuntu1~17.04.1) zesty-proposed; urgency=medium

  * New upstream snapshot.
    - net: fix reading and rendering addresses in cidr format.
      [Dimitri John Ledkov] (LP: #1689346, #1684349)
    - disk_setup: udev settle before attempting partitioning or fs creation.
      (LP: #1692093)
    - GCE: Update the attribute used to find instance SSH keys.
      [Daniel Watkins] (LP: #1693582)
    - nplan: For bonds, allow dashed or underscore names of keys.
      [Dimitri John Ledkov] (LP: #1690480)
    - tests: python2.6: fix unit tests usage of assertNone and format.
    - tests: update docstring on test_configured_list_with_none
    - fix tools/ds-identify to not write None twice.
    - tox/build: do not package depend on style requirements.
    - tests: ntp: Restructure cc_ntp unit tests. [Chad Smith]
    - flake8: move the pinned version of flake8 up to 3.3.0
    - tests: Apply workaround for snapd bug in test case. [Joshua Powers]
    - RHEL/CentOS: Fix dual stack IPv4/IPv6 configuration.  [Andreas Karis]
    - disk_setup: fix several issues with gpt disk partitions. (LP: #1692087)
    - function spelling & docstring update [Joshua Powers]
    - tests: Fix unittest bug in ntp tests. [Joshua Powers]
    - tox: move pylint target to 1.7.1
    - Fix get_interfaces_by_mac for empty macs (LP: #1692028)
    - DigitalOcean: remove routes except for the public interface.
      [Ben Howard] (LP: #1681531.)
    - netplan: pass macaddress, when specified, for vlans
      [Dimitri John Ledkov] (LP: #1690388)
    - doc: various improvements for the docs on cc_users_groups.
      [Felix Dreissig]
    - cc_ntp: write template before installing and add service restart
      [Ryan Harper] (LP: #1645644)
    - tests: fix cloudstack unit tests to avoid accessing
      /var/lib/NetworkManager [Lars Kellogg-Stedman]
    - tests: fix hardcoded path to mkfs.ext4 [Joshua Powers] (LP: #1691517)
    - Actually skip warnings when .skip file is present.
      [Chris Brinker] (LP: #1691551)
    - netplan: fix netplan render_network_state signature.
      [Dimitri John Ledkov] (LP: #1685944)
    - Azure: fix reformatting of ephemeral disks on resize to large types.
      (LP: #1686514)
    - make deb: Add devscripts dependency for make deb.
      Cleanup packages/bddeb. [Chad Smith] (LP: #1685935)
    - openstack: fix log message copy/paste typo in _get_url_settings
      [Lars Kellogg-Stedman]
    - unittests: fix unittests run on centos [Joshua Powers]
    - Improve detection of snappy to include os-release and kernel cmdline.
      (LP: #1689944)
    - Add address to config entry generated by _klibc_to_config_entry.
      [Julien Castets] (LP: #1691135)
    - sysconfig: Raise ValueError when multiple default gateways are present.
      [Chad Smith] (LP: #1687485)
    - FreeBSD: improvements and fixes for use on Azure
      [Hongjiang Zhang] (LP: #1636345)
    - Add unit tests for ds-identify, fix Ec2 bug found.
    - fs_setup: if cmd is specified, use shell interpretation.
      [Paul Meyer] (LP: #1687712)
    - doc: document network configuration defaults policy and formats.
      [Ryan Harper]
    - doc: Fix name of "uri" key in docs for "cc_apt_configure" module
      [Felix Dreissig]
    - tests: Enable artful in integration tests [Joshua Powers]

 -- Scott Moser <smoser@xxxxxxxxxx>  Fri, 26 May 2017 16:14:09 -0400

** Changed in: cloud-init (Ubuntu Zesty)
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1692087

Title:
  check_partition_layout has false positives when partitioned with gpt

Status in cloud-init:
  Fix Committed
Status in cloud-init package in Ubuntu:
  Fix Released
Status in cloud-init source package in Xenial:
  Fix Released
Status in cloud-init source package in Yakkety:
  Fix Released
Status in cloud-init source package in Zesty:
  Fix Released

Bug description:
  === Begin SRU Template ===
  [Impact]
  The disk setup module (disk_setup) of cloud-init had several issues
  when dealing with GPT formatted devices.  The result was that the user
  didn't get expected behavior if they were requesting GPT disk labels
  or if the disk present already had a GPT label.

  [Test Case]
  1.) launch an instance with a second disk "/dev/vdb".
      This can be done on openstack or azure.

  2.) write a config to system.
     $ sudo tee /etc/cloud/cloud.cfg.d/disk-setup.cfg <EOF
  #cloud-config
  disk_setup:
    /dev/vdb:
      table_type: gpt
      layout: [66, [33, 82]]
      overwrite: True
  fs_setup:
   - device: /dev/vdb
     partition: 1
     filesystem: ext4
   - device: /dev/vdb
     partition: 2
     filesystem: swap
  mounts:
      - ["/dev/vdb1", "/mnt"]
  EOF

  3. Partition the second disk with a gpt partition table.
     download a paritioning tool and use it.
     $ wget https://git.launchpad.net/~smoser/cloud-init/+git/sru-info/tree/bugs/lp-1686514/disk-setup -O disk-setup
     # format /dev/vdb with GPT disk label and 2 partitions.
     $ sudo LABEL=gpt ./disk-setup ntfs2 /dev/vdb

  4. remove state from the instance and reboot.  We expect that the desired
     partitioning will be done and the mount written and used on reboot.

     $ sudo rm -Rf /var/lib/cloud/ /var/log/cloud-init*
     $ sudo reboot

  5. ssh back in and look around
     $ grep vdb /proc/mounts
     $ grep mnt /etc/fstab

     $ sfdisk -l /dev/vdb

  6. sudo reboot
  7. ssh back in and look around.

  [Regression Potential]
  Regressions will be limited to places where the disk_setup module is used.
  That is
   a.) Azure (by default on new instances or re-deployed instance)
   b.) instances with custom user-data or system configuration.

  [Other Info]
  Upstream commit at
    https://git.launchpad.net/cloud-init/commit/?id=3507b59eaa4

  === End SRU Template ===

  As reported in bug 1686514 (comment 11), there is a bug in the code
  that determines if a device layout is "the same" and will thus be re-used.

  Even when functional, this code has some serious shortcomings:
  a.) it does not check sizes at all, only partition types
  b.) it does not check the partition table correctly

  The bug to fix here is simply some issues with its usage of sgdisk.
   * 'sgdisk -p' was being used to determine the size of a disk.
     this can fail if it believes there is a bad gpt partition table.
   * parsing of sgdisk -p output assumed that the 'name' of the partition
     type would not have any spaces (Microsoft basic data)
   * interaction with sgdisk did not realize that sgdisk wants input
     of '8300' rather than '83'.

  Related bugs:
   * bug 1686514: Azure: cloud-init does not handle reformatting GPT partition ephemeral disks
   * bug 1691489: fstab entries written by cloud-config may not be mounted

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1692087/+subscriptions


References