Commit Graph

262 Commits

Author SHA1 Message Date
Justin Cormack
a3de645048 Merge pull request #2397 from dave-tucker/aws-panic
aws: Fix panic when there is no console output
2017-08-10 21:59:54 +01:00
Dave Tucker
90bf0cc2f6 aws: Fix panic when there is no console output
When an AWS machine is stopped and there is no console output the CLI
panics due to a nil pointer dereference. This commit checks that the
console output is not null before attempting to decode it.

Signed-off-by: Dave Tucker <dt@docker.com>
2017-08-10 17:28:09 +01:00
Dave Tucker
f574ada213 aws: Honour the zone variable when creating an instance
Instances were being created in a different AZ to the one specified in
the zone variable. This could lead to situations where the disks and the
instance were in different AZs and would result in an error.

This commit adds placement information to the API call used to create
the instance.

Fixes: #2388

Signed-off-by: Dave Tucker <dt@docker.com>
2017-08-10 16:49:56 +01:00
Rolf Neugebauer
1a9d736f75 Merge pull request #2392 from rn/p2
Better kernel cmdline handling on packet.net
2017-08-09 14:20:55 +01:00
Rolf Neugebauer
a885eb3304 cmd: Append the kernel command line args when booting on Packet
The iPXE needs the hard coded value of 'kernel-params' but
we should append the kernel command line from the YAML in case
it sets other parameters.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-08-09 13:18:41 +01:00
Rolf Neugebauer
934d818bf1 cmd: Restructure iPXE script code for packet backend
Break it into multiple instructions. The single line was
super hard to parse.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-08-09 12:19:31 +01:00
Justin Cormack
34dc65561b Robustify ISO/kernel detection on hyperkit
Much easier to follow and more correct; also ignores directories.

fix #2385

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-08-09 12:00:00 +01:00
Rolf Neugebauer
04a689fcc4 cmd: Enable console access for packet.net
On 'linuxkit run packet' ssh into the SOS for the newly created
machine. This requires that you have set up your ssh keys and
have at least once logged into the ssh so that the host keys
are present in the 'known_hosts' file.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-08-07 21:35:41 +01:00
Rolf Neugebauer
148b51347f vendor: add ssh agent package
This is needed for ssh into the serial console on packet.net

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-08-07 21:35:41 +01:00
Rolf Neugebauer
c804ff0dc1 cmd: Enable always-pxe for packet.net
This option configures the machine to always PXE boot. By
default it would only PXE boot for the first time.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-08-07 21:35:41 +01:00
Rolf Neugebauer
bdc06ee30a cmd: Add packet.net env variable names to help message
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-08-07 21:35:41 +01:00
Rolf Neugebauer
71a4cd2f3c cmd: Prefix packet.net host name with username
If a packet account is shared between users, this makes it
clearer who created the machine.

Also, switch "moby" to "linuxkit"

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-08-07 21:35:41 +01:00
Rolf Neugebauer
a837312cc7 cmd: Switch packet.net API to github.com/bzub/packngo
This fork has initial support for always-pxe and was
suggested to use be used as an interim solution here:
https://github.com/packethost/packngo/issues/22#issuecomment-319973502

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-08-07 21:35:41 +01:00
Justin Cormack
73b516f09b Merge pull request #2302 from dave-tucker/mdgcp
linuxkit: Better GCP disk handling
2017-08-07 16:01:53 +01:00
Ian Campbell
97da92dc65 linuxkit: Bump to logrus 1.0.2 (with case change).
To enable this bump github.com/Azure/go-ansiterm and github.com/docker/docker
to their latest version which have switched to lower case.

This in turn requires bumping golang.org/x/sys since github.com/docker/docker/pkg/term
now uses `unix.IoctlGetTermios`. I picked the revision from docker/docker's vendor.conf.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-08-07 12:11:43 +01:00
Zachery Hostens
9173d88456 save mac address within state
Signed-off-by: Zachery Hostens <zacheryph@gmail.com>
2017-08-06 22:39:34 -05:00
Rolf Neugebauer
7c3f9690d5 cmd/qemu: Better handling of arch
- When executing on aarch64, use it as the default arch
- When selecting aarch64 on a non aarch64 system set the
  CPU flag to a default value (not 'host').

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-08-04 15:45:00 +01:00
Justin Cormack
d7caf92708 Merge pull request #2355 from justincormack/bootrom
Support UEFI ISO boot on hyperkit
2017-08-04 12:45:27 +01:00
Justin Cormack
317ddb09df Do not try to autodetect UEFI mode
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-08-04 11:42:30 +01:00
Justin Cormack
8aa811540f Support UEFI ISO boot on hyperkit
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-08-04 11:34:51 +01:00
Eric Briand
5e53f548a1 Fix AWS push
Signed-off-by: Eric Briand <eric.briand@gmail.com>
2017-08-04 10:36:00 +02:00
Rolf Neugebauer
684ad6778d cmd: Use qemu multi-arch image for qemu runner
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-08-03 17:36:22 +01:00
Nick Jones
f65a4e803d Update OpenStack run and push support
This commit updates the support for pushing images into OpenStack by
inheriting environment variables for endpoint and authentication
information, when available.

