Action "add-disk" fails with disks which still have device-mapper leftovers
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Ceph OSD Charm |
New
|
Undecided
|
Unassigned |
Bug Description
I've run the add-disk action on devices that still had device-mapper entries from a previous deployment. This fails with a stack trace.
This is because pvcreate can't open the block device exclusively:
partx: /dev/disk/
Failed to find physical volume "/dev/bcache1".
Failed to find physical volume "/dev/bcache1".
Can't open /dev/bcache1 exclusively. Mounted filesystem?
Traceback (most recent call last):
File "/var/lib/
File "lib/ceph/
File "lib/ceph/
File "lib/ceph/
File "lib/ceph/
File "/usr/local/
File "/usr/lib/
raise CalledProcessEr
subproces
When inspecting the block device I can see entries for device-mapper:
# dmsetup ls
ceph--c18fd969-
ceph--78b8d18a-
ceph--c18fd969-
ceph--78b8d18a-
ceph--6b4f06b5-
ceph--6b4f06b5-
After clearing them by hand via `dmsetup remove` the add-disk action succeeds
Probably the action should just clear those device-mapper entries.
Alternatively it would be good to catch that situation and print a warning message.
Hi Peter
When you say "previous deployment", do you mean that the machine was not new/pristine when the charm was newly deployed to that machine?
Thanks.