Commit Graph

3604 Commits

Author SHA1 Message Date
Daniel P. Berrange
c5358c0e1f Introduce callbacks for serializing domain object private data to XML
Now that drivers are using a private domain object state blob,
the virDomainObjFormat/Parse methods are no longer able to
directly serialize all neccessary state to/from XML. It is
thus neccessary to introduce a pair of callbacks fo serializing
private state.

The code for serializing vCPU PIDs and the monitor device
config can now move out of domain_conf.c and into the
qemu_driver.c where they belong.

* src/conf/capabilities.h: Add callbacks for serializing private
  state to/from XML
* src/conf/domain_conf.c, src/conf/domain_conf.h: Remove the
  monitor, monitor_chr, monitorWatch, nvcpupids and vcpupids
  fields from virDomainObjPtr. Remove code that serialized
  those fields
* src/libvirt_private.syms: Export virXPathBoolean
* src/qemu/qemu_driver.c: Add callbacks for serializing monitor
  and vcpupid data to/from XML
* src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c: Pass monitor
  char device config into qemuMonitorOpen directly.
2009-12-08 13:46:54 +00:00
Daniel P. Berrange
e4b07fd6a5 Switch LXC driver to use a private data blob for virDomainObj state
* src/lxc/lxc_driver.c: Introduce lxcDomainObjPrivate for storing
  monitor device state
2009-12-08 13:46:54 +00:00
Daniel P. Berrange
f248c965ce Switch UML driver to use a private data blob for virDomainObj state
* src/uml/uml_driver.c: Introduce umlDomainObjPrivateData for storing
  monitor device state. Remove unneccessary VIR_FREE on vcpupids
2009-12-08 13:46:53 +00:00
Daniel P. Berrange
5697aa848b Pull code to start CPUs executing out of qemudInitCpuAffinity()
The code to start CPUs executing has nothing todo with CPU
affinity masks, so pull it out of the qemudInitCpuAffinity()
method and up into qemudStartVMDaemon()

* src/qemu/qemu_driver.c: Pull code to start CPUs executing out
  of qemudInitCpuAffinity()
2009-12-08 13:46:53 +00:00
Daniel P. Berrange
8c12b20c61 Add a 'format' arg to qemuMonitorChangeMedia() since JSON will support it
The current QEMU disk media change does not support setting the
disk format. The new JSON monitor will support this, so add an
extra parameter to pass this info in

* src/qemu/qemu_driver.c: Pass in disk format when changing media
* src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c,
  src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h:
  Add a 'format' arg to qemuMonitorChangeMedia()
2009-12-08 13:46:53 +00:00
Daniel P. Berrange
3fa3cff73c Fix migration cancellation for QEMU
* src/qemu/qemu_monitor_text.c: Add missing underscore in the
  migrate_cancel monitor command impl
2009-12-08 13:46:53 +00:00
Daniel P. Berrange
fa1e4759db Move qemuMonitorEscape + migrate status enum into shared monitor code
The qemuMonitorEscape() method, and the VIR_ENUM for migration
status will be needed by the JSON monitor too, so move that code
into the shared qemu_monitor.c file instead of qemu_monitor_text.c

* src/qemu/qemu_monitor.h: Declare qemuMonitorMigrationStatus enum
  and qemuMonitorEscapeArg and qemuMonitorEscapeShell methods
* src/qemu/qemu_monitor.c: Implement qemuMonitorMigrationStatus enum
  and qemuMonitorEscapeArg and qemuMonitorEscapeShell methods
* src/qemu/qemu_monitor_text.c: Remove above methods/enum
2009-12-08 13:46:53 +00:00
Daniel P. Berrange
79533da1b3 Fix crash when deleting monitor while a command is in progress
If QEMU shuts down while we're in the middle of processing a
monitor command, the monitor will be freed, and upon cleaning
up we attempt to do  qemuMonitorUnlock(priv->mon) when priv->mon
is NULL.

To address this we introduce proper reference counting into
the qemuMonitorPtr object, and hold an extra reference whenever
executing a command.

* src/qemu/qemu_driver.c: Hold a reference on the monitor while
  executing commands, and only NULL-ify the priv->mon field when
  the last reference is released
