Archived/XCI Getting Started: Difference between revisions
Lars.kurth (talk | contribs) (Created page with "<!-- MoinMoin name: XciGettingStarted --> <!-- Comment: --> <!-- WikiMedia name: XciGettingStarted --> <!-- Page revision: 00000004 --> <!-- Original date: Wed Aug 26 …") |
m (Removed superfluous <nowiki></nowiki> tag pairs.) |
||
(One intermediate revision by one other user not shown) | |||
Line 20: | Line 20: | ||
<pre |
<pre> |
||
vhd-util create -s 10000 -n /some/path/disk |
vhd-util create -s 10000 -n /some/path/disk |
||
</pre> |
|||
Line 41: | Line 41: | ||
<pre |
<pre> |
||
uuid = 00000000-0000-0000-000000002901 |
uuid = 00000000-0000-0000-000000002901 |
||
</pre> |
|||
Line 52: | Line 52: | ||
<pre |
<pre> |
||
hvm = true |
hvm = true |
||
acpi = true |
acpi = true |
||
apic = true |
apic = true |
||
nx = true |
nx = true |
||
</pre> |
|||
Line 63: | Line 63: | ||
<pre |
<pre> |
||
disk = /some/path/disk:vhd:hda:w:disk |
disk = /some/path/disk:vhd:hda:w:disk |
||
</pre> |
|||
Line 72: | Line 72: | ||
<pre |
<pre> |
||
disk = /some/cdrom_image.iso:file:hdd:r:cdrom |
disk = /some/cdrom_image.iso:file:hdd:r:cdrom |
||
</pre> |
|||
Line 80: | Line 80: | ||
<pre |
<pre> |
||
disk = /dev/dvd:phy:phy:r:cdrom |
disk = /dev/dvd:phy:phy:r:cdrom |
||
</pre> |
|||
Line 89: | Line 89: | ||
<pre |
<pre> |
||
boot = dc |
boot = dc |
||
</pre> |
|||
Line 97: | Line 97: | ||
<pre |
<pre> |
||
boot = n |
boot = n |
||
</pre> |
|||
Line 105: | Line 105: | ||
<pre |
<pre> |
||
nic = model=e1000,id=0,bridge=xenbr0,mac=vm |
nic = model=e1000,id=0,bridge=xenbr0,mac=vm |
||
</pre> |
|||
Line 113: | Line 113: | ||
<pre |
<pre> |
||
uuid = 00000000-0000-0000-000000002901 |
uuid = 00000000-0000-0000-000000002901 |
||
hvm = true |
hvm = true |
||
Line 123: | Line 123: | ||
boot = dc |
boot = dc |
||
nic = model=e1000,id=0,bridge=xenbr0,mac=vm |
nic = model=e1000,id=0,bridge=xenbr0,mac=vm |
||
</pre> |
|||
Line 134: | Line 134: | ||
<pre |
<pre> |
||
xenvm --config /path/to/my/config |
xenvm --config /path/to/my/config |
||
</pre> |
|||
Line 163: | Line 163: | ||
<pre |
<pre> |
||
xenvm --monitor-json true [other args ...] |
xenvm --monitor-json true [other args ...] |
||
</pre> |
|||
Line 172: | Line 172: | ||
<pre |
<pre> |
||
xenvm --monitor-dbus true [other args ...] |
xenvm --monitor-dbus true [other args ...] |
||
</pre> |
|||
Line 192: | Line 192: | ||
<pre |
<pre> |
||
xenvm-cmd [--use-socket] <id> <cmd> [args] |
xenvm-cmd [--use-socket] <id> <cmd> [args] |
||
</pre> |
|||
Line 206: | Line 206: | ||
<pre |
<pre> |
||
xenvm-cmd <id> help |
xenvm-cmd <id> help |
||
</pre> |
|||
Line 219: | Line 219: | ||
* suspend : suspend the VM. you need to specify a ***file*** parameter, that will be use by xenvm to store the memory snapshot. |
* suspend : suspend the VM. you need to specify a ***file*** parameter, that will be use by xenvm to store the memory snapshot. |
||
<pre |
<pre> |
||
$ xenvm-cmd <id> suspend file=/tmp/my_memory_snapshot |
$ xenvm-cmd <id> suspend file=/tmp/my_memory_snapshot |
||
</pre> |
|||
* restore : restore the VM. you need to specify a ***file*** parameter, that will be use by xenvm to populate the VM's memory. |
* restore : restore the VM. you need to specify a ***file*** parameter, that will be use by xenvm to populate the VM's memory. |
||
<pre |
<pre> |
||
$ xenvm-cmd <id> restore file=/tmp/my_memory_snapshot |
$ xenvm-cmd <id> restore file=/tmp/my_memory_snapshot |
||
</pre> |
|||
* get : required a ***field*** parameter, and get the value of the field specified in xenvm's config. |
* get : required a ***field*** parameter, and get the value of the field specified in xenvm's config. |
||
<pre |
<pre> |
||
$ xenvm-cmd <id> get field="hvm" |
$ xenvm-cmd <id> get field="hvm" |
||
true |
true |
||
</pre> |
|||
* 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. |
* 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. |
||
<pre |
<pre> |
||
$ xenvm-cmd <id> set field="hvm" value="true" |
$ xenvm-cmd <id> set field="hvm" value="true" |
||
</pre> |
|||
Latest revision as of 21:03, 28 November 2011
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