| Branch: | Tag: | Revision:

root / lib / hypervisor @ 2a7e887b

# Date Author Comment
2a7e887b 05/12/2009 02:30 pm Guido Trotter

KVMHypervisor: return memory and cpus as integers

Currently the KVM hypervisor returns strings for the memory and cpu
values, while the xen hypervisor returns integers. Making this uniform
converting the values to integers in KVM as well.

Signed-off-by: Guido Trotter <>...

7dd106d3 04/06/2009 11:20 am Iustin Pop

Fix Xen soft reboot via polling

This patch fixes the Xen soft reboot ("xm reboot") via polling for a specific
time for either changed domain ID or decreased CPU run-time.

This sould prevent the race-conditions discussed on the mailing list for

19498d6c 03/12/2009 02:08 pm Guido Trotter

kvm: use the correct vnc bind address

There is a bug in kvm, when binding vnc to a specific address the
constant 'vnc_bind_address' is passed in, instead of the actual
requested address. This patch fixes it.

Reviewed-by: iustinp

6b405598 03/10/2009 05:02 pm Guido Trotter

Xen: Remove one hardcoded constant


Reviewed-by: imsnah

9afb67fe 02/27/2009 07:09 pm Guido Trotter

Use EnsureDirs in KVM as well.

The KVM hypervisor has also code to ensure a list of directories exist.
Substitute it with our new utils function.

Reviewed-by: iustinp

b399ce1e 02/25/2009 05:03 pm Iustin Pop

Fix xen-hvm and KERNEL_ARGS

xen-hvm doesn't have KERNEL_ARGS, and I just changed blindly all old
extra_args to HV_KERNEL_ARGS. This makes xen-hvm work again.

Reviewed-by: imsnah

07813a9e 02/24/2009 05:25 pm Iustin Pop

Remove the extra_args parameter in instance start

This patch removes the extra_args parameter and instead switches the
instance to the HV_KERNEL_ARGS hypervisor option.

This is a big change, but it's a needed cleanup, this extra parameter on
all RPC calls is not generic and we also need to have a persistent value...

a985b417 02/24/2009 05:25 pm Iustin Pop

Simplify a little the hypervisor routines

Instead of “instance.hvparams”, we use a shorter “hvp” name to make readability

Reviewed-by: imsnah

3213d3c8 02/17/2009 02:44 pm Iustin Pop

Show more details for failed xen commands

This patch also logs the output of the xm commands in case of failures;
some corner cases were forgotten in the last redo.

Reviewed-by: imsnah

bfc30ec0 02/13/2009 05:35 pm Iustin Pop

Some small improvements to the fake hypervisor

This patch modifies the fake hypervisor to substract the memory “used”
by “running” instances from the free memory, so the actual node
information changes based on the running instances.

Also some style changes and fixes are added....

5b460366 02/12/2009 07:03 pm Iustin Pop

Some small fixes

This patch removes the admin_ram LUQueryInstances field (is broken
anyway) and fixes the VNC address checks in the Xen Hypervisor.

Reviewed-by: imsnah

5c418644 02/10/2009 12:53 pm Guido Trotter

KVM: Correct CheckParameterSyntax docstring

The comment is not really true anymore, as we have a lot of parameters

Reviewed-by: iustinp

9798fcae 02/10/2009 12:53 pm Guido Trotter

KVM: Fix _CallMonitorCommand error message

1) Only instance_name is available
2) There was a missing string parameter

Reviewed-by: iustinp

11344a50 02/09/2009 05:17 pm Guido Trotter

KVM: Add usb mouse type parameter

In some cases 'mouse' may work better than 'tablet', so we'll handle
both by allowing the user to specify a parameter. By default no mouse is

Reviewed-by: iustinp

8745c3d7 02/09/2009 05:16 pm Guido Trotter

KVM: allow netboot

With this patch we allow KVM instances to be booted off the network.
The only issue is that this is not compatible with virtio nics, so
we disallow them, when booting from the net.

