]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
15 years agopython: Remove FastParser from generator.
Cole Robinson [Fri, 2 Oct 2009 14:34:54 +0000 (10:34 -0400)]
python: Remove FastParser from generator.

FastParser uses sgmlop, a non-standard python module meant as a replacement
for xmllib (which is deprecated since python 2.0). Fedora doesn't even carry
this module, and the generator doesn't have high performance requirements, so
just rip the code out.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
15 years agoconfigure: Add explict --with-python option.
Cole Robinson [Fri, 2 Oct 2009 15:19:47 +0000 (11:19 -0400)]
configure: Add explict --with-python option.

--with-python currently already works for enabling/disabling the python
bindings, but doesn't show up in the help output.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
15 years ago526769 change logrotate config default to weekly
Daniel Veillard [Mon, 5 Oct 2009 15:03:14 +0000 (17:03 +0200)]
526769 change logrotate config default to weekly

* daemon/libvirtd.logrotate.in: change to weekly rotation of logs,
  keep a month worth of data and also extend to cover LXC and UML
  domain logs

15 years agoFix typo in Makefile.am breaking NEWS file generation
Daniel P. Berrange [Fri, 2 Oct 2009 11:01:10 +0000 (12:01 +0100)]
Fix typo in Makefile.am breaking NEWS file generation

* docs/Makefile.am: Fix syntax error in NEWS rule, '$' should be '$$'
  to escape correctly

15 years agoFix emission of domain events messages
Daniel P. Berrange [Wed, 30 Sep 2009 13:33:05 +0000 (14:33 +0100)]
Fix emission of domain events messages

The code which updated the message length after writing the
payload wrote the updated length word in the wrong place since
the XDR object was given a buffer pointing to the start of the
header payload, rather than message start.

* daemon/remote.c: Fix updating of event message length so that
  we actually send the payload, not just the header

15 years agounbreak `make rpcgen'
Paolo Bonzini [Thu, 1 Oct 2009 18:18:29 +0000 (20:18 +0200)]
unbreak `make rpcgen'

Fix "make rpcgen", broken by the directory reorganization.

* src/Makefile.am (rpcgen): Fix path to rpcgen_fix.pl.

15 years agounbreak migration
Paolo Bonzini [Thu, 1 Oct 2009 18:18:28 +0000 (20:18 +0200)]
unbreak migration

Fix migration, broken in two different ways by the QEMU monitor
abstraction.  Note that the QEMU console emits a "\r\n" as the
line-ending.

* src/qemu/qemu_monitor_text.c (qemuMonitorGetMigrationStatus):
Fix "info migrate" command and its output's parsing.

15 years agoTunnelled migration.
Chris Lalancette [Wed, 30 Sep 2009 10:51:54 +0000 (12:51 +0200)]
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>
15 years agoFix build in separate build directory
Jiri Denemark [Thu, 1 Oct 2009 14:55:09 +0000 (16:55 +0200)]
Fix build in separate build directory

* cfg.mk: use $(srcdir)/ prefix for Makefile.nonreentrant include
* examples/domain-events/events-c/Makefile.am tools/Makefile.am
  examples/hellolibvirt/Makefile.am: extend the include paths to
  use $(top_srcdir)/include too.

15 years agoFix documentation and comment typos
Paolo Bonzini [Thu, 1 Oct 2009 14:42:40 +0000 (16:42 +0200)]
Fix documentation and comment typos

Fix a few mispellings :-) of "successfully" and regenerate
docs/libvirt-*.xml.
* src/libvirt.c: Fix typos.
* src/secret/secret_driver.c: Fix typos.
* docs/libvirt-api.xml: Regenerate.
* docs/libvirt-refs.xml: Regenerate.

15 years agoVarious monitor improvements for migration.
Chris Lalancette [Wed, 30 Sep 2009 12:51:32 +0000 (14:51 +0200)]
Various monitor improvements for migration.

The upcoming tunnelled migration needs to be able to set
a migration in progress in the background, as well as
be able to cancel a migration when a problem has happened.
This patch allows for both of these to properly work.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoFix USB device re-labelling
Mark McLoughlin [Wed, 30 Sep 2009 17:37:03 +0000 (18:37 +0100)]
Fix USB device re-labelling

A simple misplaced break out of a switch results in:

  libvir: error : Failed to open file '/sys/bus/pci/devices/0000:00:54c./vendor': No such file or directory
  libvir: error : Failed to open file '/sys/bus/pci/devices/0000:00:54c./device': No such file or directory
  libvir: error : this function is not supported by the hypervisor: Failed to read product/vendor ID for 0000:00:54c.

when trying to passthrough a USB host device to qemu.

* src/security_selinux.c: fix a switch/break thinko

15 years agoAvoid a libvirtd crash on broken input 523418
Daniel Veillard [Thu, 1 Oct 2009 09:54:38 +0000 (11:54 +0200)]
Avoid a libvirtd crash on broken input 523418

* src/conf/domain_conf.c: a simple typo in an XML domain file could lead
  to a crash, because we called STRPREFIX() on the looked up value without
  checking it was non-null.

15 years agoIncorrect error message in virDomainNetDefParseXML
Florian Vichot [Wed, 30 Sep 2009 16:51:30 +0000 (18:51 +0200)]
Incorrect error message in virDomainNetDefParseXML

* src/conf/domain_conf.c: when declaring a <interface type="bridge">
  tag, <source> needs a "bridge" attribute, but the parser complains
  about a missing "dev" attribute.

15 years agoFix a few 'make rpm' breakages
Daniel Veillard [Wed, 30 Sep 2009 12:34:15 +0000 (14:34 +0200)]
Fix a few 'make rpm' breakages

* Makefile.am: examples/domain-events/events-python should be added
  to dist tarball
* libvirt.spec.in: there is no makefile in domain-events but in
  domain-events/events-c and python/libvirtclass.txt has vanished

15 years ago523639 Allows a <description> tag for domains
Daniel Veillard [Wed, 30 Sep 2009 14:07:24 +0000 (16:07 +0200)]
523639 Allows a <description> tag for domains

* docs/schemas/domain.rng: allow one <description> tag in the top level
  of the <domain> to store user information as text
