Commit Graph
3453 Commits
Author SHA1 Message Date
Keir Fraser 51f36202c4 xend: destroy stubdoms synchronously
This patch makes the destruction of stubdoms a synchronous event,
therefore it is no longer possible to run out of memory when rebooting
a guest because the stubdom of the old guest is always destroyed
before the creation of the new guest.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-10-15 08:16:42 +01:00
Keir Fraser b1fd365cec xm,xend: Add new option "change_home_server" to xm migrate
This patch adds a new option to xm migrate command.  A concept of the
option is inspired from XenServer/XenCenter.  The concept is "Change
home server (affinity)."  The option name is "change_home_server."

Currently, a config.sxp file of a managed domain is not migrated to a
destination server even if the migration of the managed domain
succeeds.  The config.sxp file is kept in a source server.

By the patch, the config.sxp file is migrated with the managed domain.
The config.sxp file is unregistered from the source server, then the
config.sxp file is registered to the destination server.

BTW, should the config.sxp file be always migrated without the option?
If the managed domain is migrated without the option, the managed
domains exist on both the source server and the destination server.
(Of course, the managed domain on the source server is "halted" state,
and the managed domain on the destination server is "running" state.)
Is it good that the managed domains with a same UUID exist on both
servers?  (In the patch, I added the option for compatible.)

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-10-14 09:09:23 +01:00
Keir Fraser a45c214328 xend: call pci_device_configure on the stubdom
Whenever pci_device_configure is called on a guest that has a stubdom,
call pci_device_configure on the stubdom as well.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-10-14 08:56:55 +01:00
Keir Fraser 1ce3e83dc7 xend: allow a device to be assigned to a guest and its stubdom
This patch allows a pci device to be passed through an HVM guest and
its own stubdom at the same time.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2009-10-14 08:56:25 +01:00
Keir Fraser 2f42a37e57 xend: Fix VDI-VBD link for XenAPI
I detected problems of VDI-VBD link again.
  - In the case of inactive managed domains, VDI->VBD link was lost
    by xend restarting (or host OS rebooting).
  - In the case of active domains, both VDI->VBD link and VBD->VDI
    link were lost by xend restarting.

When xend is restarted, information of VDI instances is restored from
a vdi.xml file.  But the vdi.xml file does not have UUID of VBD
because xend does not write the UUID to the vdi.xml file.  Therefore,
VDI->VBD link is lost.  When xend is restarted, information of VBD
instances is restored from xenstore.  But xenstore does not have UUID
of VDI.  Therefore, VBD->VDI link is lost.

This patch solves the problems.  VDI instances stop having UUID of
VBD.  Instead, xend gathers UUID of VBD each time it's required.  The
method is the same as Network->VIF link.  Information of VBD instances
is restored not only from xenstore but from a config.sxp file.  UUID
of VDI is restored from the config.sxp file.

FYI, VBD->VDI link of inactive managed domains is not lost because
information of VBD instances is restored from the config.sxp file.
UUID of VDI is written by xend to the config.sxp file.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-10-09 08:56:43 +01:00
Keir Fraser d680037667 xend: Fix bug in superpage flag handling
During testing I discovered that using a bootloader magically clears
the superpage flag out of the config.  This small patch fixes that
behavior.

From: Dave McCracken <dcm@mccr.org>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-10-09 08:53:42 +01:00
Keir Fraser 636eaa12d9 Tools-side support for creating and destroying netchannel2 interfaces.
Signed-off-by: Steven Smith <steven.smith@citrix.com>
2009-10-07 07:47:50 +01:00
Keir Fraser 7cb99e3e81 xend: Updated setpolicy to support loading of flask policy
Updated xm setpolicy command to support the loading of flask security
policies.

