mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #9581 from vbatts/vbatts-fix_gh9138
contrib: fix the docker-device-tool
This commit is contained in:
commit
ca2ebaeafe
1 changed files with 8 additions and 5 deletions
|
@ -3,12 +3,15 @@ package main
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/docker/docker/daemon/graphdriver/devmapper"
|
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
log "github.com/Sirupsen/logrus"
|
||||||
|
"github.com/docker/docker/daemon/graphdriver/devmapper"
|
||||||
|
"github.com/docker/docker/pkg/devicemapper"
|
||||||
)
|
)
|
||||||
|
|
||||||
func usage() {
|
func usage() {
|
||||||
|
@ -60,7 +63,7 @@ func main() {
|
||||||
|
|
||||||
if *flDebug {
|
if *flDebug {
|
||||||
os.Setenv("DEBUG", "1")
|
os.Setenv("DEBUG", "1")
|
||||||
log.SetLevel("debug")
|
log.SetLevel(log.DebugLevel)
|
||||||
}
|
}
|
||||||
|
|
||||||
if flag.NArg() < 1 {
|
if flag.NArg() < 1 {
|
||||||
|
@ -70,7 +73,7 @@ func main() {
|
||||||
args := flag.Args()
|
args := flag.Args()
|
||||||
|
|
||||||
home := path.Join(*root, "devicemapper")
|
home := path.Join(*root, "devicemapper")
|
||||||
devices, err := devmapper.NewDeviceSet(home, false)
|
devices, err := devmapper.NewDeviceSet(home, false, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Can't initialize device mapper: ", err)
|
fmt.Println("Can't initialize device mapper: ", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
@ -143,7 +146,7 @@ func main() {
|
||||||
usage()
|
usage()
|
||||||
}
|
}
|
||||||
|
|
||||||
err := devices.RemoveDevice(args[1])
|
err := devicemapper.RemoveDevice(args[1])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Can't remove device: ", err)
|
fmt.Println("Can't remove device: ", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
@ -154,7 +157,7 @@ func main() {
|
||||||
usage()
|
usage()
|
||||||
}
|
}
|
||||||
|
|
||||||
err := devices.MountDevice(args[1], args[2], false)
|
err := devices.MountDevice(args[1], args[2], "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Can't create snap device: ", err)
|
fmt.Println("Can't create snap device: ", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|
Loading…
Reference in a new issue