diff --git a/vendor.conf b/vendor.conf index 3bf35ba7a..f0b7863f5 100644 --- a/vendor.conf +++ b/vendor.conf @@ -9,10 +9,10 @@ github.com/docker/distribution 07f32ac1831ed0fc71960b7da5d6bb83cb6881b5 github.com/docker/engine-api cf82c64276ebc2501e72b241f9fdc1e21e421743 github.com/docker/go-connections e15c02316c12de00874640cd76311849de2aeed5 github.com/docker/go-units 651fc226e7441360384da338d0fd37f2440ffbe3 -github.com/docker/hyperkit/go 89b0a4a88ec340c756a6bd14af57e26f69d29d09 +github.com/docker/hyperkit c49c076a1b24883c61f5cfbec7943b2e16ad7c5a github.com/docker/infrakit cb420e3e50ea60afe58538b1d3cab1cb14059433 github.com/ghodss/yaml 0ca9ea5df5451ffdf184b4428c902747c2c11cd7 -github.com/golang/protobuf/proto c9c7427a2a70d2eb3bafa0ab2dc163e45f143317 +github.com/golang/protobuf c9c7427a2a70d2eb3bafa0ab2dc163e45f143317 github.com/googleapis/gax-go 8c5154c0fe5bf18cf649634d4c6df50897a32751 github.com/gorilla/context 08b5f424b9271eedf6f9f0ce86cb9396ed337a42 github.com/gorilla/mux 599cba5e7b6137d46ddf58fb1765f5d928e69604 @@ -31,7 +31,7 @@ github.com/spf13/pflag 9ff6c6923cfffbcd502984b8e0c80539a94968b7 github.com/surma/gocpio fcb68777e7dc4ea43ffce871b552c0d073c17495 github.com/vaughan0/go-ini a98ad7ee00ec53921f08832bc06ecf7fd600e6a1 golang.org/x/crypto 573951cbe80bb6352881271bb276f48749eab6f4 -golang.org/x/net/context a6577fac2d73be281a500b310739095313165611 +golang.org/x/net a6577fac2d73be281a500b310739095313165611 golang.org/x/oauth2 1611bb46e67abc64a71ecc5c3ae67f1cbbc2b921 golang.org/x/sys 99f16d856c9836c42d24e7ab64ea72916925fa97 golang.org/x/text a263ba8 diff --git a/vendor/github.com/docker/hyperkit/go/hyperkit.go b/vendor/github.com/docker/hyperkit/go/hyperkit.go index f79ff94b1..7f43448ca 100644 --- a/vendor/github.com/docker/hyperkit/go/hyperkit.go +++ b/vendor/github.com/docker/hyperkit/go/hyperkit.go @@ -31,12 +31,12 @@ import ( "os" "os/exec" "os/user" + "path" "path/filepath" "strconv" "strings" "github.com/mitchellh/go-ps" - "github.com/rneugeba/iso9660wrap" ) const ( @@ -94,10 +94,6 @@ type HyperKit struct { // connected to. ConsoleStdio and ConsoleFile are supported. Console int `json:"console"` - // UserData, if non empty, will be added to a ISO under the - // filename `config` and passed to the VM. - UserData string `json:"user_data"` - // Below here are internal members, but they are exported so // that they are written to the state json file, if configured. @@ -118,7 +114,7 @@ type HyperKit struct { // - If vpnkitsock is empty no networking is configured. If it is set // to "auto" it tries to re-use the Docker for Mac VPNKit connection. // - If statedir is "" no state is written to disk. -func New(hyperkit, statedir, vpnkitsock, diskimage string) (*HyperKit, error) { +func New(hyperkit, vpnkitsock, statedir string) (*HyperKit, error) { h := HyperKit{} var err error @@ -131,13 +127,11 @@ func New(hyperkit, statedir, vpnkitsock, diskimage string) (*HyperKit, error) { if err != nil { return nil, err } - h.DiskImage = diskimage h.CPUs = defaultCPUs h.Memory = defaultMemory h.Console = ConsoleStdio - h.UserData = "" return &h, nil } @@ -199,9 +193,6 @@ func (h *HyperKit) execute(cmdline string) error { if h.Console == ConsoleFile && h.StateDir == "" { return fmt.Errorf("If ConsoleFile is set, StateDir must be specified") } - if h.UserData != "" && h.ISOImage != "" { - return fmt.Errorf("If UserData is supplied, ISOImage must not be set") - } if h.ISOImage != "" { if _, err = os.Stat(h.ISOImage); os.IsNotExist(err) { return fmt.Errorf("ISO %s does not exist", h.ISOImage) @@ -210,9 +201,6 @@ func (h *HyperKit) execute(cmdline string) error { if h.VSock && h.StateDir == "" { return fmt.Errorf("If virtio-sockets are enabled, StateDir must be specified") } - if h.UserData != "" && h.StateDir == "" { - return fmt.Errorf("If UserData is supplied, StateDir must be specified") - } if _, err = os.Stat(h.Kernel); os.IsNotExist(err) { return fmt.Errorf("Kernel %s does not exist", h.Kernel) } @@ -241,12 +229,6 @@ func (h *HyperKit) execute(cmdline string) error { } } } - if h.UserData != "" { - h.ISOImage, err = createUserDataISO(h.StateDir, h.UserData) - if err != nil { - return err - } - } // Run h.buildArgs(cmdline) @@ -331,6 +313,13 @@ func (h *HyperKit) String() string { // CreateDiskImage creates a empty file suitable for use as a disk image for a hyperkit VM. func CreateDiskImage(location string, sizeMB int) error { + diskDir := path.Dir(location) + if diskDir != "." { + if err := os.MkdirAll(diskDir, 0755); err != nil { + return err + } + } + f, err := os.Create(location) if err != nil { return err @@ -446,6 +435,9 @@ func (h *HyperKit) execHyperKit() error { if err != nil { return err } + } else { + // Make sure we reap the child when it exits + go cmd.Wait() } return nil } @@ -478,31 +470,6 @@ func stream(r io.ReadCloser, dest chan<- string) { }() } -// Create a ISO with Userdata in the specified directory -func createUserDataISO(dir string, init string) (string, error) { - cfgName := filepath.Join(dir, "config") - isoName := cfgName + ".iso" - - if err := ioutil.WriteFile(cfgName, []byte(init), 0644); err != nil { - return "", err - } - - outfh, err := os.OpenFile(isoName, os.O_CREATE|os.O_EXCL|os.O_WRONLY, 0644) - if err != nil { - return "", err - } - infh, err := os.Open(cfgName) - if err != nil { - return "", err - } - err = iso9660wrap.WriteFile(outfh, infh) - if err != nil { - return "", err - } - - return isoName, nil -} - // checkHyperKit tries to find and/or validate the path of hyperkit func checkHyperKit(hyperkit string) (string, error) { if hyperkit != "" {