* src/conf/domain_conf.c src/conf/domain_conf.h: extend the structure
  to store this text, grab it at parse time and save it back when
  present after <uuid>

15 years agoAdd src/util/storage_file.c to the POTFILES.in.
Chris Lalancette [Wed, 30 Sep 2009 12:12:03 +0000 (14:12 +0200)]
Add src/util/storage_file.c to the POTFILES.in.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoAdd a qemu feature flag for unix socket migration.
Chris Lalancette [Wed, 30 Sep 2009 10:52:34 +0000 (12:52 +0200)]
Add a qemu feature flag for unix socket migration.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoPass remote_message_header to the dispatch functions.
Chris Lalancette [Wed, 30 Sep 2009 10:29:20 +0000 (12:29 +0200)]
Pass remote_message_header to the dispatch functions.

This is necessary for the dispatch functions to be able to use
streams in the future.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoLet remoteClientStream only do RX if requested.
Chris Lalancette [Wed, 30 Sep 2009 10:47:43 +0000 (12:47 +0200)]
Let remoteClientStream only do RX if requested.

Right now, the stream stuff assumes that a stream is always
going to be used for transmit.  This is not the case, and in
fact doesn't work with the tunnelled migration stuff.  Add
a flag to remoteClientStream() to allow it to do RX only.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoFix up a few typos in the tree.
Chris Lalancette [Tue, 22 Sep 2009 09:42:06 +0000 (11:42 +0200)]
Fix up a few typos in the tree.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoFix up some warnings from stream DEBUG statements.
Chris Lalancette [Wed, 30 Sep 2009 11:05:21 +0000 (13:05 +0200)]
Fix up some warnings from stream DEBUG statements.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoFix apibuild.py warnings
Matthias Bolte [Wed, 30 Sep 2009 11:41:28 +0000 (13:41 +0200)]
Fix apibuild.py warnings

Function comments for virStreamEvent{Add,Update,Remove}Callback() are
missing a trailing ':'. Therefore apibuild.py fails to parse the comment
and warns about the missing ':'.

* docs/libvirt-api.xml, docs/libvirt-refs.xml: updated by apibuild.py
* src/libvirt.c: add missing ':' in function comments

15 years agoChange signature of remoteSendStreamData() to fix compile warning
Matthias Bolte [Wed, 30 Sep 2009 10:37:10 +0000 (12:37 +0200)]
Change signature of remoteSendStreamData() to fix compile warning

The actual type of size_t is architecture dependent. Because the len
parameter is used as unsigned int in remoteSendStreamData(), change its
type to unsigned int.

* daemon/dispatch.[ch]: change size_t to unsigned int for
  remoteSendStreamData()

15 years agoRe-label image file backing stores
Mark McLoughlin [Fri, 25 Sep 2009 13:20:13 +0000 (14:20 +0100)]
Re-label image file backing stores

Use virStorageFileGetMetadata() to find any backing stores for images
and re-label them

Without this, qemu cannot access qcow2 backing files, see:

  https://bugzilla.redhat.com/497131

* src/security/security_selinux.c: re-label backing store files in
  SELinuxSetSecurityImageLabel()

15 years agoAdd virStorageFileGetMetadata() helper
Mark McLoughlin [Tue, 29 Sep 2009 08:41:23 +0000 (09:41 +0100)]
Add virStorageFileGetMetadata() helper

* src/util/storage_file.c: add virStorageFileGetMetadata() so that
  the caller does not need to open the file

15 years agoMove virStorageGetMetadataFromFD() to libvirt_util
Mark McLoughlin [Tue, 29 Sep 2009 08:34:48 +0000 (09:34 +0100)]
Move virStorageGetMetadataFromFD() to libvirt_util

Finally, we get to the point of all this.

Move virStorageGetMetadataFromFD() to virStorageFileGetMetadataFromFD()
and move to src/util/storage_file.[ch]

There's no functional changes in this patch, just code movement

* src/storage/storage_backend_fs.c: move code from here ...

* src/util/storage_file.[ch]: ... to here

* src/libvirt_private.syms: export virStorageFileGetMetadataFromFD()

15 years agoIntroduce virStorageFileMetadata structure
Mark McLoughlin [Tue, 29 Sep 2009 08:23:04 +0000 (09:23 +0100)]
Introduce virStorageFileMetadata structure

Introduce a metadata structure and make virStorageGetMetadataFromFD()
fill it in.

* src/util/storage_file.h: add virStorageFileMetadata

* src/backend/storage_backend_fs.c: virStorageGetMetadataFromFD() now
  fills in the virStorageFileMetadata structure

15 years agoSplit virStorageGetMetadataFromFD() from virStorageBackendProbeTarget()
Mark McLoughlin [Tue, 29 Sep 2009 08:07:14 +0000 (09:07 +0100)]
Split virStorageGetMetadataFromFD() from virStorageBackendProbeTarget()

Prepare the code probing a file's format and associated metadata for
moving into libvirt_util.

* src/storage/storage_backend_fs.c: re-factor the format and metadata
  probing code in preparation for moving it

15 years agoMove file format enum to libvirt_util
Mark McLoughlin [Fri, 25 Sep 2009 13:20:13 +0000 (14:20 +0100)]
Move file format enum to libvirt_util

Rename virStorageVolFormatFileSystem to virStorageFileFormat and
move to src/util/storage_file.[ch]

* src/Makefile.am: add src/util/storage_file.[ch]

* src/conf/storage_conf.[ch]: move enum from here ...

* src/util/storage_file.[ch]: .. to here

* src/libvirt_private.syms: update To/FromString exports

* src/storage/storage_backend.c, src/storage/storage_backend_fs.c,
  src/vbox/vbox_tmpl.c: update for above changes

15 years agoFix memory leaks in libvirtd's message processing
Matthias Bolte [Wed, 30 Sep 2009 00:17:27 +0000 (02:17 +0200)]
Fix memory leaks in libvirtd's message processing

Commit 47cab734995fa9521b1df05d37e9978eedd8d3a2 changed the way how
qemud_client_message objects were reused. Before this commit
remoteDispatchClientRequest() reused the received message for normal responses
and to report non-fatal errors. If a fatal error occurred qemudWorker() frees
the message. After this commit non-fatal errors are reported by
remoteSerializeReplyError() using a new qemud_client_message object and the
original message leaks.

