Commit Graph

14 Commits

Author SHA1 Message Date
Daniel P. Berrange
3505790b85 Allow for a driver specific private data blob in virDomainObjPtr
The virDomainObjPtr object stores state about a running domain.
This object is shared across all drivers so it is not appropriate
to include driver specific state here. This patch adds the ability
to request a blob of private data per domain object instance. The
driver must provide a allocator & deallocator for this purpose

THis patch abuses the virCapabilitiesPtr structure for storing the
allocator/deallocator callbacks, since it is already being abused
for other internal things relating to parsing. This should be moved
out into a separate object at some point.

* src/conf/capabilities.h: Add privateDataAllocFunc and
  privateDataFreeFunc fields
* src/conf/domain_conf.c: Invoke the driver allocators / deallocators
  when creating/freeing virDomainObjPtr instances.
* src/conf/domain_conf.h: Pass virCapsPtr into virDomainAssignDef
  to allow access to the driver specific allocator function
* src/lxc/lxc_driver.c, src/opennebula/one_driver.c,
  src/openvz/openvz_driver.c, src/qemu/qemu_driver.c,
  src/test/test_driver.c, src/uml/uml_driver.c: Update for
  change in virDomainAssignDef contract
2009-11-02 11:03:10 -05:00
Daniel P. Berrange
a3adcce795 Convert virDomainObjListPtr to use a hash of domain objects
The current virDomainObjListPtr object stores domain objects in
an array. This means that to find a particular objects requires
O(n) time, and more critically acquiring O(n) mutex locks.

The new impl replaces the array with a virHashTable, keyed off
UUID. Finding a object based on UUID is now O(1) time, and only
requires a single mutex lock. Finding by name/id is unchanged
in complexity.

In changing this, all code which iterates over the array had
to be updated to use a hash table iterator function callback.
Several of the functions which were identically duplicating
across all drivers were pulled into domain_conf.c

* src/conf/domain_conf.h, src/conf/domain_conf.c: Change
  virDomainObjListPtr to use virHashTable. Add a initializer
  method virDomainObjListInit, and rename virDomainObjListFree
  to virDomainObjListDeinit, since its not actually freeing
  the container, only its contents. Also add some convenient
  methods virDomainObjListGetInactiveNames,
  virDomainObjListGetActiveIDs and virDomainObjListNumOfDomains
  which can be used to implement the correspondingly named
  public API entry points in drivers
* src/libvirt_private.syms: Export new methods from domain_conf.h
* src/lxc/lxc_driver.c, src/opennebula/one_driver.c,
  src/openvz/openvz_conf.c, src/openvz/openvz_driver.c,
  src/qemu/qemu_driver.c, src/test/test_driver.c,
  src/uml/uml_driver.c, src/vbox/vbox_tmpl.c: Update all code
  to deal with hash tables instead of arrays for domains
2009-10-28 20:05:55 +00:00
Chris Lalancette
6e16575a37 Tunnelled migration.
Implementation of tunnelled migration, using a Unix Domain Socket
on the qemu backend.  Note that this requires very new versions of
qemu (0.10.7 at least) in order to get the appropriate bugfixes.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2009-10-02 11:43:26 +02:00
Chris Lalancette
03d777f345 Introduce virStrncpy.
Add the virStrncpy function, which takes a dst string, source string,
the number of bytes to copy and the number of bytes available in the
dest string.  If the source string is too large to fit into the
destination string, including the \0 byte, then no data is copied and
the function returns NULL.  Otherwise, this function copies n bytes
from source into dst, including the \0, and returns a pointer to the
dst string.  This function is intended to replace all unsafe uses
of strncpy in the code base, since strncpy does *not* guarantee that
the buffer terminates with a \0.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2009-09-22 20:10:00 +02:00
Daniel P. Berrange
c93125b120 Move LXC driver into src/lxc/
* src/lxc_conf.c, src/lxc_conf.h, src/lxc_container.c,
  src/lxc_container.h, src/lxc_controller.c, src/lxc_driver.c,
  src/lxc_driver.h, src/veth.c, src/veth.h: Move to src/lxc/
