diff --git a/Makefile.am b/Makefile.am index 4d5387c9017..b2200d9d442 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,7 +6,8 @@ SUBDIRS = . src qa man EXTRA_DIST += \ src/test/run-cli-tests \ src/test/cli \ - src/test/downloads + src/test/downloads \ + udev/50-rbd.rules check-local: # Build gtest before we build our own tests. Doing this instead # of SUBDIRS because with that, gtest's own tests would be run diff --git a/debian/librbd1.install b/debian/librbd1.install index b3cb648c636..567b3b19fb5 100644 --- a/debian/librbd1.install +++ b/debian/librbd1.install @@ -1 +1,3 @@ usr/lib/librbd.so.* +usr/bin/crbdnamer +lib/udev/rules.d/50-rbd.rules diff --git a/debian/rules b/debian/rules index 6157b9cffa2..1a769f768de 100755 --- a/debian/rules +++ b/debian/rules @@ -41,6 +41,7 @@ install: build dh_installdirs $(MAKE) DESTDIR=$(DESTDIR) install + install -D -m 644 $(CURDIR)/udev/50-rbd.rules $(DESTDIR)/lib/udev/rules.d/50-rbd.rules # Add here commands to install the package into debian/testpack. # Build architecture-independent files here. diff --git a/src/Makefile.am b/src/Makefile.am index fe6a2b4b703..f67f56432dc 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -9,7 +9,7 @@ CLEANFILES = bin_PROGRAMS = sbin_PROGRAMS = sbin_SCRIPTS = -bin_SCRIPTS = crun cclass $(srcdir)/cclsinfo cdebugpack +bin_SCRIPTS = crun cclass $(srcdir)/cclsinfo cdebugpack crbdnamer # C/C++ tests to build will be appended to this check_PROGRAMS = # tests to actually run on "make check"; if you need extra, non-test, @@ -432,6 +432,7 @@ EXTRA_DIST = $(srcdir)/verify-mds-journal.sh $(srcdir)/vstart.sh $(srcdir)/stop. $(srcdir)/cclass.in $(srcdir)/cdebugpack.in \ $(srcdir)/cclsinfo $(srcdir)/make_version $(srcdir)/check_version \ $(srcdir)/.git_version \ + $(srcdir)/crbdnamer \ $(ceph_tool_gui_DATA) # work around old versions of automake that don't define $docdir diff --git a/src/crbdnamer b/src/crbdnamer new file mode 100644 index 00000000000..3bd845e3b43 --- /dev/null +++ b/src/crbdnamer @@ -0,0 +1,5 @@ +#!/bin/sh + +echo -n "cat /sys/devices/rbd/$1/pool" +echo -n " " +echo -n "cat /sys/devices/rbd/$1/name" diff --git a/udev/50-rbd.rules b/udev/50-rbd.rules new file mode 100644 index 00000000000..709e9c18b3f --- /dev/null +++ b/udev/50-rbd.rules @@ -0,0 +1 @@ +KERNEL=="rbd[0-9]*", PROGRAM="/usr/bin/crbdnamer %n", SYMLINK+="rbd/%c{1}/%c{2}:%n"