]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
15 years agoFix handling return value of qemuMonitorSetBalloon
Ryota Ozaki [Wed, 7 Oct 2009 13:33:36 +0000 (15:33 +0200)]
Fix handling return value of qemuMonitorSetBalloon

* src/qemu/qemu_driver.c: The positive return value of
  qemuMonitorSetBalloon should be handled as a success

15 years agoLXC implement memory control APIs
Ryota Ozaki [Wed, 7 Oct 2009 13:26:23 +0000 (15:26 +0200)]
LXC implement memory control APIs

The patch implements the missing memory control APIs for lxc, i.e.,
domainGetMaxMemory, domainSetMaxMemory, domainSetMemory, and improves
domainGetInfo to return proper amount of used memory via cgroup.

* src/libvirt_private.syms: Export virCgroupGetMemoryUsage
  and add missing virCgroupSetMemory
* src/lxc/lxc_driver.c: Implement missing memory functions
* src/util/cgroup.c, src/util/cgroup.h: Add the function
  to get used memory

15 years agoAdd a domain argument to SVirt *RestoreImageLabel
Jamie Strandboge [Wed, 7 Oct 2009 10:36:35 +0000 (12:36 +0200)]
Add a domain argument to SVirt *RestoreImageLabel

When James Morris originally submitted his sVirt patches (as seen in
libvirt 0.6.1), he did not require on disk labelling for
virSecurityDomainRestoreImageLabel. A later commit[2] changed this
behavior to assume on disk labelling, which halts implementations for
path-based MAC systems such as AppArmor and TOMOYO where
vm->def->seclabel is required to obtain the label.

* src/security/security_driver.h src/qemu/qemu_driver.c
  src/security/security_selinux.c: adds the 'virDomainObjPtr vm'
  argument back to *RestoreImageLabel

15 years agoFix up "make check"
Chris Lalancette [Wed, 23 Sep 2009 07:32:10 +0000 (09:32 +0200)]
Fix up "make check"

While running make check, I noticed that it was actually using
the virsh binary from my system, in /usr/bin/virsh, and not the
one that was just compiled.  This is actually caused by a bug
in Makefile.am, where we didn't update the PATH to include tools.

While here, I also updated all of the scripts to properly define
the srcdir, abs_top_srcdir, and abs_top_builddir environment
variables.  This is required if you want to be able to run the
tests standalone (i.e. ./test instead of from make check).  I've
tested this on both RHEL-5 and Fedora-10 machines, and make check
works on both, as does running the individual tests by hand.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoCreate /var/log/libvirt/{lxc,uml} dirs
Mark McLoughlin [Tue, 6 Oct 2009 11:33:17 +0000 (12:33 +0100)]
Create /var/log/libvirt/{lxc,uml} dirs