* src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c: Add reference
  counting to handle safe deletion of monitor objects
2009-12-08 13:46:48 +00:00
Guido Günther
1f60411686 udev_device_get_devpath might return NULL
Fix crash on strdup in that case.
2009-12-08 12:01:27 +01:00
Daniel Veillard
a4e09c1ed8 Fix a compilation failure if yajl not avail
configure:     yajl: no
CC     libvirt_util_la-json.lo
util/json.c:32:27: error: yajl/yajl_gen.h: No such file or directory
util/json.c:33:29: error: yajl/yajl_parse.h: No such file or directory

* src/util/json.c: remove the includes if yajl not configured in
2009-12-08 11:08:17 +01:00
Matthias Bolte
1449392dce Fix compilation for configure --disable-nls 2009-12-07 22:52:55 +01:00
Matthias Bolte
74c1c534a9 vbox: Update IIDs from version 3.1-beta2 to 3.1-final
This solves the 'nsIEventQueue object is null' error when trying
to connect to a VirtualBox 3.1 hypervisor instance.
2009-12-07 22:46:50 +01:00
Daniel P. Berrange
0a4283cb94 Fix ReprotError vs ReportError typo in JSON code
* src/util/json.c: Fix ReprotError typo when YAJL is not available
2009-12-07 17:01:33 +00:00
Daniel P. Berrange
6e547d54e5 Fix inverted conditional test in configure.ac check for yajl
* configure.in: Fix inverted conditional test when yajl is not
  found
2009-12-07 16:51:14 +00:00
Daniel P. Berrange
9428f2ced6 Introduce a simple API for handling JSON data
This introduces simple API for handling JSON data. There is
an internal data structure 'virJSONValuePtr' which stores a
arbitrary nested JSON value (number, string, array, object,
nul, etc).  There are APIs for constructing/querying objects
and APIs for parsing/formatting string formatted JSON data.

This uses the YAJL library for parsing/formatting from

 http://lloyd.github.com/yajl/

* src/util/json.h, src/util/json.c: Data structures and APIs
  for representing JSON data, and parsing/formatting it
* configure.in: Add check for yajl library
* libvirt.spec.in: Add build requires for yajl
* src/Makefile.am: Add json.c/h
* src/libvirt_private.syms: Export JSON symbols to drivers
2009-12-07 14:14:36 +00:00
Daniel P. Berrange
563dc5654c Add --system flag to autogen.sh to make it easy to build with right prefix
Add a --system flag to autogen.sh which gets turned into the args
--prefix=/usr --sysconfdir=/etc --localstatedir=/var to make it
easy to build with settings that match an RPM build

* autogen.sh: Add --system flag
2009-12-07 14:13:53 +00:00
Jiri Denemark
e7ef4ed1d2 Export all symbols from xml.h for internal use
Some of the very useful calls for XML parsing provided by util/xml.[ch]
were not exported as private symbols. This patch fixes this.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2009-12-04 21:52:08 +01:00
Matthias Bolte
03fa46886a vbox: Use virIndexToDiskName() in vboxGenerateMediumName() 2009-12-04 17:08:28 +01:00
Jiri Denemark
81ea6e4d9f Tests for interface type/model configuration
add a set of tests for Xen interface type and model configurations
2009-12-04 17:01:34 +01:00
Jiri Denemark
dddad4bcb4 Support for interface model='netfront'
Xen HVM guests with PV drivers end up with two network interfaces for
each configured interface. One of them being emulated by qemu and the
other one paravirtual. As this might not be desirable, the attached
patch provides a way for users to specify that only paravirtual network
interface should be presented to the guest.

The configuration was inspired by qemu/kvm driver, for which users can
specify model='virtio' to use paravirtual network interface.

The patch adds support for model='netfront' which results in
type=netfront instead of type=ioemu (or nothing for newer xen versions)
in guests native configuration. Xen's qemu ignores interfaces with
type != ioemu and only paravirtual network device will be seen in the
guest.

Four possible configuration scenarios follow:

