Merge pull request #9011 from vbatts/vbatts-btrfs_information

btrfs: information for the information gods
This commit is contained in:
Jessie Frazelle 2014-11-13 20:47:07 -08:00
commit 870a695375
6 changed files with 65 additions and 2 deletions

View file

@ -103,7 +103,7 @@ RUN useradd --create-home --gid docker unprivilegeduser
VOLUME /var/lib/docker
WORKDIR /go/src/github.com/docker/docker
ENV DOCKER_BUILDTAGS apparmor selinux
ENV DOCKER_BUILDTAGS apparmor selinux btrfs_noversion
# Wrap all commands in the "docker-in-docker" script to allow nested containers
ENTRYPOINT ["hack/dind"]

View file

@ -60,7 +60,14 @@ func (d *Driver) String() string {
}
func (d *Driver) Status() [][2]string {
return nil
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 {

View file

@ -0,0 +1,24 @@
// +build linux,!btrfs_noversion
package btrfs
/*
#include <btrfs/version.h>
// 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"
func BtrfsBuildVersion() string {
return string(C.BTRFS_BUILD_VERSION)
}
func BtrfsLibVersion() int {
return int(C.BTRFS_LIB_VERSION)
}

View file

@ -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
}

View file

@ -0,0 +1,13 @@
// +build linux
package btrfs
import (
"testing"
)
func TestBuildVersion(t *testing.T) {
if len(BtrfsBuildVersion()) == 0 {
t.Errorf("expected output from btrfs build version, but got empty string")
}
}

View file

@ -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.