mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-21 18:11:35 +00:00
vendor: Update hyperkit to latest version
Signed-off-by: Magnus Skjegstad <magnus@skjegstad.com>
This commit is contained in:
parent
6b937b37d5
commit
32ee53f14e
@ -5,7 +5,7 @@ github.com/docker/infrakit cb420e3e50ea60afe58538b1d3cab1cb14059433
|
|||||||
github.com/golang/protobuf c9c7427a2a70d2eb3bafa0ab2dc163e45f143317
|
github.com/golang/protobuf c9c7427a2a70d2eb3bafa0ab2dc163e45f143317
|
||||||
github.com/googleapis/gax-go 8c5154c0fe5bf18cf649634d4c6df50897a32751
|
github.com/googleapis/gax-go 8c5154c0fe5bf18cf649634d4c6df50897a32751
|
||||||
github.com/mitchellh/go-ps 4fdf99ab29366514c69ccccddab5dc58b8d84062
|
github.com/mitchellh/go-ps 4fdf99ab29366514c69ccccddab5dc58b8d84062
|
||||||
github.com/moby/hyperkit fa78d9472a7d98e393233fd61ad5e95adc8c6912
|
github.com/moby/hyperkit 95a60c3e75ac73a1cfd73bacdb5de94a737b6095
|
||||||
github.com/packethost/packngo 91d54000aa56874149d348a884ba083c41d38091
|
github.com/packethost/packngo 91d54000aa56874149d348a884ba083c41d38091
|
||||||
github.com/rneugeba/iso9660wrap 4606f848a055435cdef85305960b0e1bb788d506
|
github.com/rneugeba/iso9660wrap 4606f848a055435cdef85305960b0e1bb788d506
|
||||||
github.com/satori/go.uuid b061729afc07e77a8aa4fad0a2fd840958f1942a
|
github.com/satori/go.uuid b061729afc07e77a8aa4fad0a2fd840958f1942a
|
||||||
|
2
vendor/github.com/moby/hyperkit/README.md
generated
vendored
2
vendor/github.com/moby/hyperkit/README.md
generated
vendored
@ -38,7 +38,7 @@ via `brew` and using `opam` to install the appropriate libraries:
|
|||||||
$ brew install opam libev
|
$ brew install opam libev
|
||||||
$ opam init
|
$ opam init
|
||||||
$ eval `opam config env`
|
$ eval `opam config env`
|
||||||
$ opam install uri qcow.0.9.5 mirage-block-unix.2.7.0 conf-libev logs fmt mirage-unix
|
$ opam install uri qcow.0.10.0 qcow-tool mirage-block-unix.2.7.0 conf-libev logs fmt mirage-unix prometheus-app
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
|
|
||||||
|
44
vendor/github.com/moby/hyperkit/go/hyperkit.go
generated
vendored
44
vendor/github.com/moby/hyperkit/go/hyperkit.go
generated
vendored
@ -63,6 +63,12 @@ var defaultHyperKits = []string{"hyperkit",
|
|||||||
"/Applications/Docker.app/Contents/Resources/bin/hyperkit",
|
"/Applications/Docker.app/Contents/Resources/bin/hyperkit",
|
||||||
"/Applications/Docker.app/Contents/MacOS/com.docker.hyperkit"}
|
"/Applications/Docker.app/Contents/MacOS/com.docker.hyperkit"}
|
||||||
|
|
||||||
|
// Socket9P contains a unix domain socket path and 9p tag
|
||||||
|
type Socket9P struct {
|
||||||
|
Path string `json:"path"`
|
||||||
|
Tag string `json:"tag"`
|
||||||
|
}
|
||||||
|
|
||||||
// HyperKit contains the configuration of the hyperkit VM
|
// HyperKit contains the configuration of the hyperkit VM
|
||||||
type HyperKit struct {
|
type HyperKit struct {
|
||||||
// HyperKit is the path to the hyperkit binary
|
// HyperKit is the path to the hyperkit binary
|
||||||
@ -86,6 +92,9 @@ type HyperKit struct {
|
|||||||
// VSock guest CID
|
// VSock guest CID
|
||||||
VSockGuestCID int `json:"vsock_guest_cid"`
|
VSockGuestCID int `json:"vsock_guest_cid"`
|
||||||
|
|
||||||
|
// 9P sockets
|
||||||
|
Sockets9P []Socket9P `json:"9p_sockets"`
|
||||||
|
|
||||||
// Kernel is the path to the kernel image to boot
|
// Kernel is the path to the kernel image to boot
|
||||||
Kernel string `json:"kernel"`
|
Kernel string `json:"kernel"`
|
||||||
// Initrd is the path to the initial ramdisk to boot off
|
// Initrd is the path to the initial ramdisk to boot off
|
||||||
@ -367,32 +376,49 @@ func (h *HyperKit) buildArgs(cmdline string) {
|
|||||||
a = append(a, "-m", fmt.Sprintf("%dM", h.Memory))
|
a = append(a, "-m", fmt.Sprintf("%dM", h.Memory))
|
||||||
|
|
||||||
a = append(a, "-s", "0:0,hostbridge")
|
a = append(a, "-s", "0:0,hostbridge")
|
||||||
|
a = append(a, "-s", "31,lpc")
|
||||||
|
|
||||||
|
nextSlot := 1
|
||||||
|
|
||||||
if h.VPNKitSock != "" {
|
if h.VPNKitSock != "" {
|
||||||
if h.VPNKitKey == "" {
|
if h.VPNKitKey == "" {
|
||||||
a = append(a, "-s", fmt.Sprintf("1:0,virtio-vpnkit,path=%s", h.VPNKitSock))
|
a = append(a, "-s", fmt.Sprintf("%d:0,virtio-vpnkit,path=%s", nextSlot, h.VPNKitSock))
|
||||||
} else {
|
} else {
|
||||||
a = append(a, "-s", fmt.Sprintf("1:0,virtio-vpnkit,path=%s,uuid=%s", h.VPNKitSock, h.VPNKitKey))
|
a = append(a, "-s", fmt.Sprintf("%d:0,virtio-vpnkit,path=%s,uuid=%s", nextSlot, h.VPNKitSock, h.VPNKitKey))
|
||||||
}
|
}
|
||||||
|
nextSlot++
|
||||||
}
|
}
|
||||||
|
|
||||||
if h.UUID != "" {
|
if h.UUID != "" {
|
||||||
a = append(a, "-U", h.UUID)
|
a = append(a, "-U", 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("%d:0,virtio-blk,%s", nextSlot, h.DiskImage))
|
||||||
|
nextSlot++
|
||||||
}
|
}
|
||||||
|
|
||||||
if h.VSock {
|
if h.VSock {
|
||||||
l := fmt.Sprintf("3,virtio-sock,guest_cid=%d,path=%s", h.VSockGuestCID, h.StateDir)
|
l := fmt.Sprintf("%d,virtio-sock,guest_cid=%d,path=%s", nextSlot, h.VSockGuestCID, h.StateDir)
|
||||||
if len(h.VSockPorts) > 0 {
|
if len(h.VSockPorts) > 0 {
|
||||||
l = fmt.Sprintf("%s,guest_forwards=%s", l, intArrayToString(h.VSockPorts, ";"))
|
l = fmt.Sprintf("%s,guest_forwards=%s", l, intArrayToString(h.VSockPorts, ";"))
|
||||||
}
|
}
|
||||||
a = append(a, "-s", l)
|
a = append(a, "-s", l)
|
||||||
}
|
nextSlot++
|
||||||
if h.ISOImage != "" {
|
|
||||||
a = append(a, "-s", fmt.Sprintf("4,ahci-cd,%s", h.ISOImage))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
a = append(a, "-s", "10,virtio-rnd")
|
if h.ISOImage != "" {
|
||||||
a = append(a, "-s", "31,lpc")
|
a = append(a, "-s", fmt.Sprintf("%d,ahci-cd,%s", nextSlot, h.ISOImage))
|
||||||
|
nextSlot++
|
||||||
|
}
|
||||||
|
|
||||||
|
a = append(a, "-s", fmt.Sprintf("%d,virtio-rnd", nextSlot))
|
||||||
|
nextSlot++
|
||||||
|
|
||||||
|
for _, p := range h.Sockets9P {
|
||||||
|
a = append(a, "-s", fmt.Sprintf("%d,virtio-9p,path=%s,tag=%s", nextSlot, p.Path, p.Tag))
|
||||||
|
nextSlot++
|
||||||
|
}
|
||||||
|
|
||||||
if h.Console == ConsoleFile {
|
if h.Console == ConsoleFile {
|
||||||
a = append(a, "-l", fmt.Sprintf("com1,autopty=%s/tty,log=%s/console-ring", h.StateDir, h.StateDir))
|
a = append(a, "-l", fmt.Sprintf("com1,autopty=%s/tty,log=%s/console-ring", h.StateDir, h.StateDir))
|
||||||
|
5
vendor/github.com/moby/hyperkit/src/lib/block_if.c
generated
vendored
5
vendor/github.com/moby/hyperkit/src/lib/block_if.c
generated
vendored
@ -563,6 +563,7 @@ blockif_open(const char *optstr, const char *ident)
|
|||||||
|
|
||||||
#ifdef HAVE_OCAML_QCOW
|
#ifdef HAVE_OCAML_QCOW
|
||||||
char *mirage_qcow_config = NULL;
|
char *mirage_qcow_config = NULL;
|
||||||
|
char *mirage_qcow_stats_config = NULL;
|
||||||
struct mirage_block_stat msbuf;
|
struct mirage_block_stat msbuf;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -597,6 +598,8 @@ blockif_open(const char *optstr, const char *ident)
|
|||||||
use_mirage = 1;
|
use_mirage = 1;
|
||||||
else if (strncmp(cp, "qcow-config=", 12) == 0)
|
else if (strncmp(cp, "qcow-config=", 12) == 0)
|
||||||
mirage_qcow_config = cp + 12;
|
mirage_qcow_config = cp + 12;
|
||||||
|
else if (strncmp(cp, "qcow-stats-config=", 18) == 0)
|
||||||
|
mirage_qcow_stats_config = cp + 18;
|
||||||
#endif
|
#endif
|
||||||
else if (sscanf(cp, "sectorsize=%d/%d", &ssopt, &pssopt) == 2)
|
else if (sscanf(cp, "sectorsize=%d/%d", &ssopt, &pssopt) == 2)
|
||||||
;
|
;
|
||||||
@ -622,7 +625,7 @@ blockif_open(const char *optstr, const char *ident)
|
|||||||
if (use_mirage) {
|
if (use_mirage) {
|
||||||
#ifdef HAVE_OCAML_QCOW
|
#ifdef HAVE_OCAML_QCOW
|
||||||
mirage_block_register_thread();
|
mirage_block_register_thread();
|
||||||
mbh = mirage_block_open(nopt, mirage_qcow_config);
|
mbh = mirage_block_open(nopt, mirage_qcow_config, mirage_qcow_stats_config);
|
||||||
if (mbh < 0) {
|
if (mbh < 0) {
|
||||||
perror("Could not open mirage-block device");
|
perror("Could not open mirage-block device");
|
||||||
goto err;
|
goto err;
|
||||||
|
29
vendor/github.com/moby/hyperkit/src/lib/mirage_block_c.c
generated
vendored
29
vendor/github.com/moby/hyperkit/src/lib/mirage_block_c.c
generated
vendored
@ -46,19 +46,26 @@ if (fn == NULL) { \
|
|||||||
acquiring the runtime lock. */
|
acquiring the runtime lock. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ocaml_mirage_block_open(const char *config, const char *options, int *out, int *err) {
|
ocaml_mirage_block_open(const char *device, const char *qcow_config, const char *stats_config, int *out, int *err) {
|
||||||
CAMLparam0();
|
CAMLparam0();
|
||||||
CAMLlocal4(ocaml_config, ocaml_options_opt, ocaml_string, handle);
|
CAMLlocal5(ocaml_device, ocaml_qcow_config, ocaml_stats_config, ocaml_string, handle);
|
||||||
ocaml_config = caml_copy_string(config);
|
ocaml_device = caml_copy_string(device);
|
||||||
if (options == NULL) {
|
if (qcow_config == NULL) {
|
||||||
ocaml_options_opt = Val_int(0); /* None */
|
ocaml_qcow_config = Val_int(0); /* None */
|
||||||
} else {
|
} else {
|
||||||
ocaml_string = caml_copy_string(options);
|
ocaml_string = caml_copy_string(qcow_config);
|
||||||
ocaml_options_opt = caml_alloc(1, 0); /* Some */
|
ocaml_qcow_config = caml_alloc(1, 0); /* Some */
|
||||||
Store_field (ocaml_options_opt, 0, ocaml_string);
|
Store_field (ocaml_qcow_config, 0, ocaml_string);
|
||||||
|
}
|
||||||
|
if (stats_config == NULL) {
|
||||||
|
ocaml_stats_config = Val_int(0); /* None */
|
||||||
|
} else {
|
||||||
|
ocaml_string = caml_copy_string(stats_config);
|
||||||
|
ocaml_stats_config = caml_alloc(1, 0); /* Some */
|
||||||
|
Store_field (ocaml_stats_config, 0, ocaml_string);
|
||||||
}
|
}
|
||||||
OCAML_NAMED_FUNCTION("mirage_block_open")
|
OCAML_NAMED_FUNCTION("mirage_block_open")
|
||||||
handle = caml_callback2_exn(*fn, ocaml_config, ocaml_options_opt);
|
handle = caml_callback3_exn(*fn, ocaml_device, ocaml_qcow_config, ocaml_stats_config);
|
||||||
if (Is_exception_result(handle)){
|
if (Is_exception_result(handle)){
|
||||||
*err = 1;
|
*err = 1;
|
||||||
} else {
|
} else {
|
||||||
@ -69,11 +76,11 @@ ocaml_mirage_block_open(const char *config, const char *options, int *out, int *
|
|||||||
}
|
}
|
||||||
|
|
||||||
mirage_block_handle
|
mirage_block_handle
|
||||||
mirage_block_open(const char *config, const char *options) {
|
mirage_block_open(const char *device, const char *qcow_config, const char *stats_config) {
|
||||||
int result;
|
int result;
|
||||||
int err = 1;
|
int err = 1;
|
||||||
caml_acquire_runtime_system();
|
caml_acquire_runtime_system();
|
||||||
ocaml_mirage_block_open(config, options, &result, &err);
|
ocaml_mirage_block_open(device, qcow_config, stats_config, &result, &err);
|
||||||
caml_release_runtime_system();
|
caml_release_runtime_system();
|
||||||
if (err){
|
if (err){
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
|
8
vendor/github.com/moby/hyperkit/src/lib/mirage_block_c.h
generated
vendored
8
vendor/github.com/moby/hyperkit/src/lib/mirage_block_c.h
generated
vendored
@ -31,10 +31,12 @@ mirage_block_unregister_thread(void);
|
|||||||
/* An opened mirage-block device */
|
/* An opened mirage-block device */
|
||||||
typedef int mirage_block_handle;
|
typedef int mirage_block_handle;
|
||||||
|
|
||||||
/* Open a mirage block device with the given optional string configuration.
|
/* Open a mirage block device with the given optional qcow and stats
|
||||||
To use the default configuration, pass NULL for options. */
|
configuration.
|
||||||
|
To use the default configuration, pass NULL for qcow_config.
|
||||||
|
To not expose stats, pass NULL for stats_config */
|
||||||
extern mirage_block_handle
|
extern mirage_block_handle
|
||||||
mirage_block_open(const char *config, const char *options);
|
mirage_block_open(const char *device, const char *qcow_config, const char *stats_config);
|
||||||
|
|
||||||
struct mirage_block_stat {
|
struct mirage_block_stat {
|
||||||
int candelete; /* 1 if the device supports TRIM/DELETE/DISCARD */
|
int candelete; /* 1 if the device supports TRIM/DELETE/DISCARD */
|
||||||
|
Loading…
Reference in New Issue
Block a user