Reviewed-by: iustinp

37f88dc6 02/09/2009 05:16 pm Guido Trotter

KVM: actually support different nic types

When executing the KVM runtime we load the nic type from the runtime
hvparams and use it to specify the nic model type. As for the disk we
translate the DEV_PARAVIRTUAL type to 'virtio'.

Reviewed-by: iustinp

c2672466 02/09/2009 05:16 pm Guido Trotter

KVM: export hvparams in the runtime

They'll be used to set the nic type when we execute the runtime, since
the nics are processed later. We need to save the hvparams because we
want to use the same one as when we saved the runtime, rather than use
the current instance ones, to avoid applying only some changed...

1213604d 02/09/2009 05:16 pm Guido Trotter

KVM: actually support different disk types

By passing the relevant if= value to the disk we support different disk
types. The only change is that we'll translate "paravirtual" to
"virtio" to keep only one "paravirtualized" value, around ganeti. The
if= value is calculated outside the disks loop, as it's the same for all...

5155ede7 02/09/2009 05:16 pm Guido Trotter

Xen-HVM: Improve the invalid disk/nic type error

Copy the message from the KVM one, adding a missing 'the' and a list of
possible values, to help the user in his decision.

Reviewed-by: iustinp

43440815 02/09/2009 05:15 pm Guido Trotter

KVM: parameters for different disk and nic types

- Add a bunch of NICs and DISKs types
- Specify which one are valid disks and nics for KVM (the new ones
toghether with some of the old ones)
- Add the default values (paravirtual)
- Allow the disk and nic types as parameters and check their validity...

d08f6067 02/09/2009 05:15 pm Guido Trotter

Rename the device type constants

These are not HVM specific, so have been given an HT generic name.

Reviewed-by: iustinp

377d74c9 02/09/2009 05:15 pm Guido Trotter


The VNC base port has nothing to do with HVM itself, and is general to
VNC itself, so we're removing the HT_HVM prefix to the constant.

Reviewed-by: iustinp

0105bad3 02/09/2009 12:41 pm Iustin Pop

Export the cpu nodes and sockets from Xen

This is a hand-picked forward patch of commit 1755 on the 1.2 branch
(hand-picked since the trees diverged too much since then):

The patch changed the xen hypervisor to compute the number of cpu
sockets/nodes and enables the command line and the RAPI to show this...
9dd363eb 02/07/2009 11:04 am Guido Trotter

KVM: don't boot from a virtio cdrom

Apparently it's not supported. Also add -boot command line parameters
to kvm, since they seem to help booting from the right place. Everything
will still only work when not using a kernel, but well... :)

Reviewed-by: iustinp

ec91c05d 02/07/2009 11:04 am Guido Trotter

KVM: don't boot from cdrom with no cdrom

Reviewed-by: iustinp

66d5dbef 02/07/2009 11:04 am Guido Trotter

Support cdrom image and boot order for KVM

The cdrom image has the same meaning than in Xen HVM, and so does
boot_order, even though it has a slightly different syntax, and uses the
value 'disk' too boot from disk and 'cdrom' to boot from cdrom.

Reviewed-by: iustinp

30948aa6 02/07/2009 11:03 am Guido Trotter

Get rid of constants.HT_HVM_DEFAULT_BOOT_ORDER

Confusingly, as a leftober from 1.2, there was a
constants.HT_HVM_DEFAULT_BOOT_ORDER constant, with a value opposite to
the default HV_BOOT_ORDER hv param that got enabled only if
HV_BOOT_ORDER was set to None. Since setting it to None is very...

8b2d1013 02/05/2009 03:37 pm Guido Trotter

KVM: add VNC TLS and X509 parameters

With this parameters VNC for KVM is able to be protected by tls,
optionally with an x509 certificate, and optionally verifying the
client as well. Additionally in this patch we limit the bind address to
being a directory, rather than a file or a directory, for simplicity, as...