* src/opennebula/one_driver.c: Remove bogus veth.h include
* src/Makefile.am: Adjust for lxc paths
* daemon/qemud.c: Adjust include for lxc
2009-09-21 14:41:42 +01:00
Daniel P. Berrange
5c8d3d3bca Fix misc thread locking bugs / bogus warnings
Fix all thread locking bugs reported by object-locking test
case.

NB, some of the driver locking is getting too coarse. Driver
mutexes really need to be turned into RW locks instead to
significantly increase concurrency.

* src/lxc_driver.c: Fix useof driver when unlocked in the methods
  lxcDomainGetInfo, lxcSetSchedulerParameters, and
  lxcGetSchedulerParameters
* src/opennebula/one_driver.c: Fix missing unlock in oneDomainUndefine.
  Fix use of driver when unlocked in oneDomainGetInfo,
  oneGetOSType, oneDomainShutdown
* src/qemu_driver.c: Fix use of driver when unlocked in
  qemudDomainSavem, qemuGetSchedulerType, qemuSetSchedulerParameters
  and qemuGetSchedulerParameters
* src/storage_driver.c: Re-work storagePoolCreate to avoid bogus
  lock checking warning. Re-work storageVolumeCreateXMLFrom to
  remove a potential NULL de-reference & avoid bogus lock check
  warnings
* src/test.c: Remove testDomainAssignDef since it break lock chekc
  warnings.
* tests/object-locking.ml: Add oneDriverLock, oneDriverUnlock
  and one_driver_t methods/types to allow lock checking on the
   OpenNebula drivers
2009-09-10 14:26:56 +01:00
Chris Lalancette
9be5773fbb Minor cleanup of error path for c_oneVmInfo.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2009-08-11 13:31:04 +02:00
Jim Meyering
07613d2020 remove all trailing blank lines
by running this command:
git ls-files -z | xargs -0 perl -pi -0777 -e 's/\n\n+$/\n/'
This is in preparation for a more strict make syntax-check
rule that will detect trailing blank lines.
2009-07-16 15:06:42 +02:00
Daniel Veillard
f7bd305904 cleanup and small update for OpenNebula
* src/opennebula/one_conf.c src/opennebula/one_driver.c: cleanup
  and small update for OpenNebula driver by Abel Miguez Rodriguez
Daniel
2009-07-01 10:42:10 +00:00
Daniel P. Berrange
69ba4d0971 Remove unused code. Ensure null termination after strncpy in opennebula 2009-07-01 10:40:12 +00:00
Daniel Veillard
b547201561 Finish the integration of OpenNebula driver
* configure.in libvirt.spec.in src/Makefile.am
  src/opennebula/one_client.[ch] src/opennebula/one_conf.h
  src/opennebula/one_driver.[ch] : Finish the integration of OpenNebula,
  avoid dependancy on OpenNebula libraries, require xmlrpc-c-devel
  and build it by default, based on patch by Javier Fontan and DanB
  suggestions
Daniel
2009-06-24 17:32:56 +00:00
Daniel Veillard
31bd8cb6d0 * src/opennebula/one_conf.c src/opennebula/one_driver.c: fix One
driver compilation issues, patch by Javier Fontan and remove
  some tabs in format strings
daniel
2009-06-24 16:17:10 +00:00
Daniel P. Berrange
ee8553e156 Fix misc syntax problems with open nebula driver 2009-05-28 13:11:22 +00:00
Daniel Veillard
b811851b8d Include the OpenNebula driver
* src/opennebula/one_conf.[ch] src/opennebula/one_driver.[ch]:
  the OpenNebula driver
* configure.in include/libvirt/virterror.h qemud/Makefile.am
  qemud/qemud.c src/Makefile.am src/domain_conf.[ch] src/driver.h
  src/libvirt.c src/virterror.c: integration of the OpenNebula
  driver in the libvirt infrastructure
* AUTHORS: add Abel Miguez Rodriguez
daniel
2009-05-25 11:56:00 +00:00