VM Orchestration

How to define and launch Virtual Machines

The minimega miniclass series

Sandia National Laboratories

experiment design

These are some of the things you'll need to think about before building your environment

The answers to these questions impact how you will deploy your VMs. Such as

Configure, Launch, Start

Once you have settled on what the VM properties in your experiment should be, you'll need a way to define those properties and deploy those VMs. minimega provides an easy way to define and deploy your VMs.

There are essentially 3 steps to deploying VMs in minimega:

1. CONFIGURE VM properties with minimega's 'vm config' API

2. LAUNCH a number of VMs with the configuration described

3. START all the VMs

vm config - the heart of minimega

For a detailed explanation of Virtual Machine Types, please visit the article on minimega.org.

Configuring a VM

Configuring and Launching VMs

# uncomment the one you would like to use
#vm config cdrom myOS.iso
#vm config disk diskImage.qc2
#vm config kernel mykernel.kernel
#vm config initrd myInitrd.initrd
#vm config filesystem path/to/myfs/

vm launch kvm 5
vm launch kvm foo
vm launch kvm bar[1-5]

vm launch container 1
vm launch container footainer
vm launch container bartainer[1-5]

# The VMs will be in the BUILDING state

# This will flush any VMs in Error or Quit state
vm flush

Starting vms

vm start foo
vm start bar[1-3]
vm start all

# For full details run:
vm info
# For select details, run:
.columns name,state,snapshot,cdrom vm info
# Try modifying the above selected columns and run again!

Stopping VMs

vm stop foo
vm stop bar[1-3,5]
vm stop all
# 'vm stop' puts the specified VM(s) in the PAUSED state
vm info

vm kill foo
vm kill bar[1-5]
vm kill all
# 'vm kill' puts the specified VM(s) in the QUIT state
vm info

# 'vm flush' will clear all VMs in the QUIT or ERROR state
vm flush

VM States

A Closer Look at VM CONFIG

There are many configuration options available to you, so we will try to focus on the common options first. You can find a comprehensive list at the end of this module.

Memory:           2048
VCPUs:            1
Networks:         []
Snapshot:         true
Tags:             {}

KVM configuration:

Disk Paths:         []
CDROM Path:
Kernel Path:
Initrd Path:

Note: One of either Disk, CD, or Kernel+Initrd must be specified to launch a kvm

Container configuration:

Filesystem Path:
Hostname:
Init:            [/init]
Pre-init:

Note: Filesystem is required to launch a container

Base Directory

minimega creates a number of files that describe and allow control of virtual machines.
By default, it keeps these files in "/tmp/minimega" unless modified via the -base flag at startup.

Likewise, minimega uses /tmp/minimega/files/ as a default directory for working with files.
If you reference files, in vm config for example, it will look for those files relative to this base directory.

If you attempt to run minimega while another instance is already running, it will exit with an error that the base directory is already in use.

The base directory is important when connecting to an already running minimega instance with the attach or e flags, as those modes both look for the minimega command socket in a specified base directory.

A simple example

# As an exercise, let's launch a few VMs of various types

# Let's start by setting some properties
vm config vcpu 4
vm config memory 8196 # MB
vm config net 100 # vlan 100
vm config disk foo.qc2 # defaults to /tmp/minimega/files/foo.qc2
vm launch kvm foo[1-5]
# Now to use a different image
clear vm config disk
vm config kernel miniccc.kernel
vm config initrd miniccc.initrd
vm launch kvm foo[6-10]
# Now some containers
vm config memory 4098
vm config tags container=true
vm config filesystem /tmp/minimega/files/minicccfs
# both filesystem and kernel/initrd are set, but that is ok
vm launch container bar[1-5]
vm start all

The Results in miniweb:

VM Config - the full list

host: VM configuration:
Memory:           2048
VCPUs:            1
Networks:         []
Snapshot:         true
UUID:
Schedule host:
Coschedule limit: -1
Colocate:
Backchannel:      true
Tags:             {}

KVM configuration:

Migrate Path:
Disk Paths:         []
CDROM Path:
Kernel Path:
Initrd Path:
Kernel Append:      []
QEMU Path:          kvm
QEMU Append:        []
SerialPorts:        0
Virtio-SerialPorts: 0
Machine:
CPU:                host
Cores:              1

Container configuration:

Filesystem Path:
Hostname:
Init:            [/init]
Pre-init:
FIFOs:           0
Volumes:

Next Up...

Module 04: miniweb

Thank you

The minimega miniclass series

Sandia National Laboratories