Signed-off-by : Machon Gregory <mbgrego@tycho.ncsc.mil>
Signed-off-by : George S. Coker, II <gscoker@alpha.ncsc.mil>
2009-10-06 10:11:53 +01:00
Keir Fraser ca518e1e80 Fix memory leak in libxenstore python bindings
Temporary tuple0 python object was not freed at the end of
xspy_set_permissions() in case no error occurred. To reduce code
duplication, this path reuses the cleanup code.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2009-10-01 12:26:15 +01:00
Keir Fraser 956bf143e8 xend: allow domain creation with multiple empty CD-ROM devices
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-09-30 08:51:21 +01:00
Keir Fraser 14162d298b xend: Fix memory leaks in libxc python bindings
Reference counters are not correctly decreased for python object in
several places in python bindings for libxc. Most of them are around
PyList_Append(), which unlike PyList_SetItem() does increment
reference counter of the object being added to a list.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2009-09-30 08:44:57 +01:00
Keir Fraser 3cc1e4c380 xend: Fix save/restore after previous changeset.
Platform variable 'tsc_native' is saved/restored as a string, so must
be converted to an integer before passing to domain_set_tsc_native().

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-09-28 13:59:35 +01:00
Keir Fraser bf2c44f8b4 x86: Allow TSC mode (emulate vs native) to be configured per domain.
The default is to emulate. Old saved images will be restored with
legacy behaviour however (native TSC, no emulation).

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-09-28 10:01:10 +01:00
Keir Fraser fa2b145c09 xend: Unlink VDI instances and VBD instances
VBD information in xend does not have a VDI value if XenAPI mode
is invalid. A new patch confirms the VDI value is valid.  So, the new
patch cuts off VDI->VBD links if the VDI value is valid.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-09-25 10:46:13 +01:00
Keir Fraser 7033f11647 Revert 20221:fc94d586d02f
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-09-18 14:45:40 +01:00
Keir Fraser 41c06ea3f5 xend: Implement VIF.get_network
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-09-18 08:44:38 +01:00
Keir Fraser 75112bdbe1 xend: Unlink VDI instances and VBD instances
When VBD instances are destroyed by xm delete command, VDI
instances keep linking to the VBD instances unilaterally.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-09-18 08:27:38 +01:00
Keir Fraser 5a7b303934 xend: Consider ioemu devices for inactive managed domains
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-09-16 09:22:38 +01:00
Keir Fraser fbc4f2e894 xend: Fix VDI.get_record
We cannot get correct records of VDI by VDI.get_record.
The correct records of VDI are gotten by this patch.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-09-15 09:26:08 +01:00
Keir Fraser 278db12c2b xend: Receive error message of migration from destination server
The following error message was shown by xm migrate command.
In fact, I caused the command error by intention.  I prepared a
destination server where free memory was insufficient, and then
I tried to migrate a VM to the destination server.  As I had
expected, the command error occurred.  However the error message
was different from my expectation.  I would like to show an error
message from the destination server if an error occurred on the
destination server.

# xm migrate --live vm3 bx339
Error: (107, 'Transport endpoint is not connected')
Usage: xm migrate <Domain> <Host>

Migrate a domain to another machine.

Options:

-h, --help           Print this help.
-l, --live           Use live migration.
-p=3Dportnum, --port=3Dportnum
                     Use specified port for migration.
-n=3Dnodenum, --node=3Dnodenum
                     Use specified NUMA node on target.
-s, --ssl            Use ssl connection for migration.


If a destination server sends an error message, this patch shows=20
the error message.  For example, the following error message is=20
shown if free memory of the destination server is insufficient.

# xm migrate --live vm3 bx339
Error: I need 262144 KiB, but dom0_min_mem is 716800 and shrinking
to=20
716800 KiB would leave only 50368 KiB free. (from bx339)
Usage: xm migrate <Domain> <Host>

Migrate a domain to another machine.

Options:

-h, --help           Print this help.
-l, --live           Use live migration.
-p=3Dportnum, --port=3Dportnum
                     Use specified port for migration.
-n=3Dnodenum, --node=3Dnodenum
                     Use specified NUMA node on target.
-s, --ssl            Use ssl connection for migration.


Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-09-15 09:20:47 +01:00
Keir Fraser d51e292331 Fix typo in c/s 20158:f9ce5858.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-09-09 15:34:37 +01:00
Keir Fraser 463d75af78 xm,xend: Make cpus parameter available
When I started a VM by using xm create command, cpus parameter in VM
configuration files was ignored.  The problem occurred only when I
used XenAPI. This patch makes the parameter available.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-09-09 15:33:30 +01:00
Keir Fraser 23c3a595fe xend: Fix syntax error
Signed-off-by: Simon Horman <horms@verge.net.au>
2009-09-08 15:10:59 +01:00
Keir Fraser f703973da4 xend: passthrough: add an option pci-passthrough-strict-check
Currently when assigning device to HVM guest, we use the strict check
for HVM guest by default.(For PV guest we use loose check
automatically if necessary.)

