Earlier testing never saw this, but now a mount of a disk triggers a
udev blockdev-added event, causing ceph-disk-activate to run even
before ceph-disk-prepare has had a chance to write the files and
unmount the disk.
Avoid this by using a temporary partition type uuid ("ceph 2 be"), and
only setting it to the permanent ("ceph osd"). The hotplug event won't
match the type uuid, and thus won't trigger ceph-disk-activate.
Signed-off-by: Tommi Virtanen <tv@inktank.com>
'--mbrtogpt',
'--largest-new=1',
'--change-name=1:ceph data',
- '--typecode=1:4fbd7e29-9d25-41b8-afd0-062c0ceff05d',
+ '--typecode=1:89c57f98-2fe5-4dc0-89c1-f3ad0ceff2be',
'--',
disk,
],
finally:
unmount(path)
+ try:
+ subprocess.check_call(
+ args=[
+ 'sgdisk',
+ '--typecode=1:4fbd7e29-9d25-41b8-afd0-062c0ceff05d',
+ '--',
+ disk,
+ ],
+ )
+ except subprocess.CalledProcessError as e:
+ raise PrepareError(e)
+
def parse_args():
parser = argparse.ArgumentParser(