Archived/XCI Getting Started

= Installing a VM =
== create an empty disk ==
To install a new VM, you need a target disk. To create an empty VHD file,
you can use vhd-util:
 vhd-util create -s 10000 -n /some/path/disk
the -s argument specify the size in megabyte (in the example: ~10Gb) and
the -n argument specify the name of the disk you want to create.
You have the choice of using any other type of storage, like a LV, a disk
partition, that is supported by xenvm. Refer to the documentation for more
information.
== create a config file ==
fter creating the VM disk, you need to create a config file representing the
VM. You need to specify the boot environment it's going to use, like the
processor/device flags, which device to boot on, etc.
First, the unique identification of the VM, in the form of a uuid.
 uuid = 00000000-0000-0000-000000002901
Note that you can generate random uuid by using uuidgen or cating
/proc/sys/kernel/random/uuid .
Seconded by the internal cpu/platform details:
 hvm = true
 acpi = true
 apic = true
 nx = true
Then the disks informations; in the first place you need your VM system disk:
 disk = /some/path/disk:vhd:hda:w:disk
Since you're installing a VM from scratch, you need a second disk/media that
contains your operating system installer.
 disk = /some/cdrom_image.iso:file:hdd:r:cdrom
or if you want to use your physical host cdrom/dvdrom:
 disk = /dev/dvd:phy:phy:r:cdrom
since your disk doesn't have any system on it, you want to boot on the cdrom
device, for doing so:
 boot = dc
You can also choose to boot over pxe-config using the following snippet:
 boot = n
Adding a network interface to the VM is as simple as:
 nic = model=e1000,id=0,bridge=xenbr0,mac=vm
Finally the config file should look like the following one:
 uuid = 00000000-0000-0000-000000002901
 hvm = true
 acpi = true
 apic = true
 nx = true
 disk = /some/path/disk:vhd:hda:w:disk
 disk = /some/cdrom_image.iso:file:hdd:r:cdrom
 boot = dc
 nic = model=e1000,id=0,bridge=xenbr0,mac=vm
for more information about xenvm config and which flags are supported, refer to
the documentation.
== using xenvm ==
Simply start xenvm with the config file as an argument:
 xenvm --config /path/to/my/config
Once xenvm is started, the VM is going to start. If installing from a CD,
once the installation is done, you can remove the cdrom disk from the config file
and flip the boot option from dc to cd.
xenvm stays running even the VM is halted, which means that the monitor (see next section),
is still going to be listening for new command for this VM. Also means that
instead of restarting xenvm, you can just issue a start command to the monitor.
= Using the monitor =
The monitor is a place where you can issue command related to this VM. the range of operations
goes from status gathering, config settings, to lifecycle management, dynamic VM operations.
== Which monitors ? ==
Xenvm support 2 types of monitor. the first one is based on a unix
socket and understand some kind of binary header plus a json query.
The second one is based on dbus listening on the hierarchy
org.xen.vm.%uuid.
To use the unix monitor, xenvm need to be started with the following
option:
 xenvm --monitor-json true [other args ...]
To use the dbus monitor, xenvm need to be started with the following
option:
 xenvm --monitor-dbus true [other args ...]
note that by default, the dbus monitor is listening on the system
bus. however there's a command line flag to have dbus listen on the
session bus too. --monitor-dbus-session
Also both monitors can be use at the same time, which means that xenvm
will listen on both unix socket and dbus for queries.
== using xenvm-cmd ==
Xenvm-cmd is a command line tool to send queries to xenvm. it's very
easy to use and support both type of monitor. by default it's going to
use the dbus monitor. The query will be done on the socket monitor if
the command line argument --use-socket has been used.
 xenvm-cmd [--use-socket] <id> <cmd> [args]
Commands arguments are all in the format key=value. id represent the uuid of
the vm you're trying to contact.
== commands available ==
all commands available with the arguments supported are available by actually just
sending an help command to a xenvm running.
 xenvm-cmd <id> help
Here is the list and description of the most used commands:
* destroy : force halt the VM and xenvm will quit.
* halt, reboot : make the VM halt or reboot. note that xenvm will still be running when the VM is halt, so one can issue the start command.
* start : start the VM.
* pause, unpause : pause/unpause the VM.
* suspend : suspend the VM. you need to specify a ***file*** parameter, that will be use by xenvm to store the memory snapshot.
 $ xenvm-cmd <id> suspend file=/tmp/my_memory_snapshot
* restore : restore the VM. you need to specify a ***file*** parameter, that will be use by xenvm to populate the VM's memory.
 $ xenvm-cmd <id> restore file=/tmp/my_memory_snapshot
* get : required a ***field*** parameter, and get the value of the field specified in xenvm's config.
 $ xenvm-cmd <id> get field="hvm"
 true
* set : set dynamically a field. required a field and a value parameter. note that if the VM is running, all the changes done by set will be used next the VM is starting.
 $ xenvm-cmd <id> set field="hvm" value="true"
= VM notifications =
WIP
= Advanced =
WIP
Category:XCI
Category:Archived