When we assign device to HVM guest, if we meet with the co-assignment
issues or the ACS issue (see changeset 20081: 4a517458406f), we could
try changing the option to 'no' -- however, we have to realize this
may incur security issue and we can't make sure the device assignment
could really work properly even after we do this.

The option is located in /etc/xen/xend-config.sxp:
(pci-passthrough-strict-check yes)

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2009-09-07 13:52:48 +01:00
Keir Fraser a358be0b0f xend: Revert c/s 17536 which breaks PV passthru of MSI-X devices.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-09-07 08:48:12 +01:00
Keir Fraser 345fbe6cb4 xend: passthrough: fix physdev_map_pirq invocation
For those devices not having INTx (like VFs), avoid calling map_pirq,
otherwise the guest cannot be started successfully.

Also avoid calling this hypercall for hvm guest, this is done in the
device model.

Signed-off-by: Qing He <qing.he@intel.com>
2009-09-07 08:38:39 +01:00
Keir Fraser e4e14402c1 xend: Support "bootloader" mode for "drbd:" devices
To be able to use "bootloader" on drbd devices the following changes
need to be made:

*) Translation of devicename

_parse_uname which is used by blkdev_uname_to_file which is again used
by _configureBootloader in XendDomainInfo needs to be able to resolve
drbd resources to the corresponding blockdevice to feed to the
configured bootloader.

*) Activation of drbd device

If the drbd device isn't in Primary mode when the bootloader tries to
fetch the kernel and initrd, the start of the DomU will fail. To
prevent this the given drbd device will be made Primary before the
bootloader gets executed.

A note on the naming of drbd resouces: drbd uses mostly resource names
in it's userland tools. Because of that drbd VBDs, if configured with
the "drbd:" type, should always use the drbd resource name as
suggested by the drbd documentation at
http://www.drbd.org/users-guide-emb/s-xen-configure-domu.html. My
patches assume that the VBDs are named accordingly.

Signed-off-by: Michael Renner <michael.renner@geizhals.at>
2009-09-04 08:42:10 +01:00
Keir Fraser 35c865110a xend: fix domain_migrate
When the guest(pv-on-hvm guest that cannot suspend) reboot in
LiveMigration, the disconnecting of src-side is not transmitted to
dist-side. As a result, the error processing on the dist side is not
executed.

Signed-off-by: Tomonari Horikoshi <t.horikoshi@jp.fujitsu.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-09-04 08:34:45 +01:00
Keir Fraser 4dd7eb9f09 xm: Add "tap2" to attach blocktap disks to VM
I detected a problem when using XenAPI.  When I started a VM by
using xm create command, blocktap disks were not attached to the
VM.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-09-03 09:49:41 +01:00
Keir Fraser 7e3088ca7f xm: Make cpu_{cap|weight} available when using XenAPI
Currently, cpu_weight parameter and cpu_cap parameter in domain=20
configuration files are ignored when using XenAPI.
The parameters are available by this patch.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-09-02 11:39:27 +01:00
Keir Fraser 049607ff33 x86 passthru:: graphics passthrough
This patch supports basic gfx passthrough on xen side:
  - add a VGA type for gfx passthrough, and get the size of VGA bios
  of passthrouged gfx in hvmloader
  - add a config option 'gfx_passthru' for gfx passthrough

Signed-off-by: Ben Lin <ben.y.lin@intel.com>
Signed-off-by: Weidong Han <weidong.han@intel.com>
2009-09-01 11:36:16 +01:00
Keir Fraser 18e7740068 xend: Fix c/s 20137 -- do not redefine built-in name 'str'.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-31 18:17:26 +01:00
Keir Fraser bf6b9756fa xend: Greater verbosity on domain creation failure
Attached patch makes error reporting more verbose when
xc.domain_create() fails or raises an Exception.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
2009-08-31 10:12:10 +01:00
Keir Fraser 7a530cd968 xend: Do not pass pointer to a 16-bit domid_t to PyArg_ParseTuple()
when it expects a full integer.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
2009-08-26 15:41:59 +01:00
Keir Fraser c50b989b44 xend: Flask MLS security label handling
Changed the way security labels are handled to allow domains to be
labeled with Flask MLS security labels.  Changed the error message
generated when an invalid context is submitted to be more useful.