8447f52b 02/05/2009 03:36 pm Guido Trotter

KVM: allow binding vnc to a file

Before we forced the VNC_BIND_ADDRESS to be an ip. Now we also accept a
path, and bind the instance to it, or to a file in it if it's a

Reviewed-by: iustinp

00ad5362 02/03/2009 06:05 pm Guido Trotter

KVM: Make GetAllInstancesInfo concurrency-safe

Or actually more so. If this function gets called while instances get
shut down, it might try to report information on instances which don't
exits. Try to fail gracefully if that happens, by just skipping an...

3be34f57 01/29/2009 05:51 pm Guido Trotter

KVM: advise about VNC support on GetShellCommand

Reviewed-by: iustinp

8470c8db 01/29/2009 05:51 pm Guido Trotter

KVM: enable VNC if a VNC_BIND_ADDRESS is defined

We'll also enable a tablet usb device, as suggested by the kvm man page.

Reviewed-by: iustinp

56fee73b 01/29/2009 05:51 pm Guido Trotter

KVM: Allow the HV_VNC_BIND_ADDRESS parameter

Reviewed-by: iustinp

df5ab9f0 01/29/2009 05:50 pm Guido Trotter

KVM: make the kernel and initrd arguments optional

Under KVM we don't strictly need a kernel and initrd. If some are passed
we'll use them, otherwise the guest OS will need to behave as fully
native, and have its own boot loader and kernel.
The root_path hypervisor parameter becomes mandatory only if a kernel is...

a2faf9ee 01/29/2009 05:47 pm Guido Trotter

KVM: add the HV_SERIAL_CONSOLE parameter

Up until now a KVM instance was forced to have a serial port.
With this change this is no longer mandatory, by default we'll use one,
but if the HV_SERIAL_CONSOLE parameter is set to False we'll do without.

Reviewed-by: iustinp

5431b2e4 01/29/2009 05:47 pm Guido Trotter

GetShellCommand: get hvparams and beparams

Sometimes the hypervisor will use the instance hv and/or be parameters
to determine the best shell command. This is not possible, though,
currently, as the instance hv/beparams are not filled, so we have to
pass the filled versions separately....

d34b16d7 01/28/2009 09:06 pm Iustin Pop

Actually mark drives as read-only if so configured

This patch correctly marks the drives as read-only for Xen, and raises
and exception for KVM since it doesn't support read-only drives.

Reviewed-by: ultrotter

73cd67f4 01/27/2009 06:44 pm Guido Trotter

Xen: use utils.WriteFile for the instance configs

Also raise HypervisorError rather than OpExecError.

Reviewed-by: iustinp

78f66a17 01/27/2009 06:44 pm Guido Trotter

Xen: use utils.Readfile to read the VNC password

Also raise HypervisorError rather than OpExecError.

Reviewed-by: iustinp

074ca009 01/27/2009 01:31 pm Guido Trotter

KVM and Xen: add the HV_ROOT_PATH parameter

This parameter allows a different path to be passed to the instance
kernel. The new parameter is mandatory, and by default has the value of
the old hardcoded value for both kvm and xen.

Beta1 clusters will need to have this parameter added for their...

637ce7f9 01/27/2009 01:31 pm Guido Trotter

KVM: implement GetShellCommandForConsole

This is a class method, because it calls _InstanceSerial, which is
another class method. The patch changes it to classmethod for all the
hypervisor classes.

Reviewed-by: iustinp

0df4d98a 01/27/2009 01:30 pm Guido Trotter

KVM: classify _Instance{Monitor,Serial,KVMRuntime}

Those methods need nothing from the instantiated class, and just
manipulate strings, and fetch some class global variables, so they can
be classmethods.

Reviewed-by: iustinp

50cb2e2a 01/23/2009 07:02 pm Guido Trotter

Xen and KVM: correct a typo when checking args