Otherwise logrotate barfs:

  error: error accessing /var/log/libvirt/uml: No such file or directory
  error: libvirtd:1 glob failed for /var/log/libvirt/uml/*.log
  error: found error in /var/log/libvirt/qemu/*.log /var/log/libvirt/uml/*.log /var/log/libvirt/lxc/*.log , skipping

* qemud/Makefile.am: always create /var/log/libvirt/{lxc,uml} when
  installing the logrotate conf; not ideal, but easier than making
  the logrotate conf depend on which drivers are enabled

15 years agoFix rebuilding of devhelp files
Daniel P. Berrange [Fri, 2 Oct 2009 11:29:15 +0000 (12:29 +0100)]
Fix rebuilding of devhelp files

The devhelp/ directory files depend on libvirt-api.xml being
uptodate, but automake always processes SUBDIRS before the
current directory. So devhelp would be built and then the
libvirt-api.xml re-build, invalidating the devhelp data again.

To fix this all the rules for devhelp are moved directly
into the docs/Makefile.am allowing make to see the global
dependancy chain and thus build things in the correct order

* docs/Makefile.am: Add rules for devhelp rebuild
* docs/devhelp/Makefile.am: Remove devhelp rebuild
* configure.in: Remove docs/devhelp/Makefile.am

15 years agoFix ordering of <exports> in API description file
Daniel P. Berrange [Fri, 2 Oct 2009 11:17:18 +0000 (12:17 +0100)]
Fix ordering of <exports> in API description file

* docs/apibuild.py: Make uniq() function sort keys before returning
  them to ensure consitent ordering of <exports> in XML file

15 years agotest: Support loading node device info from file/XML
Cole Robinson [Fri, 2 Oct 2009 14:05:17 +0000 (10:05 -0400)]
test: Support loading node device info from file/XML

Also add some XML examples.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
15 years agonode conf: Make parsing routines consistent with other drivers
Cole Robinson [Fri, 2 Oct 2009 14:03:55 +0000 (10:03 -0400)]
node conf: Make parsing routines consistent with other drivers

Add virNodeDeviceParseFile, and make virNodeDeviceParseNode non-static. These
will be used by the test driver.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
15 years agotest: Implement node device driver.
Cole Robinson [Thu, 1 Oct 2009 18:54:36 +0000 (14:54 -0400)]
test: Implement node device driver.

Add a simple 'computer' device for the default driver. Only implement
the basic calls, no creation or destroy happening.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
15 years agonodedev: Break out virNodeDeviceHasCap to node_conf
Cole Robinson [Thu, 1 Oct 2009 18:53:43 +0000 (14:53 -0400)]
nodedev: Break out virNodeDeviceHasCap to node_conf

Will be used by test driver node device implementation.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
15 years agonodedev: Add locking in nodeNumOfDevices
Cole Robinson [Thu, 1 Oct 2009 18:51:39 +0000 (14:51 -0400)]
nodedev: Add locking in nodeNumOfDevices

Signed-off-by: Cole Robinson <crobinso@redhat.com>
15 years agotest: Throw a proper error in GetBridgeName
Cole Robinson [Wed, 23 Sep 2009 15:54:48 +0000 (11:54 -0400)]
test: Throw a proper error in GetBridgeName

Throw error in GetBridgeName if net has no bridge.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
15 years agopython: Add a newline after custom classes
Cole Robinson [Fri, 2 Oct 2009 17:05:03 +0000 (13:05 -0400)]
python: Add a newline after custom classes

In the generated bindings, custom classes are squashed against the following
class, which hurts readability.

15 years agopython: Fix generated virInterface method names
Cole Robinson [Wed, 23 Sep 2009 16:51:55 +0000 (12:51 -0400)]
python: Fix generated virInterface method names

A mistake in the generator was causing virInterface methods to be generated
with unpredicatable names ('ceUndefine', instead of just 'undefine'). This
fixes the method names to match existing convention.

Does anyone care if we are breaking API compat? My guess is that no one is
using the python interface bindings yet.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
15 years agopython: Use a pure python implementation of 'vir*GetConnect'
Cole Robinson [Wed, 23 Sep 2009 16:38:47 +0000 (12:38 -0400)]
python: Use a pure python implementation of 'vir*GetConnect'

The API docs explictly warn that we shouldn't use the C vir*GetConnect calls
in bindings: doing so can close the internal connection pointer and cause
things to get screwy. Implement these calls in python.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
15 years agopython: Don't generate bindings for vir*Ref
Cole Robinson [Wed, 23 Sep 2009 16:17:03 +0000 (12:17 -0400)]
python: Don't generate bindings for vir*Ref

They are only for use in implementing the bindings, so shouldn't be
exposed to regular API users.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
15 years agopython: Don't generate conflicting conn.createXML functions.
Cole Robinson [Wed, 23 Sep 2009 16:09:09 +0000 (12:09 -0400)]
python: Don't generate conflicting conn.createXML functions.

A special case in the generator wasn't doing its job, and duplicate
conn.createXML functions were being generated. The bindings diff is:

@@ -1079,14 +1079,6 @@ class virConnect:
         return __tmp

     def createXML(self, xmlDesc, flags):
-        """Create a new device on the VM host machine, for example,
-           virtual HBAs created using vport_create. """
-        ret = libvirtmod.virNodeDeviceCreateXML(self._o, xmlDesc, flags)
-        if ret is None:raise libvirtError('virNodeDeviceCreateXML() failed', conn=self)
-        __tmp = virNodeDevice(self, _obj=ret)
-        return __tmp
-
-    def createXML(self, xmlDesc, flags):
         """Launch a new guest domain, based on an XML description
           similar to the one returned by virDomainGetXMLDesc() This
           function may requires privileged access to the hypervisor.
@@ -1327,6 +1319,14 @@ class virConnect:
         __tmp = virNetwork(self, _obj=ret)
         return __tmp

+    def nodeDeviceCreateXML(self, xmlDesc, flags):
+        """Create a new device on the VM host machine, for example,
+           virtual HBAs created using vport_create. """
+        ret = libvirtmod.virNodeDeviceCreateXML(self._o, xmlDesc, flags)
+        if ret is None:raise libvirtError('virNodeDeviceCreateXML() failed', conn=self)
+        __tmp = virNodeDevice(self, _obj=ret)
+        return __tmp
+
     def nodeDeviceLookupByName(self, name):
         """Lookup a node device by its name. """
         ret = libvirtmod.virNodeDeviceLookupByName(self._o, name)

Signed-off-by: Cole Robinson <crobinso@redhat.com>
15 years agopython: Remove use of xmllib in generator.py
Cole Robinson [Fri, 2 Oct 2009 15:20:47 +0000 (11:20 -0400)]
python: Remove use of xmllib in generator.py

xmllib has been deprecated since python 2.0, and running the generator throws
a warning. Move to using xml.sax

Signed-off-by: Cole Robinson <crobinso@redhat.com>
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