Permalink
Fetching contributors…
Cannot retrieve contributors at this time
276 lines (178 sloc) 5.3 KB

NAME

kvmadm - Manage KVMs under SMF control

SYNOPSIS

kvmadm command [options...]

where 'command' is one of the following:

create <kvm_name>

import <filename>

delete [--purge=vnic,zvol,zone] <kvm_name>

edit <kvm_name>

list [kvm_name]

state [kvm_name]

start <kvm_name>

stop <kvm_name>

restart <kvm_name>

show-cmd <kvm_name>

info [type,...] <kvm_name>

monitor <kvm_name> [command]

vnc <[bind_addr:]port> <kvm_name> 

help

man

DESCRIPTION

Use kvmadm to create/edit your KVMs under SMF control

create

creates a KVM instance with the name kvm_name. Create will open an editor where the properties can be set. zvols and/or vnics which do not exist will be created.

for the KVM instance the following properties can be set:

optional
    vnc
    vnc_pw_file
    vcpus
    ram
    time_base
    boot_order
    hpet
    usb_tablet
    kb_layout
    uuid
    shutdown
    cleanup
    qemu_extra_opts
    pre_start_cmd

for each disk the following properties can be set:

mandatory
    model
    disk_path
    index 

optional
    boot
    media
    serial
    disk_size
    block_size
    cache

for each vnic the following properties can be set:

mandatory
   model
   nic_name
   index

optional
   over
   vlan_id
   mtu
   txtimer
   txburst

for each serial the following properties can be set:

mandatory
   serial_name
   index

kvmadm supports zones. zone properties are according to zonecfg. global properties can be set as "property" : "value" pair, single resources as "resource" : { } hash structure and multiple resources as "resource" : [ { }, ... ] array of hash structures. vnics and zvols must not be added to the zone configuration as kvmadm will add them automatically when setting up the zone.

import

imports a KVM configuration from a file.

delete

deletes the KVM instance with the name kvm_name. Note: zvols, vnics and zones will not be deleted by default. use the --purge option.

edit

modify the configuration of a KVM instance. See the descriptions in the create function for details.

list

lists the available KVM instances with their properties. Lists details for kvm_name is given.

state

prints the state of the KVM instance(s)

start

starts the KVM instance kvm_name

stop

stops the KVM instance kvm_name

restart

restarts the KVM instance kvm_name

show-cmd

prints the KVM invocation command for debug purpose

info

queries information about the running KVM instance from qemu monitor.

type can be one of the following:

all
block
blockstats
chardev
cpus
kvm
network
pci
registers
qtree
usb
version
vnc

monitor

connects to the qemu monitor of the running KVM instance. Sends command to the qemu monitor if provided.

vnc

forwards the vnc socket to IP

EXAMPLES

create a KVM instance with the name 'test-kvm'

kvmadm create test-kvm

check the KVM instance properties

kvmadm list test-kvm

list the available KVM instances

svcs system/kvm

copy a KVM instance

kvmadm list test-kvm > test-kvm.json

kvmadm import test-kvm.json

wait 5 minutes before starting the qemu process

"pre_start_cmd" : "/usr/bin/sleep 300"

basic zone setup

"zone" : {
    "zonepath" : "/zones/test-kvm",
    "brand"    : "lipkg",
    "ip-type"  : "exclusive"
}

adding readonly zone access to a vnc password file

"zone" : {
    ...
    "fs" : [
        {
            "dir"     : "/etc/opt/kvmadm/myvncpw",
            "special" : "/etc/opt/kvmadm/myvncpw,
            "type"    : "lofs",
            "options" : "[ro,nodevices]"
        }
    ]
}

query the attached block devices of a KVM instance with the name 'test-kvm'

kvmadm info block test-kvm

connect to the qemu monitor of the KVM instance with the name 'test-kvm'

kvmadm monitor test-kvm

set boot drive to d

kvmadm monitor test-kvm boot_set d

forward the vnc socket of the KVM instance with the name 'test-kvm' to the TCP port 5900

kvmadm vnc 5900 test-kvm

COPYRIGHT

Copyright 2017 OmniOS Community Edition (OmniOSce) Association.

LICENSE

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

AUTHOR

Tobias Oetiker <tobi@oetiker.ch> Dominik Hassler <hadfl@cpan.org>

ACKNOWLEDGMENT

While the clever configuration options and other cool ideas have been shamelessly stolen from Joyent's vmadm, the bugs and misfeatures are all exclusive to kvmadm.

HISTORY

2015-04-28 had Zone support 2014-10-03 had Initial Version