Signed-off-by: Machon B. Gregory <mbgrego@tycho.ncsc.mil>
Signed-off-by: George S. Coker, II <gscoker@alpha.ncsc.mil>
2009-08-26 15:35:14 +01:00
Keir Fraser c4651bd31d xend: Fix typos in configure_vtpm
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-08-25 14:59:09 +01:00
Keir Fraser 1b14383998 xend: Add support for URI ('file:' and 'data:' scheme) for PV/kernel
and PV/ramdisk

Add support for 'file:' and 'data:' URI schemes for the parameters
'PV/kernel' and 'PV/ramdisk' in the VM.create() call. The 'data:'
scheme handling enables using a file which is stored inside the
management system (from where the XenAPI call is send) as kernel or
ramdisk.

Notes:
o all included: a detailed description can be found in the xenapi
documentation
o bumped up the version of the API document to 1.0.8 (because of
(minimal) interface extension)
o Future enhancements (like http:, ftp: schemes) fit seamlessly into
the current design / classes
o Unittest cases and xm-test case included

Signed-off-by: Andreas Florath <xen@flonatel.org>
2009-08-25 14:56:54 +01:00
Keir Fraser 2ac9ced4cb xend: Allow vtpm instance uuid to be specified on domain creation
Right now xen will create a new vtpm instance everytime you start up a
domU, even if you specify the instance parameter in your config file.
Each vtpm instance is then given a uuid and the vtpm.db file maps
instance numbers to uuid numbers.

This patch is a hack that lets you explicitly set the uuid of your
vtpm instance. Everytime you boot up your domU now the vtpm will get
that uuid and thus it will always get the same vtpm instance number
instead of being generated a new one.

So for example, in your config file you would do something like this
vtpm = [ 'backend=0,uuid=dcdb124b-9fed-4040-b149-dd2dfd8d094c' ]

Signed-off-by: Matt Fioravante <Matthew.Fioravante@jhuapl.edu>
2009-08-24 08:05:46 +01:00
Keir Fraser f0321cbffa Fix xapi xm-tests.
There were a couple of small bugs in the xapi xm-test:
o outdated XenAPI calls were removed from testcase
  (02_xapi-vbd_basic)
o minor problem with XendLocalStorageRepository
  is fixed (missed list_images() function - which
  is moved from the XenQCoWStroageRepo to the common
  base class XendStorageRepository)
  which was detected running 02_xapi-vbd_basic.
o XenAPI session handling and connecting is fixed.
o 03_xapi-network_pos was rewritten and now uses
  XenAPI.

Signed-off-by: Andreas Florath <xen@flonatel.org>
2009-08-20 10:30:53 +01:00
Keir Fraser 89164e3f7b xend: Fix error caused by VT-d ACS patch.
Signed-off-by: Allen Kay <allen.m.kay@intel.com>
2009-08-20 08:25:41 +01:00
Keir Fraser 39b4fc5972 xend: passthrough: check if a device is behind PCIe switch that lacks ACS
Imagine a PCIe switch, which doesn't support ACS (Access Control
Services), has 2 downstream ports: A and B, according to PCIe spec,
the PCIe switch should directly route the transaction that is from A
and to a device under B -- the Root Complex and IOMMU engine are
bypassed -- this doesn't work at all in the case of hvm guest and can
even incur potential security issue, so we should not allow such kind
of device assignment.

If all the intermediate PCIe swiches between a device and Root Complex
support and enable ACS, we can safely asssign the device to guest.

Cc: Allen Kay <allen.m.kay@intel.com>
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
2009-08-19 13:12:16 +01:00
Keir Fraser 276e535eba xm,xend: Remove tab indents
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-08-19 12:55:15 +01:00
Keir Fraser c3fcb0fd91 Revert 20066:135b350496fb 2009-08-16 08:43:50 +01:00
Keir Fraser 2ca1b6fff7 xend: VBD QoS policy bits
Add the ability to define VBD QoS policy in the xend layer.