It also attempts to make the `openstack run` support more consistent
with other providers (specifically GCP and AWS), i.e just take the name
of the image as the argument and launch an instance using that.

Finally, it also updates the relevant documentation for OpenStack
support.

Signed-off-by: Nick Jones <nick@dischord.org>
2017-08-02 22:45:38 +01:00
Justin Cormack
550bf41d0b Merge pull request #2337 from zacheryph/qemu-pidfile
save qemu pid in state directory
2017-08-02 15:53:17 +01:00
Nick Jones
a6f3f99d72 Initial support for launching instances on OpenStack
This commit provides rudimentary support for launching instances on an
OpenStack platform.

Signed-off-by: Nick Jones <nick@dischord.org>
2017-08-02 14:40:38 +01:00
Zachery Hostens
aa48795203 save qemu pid in state directory
Signed-off-by: Zachery Hostens <zacheryph@gmail.com>
2017-08-01 11:23:43 -05:00
Dave Tucker
3dd45d41aa linuxkit: Better GCP disk handling
This commit allows the GCP backend to use the familiar `-disk` behaviour
that the local hypervisors use. The `file` attribute is used as the disk
name in GCP. The size is converted to GB and is always > 1GB.
This has the benefit of allowing multiple disks to be used with GCP
instances.

Signed-off-by: Dave Tucker <dt@docker.com>
2017-07-26 20:53:50 +01:00
Rolf Neugebauer
896c3574ab cmd: Change logic for using EFI FW when qemu is run in a container
By default we want qemu to use the EFI firmware image in the qemu
container. However the logic in the code would always bind mount
the FW image into the container.

This commit changes the logic to only bind mount the FW image if
it was specified on the commandline.

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-07-26 18:14:28 +01:00
Rolf Neugebauer
4b25e00c7d cmd: Update qmeu container image hash
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-07-26 18:14:28 +01:00
Ian Campbell
096aec0a19 qemu: Add -networking option, with various new alternatives
This follows the model in the hyperkit runner, although the options are
different.

The options are:

- `user`: the existing user mode networking (the default).
- `tap,«device»`: replaces the previous `-tap-device «device»` option.
- `bridge,«name»`: tap device on (preexisting) named bridge.
- `none`: No networking at all.

If not running as root then `bridge` mode requires host configuration
http://wiki.qemu.org/Features/HelperNetworking. TL;DR: you need to `chmod u+s`
the `qemu-bridge-helper` and to whitelist specific bridges in
`/etc/qemu/bridge.conf`.

Pass an explicit virtio nic and configure a random MAC since QEMU seems to use
the same one by default.

In the hyperkit runner the various `networking*` constants become
`hyperkitNetworking*` to avoid namespace clashes (e.g. for `None`). The QEMU
equivalents are `qemuNetworking*`.

Both hyperkit and qemu now support an explicit `-networking default` or
`-networking ''` to make scripting easier.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-07-25 16:17:22 +01:00
Ian Campbell
cb86cdb027 qemu: Generate a random uuid and pass via -uuid
This is the same behaviour as the LinuxKit backend.

This populates /sys/class/dmi/id/product_uuid, which newer version of weave-net
appears to require.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-07-25 16:17:22 +01:00
Nick Jones
7c65860a5c Refactor OpenStack push support to use Gophercloud
This commit refactors the OpenStack push support to make use of the
Gophercloud library in order to handle authentication and talking to the
right image service as defined in the service catalogue.

Signed-off-by: Nick Jones <nick@dischord.org>
2017-07-24 13:47:18 +01:00
Rolf Neugebauer
3219daa674 Merge pull request #2264 from tych0/support-tap-qemu
support tap devices in qemu backend
2017-07-21 10:56:24 +01:00
Tycho Andersen
d237c92273 support tap devices in qemu backend
The motivation for this is networking out (in particular, testing NFS
support) from the VM.

We could be a lot more user friendly (a la libvirt) by creating the tap
device for users and allowing them to specify a bridge instead, but then
we'd need root to create this tap device. For now, let's make people do
their own tap devices, and just use them. A tap device can be created for a
bridge as follows:

    # ip tuntap add linuxkit0 mode tap user `whoami`
    # ip link set linuxkit0 up
    # ip link set linuxkit0 master $bridge_name

and then used by:

    $ ./bin/linuxkit run qemu -tap-device linuxkit0 linuxkit

