gce: Introduce --gce-upload-dir option

This specifes a Google Cloud Storage directory to upload local image to.

$ capstan run -p gce --gce-upload-dir gs://my_bucket -i ./local.osv.image.tar.gz $instance_name

will upload the local OSv image to GCE and start a OSv instance.

Signed-off-by: Asias He <asias@cloudius-systems.com>
gce: Check if user logins with GCE

It's easy for new user to forget to login with GCE before running
capstan + GCE.  Do a check and prompt friendly.

If you do not login with GCE, it will prompt:

   You do not currently have an active account selected.
   Please run:

     $ gcloud auth login

   to obtain new credentials, or if you have already logged in with a
   different account:

     $ gcloud config set account <account name>

   to select an already authenticated account to use.

Signed-off-by: Asias He <asias@cloudius-systems.com>
gce: Enable GCE from the repo system

With this patch, the following cmd will create a GCE instance directly from
the remote GCE url, e.g., gs://osv/v0.09/osv-iperf.gce.tar.gz.

$ capstan run -p gce cloudius/osv-iperf

The url is obtained from a file in the remote repo.

Signed-off-by: Asias He <asias@cloudius-systems.com>
Merge pull request #107 from asias/gce.img.upload

gce: Introduce --gce-upload-dir option
Merge pull request #108 from asias/gce.login

gce: Check if user logins with GCE
Merge pull request #109 from asias/gce.repo

gce: Enable GCE from the repo system
Add gcutil as a prerequisite

Add a mention of gcutil, along with a link to the
gcutil installation page. Break "prerequisites" into
local and Google sections.

Signed-off-by: Don Marti <dmarti@cloudius-systems.com>
Merge pull request #111 from dmarti/gcutil-prereq

Add gcutil as a prerequisite
README: need qemu-img for minimal package installation

You cannot "capstan run" without qemu-img, and qemu-system-x86 does not depend ont the package.

Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@iki.fi>
pull: add proxy support

In proxy environment, we can use capstan search to list all images while
we can't use capstan pull to download it. We found that the default http
client uses a default tansport that supports proxy. But the transport of
DisableCompression flag has covered the  default transport, so we may
add the proxy ability.

Signed-off-by: wangbicheng <wangbicheng@huawei.com>
Signed-off-by: Pekka Enberg <penberg@iki.fi>
vbox: Fix VBoxManage error reporting

Capture the VBoxManage command output on errors and propagate it to the
callers.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
images: fix wrong display after deleting all images in a namespace

After deleting all cloudius images through 'capstan rmi', capstan images
will still show that there is a image named 'cloudius'. We found that
the 'cloudius' namespace is treated as a normal image that has no
namespace.

Signed-off-by: wangbicheng <wangbicheng@huawei.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Change os.Getenv(HOME) to util.HomePath()

It is better to use util.HomePath() because it supports Windows, Linux,
and other platforms.

Signed-off-by: wangbicheng <wangbicheng@huawei.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Fix formatting in util/repository.go

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
QEMU: Relax version number parsing

Roman Shaposhnik reports:

  Here's what I'm getting on the kvm-qemu side of things:

  # capstan run cloudius/osv
  Created instance: cloudius-osv

  exec: "qemu-system-x86_64": executable file not found in $PATH

  Which is fine, since it seems like on RHEL the relevant thing is
  called kvm-qemu.

  At least that's what virsh is using. capstan, however, doesn't seem to
  like it:

  # ln -s /usr/libexec/qemu-kvm /usr/bin/qemu-system-x86_64
  # Created instance: cloudius-osv

  unable to parse QEMU version from 'QEMU PC emulator version 0.12.1
  (qemu-kvm-0.12.1.2), Copyright (c) 2003-2008 Fabrice Bellard'

  Any advice? I must be not the first one trying to run this on
  RHEL/CentOS6.

Fix the problem by relaxing QEMU version parsing regexp.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Merge pull request #112 from penberg/relax-qemu-version-check

QEMU: Relax version number parsing
build: Move image building to cmd/build.go

Move the image building code from QEMU driver to cmd/build.go. This is
the first step into killing the QEMU dependency for building images and
use whatever hypervisor is available on the system.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Merge pull request #113 from penberg/build-code-movement

build: Move image building to cmd/build.go
Few words on RPM support

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
capstan: check "capstan info" return value

check the return value for "capstan info" and print the error message if exists

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