mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #37875 from Microsoft/jjh/bumpopengcs
Bump Microsoft/opengcs to v0.3.9
This commit is contained in:
commit
d0970ab9a4
5 changed files with 134 additions and 9 deletions
|
@ -7,7 +7,7 @@ github.com/go-check/check 4ed411733c5785b40214c70bce814c3a3a689609 https://githu
|
|||
github.com/golang/gddo 9b12a26f3fbd7397dee4e20939ddca719d840d2a
|
||||
github.com/gorilla/context v1.1
|
||||
github.com/gorilla/mux v1.1
|
||||
github.com/Microsoft/opengcs v0.3.8
|
||||
github.com/Microsoft/opengcs v0.3.9
|
||||
github.com/kr/pty 5cf931ef8f
|
||||
github.com/mattn/go-shellwords v1.0.3
|
||||
github.com/sirupsen/logrus v1.0.6
|
||||
|
|
6
vendor/github.com/Microsoft/opengcs/client/createext4vhdx.go
generated
vendored
6
vendor/github.com/Microsoft/opengcs/client/createext4vhdx.go
generated
vendored
|
@ -97,7 +97,7 @@ func (config *Config) CreateExt4Vhdx(destFile string, sizeGB uint32, cacheFile s
|
|||
return fmt.Errorf("failed to `%s` following hot-add %s to utility VM: %s", testdCommand, destFile, err)
|
||||
}
|
||||
defer testdProc.Close()
|
||||
testdProc.WaitTimeout(time.Duration(int(time.Second) * config.UvmTimeoutSeconds))
|
||||
testdProc.WaitTimeout(time.Second * time.Duration(config.UvmTimeoutSeconds))
|
||||
testdExitCode, err := testdProc.ExitCode()
|
||||
if err != nil {
|
||||
config.dismount(destFile)
|
||||
|
@ -117,7 +117,7 @@ func (config *Config) CreateExt4Vhdx(destFile string, sizeGB uint32, cacheFile s
|
|||
return fmt.Errorf("failed to `%s` following hot-add %s to utility VM: %s", lsCommand, destFile, err)
|
||||
}
|
||||
defer lsProc.Close()
|
||||
lsProc.WaitTimeout(time.Duration(int(time.Second) * config.UvmTimeoutSeconds))
|
||||
lsProc.WaitTimeout(time.Second * time.Duration(config.UvmTimeoutSeconds))
|
||||
lsExitCode, err := lsProc.ExitCode()
|
||||
if err != nil {
|
||||
config.dismount(destFile)
|
||||
|
@ -139,7 +139,7 @@ func (config *Config) CreateExt4Vhdx(destFile string, sizeGB uint32, cacheFile s
|
|||
return fmt.Errorf("failed to RunProcess %q following hot-add %s to utility VM: %s", destFile, mkfsCommand, err)
|
||||
}
|
||||
defer mkfsProc.Close()
|
||||
mkfsProc.WaitTimeout(time.Duration(int(time.Second) * config.UvmTimeoutSeconds))
|
||||
mkfsProc.WaitTimeout(time.Second * time.Duration(config.UvmTimeoutSeconds))
|
||||
mkfsExitCode, err := mkfsProc.ExitCode()
|
||||
if err != nil {
|
||||
config.dismount(destFile)
|
||||
|
|
2
vendor/github.com/Microsoft/opengcs/client/process.go
generated
vendored
2
vendor/github.com/Microsoft/opengcs/client/process.go
generated
vendored
|
@ -158,7 +158,7 @@ func (config *Config) DebugGCS() {
|
|||
logrus.Debugln("benign failure getting gcs logs: ", err)
|
||||
}
|
||||
if proc != nil {
|
||||
proc.WaitTimeout(time.Duration(int(time.Second) * 30))
|
||||
proc.WaitTimeout(time.Second * 30)
|
||||
}
|
||||
logrus.Debugf("GCS Debugging:\n%s\n\nEnd GCS Debugging", strings.TrimSpace(out.String()))
|
||||
}
|
||||
|
|
4
vendor/github.com/Microsoft/opengcs/service/gcsutils/README
generated
vendored
4
vendor/github.com/Microsoft/opengcs/service/gcsutils/README
generated
vendored
|
@ -1,4 +0,0 @@
|
|||
1. This program only runs in Linux. So you just first copy the files over to a Linux machine.
|
||||
2. Get Go and and then run make get-deps && make. This is set the $GOPATH for you and build the binaries.
|
||||
3. vhd_to_tar and tar_to_vhd are the standalone executables that read/write to stdin/out and do the tar <-> vhd conversion.
|
||||
tar2vhd_server is the service VM server that takes client requests over hvsock.
|
129
vendor/github.com/Microsoft/opengcs/vsockexec/vsockexec.c
generated
vendored
Normal file
129
vendor/github.com/Microsoft/opengcs/vsockexec/vsockexec.c
generated
vendored
Normal file
|
@ -0,0 +1,129 @@
|
|||
// vsockexec opens vsock connections for the specified stdio descriptors and
|
||||
// then execs the specified process.
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
#include <linux/vm_sockets.h>
|
||||
#include <netinet/in.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef USE_TCP
|
||||
static const int tcpmode = 1;
|
||||
#else
|
||||
static const int tcpmode;
|
||||
#endif
|
||||
|
||||
static int openvsock(unsigned int cid, unsigned int port)
|
||||
{
|
||||
int s = socket(AF_VSOCK, SOCK_STREAM, 0);
|
||||
if (s < 0) {
|
||||
perror("socket: AF_VSOCK");
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct sockaddr_vm addr = {0};
|
||||
addr.svm_family = AF_VSOCK;
|
||||
addr.svm_port = port;
|
||||
addr.svm_cid = cid;
|
||||
if (connect(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
|
||||
fprintf(stderr, "connect: port %u: %s", port, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
static int opentcp(unsigned short port)
|
||||
{
|
||||
int s = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (s < 0) {
|
||||
perror("socket: AF_INET");
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct sockaddr_in addr = {0};
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons(port);
|
||||
addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
|
||||
if (connect(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
|
||||
fprintf(stderr, "connect: port %u: %s\n", port, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
_Noreturn static void usage(const char *argv0)
|
||||
{
|
||||
fprintf(stderr, "%s [-i port] [-o port] [-e port] -- program [args...]\n", argv0);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
unsigned int ports[3] = {0};
|
||||
int sockets[3] = {-1, -1, -1};
|
||||
int c;
|
||||
while ((c = getopt(argc, argv, "+i:o:e:")) != -1) {
|
||||
switch (c) {
|
||||
case 'i':
|
||||
ports[0] = strtoul(optarg, NULL, 10);
|
||||
break;
|
||||
|
||||
case 'o':
|
||||
ports[1] = strtoul(optarg, NULL, 10);
|
||||
break;
|
||||
|
||||
case 'e':
|
||||
ports[2] = strtoul(optarg, NULL, 10);
|
||||
break;
|
||||
|
||||
default:
|
||||
usage(argv[0]);
|
||||
}
|
||||
}
|
||||
|
||||
if (optind == argc) {
|
||||
fprintf(stderr, "%s: missing program argument\n", argv[0]);
|
||||
usage(argv[0]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (ports[i] != 0) {
|
||||
int j;
|
||||
for (j = 0; j < i; j++) {
|
||||
if (ports[i] == ports[j]) {
|
||||
int s = dup(sockets[j]);
|
||||
if (s < 0) {
|
||||
perror("dup");
|
||||
return 1;
|
||||
}
|
||||
sockets[i] = s;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (j == i) {
|
||||
int s = tcpmode ? opentcp(ports[i]) : openvsock(VMADDR_CID_HOST, ports[i]);
|
||||
if (s < 0) {
|
||||
return 1;
|
||||
}
|
||||
sockets[i] = s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (sockets[i] >= 0) {
|
||||
dup2(sockets[i], i);
|
||||
close(sockets[i]);
|
||||
}
|
||||
}
|
||||
|
||||
execvp(argv[optind], argv + optind);
|
||||
fprintf(stderr, "execvp: %s: %s\n", argv[optind], strerror(errno));
|
||||
return 1;
|
||||
}
|
Loading…
Reference in a new issue