To fix this leak the original message has to be freed if
remoteSerializeReplyError() succeeds. If remoteSerializeReplyError()
fails the original message is freed in qemudWorker().

* daemon/dispatch.c: free qemud_client_message objects that will not be reused
  and would leak otherwise, also free the allocated qemud_client_message object
  in remoteSerializeError() if an error occurs

15 years agoFix QEMU test suite with new VNC env variable
Daniel P. Berrange [Tue, 29 Sep 2009 16:15:52 +0000 (17:15 +0100)]
Fix QEMU test suite with new VNC env variable

* qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.args,
  qemuxml2argvdata/qemuxml2argv-graphics-vnc-tls.args,
  qemuxml2argvdata/qemuxml2argv-graphics-vnc.args,
  qemuxml2argvdata/qemuxml2argv-input-xen.args: Add in
  QEMU_AUDIO_DRV=none env variable

15 years agoVBox vboxDomainDestroy forgot to wait for completion
Pritesh Kothari [Tue, 29 Sep 2009 15:41:04 +0000 (17:41 +0200)]
VBox vboxDomainDestroy forgot to wait for completion

* src/vbox/vbox_tmpl.c: the vboxDomainDestroy forgot to wait for
  completion of the PowerDown command

15 years agoRemove hand-crafted UUID parsers
Daniel P. Berrange [Thu, 24 Sep 2009 13:24:57 +0000 (14:24 +0100)]
Remove hand-crafted UUID parsers

* src/libvirt.c: Remove hand-crafted UUID parsers in favour of
  calling virParseUUID

15 years agoAllow control over QEMU audio backend
Daniel P. Berrange [Mon, 14 Sep 2009 10:23:20 +0000 (11:23 +0100)]
Allow control over QEMU audio backend

When using VNC for graphics + keyboard + mouse, we shouldn't
then use the host OS for audio. Audio should go back over
VNC.

When using SDL for graphics, we should use the host OS for
audio since that's where the display is. We need to allow
certain QEMU env variables to be passed through to guest
too to allow choice of QEMU audio backend.

* qemud/libvirtd.sysconf: Mention QEMU/SDL audio env vars
* src/qemu_conf.c: Passthrough QEMU/SDL audio env for SDL display,
  disable host audio for VNC display

15 years agoHandle data streams in remote client
Daniel P. Berrange [Fri, 7 Aug 2009 14:13:46 +0000 (15:13 +0100)]
Handle data streams in remote client

* src/remote_internal.c: Add helper APIs for processing data streams

15 years agoHandle outgoing data streams in libvirtd
Daniel P. Berrange [Mon, 24 Aug 2009 19:57:16 +0000 (20:57 +0100)]
Handle outgoing data streams in libvirtd

* daemon/dispatch.c: Set streamTX flag on outgoing data packets
* daemon/qemud.h: Add streamTX flag to track outgoing data
* daemon/qemud.c: Re-enable further TX when outgoing data packet
  has been fully sent.
* daemon/stream.h, daemon/stream.c: Add method for enabling TX.
  Support reading from streams and transmitting data out to client

15 years agoHandle incoming data streams in libvirtd
Daniel P. Berrange [Mon, 24 Aug 2009 19:53:48 +0000 (20:53 +0100)]
Handle incoming data streams in libvirtd

* daemon/stream.c: Handle incoming stream data packets, queuing until
  stream becomes writable. Handle stream completion handshake
* po/POTFILES.in: Add daemon/stream.c

15 years agoHelper functions for processing data streams in libvirtd
Daniel P. Berrange [Fri, 10 Jul 2009 12:06:36 +0000 (13:06 +0100)]
Helper functions for processing data streams in libvirtd

Defines the extensions to the remote protocol for generic
data streams. Adds a bunch of helper code to the libvirtd
daemon for working with data streams.

* daemon/Makefile.am: Add stream.c/stream.h to build
* daemon/stream.c, qemud/stream.h: Generic helper functions for
  creating new streams, associating streams with clients, finding
  existing streams for a client and removing/deleting streams.
* src/remote/remote_protocol.x: Add a new 'REMOTE_STREAM' constant
  for the 'enum remote_message_type' for encoding stream data
  in wire messages. Add a new 'REMOTE_CONTINUE' constant to
  'enum remote_message_status' to indicate further data stream
  messsages are expected to follow.  Document how the
  remote_message_header is used to encode data streams
* src/remote/remote_protocol.h: Regenerate
* daemon/dispatch.c: Remove assumption that a error message
  sent to client is always type=REMOTE_REPLY. It may now
  also be type=REMOTE_STREAM. Add convenient method for
  sending outgoing stream data packets. Log and ignore
  non-filtered incoming stream packets. Add a method for
  serializing a stream error message
* daemon/dispatch.h:  Add API for serializing stream errors
  and sending stream data packets
* daemon/qemud.h: Add struct qemud_client_stream for tracking
  active data streams for clients. Tweak filter function
  operation so that it accepts a client object too.
* daemon/qemud.c: Refactor code for free'ing message objects
  which have been fully transmitted into separate method.
  Release all active streams when client shuts down. Change
  filter function to be responsible for queueing the message

15 years agoAdd public API definition for data stream handling
Daniel P. Berrange [Fri, 10 Jul 2009 11:18:12 +0000 (12:18 +0100)]
Add public API definition for data stream handling

* include/libvirt/libvirt.h.in: Public API contract for
  virStreamPtr object
* src/libvirt_public.syms: Export data stream APIs
* src/libvirt_private.syms: Export internal helper APIs
* src/libvirt.c: Data stream API driver dispatch
* src/datatypes.h, src/datatypes.c: Internal helpers for virStreamPtr
  object
* src/driver.h: Define internal driver API for streams
* .x-sc_avoid_write: Ignore src/libvirt.c because it trips
  up on comments including write()
* python/Makefile.am: Add libvirt-override-virStream.py
* python/generator.py: Add rules for virStreamPtr class
* python/typewrappers.h, python/typewrappers.c: Wrapper
  for virStreamPtr
* docs/libvirt-api.xml, docs/libvirt-refs.xml: Regenerate
  with new APIs

