diff --git a/daemon/graphdriver/btrfs/btrfs.go b/daemon/graphdriver/btrfs/btrfs.go index ef77ae9158..a3964b963c 100644 --- a/daemon/graphdriver/btrfs/btrfs.go +++ b/daemon/graphdriver/btrfs/btrfs.go @@ -60,10 +60,14 @@ func (d *Driver) String() string { } func (d *Driver) Status() [][2]string { - return [][2]string{ - {"Build Version", BtrfsBuildVersion()}, - {"Library Version", fmt.Sprintf("%d", BtrfsLibVersion())}, + status := [][2]string{} + if bv := BtrfsBuildVersion(); bv != "-" { + status = append(status, [2]string{"Build Version", bv}) } + if lv := BtrfsLibVersion(); lv != -1 { + status = append(status, [2]string{"Library Version", fmt.Sprintf("%d", lv)}) + } + return status } func (d *Driver) Cleanup() error { diff --git a/daemon/graphdriver/btrfs/version.go b/daemon/graphdriver/btrfs/version.go index 1b2b148c07..89ed85749d 100644 --- a/daemon/graphdriver/btrfs/version.go +++ b/daemon/graphdriver/btrfs/version.go @@ -1,9 +1,18 @@ -// +build linux +// +build linux,!btrfs_noversion package btrfs /* #include + +// because around version 3.16, they did not define lib version yet +int my_btrfs_lib_version() { +#ifdef BTRFS_LIB_VERSION + return BTRFS_LIB_VERSION; +#else + return -1; +#endif +} */ import "C" diff --git a/daemon/graphdriver/btrfs/version_none.go b/daemon/graphdriver/btrfs/version_none.go new file mode 100644 index 0000000000..69a4e51cf8 --- /dev/null +++ b/daemon/graphdriver/btrfs/version_none.go @@ -0,0 +1,13 @@ +// +build linux,btrfs_noversion + +package btrfs + +// TODO(vbatts) remove this work-around once supported linux distros are on +// btrfs utililties of >= 3.16.1 + +func BtrfsBuildVersion() string { + return "-" +} +func BtrfsLibVersion() int { + return -1 +} diff --git a/hack/PACKAGERS.md b/hack/PACKAGERS.md index 265f7d676b..65bf60cd03 100644 --- a/hack/PACKAGERS.md +++ b/hack/PACKAGERS.md @@ -162,6 +162,12 @@ SELinux, you will need to use the `selinux` build tag: export DOCKER_BUILDTAGS='selinux' ``` +If your version of btrfs-progs is < 3.16.1 (also called btrfs-tools), then you +will need the following tag to not check for btrfs version headers: +```bash +export DOCKER_BUILDTAGS='btrfs_noversion' +``` + There are build tags for disabling graphdrivers as well. By default, support for all graphdrivers are built in.