- no model specified in domain's XML
    - libvirt will behave like before this change; it will set
      type=ioemu for HVM guests on xen host which is not newer than
      XEND_CONFIG_MAX_VERS_NET_TYPE_IOEMU
    - covered by existing tests

- PV guest, any model
    - no functional change, model is passed as is (and ignored by the
      hypervisor)
    - covered by existing tests (e.g., *-net-e1000.*)
- HVM guest, model=netfront
    - type is set to "netfront", model is not specified
    - covered by new *-net-netfront.* tests

- HVM guest, model != netfront
    - type is set to "ioemu", model is passed as is
    - covered by new *-net-ioemu.* tests

The fourth scenario feels like a regression for xen newer than
XEND_CONFIG_MAX_VERS_NET_TYPE_IOEMU as users who had a model specified
in their guest's configuration won't see a paravirtual interface in
their guests any more. On the other hand, the reason for specifying a
model is most likely the fact that they want to use such model which
implies emulated interface. Users of older xen won't be affected at all
as their xen provides paravirtual interface regardless of the type used.

- src/xen/xend_internal.c: add netfront support for the xend backend
- src/xen/xm_internal.c: add netfront support for the XM serialization too
2009-12-04 16:55:59 +01:00
Pritesh Kothari
834d65471d vbox: Add support for version 3.1
Also fixed serial port configuration which was broken due to recent
change in virDomainChrDef where targetType was newly added.

* src/Makefile.am: add new files
* src/vbox/vbox_driver.c: add case for version 3.1
* src/vbox/vbox_tmpl.c: refactor common patterns into macros, support for
  version 3.1, serial port configuration fix
* src/vbox/vbox_CAPI_v3_1.h, src/vbox/vbox_V3_1.c: generated code
2009-12-04 14:49:45 +01:00
Matthias Bolte
63166a4e0c Add virIndexToDiskName and fix mapping gap
esxVMX_IndexToDiskName handles indices up to 701. This limit comes
from a mapping gap in virDiskNameToIndex:

  sdzy -> 700
  sdzz -> 701
  sdaaa -> 728
  sdaab -> 729

This line in virDiskNameToIndex causes this gap:

  idx = (idx + i) * 26;

Fixing it by altering this line to:

  idx = (idx + (i < 1 ? 0 : 1)) * 26;

Also add a new version of virIndexToDiskName that handles the inverse
mapping for arbitrary indices.

* src/esx/esx_vmx.[ch]: remove esxVMX_IndexToDiskName
* src/util/util.[ch]: add virIndexToDiskName and fix mapping gap
* tests/esxutilstest.c: update test to verify that the gap is fixed
2009-12-03 18:07:49 +01:00
Matthias Bolte
7a18fbeeb8 Fix some locking issues
* src/conf/domain_conf.c: don't call virDomainObjUnlock twice
* src/qemu/qemu_driver.c: relock driver lock if an error occurs in
  qemuDomainObjBeginJobWithDriver, enter/exit monitor with driver
  in qemudDomainSave
2009-12-03 17:06:38 +01:00
Daniel Veillard
816d79143b Fix missing background color 2009-12-03 15:27:24 +01:00
Daniel P. Berrange
32f021f266 Fix event test timer checks on kernels with HZ=100
On kernels with HZ=100, the resolution of sleeps in poll() is
quite bad. Doing a precise check on the expiry time vs the
current time will thus often thing the timer has not expired
even though we're within 10ms of the expected expiry time. This
then causes another pointless sleep in poll() for <10ms. Timers
do not need to have such precise expiration, so we treat a timer
as expired if it is within 20ms of the expected expiry time. This
also fixes the eventtest.c test suite on kernels with HZ=100

* daemon/event.c: Add 20ms fuzz when checking for timer expiry
2009-12-02 11:53:42 +00:00
Daniel P. Berrange
e15bf04465 Fix typo in QEMU driver webpage
* docs/drvqemu.html.in: Fix typo describing URI driver protocol
2009-11-30 15:21:21 +00:00
Paolo Bonzini
fe9c8d9147 Add another SENTINEL attribute
* src/xen/xend_internal.c (xend_op): Add ATTRIBUTE_SENTINEL.
2009-11-30 10:49:05 +01:00
Wolfgang Mauerer
43d0ba5f95 Clarify documentation for private symbols
The instruction "See Makefile.am" in libvirt.private_syms
always makes me think that this file is autogenerated
and should not be touched manually. This patch spares
every reader of libvirt.private_syms the hassle of
reading Makefile.am before augmenting libvirt.private_syms.

