Growpart fails on FreeBSD with MBR/Slices

Bug #2016350 reported by Tyler Wilson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init
Fix Released
Undecided
Mina Galić

Bug Description

A VM with slices and/or MBR will have a slice named /dev/da0s1a and makes growpart fail on its partition detection;

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/cloudinit/config/modules.py", line 246, in _run_modules
    ran, _r = cc.run(
  File "/usr/local/lib/python3.9/site-packages/cloudinit/cloud.py", line 67, in run
    return self._runners.run(name, functor, args, freq, clear_on_fail)
  File "/usr/local/lib/python3.9/site-packages/cloudinit/helpers.py", line 185, in run
    results = functor(*args)
  File "/usr/local/lib/python3.9/site-packages/cloudinit/config/cc_growpart.py", line 613, in handle
    resized = util.log_time(
  File "/usr/local/lib/python3.9/site-packages/cloudinit/util.py", line 2721, in log_time
    ret = func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/cloudinit/config/cc_growpart.py", line 526, in resize_devices
    (disk, ptnum) = device_part_info(blockdev)
  File "/usr/local/lib/python3.9/site-packages/cloudinit/config/cc_growpart.py", line 273, in device_part_info
    return (m.group(1), m.group(2))
AttributeError: 'NoneType' object has no attribute 'group'

It seems the regex needs to be modified to support MBR disks, if we want to support them.

Tyler Wilson (loth)
summary: - Growpart fails on FreeBSD with virtio-SCSI
+ Growpart fails on FreeBSD with MBR/Slices
description: updated
description: updated
Revision history for this message
Brett Holman (holmanb) wrote (last edit ):

Thanks, Tyler, for filing this bug.

It looks like fixing this issue involves figuring out what the resize invocation should look like.

On FreeBSD, if I understand correctly, gpart is used to resize the disk. I'm curious what that invocation should look like.

Maybe something like this?

gpart resize -i a /dev/da0s1

Could you please confirm that the above works, or provide an example command that works with MBR+slices?

Chad Smith (chad.smith)
Changed in cloud-init:
status: New → Incomplete
Mina Galić (minagalic)
Changed in cloud-init:
assignee: nobody → Mina Galić (minagalic)
Revision history for this message
Mina Galić (minagalic) wrote :

I've written a very simple patch for this now, if you wanna give it a test drive: https://github.com/canonical/cloud-init/pull/2168

James Falcon (falcojr)
Changed in cloud-init:
status: Incomplete → Fix Committed
Revision history for this message
James Falcon (falcojr) wrote :
Revision history for this message
Chad Smith (chad.smith) wrote : Fixed in cloud-init version 23.2.

This bug is believed to be fixed in cloud-init in version 23.2. If this is still a problem for you, please make a comment and set the state back to New

Thank you.

Changed in cloud-init:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.