Consider the following vbd entry:

vbd = [
   'phy:/dev/server/virtualmachine1-disk,xvda1,w,credit=3D5000/s@50ms',
]

This means that a VM may perform 5000 I/O operations per second, with
credit being replenished every 50 milliseconds.

The 'credit' xenstore value is by the blkback driver to ratelimit I/O
operations for the specific device.

Signed-off-by: William Pitcock <nenolod@dereferenced.org>
2009-08-14 17:10:11 +01:00
Keir Fraser 81d70f1a53 tmem: expose freeable memory
Expose tmem "freeable" memory for use by management tools.

Management tools looking for a machine with available
memory often look at free_memory to determine if there
is enough physical memory to house a new or migrating
guest.  Since tmem absorbs much or all free memory,
and since "ephemeral" tmem memory can be synchronously
freed, management tools need more data -- not only how
much memory is "free" but also how much memory is
"freeable" by tmem if tmem is told (via an already
existing tmem hypercall) to relinquish freeable memory.
This patch provides that extra piece of data (in MB).

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
2009-08-10 13:27:54 +01:00
Keir Fraser 22d91502ea xend: Rename device backend value when xm save/migrate
The Xend has a problem that it often fails to restore/migrate
a PV domain whose device backends are partly a driver domain.

Because a checkpoint of the PV domain has device backend value as
domain id, you can restore/migrate the PV domain only when a driver
domain is the same id as device backend value in the checkpoint.

I attached a patch to fix it by renaming device backend value in a
checkpoint from domain id to domain name when xm save/migrate.

This patch doesn't rename device backend value if the value is 0,
which is Domain-0, so the checkpoint format is compatible if you use
only Domain-0 as device backend.

Signed-off-by: Rikiya Ayukawa <ayukawa.rikiya@jp.fujitsu.com>
2009-08-07 17:22:04 +01:00
Keir Fraser 734a7f6677 tmem: save/restore/migrate/livemigrate and shared pool authentication
Attached patch implements save/restore/migration/livemigration
for transcendent memory ("tmem").  Without this patch, domains
using tmem may in some cases lose data when doing save/restore
or migrate/livemigrate.  Also included in this patch is
support for a new (privileged) hypercall for authorizing
domains to share pools; this provides the foundation to
accomodate upstream linux requests for security for shared
pools.

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
2009-08-06 09:19:55 +01:00
Keir Fraser 3c11d89e35 Revert 20006:edf21ab7d7a4 and 20023:2b28320c6f8c. 2009-08-05 14:56:29 +01:00
Keir Fraser 41f4eefa05 xend: Remove _setSchedParams
Currently, xc.sched_credit_domain_set is called twice when domains
are created.

start@XendDomainInfo
  _constructDomain
    xc.sched_credit_domain_set  --- 1st
  _initDomain
    _setSchedParams
      domain_sched_credit_set
        xc.sched_credit_domain_set  --- 2nd

resume@XendDomainInfo
  _constructDomain
    xc.sched_credit_domain_set  --- 1st
  _setSchedParams
    domain_sched_credit_set
      xc.sched_credit_domain_set  --- 2nd

This patch removes _setSchedParams method added by changeset 19955,
because xc.sched_credit_domain_set was added into _constructDomain
method by changeset 20006.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
2009-08-05 14:03:38 +01:00
Keir Fraser f275a935a2 xend: fix memory leak resulting in long garbage collector runs
In the method xen.xend.XendStateStore.XendStateStore.load_state and
xen.xend.XendStateStore.XendStateStore.save_state the minidom objects
used to load/save the current state of a device type, can't be freed
by the python garbage collector after all references to the top node
are cleared, because of cyclic references between the DOM nodes. So
memory usage of xend increases after calling these methods.  To solve
this problem, the unlink() method must be called for a minidom object
before the last reference to the top node is cleared (see python
docs). This breaks the cyclic references, so the garbage collector can
free these objects.

Signed-off-by: juergen.gross@ts.fujitsu.com
2009-08-05 12:04:39 +01:00