diff --git a/ceph b/ceph index 239cbebf9..ad1f5e0c3 160000 --- a/ceph +++ b/ceph @@ -1 +1 @@ -Subproject commit 239cbebf96dba6c1532702b7a460937ed4ae6785 +Subproject commit ad1f5e0c3d9679d1f46250497927112ccb72c9be diff --git a/cmd/castled/main.go b/cmd/castled/main.go index 162d28003..328b12dc5 100644 --- a/cmd/castled/main.go +++ b/cmd/castled/main.go @@ -1,6 +1,7 @@ package main import ( + "fmt" "os" "github.com/quantum/castle/pkg/castled" @@ -9,6 +10,13 @@ import ( func main() { + if len(os.Args) > 1 && os.Args[1] == "version" { + fmt.Printf("cephd: %v\n", cephd.Version()) + rmajor, rminor, rpatch := cephd.RadosVersion() + fmt.Printf("rados: %v.%v.%v\n", rmajor, rminor, rpatch) + return + } + if len(os.Args) > 2 && os.Args[1] == "daemon" { cephd.RunDaemon(os.Args[2], os.Args[3:]...) return diff --git a/pkg/cephd/cephd.go b/pkg/cephd/cephd.go index 18f3fc96d..410cdb419 100644 --- a/pkg/cephd/cephd.go +++ b/pkg/cephd/cephd.go @@ -10,6 +10,7 @@ package cephd // #include // #include // #include "cephd/libcephd.h" +// #include "rados/librados.h" import "C" import ( @@ -18,6 +19,14 @@ import ( "unsafe" ) +// Version returns the major, minor, and patch components of the version of +// the RADOS library linked against. +func RadosVersion() (int, int, int) { + var c_major, c_minor, c_patch C.int + C.rados_version(&c_major, &c_minor, &c_patch) + return int(c_major), int(c_minor), int(c_patch) +} + // cephdError represents an error type cephdError int