]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk-prepare: Avoid triggering activate before prepare is done.
authorTommi Virtanen <tv@inktank.com>
Wed, 3 Oct 2012 15:47:20 +0000 (08:47 -0700)
committerTommi Virtanen <tv@inktank.com>
Fri, 5 Oct 2012 22:41:35 +0000 (15:41 -0700)
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>
src/ceph-disk-prepare

index 59022078592fe2eceb2ce6a5438a264426d7c51c..74b07155ffeada3083fe7fbb282ac150b00eb7da 100755 (executable)
@@ -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(