A missing 'be' was present in the error string for both xen and kvm,
when the kernel or initrd path was not absolute.

Reviewed-by: imsnah

c087266c 01/21/2009 08:23 pm Guido Trotter

KVM live migration: handle failure

If the KVM live migration ends up in a 'failed' state it has been
aborted at the kvm level, and the machine is still running locally.
We support also the 'cancelled' state even though there should be no way
of reaching it, without manual intervention....

90c024f6 01/21/2009 08:23 pm Guido Trotter

KVM: change a few IOError with EnvironmentError

Reviewed-by: iustinp

30e42c4e 01/21/2009 08:23 pm Guido Trotter

KVM: instance migration

The tcp port used for migrating KVM instances is selectable at
./configure time. We use a single port as nodes are locked anyway during
a migration, so no two migrations can happen at the same time to the
same node.

Reviewed-by: iustinp

1f8b3a27 01/21/2009 08:22 pm Guido Trotter

KVM: add the _InstancePidAlive function

Throughout the kvm code we very often look for the instance pidfile
name, read it, and check if the process is alive. Abstract this into a
private function and use that one instead.

This patch also changes RebootInstance to check whether the instance is...

f02881e0 01/21/2009 08:22 pm Guido Trotter

KVM: fix RebootInstance

RebootInstance was broken, because it just used to call StartInstance
with wrong parameters. With this patch we still stop the instance, but
use the saved kvm runtime to start it again.

Reviewed-by: iustinp

6567aff3 01/21/2009 08:22 pm Guido Trotter

KVM: retry the instance shutdown command

When we ask the instance to shutdown sometimes the command won't work,
especially if the instance isn't fully booted up. We'll wait for a bit,
and give it a few chances before giving up.

Reviewed-by: iustinp

4390ccff 01/21/2009 08:20 pm Guido Trotter

Xen: implement auxiliary migration functions

These are used, for the xen hypervisor, to copy the xen config file to
the remote node. This breaks migration for instances which have been
migrated, but not restarted, with the old code, for which the config
file was just lost....

c979d253 01/21/2009 04:12 pm Iustin Pop

Fix some more pylint errors

Two are real errors (invalid names) and one is style error (overriding
name from outer scope).

Reviewed-by: ultrotter

cd42d0ad 01/21/2009 12:03 pm Guido Trotter

Implement the new live migration backend functions

