From b40b2d6cc99b0a6d4614a48321a5ae2aaaaa5b32 Mon Sep 17 00:00:00 2001 From: Tommi Virtanen Date: Wed, 3 Oct 2012 08:47:20 -0700 Subject: [PATCH] ceph-disk-prepare: Avoid triggering activate before prepare is done. 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 --- src/ceph-disk-prepare | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/ceph-disk-prepare b/src/ceph-disk-prepare index 59022078592fe..74b07155ffead 100755 --- a/src/ceph-disk-prepare +++ b/src/ceph-disk-prepare @@ -188,7 +188,7 @@ def prepare( '--mbrtogpt', '--largest-new=1', '--change-name=1:ceph data', - '--typecode=1:4fbd7e29-9d25-41b8-afd0-062c0ceff05d', + '--typecode=1:89c57f98-2fe5-4dc0-89c1-f3ad0ceff2be', '--', disk, ], @@ -223,6 +223,18 @@ def prepare( 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( -- 2.39.5