Signed-off-by: Wolfgang Mauerer <wolfgang.mauerer@siemens.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2009-11-26 18:52:03 +00:00
Wolfgang Mauerer
4060131927 Fix help message
The configuration file setting is overriden by -f or --config, but
not with -c

Signed-off-by: Wolfgang Mauerer <wolfgang.mauerer@siemens.com>
2009-11-26 18:51:51 +00:00
Daniel P. Berrange
bb8d57c68a Fix threading problems in python bindings
* libvirt-override.c: Add many missing calls to allow threading
  when entering C code, otherwise python blocks & then deadlocks
  when we have an async event to dispatch back into python code.
  Fix return value check for virDomainPinVcpu binding.
2009-11-26 12:07:41 +00:00
Daniel P. Berrange
7ed63c5312 Supress annoying libcap-ng errors from valgrind
* tests/.valgrind.supp: Ignore capng problems
2009-11-26 12:07:17 +00:00
Daniel P. Berrange
874990dc2c Fix two leaks in test driver
* src/test/test_driver.c: Fix leak of vcpu info, and nodedevice
  info
2009-11-26 12:07:17 +00:00
Daniel P. Berrange
db810b1148 Free cgroup device ACL list on driver shutdown
* src/qemu/qemu_driver.c: Free cgroup ACLs
2009-11-26 12:07:17 +00:00
Matthias Bolte
7cfbb17978 xen: Fix unconditional freeing in xenDaemonListDefinedDomains()
Commit 790f0b3057 causes the contents of
the names array to be freed even on success, resulting in no listing of
defined but inactive Xen domains.

Spotted by Jim Fehlig
2009-11-26 00:09:40 +01:00
Daniel P. Berrange
8f147d16f1 Fix default disk type when parsing QEMU argv
* src/qemu/qemu_conf.c: Fix default disk type to be 'FILE'
  again, after previous commit accidentally changed it
2009-11-24 10:59:05 +00:00
Gerhard Stenzel
fb7cebb767 remove port filter when network device is detached
* src/qemu/qemu_driver.c: remove the port filter if the network device
  is detached via virDomainDetachDevice.
2009-11-24 11:25:16 +01:00
Daniel P. Berrange
e7c78b0a94 Support QEMU's virtual FAT block device driver
Introduce a new type="dir"  mode for <disks> that allows use of
QEMU's  virtual FAT block device driver. eg

    <disk type='dir' device='floppy'>
      <source dir='/tmp/test'/>
      <target dev='fda' bus='fdc'/>
      <readonly/>
    </disk>

gets turned into

  -drive file=fat:floppy:/tmp/test,if=floppy,index=0

Only read-only disks are supported with virtual FAT mode

* src/conf/domain_conf.c, src/conf/domain_conf.h: Add type="dir"
* docs/schemas/domain.rng: Document new disk type
* src/xen/xend_internal.c, src/xen/xm_internal.c: Raise error for
  unsupported disk types
* tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom-empty.args: Fix
  empty disk file handling
* tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fat.args,
  tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fat.xml,
  tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-fat.args,
  tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-fat.xml
  tests/qemuxml2argvtest.c: Test QEMU vitual FAT driver
* src/qemu/qemu_conf.c: Support generating fat:/some/dir type
  disk args
* src/security/security_selinux.c: Temporarily skip labelling
  of directory based disks
2009-11-23 12:17:16 +00:00
Daniel P. Berrange
a73cd93b24 Alternate CPU affinity impl to cope with NR_CPUS > 1024
The cpu_set_t type can only cope with NR_CPUS <= 1024, beyond this
it is neccessary to use alternate CPU_SET maps with a dynamically
allocated CPU map