MigrationInfo, AcceptInstance and AbortMigration are implemented as
hypervisor specific functions, and by default they do nothing (as
they're not always necessary).

This patch also converts hv_base.MigrateInstance docstring to epydoc,...

38e250ba 01/21/2009 11:55 am Guido Trotter

KVM: save and remove the KVM runtime

At instance startup time we save the kvm runtime, and at stop time we
delete it. This patch also includes a function to load the kvm runtime,
which is unused yet.

Reviewed-by: iustinp

ee5f20b0 01/21/2009 11:55 am Guido Trotter

KVM: split KVM runtime generation and startup

Before we used to generate the kvm command line and then just run it.
With this patch we split the generation from the time it is run,
allowing us to save it and replay it at reboot.

We must take special care about instance nics:...

a1d79fc6 01/20/2009 08:12 pm Guido Trotter

KVM: add a _CONF_DIR

Currently we keep pid files and control files. In the conf dir we'll
also keep the data to start the instance anew, and the network
interface scripts. These will then be copied to a separate area (since
_CONF_DIR could be mounted 'noexec') and used to start the instance....

c4fbefc8 01/20/2009 08:12 pm Guido Trotter

KVM: Remove sockets after shutdown

Abstract the monitor and serial socket naming in two functions, and
reuse them to cleanup the files after shutdown.

Reviewed-by: iustinp

c4469f75 01/20/2009 08:11 pm Guido Trotter

KVM: fix class docstring

Reviewed-by: iustinp

fdf7f055 01/20/2009 08:11 pm Guido Trotter

Xen: use epydoc in MigrateInstance docstring

Reviewed-by: iustinp

53c776b5 01/13/2009 05:21 pm Iustin Pop

Forward port the live migration from 1.2 branch

This is forward port via copy (and not individual patches cherry-pick)
of the latest code on the 1.2 branch related to the migration.

The changes compared to 1.2 are the fact that we don't need the
IdentifyDisks step anymore (the drbd rpc calls are independent now), and...

069cfbf1 01/07/2009 07:01 pm Iustin Pop

Simplify hypervisor block_devices structure

This is a partial forward-port of commit 1136 on the 1.2 branch:

The hypervisor doesn't need to be passed the whole block device
structure, so we'll just give it the block device name on the local
node, and the name as seen by the instance. This will make it easier to...
e09fdcfa 01/06/2009 11:57 am Iustin Pop

Fix some pylint-detected issues

Two bad indentation cases and a missing variable.

Reviewed-by: imsnah

14aa53cb 12/16/2008 06:24 pm Guido Trotter

KVM: improve socat interface

Call socat with a full path specified at configure time, rather than
just by its name, and check for the binary to exist at hypervisor

Reviewed-by: iustinp

5661b908 12/14/2008 02:04 pm Iustin Pop

cleanup: xen hypervisor

Wrong indentation and uniformize one method signature.

Reviewed-by: amishchenko

08137f9e 12/14/2008 02:04 pm Iustin Pop

cleanup: kvm code likes to redefine names

Reviewed-by: amishchenko

c41eea6e 12/11/2008 07:13 pm Iustin Pop

Fix epydoc format warnings

This patch should fix all outstanding epydoc parsing errors; as such, we
switch epydoc into verbose mode so that any new errors will be visible.

Reviewed-by: imsnah

8a74a9b9 12/02/2008 12:54 pm Guido Trotter

KVMHypervisor add two missing 'constants.'

Some calls to the HV parameters were missing them.

Reviewed-by: imsnah

47387b1e 12/02/2008 12:54 pm Guido Trotter

KVMHypervisor fix to case misspellings

Reviewed-by: imsnah

2864f2d9 11/20/2008 08:18 am Iustin Pop

Change Xen hypervisor to not use iv_name

Currently the iv_name is very linux-specific, and will break with the
multi-disk changes.

The patch changes this to generate sdX names based on the disk index in
the disks structure, instead of relying on the iv_name....

b48909c8 10/20/2008 03:50 pm Iustin Pop

Convert to use the logging module

Reviewed-by: imsnah

6b5605e8 10/14/2008 05:47 pm Iustin Pop

Convert the KVM hypervisor to hvparams

I'm not sure which parameters it should use, I took all I saw in the
code. Update: ultrotter says the list is OK for now.

Reviewed-by: ultrotter

8b3fd458 10/14/2008 02:29 pm Iustin Pop

Change hypervisors to use the beparams

This patch changes the hypervisor functions to use the beparams dict
instead of the instance attributes.

Reviewed-by: ultrotter

f48148c3 10/14/2008 01:19 pm Iustin Pop

Implement the new hypervisor API in base/xen

This patch adds the new methods CheckParameterSyntax and the
ValidateParameters in the base and xen hypervisors. It also changes the
xen hypervisor to use the new hvparams field on instance.

Reviewed-by: imsnah

00cd937c 10/08/2008 05:31 pm Iustin Pop

Sanitize the hypervisor names

Since in 2.0 the user will possibly have more interaction with the
hypervisor names, we sanitize them by removing the version numbers
(the version can be a prerequisite for the ganeti installation, we
shouldn't document it in variable names)....

e69d05fd 10/08/2008 01:36 pm Iustin Pop

Move the hypervisor attribute to the instances

This (big) patch moves the hypervisor type from the cluster to the
instance level; the cluster attribute remains as the default hypervisor,
and will be renamed accordingly in a next patch. The cluster also gains...

3707f851 10/01/2008 08:34 pm Michael Hanselmann

Convert hypervisor

Replacing ssconf with configuration.

Reviewed-by: iustinp

d0c11cf7 09/04/2008 05:53 pm Alexander Schreiber

Merge r1607 from branches/ganeti/ganeti-1.2

Use a default vnc_bind_address if None is specified

Reviewed-by: iustinp

04c4330c 09/02/2008 11:42 am Alexander Schreiber

merge r1540 from branches/ganeti/ganeti-1.2

Allow access to HVM serial console

Reviewed-by: imsnah

5397e0b7 08/29/2008 07:17 pm Alexander Schreiber

Merge r1536 from branches/ganeti/ganeti-1.2

Add HVM device type flags 2/3

Reviewed-by: ultrotter

d47d3d38 08/13/2008 07:41 pm Guido Trotter

KVM Hypervisor Cleanup

- Remove a few experiemental code lines left as comments
- Rework first disks' boot=on addition, which was calculated twice
- Remove an empty line
- Remove reference to hvm_pae which doesn't apply to kvm

Reviewed-by: imsnah

eb58f9b1 08/13/2008 05:25 pm Guido Trotter

Add KVM hypervisor code contains the code for ganeti to work under kvm.
This patch also modifies to ship that file, and
lib/hypervisor/ to import it, and add kvm to the
hypervisors map.

Reviewed-by: imsnah

a5f723a2 08/13/2008 05:24 pm Guido Trotter

FakeHypervisor: fix a function signature

StartInstance takes 'block_devices', not 'force' as its third argument.
Even if this is not used in the fake hypervisor it's better to have the
correct argument name to avoid confusion.

Reviewed-by: imsnah

97efde45 07/30/2008 06:49 pm Guido Trotter

Xen: remove two end-of-line semicolons

It's python, isn't it?

Reviewed-by: iustinp

3b9e6a30 07/30/2008 04:27 pm Iustin Pop

Fix some errors detected by pylint

Reviewed-by: imsnah

e8230860 06/19/2008 03:56 pm Michael Hanselmann

Use a single instead of many

This change allows us to use cleaner dependencies between
directories. The build system is basically rewritten in large parts
and may contain bugs.

Reviewed-by: iustinp

6e7275c0 06/16/2008 01:37 pm Iustin Pop

hypervisor: add live migration support

This is just the hypervisor-level migration (e.g. “xm migrate”) not the
whole node coordination work.

Reviewed-by: ultrotter

a21dda8b 06/01/2008 02:37 am Iustin Pop

Forward-port: patch 3/4 extended HVM features for 1.2

This patch adds hypervisor support for the extended HVM features.

Author: schreiberal
Reviewed-by: iustinp

e3e66f02 05/09/2008 01:12 pm Michael Hanselmann

Remove utils.CheckDaemonAlive and use “xm info” instead

There are a couple of reasons for doing so:
- /proc is not OS independent, it's only supported by Linux (there are
emulations on other systems, but those might differ from the way
Linux represents data)....

a9369c6e 05/06/2008 01:20 pm Michael Hanselmann

Use dict instead of if/elif map for hypervisor classes

Reviewed-by: iustinp

a2d32034 05/06/2008 01:20 pm Michael Hanselmann

Rename hypervisor code to lowercase filenames

Reviewed-by: iustinp

e8a4c138 05/05/2008 01:01 pm Iustin Pop

Add node cpu count to gnt-node list

This patch adds the backend and frontend changes needed for being able
to list the cpu count.

Reviewed-by: ultrotter

65a6f9b7 04/28/2008 06:05 pm Michael Hanselmann

Split into several files

Before it was a huge file with more than 700 lines. No code changes were
made except for changing imports and class names where needed. In the
future, we could even think about only importing the hypervisors we
actually need. The patch finished QA scripts and distcheck successfully....