]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk: - is translated into / with systemd
authorLoic Dachary <ldachary@redhat.com>
Sun, 20 Sep 2015 12:03:39 +0000 (14:03 +0200)
committerLoic Dachary <ldachary@redhat.com>
Tue, 22 Sep 2015 06:46:56 +0000 (08:46 +0200)
When running ceph-disk trigger /dev/dm-1 with systemd, the path name is
translated into /dev/dm/1 because of systemd escape rules. Explicitly
translate - into \x2d for systemd to preserve the -.

It would be better to use systemd-escape
http://www.freedesktop.org/software/systemd/man/systemd-escape.html
but it does not appear to be generally available on CentOS 7 and
probably other distributions.

http://tracker.ceph.com/issues/13174 Fixes: #13174

Signed-off-by: Loic Dachary <ldachary@redhat.com>
src/ceph-disk

index 55319f9fe40960111fad4c4e3fac8d1e85bdf467..70fe4238af2fff637f6998ad6d912a31e9683e01 100755 (executable)
@@ -3022,8 +3022,11 @@ def main_zap(args):
 ###########################
 
 def main_trigger(args):
+    LOG.debug("main_trigger: " + str(args))
     if is_systemd() and not args.sync:
-        service='ceph-disk@{dev}.service'.format(dev=args.dev)
+        # http://www.freedesktop.org/software/systemd/man/systemd-escape.html
+        escaped_dev = args.dev.replace('-', '\\x2d')
+        service='ceph-disk@{dev}.service'.format(dev=escaped_dev)
         LOG.info('systemd detected, triggering %s' % service)
         command(
             [