Signed-off-by: Tycho Andersen <tycho@docker.com>
2017-07-20 12:40:07 -06:00
thebsdbox
41f2d2c256 OpenStack Push support
Signed-off-by: Dan Finneran <daniel.finneran@gmail.com>
2017-07-20 16:24:48 +01:00
Dennis Chen
3b1dfb69c7 ARM64: specify external firware binary for containerized qemu
Current implementation uses a fixed firmware(bios) binary
installed by the build process of the qemu container image,
which will prevent us from providing an external firmware binary
outside the container. This patch removes this limitation, thus we
can assign a firware binary image file with "-fw" option.

Signed-off-by: Dennis Chen <dennis.chen@arm.com>
2017-07-14 09:10:42 +00:00
Justin Cormack
944793312a Merge pull request #2197 from ijc/qemu-envvar-overrides
qemu: allow kvm and containerized options to be overridden by the env…
2017-07-13 16:25:51 +01:00
Ian Campbell
cc8bd94960 qemu: allow kvm and containerized options to be overridden by the environment
This is useful in the case where Moby is shelling out to LinuxKit for certain
image types (currently raw and qcow2). Currently to experiment with different
options (e.g. when comparing performance to CI) you have to edit either the
moby or linuxkit tool to change the options used.

The environment variables take precedence over any explict command line options
given.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-07-13 15:23:14 +01:00
Dave Tucker
94f2d2cd9a linuxkit: Fix qemu run behaviour when file does not exist
This commit fixes an issue reported on Slack where `linuxkit run` will
assume that a file that is neither a kernel or iso must be a disk image
without first checking that it exists. This would result in `qemu-img`
attempting to create a disk with 0 size due to the default behaviour of
creating disk images that do not exist.

Signed-off-by: Dave Tucker <dt@docker.com>
2017-07-13 11:46:22 +01:00
Justin Cormack
107c014a9d Re-run vendoring
Latest `vndr` has changed its algorithm a bit. It also pointed out that we were missing
some things.

Move the `vendor` directory up to the `linuxkit` command, else it gets confused by packages
that have Go code in.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-07-11 13:12:00 +01:00
Stefan Bourlon
846e814a7f Backend vCenter: Remove network param for push cmd
The network parameter is not used in the command
"linuxkit push vcenter ..."

Signed-off-by: Stefan Bourlon <stefan.bourlon@ca.com>
2017-07-10 14:03:55 -07:00
Stefan Bourlon
ffef020a09 Backend vCenter: add the datacenter parameter
Signed-off-by: Stefan Bourlon <stefan.bourlon@ca.com>
2017-07-07 14:32:14 -07:00
Stefan Bourlon
ea5114dc93 Backend vCenter: Upload ISO only with linuxkit push
Signed-off-by: Stefan Bourlon <stefan.bourlon@ca.com>
2017-07-07 14:26:58 -07:00
Dennis Chen
3a9c88c0c5 ARM64: Remove the hardcode of virtual machine type
Current implementation hardcodes the virtual machine as
"q35" for x86, this patch remove this hardcode and config
the machine type according to the arch the VM is running.
Also, in order to make sure the qemu can run on arm64 platform,
we need to specify the vcpu type in the command line.

Signed-off-by: Dennis Chen <dennis.chen@arm.com>
2017-07-07 21:54:15 +08:00
Rolf Neugebauer
4a9c00a5e0 src: Update qemu image to latest
Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-07-01 19:24:15 +01:00
Ian Campbell
7151f1af52 qemu: Add -enable-kvm to force (attempted) use (or not) of KVM
The default is set by probing for /dev/kvm. Use of KVM can be forcibly disabled
with `-enable-kvm=false`. Note that passing `-enable-kvm=true` when `/dev/kvm` is
not present still boots but complains:

    Could not access KVM kernel module: No such file or directory
    failed to initialize KVM: No such file or directory
    Back to tcg accelerator.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-06-27 12:20:25 +01:00
Justin Cormack
c20f10f7f8 Add vmnet support to linuxkit run hyperkit
Allows routed networking, so long as you runhyperkit as root.

This has quite a few downsides, including the requirement to
run as root in order to set up the networking, but some people
really want VMs that are routable from the host.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-06-16 10:54:32 -07:00
Rolf Neugebauer
2f212e6c74 cmd: Unify the push coding style
- Use 'flags' for the subcommand FlagSet
- Use %v to print errors
- Use 'path' for the path
- Fix cases where the 'path' refers to a different directory
- Don't use CamelCase for command line options

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
2017-06-15 17:31:28 -07:00
Justin Cormack
d194cf7cf7 Update hyperkit and support multiple disks
Now hyperkit Go API has multiple disk support, allow using them from linuxkit

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
2017-06-15 13:31:46 -07:00
Ian Campbell
e2eb17ef6c Only create qemu runner state dir if it is going to be used.
Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-06-13 17:22:08 +01:00