Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
48 changes: 2 additions & 46 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ endif
# Include makefiles

-include mk/color.mk
-include mk/lib9p.mk
# Include driver debug makefile if $MACHINE_DRIVER_DEBUG=1
ifeq ($(MACHINE_DRIVER_DEBUG),1)
-include mk/driver.mk
Expand Down Expand Up @@ -112,43 +111,6 @@ GO_BUILD_FLAG += -race
endif


# Use virtio-9p shared folder with static build lib9p library
# Default is enable
GO_BUILD_TAGS ?= lib9p
# included 'lib9p' in the $GO_BUILD_TAGS, and exists 'lib9p.a' file
ifneq (,$(findstring lib9p,$(GO_BUILD_TAGS)))
CGO_CFLAGS += -I${PWD}/${LIB9P_DIR}
CGO_LDFLAGS += ${PWD}/vendor/build/lib9p/lib9p.a
bin/docker-machine-driver-xhyve: lib9p
endif


# Use mirage-block for pwritev|preadv
HAVE_OCAML_QCOW := $(shell if ocamlfind query qcow uri >/dev/null 2>/dev/null ; then echo YES ; else echo NO; fi)
ifeq ($(HAVE_OCAML_QCOW),YES)
LIBEV_FILE ?= /usr/local/lib/libev.a
LIBEV = $(shell if test -e $(LIBEV_FILE) ; then echo $(LIBEV_FILE) ; fi )
OCAML_WHERE := $(shell ocamlc -where)
OCAML_LDLIBS := -L $(OCAML_WHERE) \
$(shell ocamlfind query cstruct)/cstruct.a \
$(shell ocamlfind query cstruct)/libcstruct_stubs.a \
$(shell ocamlfind query io-page)/io_page.a \
$(shell ocamlfind query io-page)/io_page_unix.a \
$(shell ocamlfind query io-page)/libio_page_unix_stubs.a \
$(shell ocamlfind query lwt.unix)/liblwt-unix_stubs.a \
$(shell ocamlfind query lwt.unix)/lwt-unix.a \
$(shell ocamlfind query lwt.unix)/lwt.a \
$(shell ocamlfind query threads)/libthreadsnat.a \
$(shell ocamlfind query mirage-block-unix)/libmirage_block_unix_stubs.a \
$(LIBEV) \
-lasmrun -lbigarray -lunix
CGO_CFLAGS += -DHAVE_OCAML=1 -DHAVE_OCAML_QCOW=1 -DHAVE_OCAML=1 -I$(OCAML_WHERE)
CGO_LDFLAGS += $(OCAML_LDLIBS)
GO_BUILD_TAGS += qcow2
bin/docker-machine-driver-xhyve: vendor/github.com/zchee/libhyperkit/mirage_block_ocaml.o
endif


GO_BUILD_FLAG += -tags='$(GO_BUILD_TAGS)'


Expand All @@ -161,9 +123,6 @@ GO_BUILD_FLAG += -tags='$(GO_BUILD_TAGS)'
export GOARCH=amd64
export GOOS=darwin

# Support go1.5 vendoring (let us avoid messing with GOPATH or using godep)
export GO15VENDOREXPERIMENT=1

# TODO: uuid.go need cgo
export CGO_ENABLED=1

Expand All @@ -175,9 +134,6 @@ default: build

build: bin/docker-machine-driver-xhyve

vendor/github.com/zchee/libhyperkit/mirage_block_ocaml.o:
$(VERBOSE) $(GO_CMD) generate $(GO_BUILD_FLAG) $(GO_VERBOSE) ./vendor/github.com/zchee/libhyperkit

bin/docker-machine-driver-xhyve:
$(VERBOSE) test -d bin || mkdir -p bin;
@echo "${CBLUE}==>${CRESET} Build ${CGREEN}${PACKAGE}${CRESET}..."
Expand Down Expand Up @@ -220,8 +176,8 @@ docker-build-nocache:
${DOCKER_CMD} build --rm --no-cache -t ${GITHUB_USER}/${PACKAGE} .


clean: clean-lib9p
@${RM} -r ./bin ./vendor/github.com/zchee/libhyperkit/*.cmi ./vendor/github.com/zchee/libhyperkit/*.cmx ./vendor/github.com/zchee/libhyperkit/*.syso
clean:
@${RM} -r ./bin


run: driver-run
Expand Down
17 changes: 13 additions & 4 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ import:
- package: github.com/johanneswuerbach/nfsexports
- package: github.com/mitchellh/go-ps
- package: github.com/zchee/go-qcow2
- package: github.com/zchee/libhyperkit
- package: github.com/jceel/lib9p
version: 7be3e0b914fbb2d2ecfe2984d02bacfd8e762eae
- package: github.com/zchee/go-vmnet
- package: github.com/moby/hyperkit
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should put version v0.20170425 so that each iteration shouldn't get from master.

- package: github.com/moby/hyperkit
  version: v0.20170425

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually need 62fb993cc65090d3efe29e9b1ed871b017eeaa4d, it contains a PR I submitted yesterday to add support for qcow and sparsebundle disks. What's the best way to pin to that in glide?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dlorenc Then you just put this hash as version. Below should work.

- package: github.com/moby/hyperkit
  version: 62fb993cc65090d3efe29e9b1ed871b017eeaa4d

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Thanks!

version: 62fb993cc65090d3efe29e9b1ed871b017eeaa4d
testImport:
- package: github.com/stretchr/testify
version: v1.1.4
Expand Down
32 changes: 1 addition & 31 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,10 @@
package main

import (
"fmt"
"os"

"github.com/docker/machine/libmachine/drivers/plugin"
"github.com/zchee/docker-machine-driver-xhyve/xhyve"
hyperkit "github.com/zchee/libhyperkit"
)

func main() {
if len(os.Args) >= 2 && os.Args[1] == "xhyve" {
runXhyve()
} else {
plugin.RegisterDriver(xhyve.NewDriver("", ""))
}
}

func runXhyve() {
done := make(chan bool)
ptyCh := make(chan string)

args := os.Args[1:] // Technically we only need 2:, but a bug in hooklift/xhyve requires one arg in the beginning
go func() {
if err := hyperkit.Run(args, ptyCh); err != nil {
fmt.Println(err)
}
done <- true
}()

if os.Args[len(os.Args)-1] != "-M" {
fmt.Printf("Waiting on a pseudo-terminal to be ready... ")
pty := <-ptyCh
fmt.Printf("done\n")
fmt.Printf("Hook up your terminal emulator to %s in order to connect to your VM\n", pty)
}

<-done
plugin.RegisterDriver(xhyve.NewDriver("", ""))
}
7 changes: 7 additions & 0 deletions vendor/github.com/moby/hyperkit/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions vendor/github.com/moby/hyperkit/CODINGSTYLE.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

70 changes: 70 additions & 0 deletions vendor/github.com/moby/hyperkit/CONTRIBUTING.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

77 changes: 77 additions & 0 deletions vendor/github.com/moby/hyperkit/MAINTAINERS

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading