Clean up port forwarding code

Clean up port forwarding code in preparation for VirtualBox support.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
vbox: Port forwarding

This adds port forwarding support to vbox via the "-f" command line
option that is already supported by QEMU.

The syntax of a port forward rule is:

  <host-port>:<guest-port>

For example, running Don's HTTP server example with:

  [penberg@localhost http-server]$ capstan run -p vbox -f 9090:8080

makes the guest 8080 port available at localhost:9090.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
capstan.go: Unify RunConfig initialization

Inline 'image' and 'hypervisor' variables to RunConfig initializer.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
qemu: Fix Ctrl-C handling for running guest

Currently, pressing Ctrl-C kills QEMU.  Fix that by making sure the key
press is propagated all the way to the OSv guest.  This makes Ctrl-C
behave like it does with scripts/run.py in osv.git.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
run: Drop terminal into raw mode

Drop the terminal into raw mode to make Ctrl-C work with VirtualBox as
well.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Fetch dependencies automatically

Make dependency fetching part of the install script.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Capstan: Add Search action

search action allows the user to search in a remote repository.

To get all the images do:
capstan search

to search for all the images that contains the word 'tomcat' do
capstan search tomcat

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Capstan: Add S3 repository

This patch adds s3 remote repository, and index file per image.

This image file contains meta data about the image, like description,
and time of creation.

Both local and remote repository has the same directory structure:
{namespace}/{image}/
Inside the image directory there is an image per supported hypervisor.

After this patch is applied, it will be possible to run:

capstan images
to get the list of local images with their meta-data

capstan search [term]
to search for a remote image/s with an optional search term

capstan pull {image}
pull an image from the remote repository and put it in the local
repository. The original git functionality remains, if the image is
found remotely, it will be downloaded from the S3 repository if not, the
git will be used.

pull update all the types of the available image

This patch also contains a run of gofmt

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Capstan: Change the repository to use S3 repository if needed

When doing git pull, the repository will first check if the requested
image is found in the remote s3 repository, if so, it will be downloaded
from there, if not, the git functionality will be used.

In capstan images, if there is meta data (index.yaml) for the image,
that meta data will be printed, if not only the image will be displayed

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Tests: Update test to support the new output format

With the addition of metadata file, the images task print an extra
header line, that the test need to take into account.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Merge pull request #23 from amnonh/master

Add S3 Repository support
S3 Repository: Fix creating directory for the target

Fix a few bugs:
Make sure that there is a terget directory for the downloaded file
Do not expect an empty directory in the bucket

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Merge pull request #24 from amnonh/mkdir_s3

S3 Repository: Fix creating directory for the target
run: Pull remote images automatically

Fixes #25.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
s3_repository: Fix error handling

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
s3_repository: Simplify file info printing

Use fmt.Sprintf() for formatting.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Move Github repository support to separate file

Clean up repository.go and move Github support to separate file.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Run gofmt on s3_repository.go

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Switch to Cloudius repository URL

Use the Cloudius repository URL instead of Amnon's personal S3 bucket.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Clean up filesystem after test

Remove the "example.qcow2" file after tests are run.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>