vendor: Update the HyperKit go bindings

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
Rolf Neugebauer 2017-04-06 21:45:14 +01:00
parent f4127faec3
commit 569a5a4ba8
2 changed files with 11 additions and 5 deletions

View File

@ -9,7 +9,7 @@ github.com/docker/distribution 07f32ac1831ed0fc71960b7da5d6bb83cb6881b5
github.com/docker/engine-api cf82c64276ebc2501e72b241f9fdc1e21e421743 github.com/docker/engine-api cf82c64276ebc2501e72b241f9fdc1e21e421743
github.com/docker/go-connections e15c02316c12de00874640cd76311849de2aeed5 github.com/docker/go-connections e15c02316c12de00874640cd76311849de2aeed5
github.com/docker/go-units 651fc226e7441360384da338d0fd37f2440ffbe3 github.com/docker/go-units 651fc226e7441360384da338d0fd37f2440ffbe3
github.com/docker/hyperkit/go 57e91c5bb6655514aa71d00dd1949db891903d34 github.com/docker/hyperkit/go 89b0a4a88ec340c756a6bd14af57e26f69d29d09
github.com/docker/infrakit cb420e3e50ea60afe58538b1d3cab1cb14059433 github.com/docker/infrakit cb420e3e50ea60afe58538b1d3cab1cb14059433
github.com/ghodss/yaml 0ca9ea5df5451ffdf184b4428c902747c2c11cd7 github.com/ghodss/yaml 0ca9ea5df5451ffdf184b4428c902747c2c11cd7
github.com/golang/protobuf/proto c9c7427a2a70d2eb3bafa0ab2dc163e45f143317 github.com/golang/protobuf/proto c9c7427a2a70d2eb3bafa0ab2dc163e45f143317

View File

@ -69,6 +69,8 @@ type HyperKit struct {
StateDir string `json:"state_dir"` StateDir string `json:"state_dir"`
// VPNKitSock is the location of the VPNKit socket used for networking. // VPNKitSock is the location of the VPNKit socket used for networking.
VPNKitSock string `json:"vpnkit_sock"` VPNKitSock string `json:"vpnkit_sock"`
// UUID is a string containing a UUID for the VM. It can be used in conjunction with VPNKit to get consistent IP address.
UUID string `json:"uuid"`
// DiskImage is the path to the disk image to use // DiskImage is the path to the disk image to use
DiskImage string `json:"disk"` DiskImage string `json:"disk"`
// ISOImage is the (optional) path to a ISO image to attach // ISOImage is the (optional) path to a ISO image to attach
@ -144,12 +146,12 @@ func New(hyperkit, statedir, vpnkitsock, diskimage string) (*HyperKit, error) {
func FromState(statedir string) (*HyperKit, error) { func FromState(statedir string) (*HyperKit, error) {
b, err := ioutil.ReadFile(filepath.Join(statedir, jsonFile)) b, err := ioutil.ReadFile(filepath.Join(statedir, jsonFile))
if err != nil { if err != nil {
return nil, fmt.Errorf("Can't read json file: ", err) return nil, fmt.Errorf("Can't read json file: %s", err)
} }
h := &HyperKit{} h := &HyperKit{}
err = json.Unmarshal(b, h) err = json.Unmarshal(b, h)
if err != nil { if err != nil {
return nil, fmt.Errorf("Can't parse json file: ", err) return nil, fmt.Errorf("Can't parse json file: %s", err)
} }
// Make sure the pid written by hyperkit is the same as in the json // Make sure the pid written by hyperkit is the same as in the json
@ -353,7 +355,11 @@ func (h *HyperKit) buildArgs(cmdline string) {
a = append(a, "-s", "0:0,hostbridge") a = append(a, "-s", "0:0,hostbridge")
if h.VPNKitSock != "" { if h.VPNKitSock != "" {
a = append(a, "-s", fmt.Sprintf("1:0,virtio-vpnkit,path=%s", h.VPNKitSock)) if h.UUID == "" {
a = append(a, "-s", fmt.Sprintf("1:0,virtio-vpnkit,path=%s", h.VPNKitSock))
} else {
a = append(a, "-s", fmt.Sprintf("1:0,virtio-vpnkit,path=%s,uuid=%s", h.VPNKitSock, h.UUID))
}
} }
if h.DiskImage != "" { if h.DiskImage != "" {
a = append(a, "-s", fmt.Sprintf("2:0,virtio-blk,%s", h.DiskImage)) a = append(a, "-s", fmt.Sprintf("2:0,virtio-blk,%s", h.DiskImage))
@ -502,7 +508,7 @@ func checkHyperKit(hyperkit string) (string, error) {
if hyperkit != "" { if hyperkit != "" {
p, err := exec.LookPath(hyperkit) p, err := exec.LookPath(hyperkit)
if err != nil { if err != nil {
return "", fmt.Errorf("Could not find hyperkit executable: ", hyperkit) return "", fmt.Errorf("Could not find hyperkit executable %s: %s", hyperkit, err)
} }
return p, nil return p, nil
} }