Merge pull request #1611 from errordeveloper/uuid

Generate BIOS UUID
This commit is contained in:
Justin Cormack 2017-04-12 19:39:39 +01:00 committed by GitHub
commit 6f2e0b6a52
8 changed files with 312 additions and 7 deletions

View File

@ -10,6 +10,7 @@ import (
log "github.com/Sirupsen/logrus"
"github.com/docker/hyperkit/go"
"github.com/rneugeba/iso9660wrap"
"github.com/satori/go.uuid"
)
// Process the run arguments and execute run
@ -66,7 +67,7 @@ func runHyperKit(args []string) {
}
}
uuidStr := ""
vpnKitKey := ""
if *ipStr != "" {
// If an IP address was requested construct a "special" UUID
// for the VM.
@ -76,10 +77,13 @@ func runHyperKit(args []string) {
uuid[13] = ip.To4()[1]
uuid[14] = ip.To4()[2]
uuid[15] = ip.To4()[3]
uuidStr = fmt.Sprintf("%x-%x-%x-%x-%x", uuid[0:4], uuid[4:6], uuid[6:8], uuid[8:10], uuid[10:])
vpnKitKey = fmt.Sprintf("%x-%x-%x-%x-%x", uuid[0:4], uuid[4:6], uuid[6:8], uuid[8:10], uuid[10:])
}
}
// Generate new UUID, otherwise /sys/class/dmi/id/product_uuid is identical on all VMs
vmUUID := uuid.NewV4().String()
// Run
cmdline, err := ioutil.ReadFile(prefix + "-cmdline")
if err != nil {
@ -97,7 +101,8 @@ func runHyperKit(args []string) {
h.Kernel = prefix + "-bzImage"
h.Initrd = prefix + "-initrd.img"
h.UUID = uuidStr
h.VPNKitKey = vpnKitKey
h.UUID = vmUUID
h.DiskImage = *disk
h.ISOImage = isoPath
h.CPUs = *cpus

View File

@ -9,7 +9,7 @@ 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 c49c076a1b24883c61f5cfbec7943b2e16ad7c5a
github.com/docker/hyperkit 9b5f5fd848f0f5aedccb67a5a8cfa6787b8654f9
github.com/docker/infrakit cb420e3e50ea60afe58538b1d3cab1cb14059433
github.com/ghodss/yaml 0ca9ea5df5451ffdf184b4428c902747c2c11cd7
github.com/golang/protobuf c9c7427a2a70d2eb3bafa0ab2dc163e45f143317

View File

@ -0,0 +1,67 @@
# Integration Testing on Swarm
IT on Swarm allows you to execute integration test in parallel across a Docker Swarm cluster
## Architecture
### Master service
- Works as a funker caller
- Calls a worker funker (`-worker-service`) with a chunk of `-check.f` filter strings (passed as a file via `-input` flag, typically `/mnt/input`)
### Worker service
- Works as a funker callee
- Executes an equivalent of `TESTFLAGS=-check.f TestFoo|TestBar|TestBaz ... make test-integration-cli` using the bind-mounted API socket (`docker.sock`)
### Client
- Controls master and workers via `docker stack`
- No need to have a local daemon
Typically, the master and workers are supposed to be running on a cloud environment,
while the client is supposed to be running on a laptop, e.g. Docker for Mac/Windows.
## Requirement
- Docker daemon 1.13 or later
- Private registry for distributed execution with multiple nodes
## Usage
### Step 1: Prepare images
$ make build-integration-cli-on-swarm
Following environment variables are known to work in this step:
- `BUILDFLAGS`
- `DOCKER_INCREMENTAL_BINARY`
### Step 2: Execute tests
$ ./hack/integration-cli-on-swarm/integration-cli-on-swarm -replicas 40 -push-worker-image YOUR_REGISTRY.EXAMPLE.COM/integration-cli-worker:latest
Following environment variables are known to work in this step:
- `DOCKER_GRAPHDRIVER`
- `DOCKER_EXPERIMENTAL`
#### Flags
Basic flags:
- `-replicas N`: the number of worker service replicas. i.e. degree of parallelism.
- `-chunks N`: the number of chunks. By default, `chunks` == `replicas`.
- `-push-worker-image REGISTRY/IMAGE:TAG`: push the worker image to the registry. Note that if you have only single node and hence you do not need a private registry, you do not need to specify `-push-worker-image`.
Experimental flags for mitigating makespan nonuniformity:
- `-shuffle`: Shuffle the test filter strings
Flags for debugging IT on Swarm itself:
- `-rand-seed N`: the random seed. This flag is useful for deterministic replaying. By default(0), the timestamp is used.
- `-filters-file FILE`: the file contains `-check.f` strings. By default, the file is automatically generated.
- `-dry-run`: skip the actual workload
- `keep-executor`: do not auto-remove executor containers, which is used for running privileged programs on Swarm

View File

@ -0,0 +1,2 @@
# dependencies specific to worker (i.e. github.com/docker/docker/...) are not vendored here
github.com/bfirsh/funker-go eaa0a2e06f30e72c9a0b7f858951e581e26ef773

144
vendor/github.com/docker/docker/vendor.conf generated vendored Normal file
View File

@ -0,0 +1,144 @@
# the following lines are in sorted order, FYI
github.com/Azure/go-ansiterm 388960b655244e76e24c75f48631564eaefade62
github.com/Microsoft/hcsshim v0.5.13
# TODO: get rid of this fork once PR https://github.com/Microsoft/go-winio/pull/43 is merged
github.com/Microsoft/go-winio 7c7d6b461cb10872c1138a0d7f3acf9a41b5c353 https://github.com/dgageot/go-winio.git
github.com/Sirupsen/logrus v0.11.0
github.com/davecgh/go-spew 6d212800a42e8ab5c146b8ace3490ee17e5225f9
github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a
github.com/go-check/check 4ed411733c5785b40214c70bce814c3a3a689609 https://github.com/cpuguy83/check.git
github.com/gorilla/context v1.1
github.com/gorilla/mux v1.1
github.com/kr/pty 5cf931ef8f
github.com/mattn/go-shellwords v1.0.0
github.com/tchap/go-patricia v2.2.6
github.com/vdemeester/shakers 24d7f1d6a71aa5d9cbe7390e4afb66b7eef9e1b3
# forked golang.org/x/net package includes a patch for lazy loading trace templates
golang.org/x/net c427ad74c6d7a814201695e9ffde0c5d400a7674
golang.org/x/sys 8f0908ab3b2457e2e15403d3697c9ef5cb4b57a9
github.com/docker/go-units 9e638d38cf6977a37a8ea0078f3ee75a7cdb2dd1
github.com/docker/go-connections a2afab9802043837035592f1c24827fb70766de9
golang.org/x/text f72d8390a633d5dfb0cc84043294db9f6c935756
github.com/RackSec/srslog 456df3a81436d29ba874f3590eeeee25d666f8a5
github.com/imdario/mergo 0.2.1
#get libnetwork packages
github.com/docker/libnetwork b6cb1eee1e7fc27ee05f0eb830d3e60e67a88565
github.com/docker/go-events 18b43f1bc85d9cdd42c05a6cd2d444c7a200a894
github.com/armon/go-radix e39d623f12e8e41c7b5529e9a9dd67a1e2261f80
github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec
github.com/hashicorp/go-msgpack 71c2886f5a673a35f909803f38ece5810165097b
github.com/hashicorp/memberlist 88ac4de0d1a0ca6def284b571342db3b777a4c37
github.com/hashicorp/go-multierror fcdddc395df1ddf4247c69bd436e84cfa0733f7e
github.com/hashicorp/serf 598c54895cc5a7b1a24a398d635e8c0ea0959870
github.com/docker/libkv 1d8431073ae03cdaedb198a89722f3aab6d418ef
github.com/vishvananda/netns 604eaf189ee867d8c147fafc28def2394e878d25
github.com/vishvananda/netlink c682914b0b231f6cad204a86e565551e51d387c0
github.com/BurntSushi/toml f706d00e3de6abe700c994cdd545a1a4915af060
github.com/samuel/go-zookeeper d0e0d8e11f318e000a8cc434616d69e329edc374
github.com/deckarep/golang-set ef32fa3046d9f249d399f98ebaf9be944430fd1d
github.com/coreos/etcd 824277cb3a577a0e8c829ca9ec557b973fe06d20
github.com/ugorji/go f1f1a805ed361a0e078bb537e4ea78cd37dcf065
github.com/hashicorp/consul v0.5.2
github.com/boltdb/bolt fff57c100f4dea1905678da7e90d92429dff2904
github.com/miekg/dns 75e6e86cc601825c5dbcd4e0c209eab180997cd7
# get graph and distribution packages
github.com/docker/distribution b38e5838b7b2f2ad48e06ec4b500011976080621
github.com/vbatts/tar-split v0.10.1
github.com/opencontainers/go-digest a6d0ee40d4207ea02364bd3b9e8e77b9159ba1eb
# get go-zfs packages
github.com/mistifyio/go-zfs 22c9b32c84eb0d0c6f4043b6e90fc94073de92fa
github.com/pborman/uuid v1.0
# get desired notary commit, might also need to be updated in Dockerfile
github.com/docker/notary v0.4.2
google.golang.org/grpc v1.0.4
github.com/miekg/pkcs11 df8ae6ca730422dba20c768ff38ef7d79077a59f
github.com/docker/go v1.5.1-1-1-gbaf439e
github.com/agl/ed25519 d2b94fd789ea21d12fac1a4443dd3a3f79cda72c
# When updating, also update RUNC_COMMIT in hack/dockerfile/binaries-commits accordingly
github.com/opencontainers/runc 9c2d8d184e5da67c95d601382adf14862e4f2228 https://github.com/docker/runc.git # libcontainer
github.com/opencontainers/runtime-spec 1c7c27d043c2a5e513a44084d2b10d77d1402b8c # specs
github.com/seccomp/libseccomp-golang v0.9.0
# libcontainer deps (see src/github.com/opencontainers/runc/Godeps/Godeps.json)
github.com/coreos/go-systemd v4
github.com/godbus/dbus v4.0.0
github.com/syndtr/gocapability 2c00daeb6c3b45114c80ac44119e7b8801fdd852
github.com/golang/protobuf 8ee79997227bf9b34611aee7946ae64735e6fd93
# gelf logging driver deps
github.com/Graylog2/go-gelf 7029da823dad4ef3a876df61065156acb703b2ea
github.com/fluent/fluent-logger-golang v1.2.1
# fluent-logger-golang deps
github.com/philhofer/fwd 98c11a7a6ec829d672b03833c3d69a7fae1ca972
github.com/tinylib/msgp 75ee40d2601edf122ef667e2a07d600d4c44490c
# fsnotify
github.com/fsnotify/fsnotify v1.2.11
# awslogs deps
github.com/aws/aws-sdk-go v1.4.22
github.com/go-ini/ini 060d7da055ba6ec5ea7a31f116332fe5efa04ce0
github.com/jmespath/go-jmespath 0b12d6b521d83fc7f755e7cfc1b1fbdd35a01a74
# logentries
github.com/bsphere/le_go 7a984a84b5492ae539b79b62fb4a10afc63c7bcf
# gcplogs deps
golang.org/x/oauth2 96382aa079b72d8c014eb0c50f6c223d1e6a2de0
google.golang.org/api 3cc2e591b550923a2c5f0ab5a803feda924d5823
cloud.google.com/go 9d965e63e8cceb1b5d7977a202f0fcb8866d6525
github.com/googleapis/gax-go da06d194a00e19ce00d9011a13931c3f6f6887c7
google.golang.org/genproto b3e7c2fb04031add52c4817f53f43757ccbf9c18
# native credentials
github.com/docker/docker-credential-helpers v0.5.0
# containerd
github.com/docker/containerd 9048e5e50717ea4497b757314bad98ea3763c145
github.com/tonistiigi/fifo 1405643975692217d6720f8b54aeee1bf2cd5cf4
# cluster
github.com/docker/swarmkit b74ec2b81bb1d4a998f461bb2dc59b9408b7790f
github.com/golang/mock bd3c8e81be01eef76d4b503f5e687d2d1354d2d9
github.com/gogo/protobuf 8d70fb3182befc465c4a1eac8ad4d38ff49778e2
github.com/cloudflare/cfssl 7fb22c8cba7ecaf98e4082d22d65800cf45e042a
github.com/google/certificate-transparency d90e65c3a07988180c5b1ece71791c0b6506826e
golang.org/x/crypto 3fbbcd23f1cb824e69491a5930cfeff09b12f4d2
golang.org/x/time a4bde12657593d5e90d0533a3e4fd95e635124cb
github.com/hashicorp/go-memdb cb9a474f84cc5e41b273b20c6927680b2a8776ad
github.com/hashicorp/go-immutable-radix 8e8ed81f8f0bf1bdd829593fdd5c29922c1ea990
github.com/hashicorp/golang-lru a0d98a5f288019575c6d1f4bb1573fef2d1fcdc4
github.com/coreos/pkg fa29b1d70f0beaddd4c7021607cc3c3be8ce94b8
github.com/pivotal-golang/clock 3fd3c1944c59d9742e1cd333672181cd1a6f9fa0
github.com/prometheus/client_golang 52437c81da6b127a9925d17eb3a382a2e5fd395e
github.com/beorn7/perks 4c0e84591b9aa9e6dcfdf3e020114cd81f89d5f9
github.com/prometheus/client_model fa8ad6fec33561be4280a8f0514318c79d7f6cb6
github.com/prometheus/common ebdfc6da46522d58825777cf1f90490a5b1ef1d8
github.com/prometheus/procfs abf152e5f3e97f2fafac028d2cc06c1feb87ffa5
github.com/matttproud/golang_protobuf_extensions v1.0.0
github.com/pkg/errors 839d9e913e063e28dfd0e6c7b7512793e0a48be9
github.com/grpc-ecosystem/go-grpc-prometheus 6b7015e65d366bf3f19b2b2a000a831940f0f7e0
# cli
github.com/spf13/cobra v1.5.1 https://github.com/dnephin/cobra.git
github.com/spf13/pflag 9ff6c6923cfffbcd502984b8e0c80539a94968b7
github.com/inconshreveable/mousetrap 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75
github.com/flynn-archive/go-shlex 3f9db97f856818214da2e1057f8ad84803971cff
github.com/Nvveen/Gotty 6018b68f96b839edfbe3fb48668853f5dbad88a3 https://github.com/ijc25/Gotty
# metrics
github.com/docker/go-metrics 86138d05f285fd9737a99bee2d9be30866b59d72
# composefile
github.com/mitchellh/mapstructure f3009df150dadf309fdee4a54ed65c124afad715
github.com/xeipuuv/gojsonpointer e0fe6f68307607d540ed8eac07a342c33fa1b54a
github.com/xeipuuv/gojsonreference e02fc20de94c78484cd5ffb007f8af96be030a45
github.com/xeipuuv/gojsonschema 93e72a773fade158921402d6a24c819b48aba29d
gopkg.in/yaml.v2 4c78c975fe7c825c6d1466c42be594d1d6f3aba6

View File

@ -69,7 +69,9 @@ type HyperKit struct {
StateDir string `json:"state_dir"`
// VPNKitSock is the location of the VPNKit socket used for networking.
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.
// VPNKitKey is a string containing a UUID, it can be used in conjunction with VPNKit to get consistent IP address.
VPNKitKey string `json:"vpnkit_key"`
// UUID is a string containing a UUID, it sets BIOS DMI UUID for the VM (as found in /sys/class/dmi/id/product_uuid on Linux).
UUID string `json:"uuid"`
// DiskImage is the path to the disk image to use
DiskImage string `json:"disk"`
@ -344,12 +346,15 @@ func (h *HyperKit) buildArgs(cmdline string) {
a = append(a, "-s", "0:0,hostbridge")
if h.VPNKitSock != "" {
if h.UUID == "" {
if h.VPNKitKey == "" {
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))
a = append(a, "-s", fmt.Sprintf("1:0,virtio-vpnkit,path=%s,uuid=%s", h.VPNKitSock, h.VPNKitKey))
}
}
if h.UUID != "" {
a = append(a, "-U", h.UUID)
}
if h.DiskImage != "" {
a = append(a, "-s", fmt.Sprintf("2:0,virtio-blk,%s", h.DiskImage))
}

1
vendor/github.com/docker/hyperkit/go/vendor.conf generated vendored Normal file
View File

@ -0,0 +1 @@
github.com/mitchellh/go-ps 4fdf99ab29366514c69ccccddab5dc58b8d84062

81
vendor/github.com/docker/infrakit/vendor.conf generated vendored Normal file
View File

@ -0,0 +1,81 @@
# Vendor configuration for trash (https://github.com/rancher/trash)
# Install trash with `go get github.com/rancher/trash`
# Synchronize the vendor/ directory with `vendor.conf` by running `trash`.
# Update dependencies by running `trash -u`.
# package
github.com/docker/infrakit
github.com/Masterminds/sprig 2.8.0
github.com/Microsoft/go-winio 0.3.6
github.com/Sirupsen/logrus v0.11.0-5-gabc6f20
github.com/aokoli/goutils 1.0.0
github.com/armon/go-radix 4239b77
github.com/beorn7/perks 4c0e845
github.com/beorn7/perks/quantile 4c0e845
github.com/coreos/etcd/auth/authpb v3.1.3
github.com/coreos/etcd/clientv3 v3.1.3
github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes v3.1.3
github.com/coreos/etcd/etcdserver/etcdserverpb v3.1.3
github.com/coreos/etcd/mvcc/mvccpb v3.1.3
github.com/coreos/etcd/pkg/tlsutil v3.1.3
github.com/davecgh/go-spew v1.0.0-9-g346938d
github.com/docker/distribution v2.6.0-rc.1-4-g7694c31
github.com/docker/docker 3a68292
github.com/docker/go-connections v0.2.1-10-gf512407
github.com/docker/go-units v0.3.1-8-g8a7beac
github.com/ghodss/yaml 73d445a93680fa1a78ae23a5839bad48f32ba1ee
github.com/golang/glog 23def4e
github.com/golang/mock bd3c8e8
github.com/golang/protobuf/jsonpb 4bd1920723d7b7c925de087aa32e2187708897f7
github.com/golang/protobuf/proto 4bd1920723d7b7c925de087aa32e2187708897f7
github.com/gorilla/handlers v1.1-12-ge1b2144
github.com/gorilla/mux 757bef9
github.com/gorilla/rpc 22c016f
github.com/grpc-ecosystem/go-grpc-prometheus v1.1
github.com/grpc-ecosystem/grpc-gateway/runtime 84398b94e188ee336f307779b57b3aa91af7063c
github.com/grpc-ecosystem/grpc-gateway/utilities 84398b94e188ee336f307779b57b3aa91af7063c
github.com/inconshreveable/mousetrap 76626ae
github.com/jmespath/go-jmespath 0.2.2-14-gbd40a43
github.com/juju/ansiterm 35c59b9
github.com/juju/errors 6f54ff6
github.com/juju/gomaasapi 31d8415
github.com/juju/loggo 3b7ece4
github.com/juju/schema e4e0580
github.com/juju/utils 8f0eda3
github.com/juju/version 1f41e27
github.com/lunixbochs/vtclean 4fbf763
github.com/mattn/go-colorable d228849
github.com/mattn/go-isatty 30a891c
github.com/matttproud/golang_protobuf_extensions v1.0.0
github.com/nightlyone/lockfile 1d49c98
github.com/opencontainers/runc v1.0.0-rc2-137-g43c4300
github.com/pkg/errors v0.8.0-2-g248dadf
github.com/pmezard/go-difflib v1.0.0
github.com/prometheus/client_golang/prometheus v0.8.0
github.com/prometheus/client_model 6f38060
github.com/prometheus/common 49fee29
github.com/prometheus/procfs a1dba9c
github.com/satori/go.uuid v1.1.0
github.com/spf13/afero 06b7e5f
github.com/spf13/cobra 6e91dde
github.com/spf13/pflag 5ccb023
github.com/stretchr/testify v1.1.4-4-g976c720
github.com/twmb/algoimpl 716f8e7
github.com/vaughan0/go-ini a98ad7e
golang.org/x/crypto/pbkdf2 b07d8c9
golang.org/x/net 0dd7c8d
golang.org/x/sys b699b70
golang.org/x/text a263ba8
google.golang.org/grpc v1.0.4
google.golang.org/grpc/codes v1.0.4
google.golang.org/grpc/credentials v1.0.4
google.golang.org/grpc/grpclog v1.0.4
google.golang.org/grpc/metadata v1.0.4
gopkg.in/inconshreveable/log15.v2 v2.11
gopkg.in/juju/names.v2 0847c26
gopkg.in/mgo.v2/bson 3f83fa5
gopkg.in/mgo.v2/internal 3f83fa5
gopkg.in/tylerb/graceful.v1 v1.2.13
gopkg.in/yaml.v2 a5b47d3