Virtual data center construction tool
Clone or download
morimoto-cybozu Merge pull request #68 from cybozu-go/enable-virtfs
add -enable-virtfs options to share files between guest and host.
Latest commit 5f908a9 Oct 11, 2018
Permalink
Failed to load latest commit information.
.circleci Fix test Sep 25, 2018
bin Fix test Sep 25, 2018
cmd add -enable-virtfs options to share files between guest and host. Oct 10, 2018
docs Fix size notation in example. Sep 4, 2018
examples [refactor] yaml Jun 26, 2018
mtest Fix test Sep 25, 2018
.gitignore Add tap.go to generate tap name Apr 19, 2018
CHANGELOG.md Update CHANGELOG.md Jul 31, 2018
LICENSE Fix LICENSE Mar 23, 2018
README.md add -enable-virtfs options to share files between guest and host. Oct 10, 2018
RELEASE.md Add RELEASE.md Jul 25, 2018
bmc.go Improve guestConnection handler. Jun 27, 2018
cache.go [refactor] image and datafolder Jun 26, 2018
cache_test.go implement local filesystem cache Apr 6, 2018
cluster.go simplify Oct 3, 2018
colored_log.go support colored log May 29, 2018
compress.go [refactor] misc improvements. Jun 27, 2018
exec.go [refactor] misc improvements. Jun 27, 2018
folder.go add Kind field for placemat-menu to export yaml Jun 27, 2018
go.mod Use go modules Sep 25, 2018
go.sum Use go modules Sep 25, 2018
image.go nil check Jun 27, 2018
namegen.go Add Pod resource. May 7, 2018
nat.go [refactor] misc improvements. Jun 27, 2018
network.go Fix for gofmt Sep 25, 2018
network_test.go [refactor] yaml Jun 26, 2018
node.go add -enable-virtfs options to share files between guest and host. Oct 10, 2018
node_test.go [refactor] runtime, cluster Jun 26, 2018
node_vm.go Fix clean up logic for QEMU VMs. Jun 27, 2018
node_volume.go [refactor] misc improvements. Jun 27, 2018
pod.go simplify Oct 3, 2018
runtime.go add -enable-virtfs options to share files between guest and host. Oct 10, 2018
sysctl.go Add sysctlGet and sysctlSet functions. Jul 26, 2018
sysctl_test.go Add sysctlGet and sysctlSet functions. Jul 26, 2018
yaml.go [refactor] misc improvements. Jun 27, 2018
yaml_test.go [refactor] yaml Jun 26, 2018

README.md

GitHub release CircleCI GoDoc Go Report Card

Placemat

Placemat is a tool to simulate data center networks and servers using rkt Pods, QEMU/KVM virtual machines, and Linux networking stacks. Placemat can simulate virtually any kind of network topologies to help tests and experiments for software usually used in data centers.

Features

  • No daemons

    Placemat is a single binary executable. It just builds networks and virtual machines when it starts, and destroys them when it terminates. This simplicity makes placemat great for a continuous testing tool.

  • Declarative YAML

    Networks, virtual machines, and other kind of resources are defined in YAML files in a declarative fashion. Users need not mind the order of creation and/or destruction of resources.

  • Virtual BMC for IPMI power management

    Power on/off/reset of VMs can be done by IPMI commands. See virtual BMC for details.

  • Automation

    Placemat supports cloud-init and ignition to automate virtual machine initialization. Files on the host machine can be exported to guests as a VVFAT drive. QEMU disk images can be downloaded from remote HTTP servers.

    All of these help implementation of fully-automated tests.

  • UEFI

    Not only traditional BIOS, but placemat VMs can be booted in UEFI mode if OVMF is available.

Usage

This project provides these commands:

  • placemat is the main tool to build networks and virtual machines.
  • placemat-connect is a utility to connect to VM serial console.

placemat command

placemat reads all YAML files specified in command-line arguments, then creates resources defined in YAML. To destroy, just kill the process (by sending a signal or Control-C).

$ placemat [OPTIONS] YAML [YAML ...]

Options:
  -graphic
        run QEMU with graphical console
  -enable-virtfs
        enable VirtFS to share files between the guest and the host OS.
  -shared-dir
        shared directory between the guest and the host OS (default "/mnt/placemat")
  -run-dir string
        run directory (default "/tmp")
  -cache-dir string
        directory for cache data.
  -data-dir string
        directory to store data (default "/var/scratch/placemat")
  -debug
        show QEMU's and Pod's stdout and stderr        
  -force
        force run with removal of garbage

If -cache-dir is not specified, the default will be /home/${SUDO_USER}/placemat_data if sudo is used for placemat. If sudo is not used, cache directory will be the same as -data-dir. -force is used for forced run. Remaining garbage, for example virtual networks, mounts, socket files will be removed.

placemat-connect command

If placemat starts without -graphic option, VMs will have no graphic console. Instead, they have serial consoles exposed via UNIX domain sockets.

placemat-connect is a tool to connect to the serial console.

$ placemat-connect [-run-dir=/tmp] your-vm-name

Options:
  -run-dir
        the directory specified for placemat by -run-dir.

To exit from the console, press Ctrl-Q, Ctrl-X in this order.

Getting started

Prerequisites

For Ubuntu or Debian, you can install them as follows:

$ sudo apt-get update
$ sudo apt-get install qemu-system-x86 qemu-utils ovmf picocom

As to rkt, obtain a deb (or rpm) package then install it as follows:

$ wget https://github.com/rkt/rkt/releases/download/v1.30.0/rkt_1.30.0-1_amd64.deb
$ sudo dpkg -i rkt_1.30.0-1_amd64.deb

Install placemat

Install placemat and placemat-connect:

$ go get -u github.com/cybozu-go/placemat/cmd/placemat
$ go get -u github.com/cybozu-go/placemat/cmd/placemat-connect

Run examples

See examples how to write YAML files.

To launch placemat from YAML files, run it with sudo as follows:

$ sudo $GOPATH/bin/placemat cluster.yml

To connect to a serial console of a VM, use placemat-connect:

$ sudo $GOPATH/bin/placemat-connect VM

This will launch picocom. To exit, type Ctrl-Q, then Ctrl-X.

Specification

See specifications under docs directory.

License

MIT