]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk: map after luks formatting
authorLoic Dachary <ldachary@redhat.com>
Wed, 2 Mar 2016 09:14:16 +0000 (16:14 +0700)
committerLoic Dachary <ldachary@redhat.com>
Fri, 4 Mar 2016 02:13:35 +0000 (09:13 +0700)
dmcrypt_map is idempotent, it does not matter that it is called multiple
times when activating or preparing a device. It is however important to
not cryptsetup remove the device after preparing it because partprobe
may not re-send another add udev event to luksOpen / create it again.

On Ubuntu 14.04, no extra add udev event is sent after the partition was
acknowledged by the kernel. On CentOS 7.2 an extra udev event is sent
for each existing partition, regardless of what the kernel already
knows.

The format() function is just a call to map() to limit the extent of the
refactor. The dmcrypt_map/unmap functions should be refactored into a
device class and the format() function can then be made more specific.

Signed-off-by: Loic Dachary <loic@dachary.org>
src/ceph-disk/ceph_disk/main.py

index 17d3d6ddfc6c3302d676e9009966d5c2907a3087..77d530186d23a768e85ffeb641a970a321f3912c 100755 (executable)
@@ -1657,7 +1657,6 @@ class DevicePartitionCrypt(DevicePartition):
     def format(self):
         self.setup_crypt()
         self.map()
-        self.unmap()
 
 
 class DevicePartitionCryptPlain(DevicePartitionCrypt):
@@ -2062,6 +2061,7 @@ class PrepareSpace(object):
 
         if isinstance(partition, DevicePartitionCrypt):
             partition.format()
+            partition.map()
 
             command_check_call(
                 [