15 years agoVbox call OpenHardDisk with "" instead of NULL
Pritesh Kothari [Tue, 29 Sep 2009 13:17:51 +0000 (15:17 +0200)]
Vbox call OpenHardDisk with "" instead of NULL

* src/vbox/vbox_tmpl.c: UTF-16 fixed version of Florian Vichot initial
  patch

15 years agoAvoid double free in errors in virsh
Jim Fehlig [Tue, 29 Sep 2009 11:42:42 +0000 (13:42 +0200)]
Avoid double free in errors in virsh

* tools/virsh.c: it was possible to get vshDeinit to call itself back
  via vshError, remove the doexit parameter of vshError to avoid the
  possibility and make sure to exit directly after in those case.

15 years agoFix crash in device hotplug cleanup code
Daniel P. Berrange [Thu, 24 Sep 2009 14:42:25 +0000 (15:42 +0100)]
Fix crash in device hotplug cleanup code

* src/qemu/qemu_driver.c: Fix crash in scenario where XML
  parsing of hotplugged device failed & thus 'dev' is NULL

15 years agoStandardize debugging messages in QEMU monitor code
Daniel P. Berrange [Thu, 24 Sep 2009 14:37:05 +0000 (15:37 +0100)]
Standardize debugging messages in QEMU monitor code

* src/qemu/qemu_monitor_text.c: Always print command and reply
  in qemuMonitorCommandWithHandler. Print all args in each monitor
  command API & remove redundant relpy printing

15 years agoRemove low level monitor APIs from header file
Daniel P. Berrange [Wed, 23 Sep 2009 16:39:07 +0000 (17:39 +0100)]
Remove low level monitor APIs from header file

* src/qemu/qemu_monitor_text.h: Remove qemudMonitorCommand,
  qemudMonitorCommandWithFd, qemudMonitorCommandWithHandler,
  qemudMonitorCommandExtra low level APIs
* src/qemu/qemu_monitor_text.c: Replace s/qemud/qemuMonitor/

15 years agoAdd API for issuing 'host_net_remove' monitor command
Daniel P. Berrange [Wed, 23 Sep 2009 16:32:50 +0000 (17:32 +0100)]
Add API for issuing 'host_net_remove' monitor command

* src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c: Add new
  qemuMonitorRemoveHostNetwork() command for removing host
  networks
* src/qemu/qemu_driver.c: Convert NIC hotplug methods over
  to use qemuMonitorRemoveHostNetwork()

15 years agoAdd API for issuing 'host_net_add' monitor command
Daniel P. Berrange [Wed, 23 Sep 2009 16:25:28 +0000 (17:25 +0100)]
Add API for issuing 'host_net_add' monitor command

* src/qemu/qemu_conf.h, src/qemu/qemu_conf.c: Remove prefix arg
  from qemuBuildHostNetStr which is no longer required
* src/qemu/qemu_driver.c: Refactor to use qemuMonitorAddHostNetwork()
  API for adding host network
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new
  qemuMonitorAddHostNetwork() method for adding host networks

15 years agoAdd API for issuing 'pci_add nic' monitor command
Daniel P. Berrange [Wed, 23 Sep 2009 16:01:39 +0000 (17:01 +0100)]
Add API for issuing 'pci_add nic' monitor command

* src/qemu/qemu_conf.c: Remove separator from qemuBuildNicStr()
  args, and remove hardcoded 'nic' prefix. Leave it upto callers
  instead
* src/qemu/qemu_driver.c: Switch over to using the new
  qemuMonitorAddPCINetwork() method for NIC hotplug
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new
  qemuMonitorAddPCINetwork API for PCI network device hotplug

15 years agoAdd API for issuing 'getfd' and 'closefd' monitor commands
Daniel P. Berrange [Wed, 23 Sep 2009 15:51:10 +0000 (16:51 +0100)]
Add API for issuing 'getfd' and 'closefd' monitor commands

* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new
  qemuMonitorCloseFileHandle and qemuMonitorSendFileHandle
  APIs for processing file handles
* src/qemu/qemu_driver.c: Convert NIC hotplug method over to
  use   qemuMonitorCloseFileHandle and qemuMonitorSendFileHandle

15 years agoAdd API for issuing 'pci_add storage' monitor command
Daniel P. Berrange [Wed, 23 Sep 2009 15:38:44 +0000 (16:38 +0100)]
Add API for issuing 'pci_add storage' monitor command

* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new
  API qemuMonitorAddPCIDisk()
* src/qemu/qemu_driver.c: Convert over to using the new
  qemuMonitorAddPCIDisk() method, and remove now obsolete
  qemudEscape() method

15 years agoAdd API for issuing 'pci_del' monitor command
Daniel P. Berrange [Wed, 23 Sep 2009 15:25:05 +0000 (16:25 +0100)]
Add API for issuing 'pci_del' monitor command

* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new API
  qemuMonitorRemovePCIDevice() for removing PCI device
* src/qemu/qemu_driver.c: Convert all places removing PCI devices
  over to new qemuMonitorRemovePCIDevice() API

15 years agoAdd API for issuing 'pci_add host' monitor command
Daniel P. Berrange [Wed, 23 Sep 2009 15:15:51 +0000 (16:15 +0100)]
Add API for issuing 'pci_add host' monitor command

* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new
  API qemuMonitorAddPCIHostDevice()
* src/qemu/qemu_driver.c: Switch to using qemuMonitorAddPCIHostDevice()
  for PCI host device hotplug

15 years agoAdd APIs for sending 'usb_add' command for host devices
Daniel P. Berrange [Wed, 23 Sep 2009 15:04:55 +0000 (16:04 +0100)]
Add APIs for sending 'usb_add' command for host devices

One API adds an exact device based on bus+dev, the other adds
any device matching vendor+product

* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new
  qemuMonitorAddUSBDeviceExact() and qemuMonitorAddUSBDeviceMatch()
  commands.
* src/qemu/qemu_driver.c: Switch over to using the new
    qemuMonitorAddUSBDeviceExact() and qemuMonitorAddUSBDeviceMatch()

15 years agoAdd API for using 'usb_add' for disk devices
Daniel P. Berrange [Wed, 23 Sep 2009 14:38:43 +0000 (15:38 +0100)]
Add API for using 'usb_add' for disk devices

* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new
  qemuMonitorAddUSBDisk() API
* src/qemu/qemu_driver.c: Switch USB disk hotplug to the new
  src/qemu/qemu_driver.c API.

15 years agoAdd API for issuing 'migrate' command with exec protocol
Daniel P. Berrange [Wed, 23 Sep 2009 14:23:47 +0000 (15:23 +0100)]
Add API for issuing 'migrate' command with exec protocol

* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new
  qemuMonitorMigrateToCommand() API
* src/qemu/qemu_driver.c: Switch over to using the
  qemuMonitorMigrateToCommand() API for core dumps and save
  to file APIs

15 years agoAdd API for issuing a 'migrate' monitor command for TCP
Daniel P. Berrange [Wed, 23 Sep 2009 13:48:49 +0000 (14:48 +0100)]
Add API for issuing a 'migrate' monitor command for TCP

* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new API
  qemuMonitorMigrateToHost() for doing TCP migration
* src/qemu/qemu_driver.c: Convert to use qemuMonitorMigrateToHost().
  Also handle proper URIs (tcp:// as well as tcp:)

15 years agoAdd API for running 'info migration' monitor command
Daniel P. Berrange [Wed, 23 Sep 2009 13:27:12 +0000 (14:27 +0100)]
Add API for running 'info migration' monitor command

* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new
  qemuMonitorGetMigrationStatus() command.
* src/qemu/qemu_driver.c: Use new qemuMonitorGetMigrationStatus()
  command to check completion status.

15 years agoAdd API for issuing the 'migrate_set_speed' monitor command
Daniel P. Berrange [Wed, 23 Sep 2009 12:57:56 +0000 (13:57 +0100)]
Add API for issuing the 'migrate_set_speed' monitor command

* src/qemu/qemu_driver.c: Use new qemuMonitorSetMigrationSpeed()
  API during migration
* src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c: Add new
  qemuMonitorSetMigrationSpeed() API

15 years agoAdd API for issuing 'info blockstats' command
Daniel P. Berrange [Wed, 23 Sep 2009 12:51:05 +0000 (13:51 +0100)]
Add API for issuing 'info blockstats' command

* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add a new
  qemuMonitorGetBlockStatsInfo() command
* src/qemu/qemu_driver.c: Remove directly use of blockstats in
  favour of calling qemuMonitorGetBlockStatsInfo()

15 years agoAdd APIs for issuing 'memsave' and 'pmemsave' monitor commands
Daniel P. Berrange [Wed, 23 Sep 2009 12:33:45 +0000 (13:33 +0100)]
Add APIs for issuing 'memsave' and 'pmemsave' monitor commands

* src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c: Add new APIs
  qemuMonitorSaveVirtualMemory() and qemuMonitorSavePhysicalMemory()
* src/qemu/qemu_driver.c: Use the new qemuMonitorSaveVirtualMemory()
  and qemuMonitorSavePhysicalMemory() APIs

15 years agoAdd APIs for issuing 'eject' and 'change dev' monitor commands
Daniel P. Berrange [Wed, 23 Sep 2009 11:51:59 +0000 (12:51 +0100)]
Add APIs for issuing 'eject' and 'change dev' monitor commands

* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new APis
  qemuMonitorChangeMedia and qemuMonitorEjectMedia. Pull in code
  for qemudEscape
* src/qemu/qemu_driver.c: Remove code that directly issues 'eject'
  and 'change' commands in favour of API calls.

15 years agoAdd API for issuing 'balloon' monitor command
Daniel P. Berrange [Wed, 23 Sep 2009 11:35:10 +0000 (12:35 +0100)]
Add API for issuing 'balloon' monitor command

* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add new
  qemuMonitorSetBalloon() based on existing code in
  qemudDomainSetMemoryBalloon
* src/qemu/qemu_driver.c: Remove use of qemudDomainSetMemoryBalloon()
  in favour of qemuMonitorSetBalloon(). Fix error code when balloon
  is not supported

15 years agoAdd API for running 'info balloon' monitor command
Daniel P. Berrange [Wed, 23 Sep 2009 11:29:39 +0000 (12:29 +0100)]
Add API for running 'info balloon' monitor command

* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Pull old
  qemudDomainGetMemoryBalloon() code into a new method called
  qemuMonitorGetBalloonInfo()
* src/qemu/qemu_driver.c: Update to call qemuMonitorGetBalloonInfo()
  and remove qemudDomainGetMemoryBalloon().

15 years agoAdd API for the 'system_powerdown' monitor command
Daniel P. Berrange [Wed, 23 Sep 2009 11:21:00 +0000 (12:21 +0100)]
Add API for the 'system_powerdown' monitor command

* src/qemu/qemu_driver.c: Remove use of 'system_powerdown'
* src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c: Add a new
  qemuMonitorSystemPowerdown() api call

15 years agoAdd API for 'stop' monitor command
Daniel P. Berrange [Wed, 23 Sep 2009 11:14:53 +0000 (12:14 +0100)]
Add API for 'stop' monitor command

* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add a new
  qemuMonitorStopCPUs() API
* src/qemu/qemu_driver.c: Replace direct monitor commands for 'stop'
  with qemuMonitorStopCPUs()

15 years agoRename qemudMonitorSendCont to qemuMonitorStartCPUs
Daniel P. Berrange [Wed, 23 Sep 2009 11:10:58 +0000 (12:10 +0100)]
Rename qemudMonitorSendCont to qemuMonitorStartCPUs

* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Rename
  Rename qemudMonitorSendCont to qemuMonitorStartCPUs
* src/qemu/qemu_driver.c: Update callers for new name

15 years agoAdd API for 'change vnc password' monitor command
Daniel P. Berrange [Wed, 23 Sep 2009 11:06:57 +0000 (12:06 +0100)]
Add API for 'change vnc password' monitor command

* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add a
  new qemuMonitorSetVNCPassword() API
* src/qemu/qemu_driver.c: Refactor qemudInitPasswords to
  call qemuMonitorSetVNCPassword()

15 years agoAdd API for 'info cpus' monitor command
Daniel P. Berrange [Wed, 23 Sep 2009 10:49:14 +0000 (11:49 +0100)]
Add API for 'info cpus' monitor command

* src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c: Add a new
  qemuMonitorGetCPUInfo() command
* src/qemu/qemu_driver.c: Refactor qemudDetectVcpuPIDs to
  use qemuMonitorGetCPUInfo()

15 years agoPull QEMU monitor interaction out to separate file
Daniel P. Berrange [Tue, 22 Sep 2009 17:48:40 +0000 (18:48 +0100)]
Pull QEMU monitor interaction out to separate file

Pull out all the QEMU monitor interaction code to a separate
file. This will make life easier when we need to drop in a
new implementation for the forthcoming QMP machine friendly
monitor support.

Next step is to add formal APIs for each monitor command,
and remove direct commands for sending/receiving generic
data.

* src/Makefile.am: Add qemu_monitor.c to build
* src/qemu/qemu_driver.c: Remove code for monitor interaction
* src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h: New
  file for monitor interaction
* po/POTFILES.in: Add src/qemu/qemu_monitor_text.c

15 years agoMaintain value of ctxt->node in virInterfaceDefParseDhcp
Laine Stump [Tue, 29 Sep 2009 09:16:04 +0000 (11:16 +0200)]
Maintain value of ctxt->node in virInterfaceDefParseDhcp

* src/conf/interface_conf.c: This was causing subsequent calls to
  virXPathxxx() to fail, since ctxt->node was left pointing at the
  dhcp node, rather than the protocol node.

15 years agoFix some XPath relative node resets
Daniel Veillard [Tue, 29 Sep 2009 09:07:01 +0000 (11:07 +0200)]
Fix some XPath relative node resets

* src/util/xml.c: The virXPath... function take extra care to preserve
  the XPath context node (ctxt->node) but in the case of virXPathString
  and virXPathBoolean they forgot to do this on the error path. This
  patch fixes this and move all ctxt->node = relnode instuctions just
  after the xmlXPathEval() to make sure this doesn't happen if this code
  is modified.

15 years agoutil.h needs libvirt.h for virConnectPtr
Mark McLoughlin [Fri, 25 Sep 2009 13:20:12 +0000 (14:20 +0100)]
util.h needs libvirt.h for virConnectPtr

Seems standard to include internal.h in order to pull in libvirt.h

* src/util/util.h: include internal.h

15 years agoDon't require full daemon install for libvirt python bindings
Daniel P. Berrange [Mon, 28 Sep 2009 13:14:43 +0000 (14:14 +0100)]
Don't require full daemon install for libvirt python bindings

* libvirt.spec.in: libvirt-python only needs to depend on
  libvirt-clients

15 years agoFix API doc extractor to stop munging comment formatting
Daniel P. Berrange [Fri, 25 Sep 2009 12:24:40 +0000 (13:24 +0100)]
Fix API doc extractor to stop munging comment formatting

The python method help docs are copied across from the C
funtion comments, but in the process all line breaks and
indentation was being lost. This made the resulting text
and code examples completely unreadable. Both the API
doc extractor and the python generator were destroying
whitespace & this fixes them to preserve it exactly.

* docs/apibuild.py: Preserve all whitespace when extracting
  function comments. Print function comment inside a <![CDATA[
  section to fully preserve all whitespace. Look for the
  word 'returns' to describe return values, instead of 'return'
  to avoid getting confused with code examples including the
  C 'return' statement.
* python/generator.py: Preserve all whitespace when printing
  function help docs
* src/libvirt.c: Change any return parameter indicated by
  'return' to be 'returns', to avoid confusing the API extractor
* docs/libvirt-api.xml: Re-build for fixed descriptions

15 years agoFix cdub's surname spelling
Mark McLoughlin [Thu, 24 Sep 2009 13:50:51 +0000 (14:50 +0100)]
Fix cdub's surname spelling

15 years agoAdded Matthias Bolte as commiter
Daniel Veillard [Thu, 24 Sep 2009 13:32:16 +0000 (15:32 +0200)]
Added Matthias Bolte as commiter

15 years agoFix secret_driver compile warning, bug.
Charles Duffy [Thu, 24 Sep 2009 10:58:53 +0000 (12:58 +0200)]
Fix secret_driver compile warning, bug.

Set def to NULL in secretLoad(), otherwise we can access a
random pointer on error.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoFix unitialized variable in qemudDomainDetachHostPciDevice()
Charles Duffy [Thu, 24 Sep 2009 08:00:24 +0000 (09:00 +0100)]
Fix unitialized variable in qemudDomainDetachHostPciDevice()

* src/qemu/qemu_driver.c: initialize detach var

15 years agoFix a typo in virNetHasValidPciAddr() too
Mark McLoughlin [Thu, 24 Sep 2009 07:55:55 +0000 (08:55 +0100)]
Fix a typo in virNetHasValidPciAddr() too

* src/conf/domain_conf.h: check domain/bus/slot, not domain/domain/slot

15 years agoFix a typo in virDiskHasValidPciAddr()
Jiri Denemark [Wed, 23 Sep 2009 16:46:23 +0000 (18:46 +0200)]
Fix a typo in virDiskHasValidPciAddr()

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
15 years agoESX: Check if a datastore is accessible first
Matthias Bolte [Wed, 23 Sep 2009 13:08:25 +0000 (15:08 +0200)]
ESX: Check if a datastore is accessible first

An inaccessible datastore has no valid URL property so don't
access its URI property.

* src/esx/esx_vi.c: esxVI_LookupDatastoreByName(): check if datastore is
  accessible before accessing its URL property
* src/esx/esx_vmx.c: update to changed datastore properties

15 years agoESX remove phantom mode
Matthias Bolte [Wed, 23 Sep 2009 13:00:02 +0000 (15:00 +0200)]
ESX remove phantom mode

* src/esx/esx_driver.c: remove phantom mode

15 years agoESX replace esxUtil_EqualSuffix() with virFileHasSuffix()
Matthias Bolte [Wed, 23 Sep 2009 12:56:05 +0000 (14:56 +0200)]
ESX replace esxUtil_EqualSuffix() with virFileHasSuffix()

* src/esx/esx_util.[ch]: remove esxUtil_EqualSuffix()
* src/esx/esx_driver.c, src/esx/esx_vmx.c: replace esxUtil_EqualSuffix()
  with virFileHasSuffix()

15 years agoESX add esxDomainDefineXML()
Matthias Bolte [Wed, 23 Sep 2009 12:52:36 +0000 (14:52 +0200)]
ESX add esxDomainDefineXML()

A given domain XML gets converted to a VMX config, uploaded to the host
and registered as new virtual machine.

* src/esx/esx_driver.c: refactor datastore related path parsing into
  esxUtil_ParseDatastoreRelatedPath()
* src/esx/esx_util.[ch]: add esxUtil_ParseDatastoreRelatedPath()
* src/esx/esx_vi.[ch]: add esxVI_Context_UploadFile(), add datastores to
  the traversal in esxVI_BuildFullTraversalSpecList(), add
  esxVI_LookupDatastoreByName()
* src/esx/esx_vi_methods.[ch]: add esxVI_RegisterVM_Task()
* src/esx/esx_vi_types.c: make some error message more verbose
* src/esx/esx_vmx.[ch]: add esxVMX_AbsolutePathToDatastoreRelatedPath()
  to convert a path into a datastore related path, add esxVMX_ParseFileName()
  to convert from VMX path format to domain XML path format, extend the other
  parsing function to be datastore aware, add esxVMX_FormatFileName() to
  convert from domain XML path format to VMX path format, fix VMX ethernet
  entry formating
* tests/esxutilstest.c: add test for esxUtil_ParseDatastoreRelatedPath()
* tests/vmx2xmldata/*: update domain XML files to use datastore related paths
* tests/xml2vmxdata/*: update domain XML files to use datastore related paths,
  update VMX files to use absolute paths

15 years agoESX add esxVI_Occurence enum to for occurences
Matthias Bolte [Wed, 23 Sep 2009 12:40:41 +0000 (14:40 +0200)]
ESX add esxVI_Occurence enum to for occurences

Add esxVI_Occurence enum to describe expected occurence of items
* src/esx/esx_driver.c: update the use of esxVI_LookupVirtualMachineByUuid()
* src/esx/esx_vi.c: add an esxVI_Occurence parameter to
  esxVI_LookupVirtualMachineByUuid() and take care if esxVI_FindByUuid()
  can't find anything for a given uuid
* src/esx/esx_vi.h: add esxVI_Occurence enum
* src/esx/esx_vi_methods.c: expect null or more items to be returned
  from esxVI_FindByUuid()

15 years agoESX Whitespace cleanup
Matthias Bolte [Wed, 23 Sep 2009 12:37:26 +0000 (14:37 +0200)]
ESX Whitespace cleanup

15 years agoESX add x86_64 detection based on the CPUID
Matthias Bolte [Wed, 23 Sep 2009 12:29:39 +0000 (14:29 +0200)]
ESX add x86_64 detection based on the CPUID

* src/esx/esx_driver.c: add esxSupportsLongMode() and update esxCapsInit()
* src/esx/esx_vi.[ch]: Add AnyType handling for lists
* src/esx/esx_vi_types.c: bind VI type HostCpuIdInfo

15 years agoESX add tests for the VMX to/from domain XML mapping
Matthias Bolte [Wed, 23 Sep 2009 12:25:52 +0000 (14:25 +0200)]
ESX add tests for the VMX to/from domain XML mapping

* tests/.gitignore: ignore new test binaries
* tests/Makefile.am: add new tests
* tests/esxutilstest.c: test esxVMX_IndexToDiskName()
* tests/vmx2xmldata/*: config files for the VMX to domain XML test
* tests/vmx2xmltest.c: test the VMX to domain XML mapping
* tests/xml2vmxdata/*: config files for the domain XML to VMX test
* tests/xml2vmxtest.c: test the domain XML to VMX mapping

15 years agoESX Add esxDomainXMLToNative()
Matthias Bolte [Wed, 23 Sep 2009 12:16:41 +0000 (14:16 +0200)]
ESX Add esxDomainXMLToNative()

Extend and cleanup the VMX to domain XML mapping. Add the domain XML to
VMX mapping functions.

* src/esx/esx_driver.c: add esxDomainXMLToNative()
* src/esx/esx_vmx.[ch]: add esxVMX_SCSIDiskNameToControllerAndID(),
  esxVMX_IDEDiskNameToControllerAndID(), esxVMX_FloppyDiskNameToController(),
  esxVMX_GatherSCSIControllers(), add basic handling for the VMX guestOS entry
  to distinguish between i686 and x86_64, make SCSI virtualDev VMX entry
  optional as it should be, map the VMX networkName entry to the domain XML
  interface bridge name, add basic mapping for serial devices in pipe mode,
  add several esxVMX_Format*() functions

15 years agoESX Set challenge for auth callback to hostname
Matthias Bolte [Wed, 23 Sep 2009 12:11:54 +0000 (14:11 +0200)]
ESX Set challenge for auth callback to hostname

This enables the auth callback to automatically distinguish between
requests for ESX host and vCenter credentials.

* src/esx/esx_util.[ch]: set challenge for auth callback to hostname

15 years agoESX Add esxNodeGetFreeMemory()
Matthias Bolte [Wed, 23 Sep 2009 12:09:44 +0000 (14:09 +0200)]
ESX Add esxNodeGetFreeMemory()

* src/esx/esx_driver.c: add esxNodeGetFreeMemory(), cache IP address
* src/esx/esx_vi.[ch]: refactor resource pool query into esxVI_GetResourcePool()
* src/esx/esx_vi_types.[ch]: bind VI type ResourcePoolResourceUsage

15 years agoFix up "make syntax-check" after the tree restructuring.
Chris Lalancette [Wed, 23 Sep 2009 12:58:13 +0000 (14:58 +0200)]
Fix up "make syntax-check" after the tree restructuring.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agonetwork: add 'bootp' and 'tftp' config
Paolo Bonzini [Mon, 21 Sep 2009 20:50:25 +0000 (22:50 +0200)]
network: add 'bootp' and 'tftp' config

Currently, libvirtd will start a dnsmasq process for the virtual
network, but (aside from killing the dnsmasq process and replacing it),
there's no way to define tftp boot options.

This change introduces the appropriate tags to the dhcp configuration:

 <network>
   <name>default</name>
   <bridge name="virbr%d" />
   <forward/>
   <ip address="192.168.122.1" netmask="255.255.255.0">
     <tftp root="/var/lib/tftproot" />
     <dhcp>
       <range start="192.168.122.2" end="192.168.122.254" />
       <bootp file="pxeboot.img"/>
     </dhcp>
   </ip>
 </network>

When the attributes are present, these are passed to the
arguments to dnsmasq:

 dnsmasq [...] --enable-tftp --tftp-root /srv/tftp --dhcp-boot pxeboot.img
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^
                      from <tftp />                     from <bootp />

At present, only local tftp servers are supported (ie, dnsmasq runs as
the tftp server), but we could improve this in future by adding a
server= attribute.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2009-09-21  Paolo Bonzini  <pbonzini@redhat.com>
            Jeremy Kerr  <jk@ozlabs.org>

* docs/formatnetwork.html.in: Document new tags.
* docs/formatnetwork.html: Regenerate.
* docs/schemas/network.rng: Update.
* src/network_conf.c (virNetworkDefFree): Free new fields.
(virNetworkDHCPRangeDefParseXML): Parse <bootp>.
(virNetworkIPParseXML): New, parsing <dhcp> and <tftp>.
(virNetworkDefParseXML): Use virNetworkIPParseXML instead of
virNetworkDHCPRangeDefParseXML.
(virNetworkDefFormat): Pretty print new fields.
* src/network_conf.h (struct _virNetworkDef): Add netboot fields.
* src/network_driver.c (networkBuildDnsmasqArgv): Add
TFTP and BOOTP arguments.

* tests/Makefile.am (EXTRA_DIST): Add networkschemadata.
* tests/networkschematest: Look in networkschemadata.
* tests/networkschemadata/netboot-network.xml: New.

15 years agoIntroduce virStrncpy.
Chris Lalancette [Mon, 3 Aug 2009 12:37:44 +0000 (14:37 +0200)]
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>
15 years agoFix handling of Xen(ner) detection
Daniel P. Berrange [Tue, 25 Aug 2009 13:17:29 +0000 (14:17 +0100)]
Fix handling of Xen(ner) detection

Latest upstream QEMU can be built with Xen support, which introduces
a -xen-domid argument. This was  mistakenly detected as -domid due
to old Xenner support. Adapt to cope with both syntax. Also only
set domid if the virt type is xen, or the guest type is xen

* src/qemu_conf.c, src/qemu_conf.h: Detect new -xen-domid flag in
  preference to -domid.
* tests/qemuxml2argvdata/qemuxml2argv-bootloader.args,
  tests/qemuxml2argvdata/qemuxml2argv-input-xen.args: Add missing
  -domid param
* tests/qemuxml2argvdata/qemuxml2argv-misc-uuid.args: Remove bogus
  -boot param.
* tests/qemuxml2argvtest.c: Add missing QEMUD_CMD_FLAG_DOMID params

15 years agoIgnore auto-generated header file
Daniel P. Berrange [Tue, 22 Sep 2009 15:12:51 +0000 (16:12 +0100)]
Ignore auto-generated header file

* include/libvirt/.gitignore: Ignore libvirt.h

15 years agoFix xen driver refcounting.
Matthias Bolte [Tue, 22 Sep 2009 13:12:48 +0000 (15:12 +0200)]
Fix xen driver refcounting.

The commit cb51aa48a777ddae6997faa9f28350cb62655ffd "Fix up connection
reference counting." changed the driver closing and virConnectPtr
unref-logic in virConnectClose().

Before this commit virConnectClose() closed all drivers of the given
virConnectPtr and virUnrefConnect()'ed it afterwards. After this
commit the driver-closing is done in virUnrefConnect() if and only if
the ref-count of the virConnectPtr dropped to zero.

This change in execution order leads to a virConnectPtr leak, at least
for connections to Xen.

The relevant call sequences:

virConnectOpen() -> xenUnifiedOpen() ...

... xenInotifyOpen() -> virConnectRef(conn)

... xenStoreOpen() -> xenStoreAddWatch() -> conn->refs++

virConnectClose() -> xenUnifiedClose() ...

... xenInotifyClose() -> virUnrefConnect(conn)

... xenStoreClose() -> xenStoreRemoveWatch() -> virUnrefConnect(conn)

Before the commit this additional virConnectRef/virUnrefConnect calls
where no problem, because virConnectClose() closed the drivers
explicitly and the additional refs added by the Xen subdrivers were
removed properly. After the commit this additional refs result in a
virConnectPtr leak (including a leak of the hypercall file handle;
that's how I noticed this problem), because now the drivers are only
close if and only if the ref-count drops to zero, but this cannot
happen anymore, because the additional refs from the Xen subdrivers
would only be removed if the drivers get closed, but that doesn't
happen because the ref-count cannot drop to zero.

The fix for this problem is simple: remove the
virConnectRef/virUnrefConnect calls from the Xen subdrivers (see
attached patch). Maybe someone could explain why the Xen Inotify and
Xen Store driver do this extra ref-counting, but none of the other Xen
subdrivers. It seems unnecessary to me and can be removed without
problems.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoFix a number of small typos
Dan Kenigsberg [Tue, 22 Sep 2009 10:54:57 +0000 (12:54 +0200)]
Fix a number of small typos

15 years agolxc: suspend/resume support
Ryota Ozaki [Mon, 21 Sep 2009 14:31:22 +0000 (23:31 +0900)]
lxc: suspend/resume support

* src/conf/domain_conf.c: Don't assume all virDomainObjPtr have
  a non-NULL monitor_chr field in virDomainObjFormat.
* src/lxc/lxc_driver.c: Implement suspend/resume driver APis
* src/util/cgroup.c, src/util/cgroup.h: Support the 'freezer'
  cgroup controller
* src/libvirt_private.syms: Export virCgroupSetFreezerState
  and virCgroupGetFreezerState

15 years agoOpenVZ Fix a restriction about domain names
Yuji NISHIDA [Tue, 22 Sep 2009 10:19:09 +0000 (12:19 +0200)]
OpenVZ Fix a restriction about domain names

* src/openvz/openvz_driver.c: try to autogenerate a non-conflicting
  id for the domain and use the name field as the name not as id.