* src/util/processinfo.c: Support new unlimited size CPU set type
2009-11-23 11:58:13 +00:00
Daniel P. Berrange
37f415da42 Pull schedular affinity code out into a separate module
* src/Makefile.am: Add processinfo.h/processinfo.c
* src/util/processinfo.c, src/util/processinfo.h: Module providing
  APIs for getting/setting process CPU affinity
* src/qemu/qemu_driver.c: Switch over to new APIs for schedular
  affinity
* src/libvirt_private.syms: Export virProcessInfoSetAffinity
  and virProcessInfoGetAffinity to internal drivers
2009-11-23 11:58:13 +00:00
Daniel P. Berrange
af10d9baa8 Ignore docs/ directory for strcmp() syntax check
* .x-sc_prohibit_strcmp_and_strncmp: Ignore docs/
2009-11-23 11:58:13 +00:00
Dan Kenigsberg
79d2c5831a Fix news.html validation 2009-11-22 20:08:54 +01:00
Daniel Veillard
040e80f7e6 Release of libvirt-0.7.4
0.7.3 was broken

* configure.in docs/news.html.in: release of 0.7.4
* configure.in libvirt.spec.in: require netcf >= 0.1.4
* src/Makefile.am: node_device/node_device_udev.h was missing from
  NODE_DEVICE_DRIVER_UDEV_SOURCES breaking compilation on platforms with
  udev
2009-11-20 19:43:59 +01:00
Daniel Veillard
b8d4b6bec9 Release of libvirt-0.7.3
* configure.in docs/news.html.in libvirt.spec.in: describe new release
* po/*.po*: regenerate
2009-11-20 17:31:13 +01:00
Daniel P. Berrange
4811fab790 Enable udev instead of hal on F12 / RHEL-6 or later
HAL has been deprecated since F12 and RHEL-6, so if building on
these platforms, switch on the udev driver instead

* libvirt.spec.in: Activate udev on F12/RHEL6
2009-11-20 16:45:46 +01:00
Cole Robinson
eb81396863 Document overriding domain interface target
* docs/formatdomain.html.in: document that vnet and vif are reserved
  names and will be ignored if manually specified.
2009-11-20 16:25:58 +01:00
Cole Robinson
c7e1cfc9f4 python: Actually implement list*Interfaces bindings
* python/generator.py python/libvirt-override-api.xml
  python/libvirt-override.c: implement the bindings for
  virConnectListInterfaces() and virConnectListDefinedInterfaces()
2009-11-20 16:22:42 +01:00
Daniel Veillard
7d43c80bc4 514532 Fix man page, most operation are synchronous
* tools/virsh.pod: the man page was stating that most operations
  are asynchronous while in fact most of them are synchronous except
  domain shutdown, setvcpus and setmem.
2009-11-20 16:09:36 +01:00
Daniel Veillard
776b675861 504262 Check for duplicated UUID in XM Xen defines
* src/xen/xm_internal.c: the XM driver was not checking for previously
  defined UUID on new defines. Similar to virDomainObjIsDuplicate()
  behaviour.
2009-11-20 16:02:17 +01:00
Daniel Veillard
2060a0a43e 512069 fix domain XML schemas for backward compatibility
For backward compatibility we used to add the tty path as
a tty attribute on console of type pty, duplicating the value
now found in source/@path, but the Relax-NG grammar wasn't
extended for this
    <console type='pty' tty='/dev/pts/8'>
      <source path='/dev/pts/8'/>
      <target port='0'/>
    </console>

* docs/schemas/domain.rng: allow an optional tty attribute
  containing a devicePath
2009-11-20 15:48:19 +01:00
Steve Yarmie
b827338a72 qemu-kvm needs -enable-kvm flag for VT optimization
Recent qemu releases require command option '-enable-qemu' in order
for the kvm functionality be activated. Libvirt needs to pass this flag
to qemu when starting a domain. Note that without the option,
even if both the kernel and qemu support KVM, KVM will not be activated
and VMs will be very slow.

* src/qemu/qemu_conf.h src/qemu/qemu_conf.c: parse the extra command
  line option from help and add it when running kvm
* tests/qemuhelptest.c: this modified the flags output for qemu-0.10.5
  and qemu-kvm-0.11.0-rc2 regression tests
2009-11-20 15:41:05 +01:00