Add GenerateMAC utility function

This adds a GenerateMAC auxiliary function for generating an unique MAC
address. It clears the LSB bit for "unicast" and sets the next-to-LSB
bit for "locally administered".

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
qemu: MAC address auto-generations

This patch adds "--mac" command line option for specifying the MAC
address of a QEMU instance. If it is not specified, the MAC address is
generated automatically.

This fixes multiple QEMU instances from receiving the same IP address
via DHCP.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Merge pull request #117 from penberg/qemu-mac-address

QEMU MAC address generation
build: Increase memory size and add memory size ("-m") option

Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Fix CLI library struct initializers

Build broke because the CLI library introduced a new field in the
structs and we don't do vendoring.

Switch to named initializers to be future proof.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
qemu: Use "unsafe" cache if direct IO is not supported

ZFS on Linux, for example, does not support direct I/O. Probe for DIO
support before starting a new QEMU instance and fall-back to "unsafe"
caching if it's not supported. Suggested by Tomek.

Fixes #118.

Signed-off-by: Pekka Enberg <penberg@iki.fi>
Rename "push" command to "import"

Reserve the "push" command for pushing Capstan images to remote
repositories in the future.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Fix build breakage from "import" rename

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
import: Add support for generating index file

Add optional command line options to the "import" command for specifying
version, description, creation date, and build command. These will be
used for generating a "index.yaml" file in the local repository that's
picked up by commands like "capstan images".

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Merge pull request #119 from penberg/qemu/direct-io

qemu: Use "unsafe" cache if direct IO is not supported
Add Go 1.3 and drop Go 1.1

Capstan depdencency no longer builds with Go 1.1:

../../../gopkg.in/yaml.v1/encode.go:188: undefined: strings.IndexByte
../../../gopkg.in/yaml.v1/encode.go:188: undefined: strings.IndexByte

While at it, add Go 1.3.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
build: add directory upload support

Some applications like to have a pre-created directory hierarchy
when they start up. Teach Capstan how to upload directories to the
application image.

Signed-off-by: James Peach <jorgar@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
capstan: only make a single rootfs replacement

We know that each path in a rootfs will begin with the rootfs prefix.
We only want to replace the prefix occurrence of the roofs prefix
not any subsequent occurrences, otherwise we will mangle file names.

Signed-off-by: James Peach <jorgar@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Fix O_DIRECT build breakage on OS X

There's no O_DIRECT on OS X or Windows. Fix that up. Reported by @jpeach.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Merge pull request #121 from penberg/fix-osx-build

Fix O_DIRECT build breakage on OS X