qemu: Store VMConfig to a file

We can use this file to restart a stopped instance.

Signed-off-by: Asias He <asias@cloudius-systems.com>
util: Add SearchInstance helper

Give an instance name to search if this instance exists under
.capstan/instances.

Signed-off-by: Asias He <asias@cloudius-systems.com>
cmd/stop: Switch to util.SearchInstance

Signed-off-by: Asias He <asias@cloudius-systems.com>
qemu: Support start an stopped instance

It works like below:

    $ capstan run osv.qcow2
    Created instance: i1397047839

    $ capstan stop i1397047839
    Stopped instance: i1397047839

    $ capstan run i1397047839
    Created instance: i1397047839

Note, Instance is not deleted when it is stopped any more. capstan
delete will be added to support delete an instance soon.

Signed-off-by: Asias He <asias@cloudius-systems.com>
gce: Support DeleteVM

Changing the name and arg of vmDelete to DeleteVM which will be used by
`capstan delete` cmd.

Signed-off-by: Asias He <asias@cloudius-systems.com>
vbox: Change DeleteVM to be used by capstan delete

After this, instance is not deleted when stopped.

Signed-off-by: Asias He <asias@cloudius-systems.com>
vmw: Change DeleteVM to be used by capstan delete

After this, instance is not deleted when stopped.

Signed-off-by: Asias He <asias@cloudius-systems.com>
qemu: Change DeleteVM to be used by capstan delete

Signed-off-by: Asias He <asias@cloudius-systems.com>
cmd/delete: Introduce capstan delete cmd

This cmd is used to delete an instance on the local disk or in the
cloud.

Signed-off-by: Asias He <asias@cloudius-systems.com>
cmd/stop: Fix typo in usage message

It is stop not info.

Signed-off-by: Asias He <asias@cloudius-systems.com>
Merge pull request #67 from asias/restart

qemu: Support start an stopped instance
Merge pull request #68 from asias/delete

Implement capstan delete cmd
vbox: Store VMConfig to a file

We can use this file to restart a stopped instance.

TODO: We have duplicated implementation of LoadConfig and StoreConfig.
Need to consolidate and introduce a helper.

Signed-off-by: Asias He <asias@cloudius-systems.com>
vmw: Store VMConfig to a file

We can use this file to restart a stopped instance.

Signed-off-by: Asias He <asias@cloudius-systems.com>
vbox, vmw: Support start an stopped instance

It works like below:

   $ capstan run osv.vmdk
   Created instance: i1397047839

   $ capstan stop i1397047839
   Stopped instance: i1397047839

   $ capstan run i1397047839
   Created instance: i1397047839

Signed-off-by: Asias He <asias@cloudius-systems.com>
vmw: Delete ConfigFile as well

vmxRun deleteVM will not delete the file not created by vmxRun. Delete
it ourself.

Signed-off-by: Asias He <asias@cloudius-systems.com>
vbox: Delete ConfigFile as well

VBoxManage  unregistervm --delete will not delete the file not created
by VBoxManage. Delete it ourself.

Signed-off-by: Asias He <asias@cloudius-systems.com>
cmd/run: Beautify the output when instance is stopped

Before:
   [asias@hjpc capstan]$ capstan run
   Created instance: i1397111888
   OSv v0.06-rc2-31-gdf30ec8

   [/]% [asias@hjpc capstan]$

After:
   [asias@hjpc capstan]$ capstan run
   Created instance: i1397111771
   OSv v0.06-rc2-31-gdf30ec8

   [/]%
   [asias@hjpc capstan]$

Signed-off-by: Asias He <asias@cloudius-systems.com>
Merge pull request #69 from asias/restart2

vbox, vmw: Support start an stopped instance
qemu: Bridged networking support

This patch adds bridged networking support to Capstan. You can enable it
with the "-n" command line option:

  $ capstan run -n bridge

which will use 'virbr0' device by default. You can change it with the
'-b' command line option.

Capstan will still default to port forwarding but we definitely should
switch to bridging once we support it on other hypervisors as well.

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