]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
14 years agoextend logging to record configuration-related changes
Naoya Horiguchi [Wed, 30 Mar 2011 01:19:47 +0000 (09:19 +0800)]
extend logging to record configuration-related changes

Currently libvirt's default logging is limited and it is difficult to
determine what was happening when a proglem occurred (especially on a
machines where one don't know the detail.)  This patch helps to do that
by making additional logging available for the following events:

  creating/defining/undefining domains
  creating/defining/undefining/starting/stopping networks
  creating/defining/undefining/starting/stopping storage pools
  creating/defining/undefining/starting/stopping storage volumes.

* AUTHORS: add Naoya Horiguchi
* src/network/bridge_driver.c src/qemu/qemu_driver.c
  src/storage/storage_driver.c: provide more VIR_INFO logging

14 years agoAdd libvirt_iohelper to spec file
Daniel Veillard [Wed, 30 Mar 2011 00:54:23 +0000 (08:54 +0800)]
Add libvirt_iohelper to spec file

The new iohelper binary was missing from the packaging spec

14 years agocputune: New tests for cputune XML
Osier Yang [Tue, 29 Mar 2011 13:44:14 +0000 (21:44 +0800)]
cputune: New tests for cputune XML

v1 - v2:
  * Add missed tests/qemuxml2argvdata/qemuxml2argv-cputune.args

14 years agocputune: Support cputune for xend driver
Osier Yang [Tue, 29 Mar 2011 13:43:41 +0000 (21:43 +0800)]
cputune: Support cputune for xend driver

Not sure if it's the correct way to add cputune xml for xend driver,
and besides, seems "xm driver" and "xen hypervisor" also support
vcpu affinity, do we need to add support for them too?

14 years agocputune: Support cputune for lxc driver
Osier Yang [Tue, 29 Mar 2011 13:42:54 +0000 (21:42 +0800)]
cputune: Support cputune for lxc driver

LXC driver doesn't support vcpu affinity yet, so just need
to modify it to support cpu shares.

14 years agocputune: Support cputune for qemu driver
Osier Yang [Tue, 29 Mar 2011 13:41:25 +0000 (21:41 +0800)]
cputune: Support cputune for qemu driver

When domain startup, setting cpu affinity and cpu shares according
to the cputune xml specified in domain xml.

Modify "qemudDomainPinVcpu" to update domain config for vcpupin,
and modify "qemuSetSchedulerParameters" to update domain config
for cpu shares.

v1 - v2:
   * Use "VIR_ALLOC_N" instead of "VIR_ALLOC_VAR"
   * But keep raising error when it fails on adding vcpupin xml
     entry, as I still don't have a better idea yet.

14 years agocputune: Implementations of parsing and formating cputune xml
Osier Yang [Tue, 29 Mar 2011 13:34:18 +0000 (21:34 +0800)]
cputune: Implementations of parsing and formating cputune xml

Implementations of following functions:
  virDomainVcpupinIsDuplicate
  virDomainVcpupinFindByVcpu
  virDomainVcpupinAdd

Update "virDomainDefParseXML" to parse, and "virDomainDefFormatXML"
to build cputune xml, also implementations of new internal helper
functions.

v1 - v2:
  * Resolve potential crash bug of "virDomainVcpupinAdd"

14 years agocputune: Add data structures presenting cputune XML
Osier Yang [Tue, 29 Mar 2011 13:33:36 +0000 (21:33 +0800)]
cputune: Add data structures presenting cputune XML

Also related new functions' declaration, and expose the new introduced
functions in libvirt_private.syms.

v1 - v2:
  Don't expose "virAllocVar" in libvirt_private.syms

14 years agocputune: Add document for cputune XML
Osier Yang [Tue, 29 Mar 2011 13:04:21 +0000 (21:04 +0800)]
cputune: Add document for cputune XML

v1 - v3:
  * More clear document for "cpu shares", adopted suggestions from
    Matthias Bottle and Daniel Veillard.

14 years agocputune: Add XML schema for cputune xml
Osier Yang [Tue, 29 Mar 2011 13:01:57 +0000 (21:01 +0800)]
cputune: Add XML schema for cputune xml

v1 - v2:
  * Remove upper limit of cpu shares. (Suggested by Matthias Bottle)

14 years agoqemu: fix regression with fd labeling on migration
Eric Blake [Mon, 28 Mar 2011 21:50:22 +0000 (15:50 -0600)]
qemu: fix regression with fd labeling on migration

My earlier testing for commit 34fa0de0 was done while starting
just-built libvirt from an unconfined_t shell, where the fds happened
to work when transferring to qemu.  But when installed and run under
virtd_t, failure to label the raw file (with no compression) or the
pipe (with compression) triggers SELinux failures when passing fds
over SCM_RIGHTS to svirt_t qemu.

* src/qemu/qemu_migration.c (qemuMigrationToFile): When passing
FDs, make sure they are labeled.

14 years agoqemu: improve error message on failed fd transfer
Eric Blake [Mon, 28 Mar 2011 21:14:15 +0000 (15:14 -0600)]
qemu: improve error message on failed fd transfer

First fallout of fd: migration - it looks like SELinux enforcing
_does_ require fd labeling (running uninstalled libvirtd from an
unconstrained shell had no problems, but once faked out by doing
 chcon `stat -c %C /usr/sbin/libvirtd` daemon/libvirtd
 run_init $PWD/daemon/libvirtd
to run it with the same context as an init script service, and with
SELinux enforcing, I got a rather confusing failure:
error: Failed to save domain fedora_12 to fed12.img
error: internal error unable to send TAP file handle: No file descriptor supplied via SCM_RIGHTS

This fixes the error message, then I need to figure out a subsequent
patch that does the fsetfilecon() necessary to keep things happy.
It also appears that libvirtd hangs on a failed fd transfer; I don't
know if that needs an independent fix.

* src/qemu/qemu_monitor_text.c (qemuMonitorTextSendFileHandle):
Improve message, since TAP is no longer only client.

14 years agomaint: ignore new built file
Eric Blake [Tue, 29 Mar 2011 13:05:12 +0000 (07:05 -0600)]
maint: ignore new built file

* .gitignore: Exclude libvirt_iohelper.

14 years agoAdd domainSuspend/Resume to libxl driver
Markus Groß [Tue, 29 Mar 2011 12:55:38 +0000 (20:55 +0800)]
Add domainSuspend/Resume to libxl driver

* src/libxl/libxl_driver.c: implements libxlDomainSuspend and
  libxlDomainResume

14 years agoAdd domainGetOSType to libxl driver
Markus Groß [Tue, 29 Mar 2011 12:49:43 +0000 (20:49 +0800)]
Add domainGetOSType to libxl driver

* src/libxl/libxl_driver.c: implements libxlDomainGetOSType

14 years agoAdd domainGetSchedulerType to libxl driver
Markus Groß [Tue, 29 Mar 2011 12:46:55 +0000 (20:46 +0800)]
Add domainGetSchedulerType to libxl driver

* src/libxl/libxl_driver.c: implements libxlDomainGetSchedulerType

14 years agoImplements domainXMLTo/FromNative in libxl driver
Markus Groß [Tue, 29 Mar 2011 12:39:18 +0000 (20:39 +0800)]
Implements domainXMLTo/FromNative in libxl driver

* src/Makefile.am src/libvirt_private.syms configure.ac: share and
  reuse the sexpr routines from sexpr.h of the old xen driver
* src/libxl/libxl_driver.c: implements libxlDomainXMLFromNative and
  libxlDomainXMLToNative

14 years agoAdd vcpu functions to libxl driver
Markus Groß [Tue, 29 Mar 2011 12:31:45 +0000 (20:31 +0800)]
Add vcpu functions to libxl driver

Hook the virtual cpu functions to their libxenlight counterparts

* src/libxl/libxl_driver.c: implements libxlDomainSetVcpus,
  libxlDomainGetVcpus, libxlDomainSetVcpusFlags,
  libxlDomainGetVcpusFlags and libxlDomainPinVcpu

14 years agoList authors in copyright headers
Markus Groß [Tue, 29 Mar 2011 12:24:05 +0000 (20:24 +0800)]
List authors in copyright headers

* src/libxl/libxl_conf.[ch] src/libxl/libxl_driver.[ch]: add authors
  after the licence template

14 years agoAdd event callbacks to libxl driver
Markus Groß [Tue, 29 Mar 2011 12:18:24 +0000 (20:18 +0800)]
Add event callbacks to libxl driver

* src/libxl/libxl_conf.h: add the necessary fields to the driver
  private structure
* src/libxl/libxl_driver.c: add lifecycle event support and entry
  points for event(de)register(any)

14 years agoIgnore return value of virDomainObjUnref
Markus Groß [Tue, 29 Mar 2011 10:59:09 +0000 (18:59 +0800)]
Ignore return value of virDomainObjUnref

* src/libxl/libxl_driver.c: use ignore_value() in libxlDomainObjUnref
  and libxlCreateDomEvents

14 years agoFix infinite loop in daemon if client quits with multiple streams open
Daniel P. Berrange [Fri, 18 Mar 2011 16:24:24 +0000 (16:24 +0000)]
Fix infinite loop in daemon if client quits with multiple streams open

The daemon loops over the linked list of streams when a client
quits, closing any that the client hadn't already closed. Except
it didn't ever move to the next element in the list!

* daemon/stream.c: Fix loop over linked list of streams

14 years agoRemote protocol support for storage vol upload/download APIs
Daniel P. Berrange [Tue, 14 Jul 2009 22:46:15 +0000 (23:46 +0100)]
Remote protocol support for storage vol upload/download APIs

* daemon/remote.c, src/remote/remote_driver.c: Implementation
  of storage vol upload/download APIs
* src/remote/remote_protocol.x: Wire protocol definition for
  upload/download
* daemon/remote_dispatch_args.h, daemon/remote_dispatch_prototypes.h,
  daemon/remote_dispatch_table.h, src/remote/remote_protocol.h,
  src/remote/remote_protocol.c: Re-generate

14 years agoSupport volume data upload/download APIs in storage driver
Daniel P. Berrange [Tue, 14 Jul 2009 15:24:42 +0000 (16:24 +0100)]
Support volume data upload/download APIs in storage driver

Use generic FD streams to allow data upload/download to/from
any storage volume

* src/storage/storage_driver.c: Wire up upload/download APIs

14 years agoAdd vol-upload and vol-download commands to virsh
Daniel P. Berrange [Tue, 14 Jul 2009 13:24:53 +0000 (14:24 +0100)]
Add vol-upload and vol-download commands to virsh

The new commands vol-upload and vol-download, allow a local file
to be transferred to/from a storage volume.

* tools/virsh.c: Add vol-upload and vol-download commands
* tools/virsh.pod: Document new commands

14 years agoAdd public APIs for storage volume upload/download
Daniel P. Berrange [Tue, 14 Jul 2009 13:24:27 +0000 (14:24 +0100)]
Add public APIs for storage volume upload/download

New APIs are added allowing streaming of content to/from
storage volumes.

* include/libvirt/libvirt.h.in: Add virStorageVolUpload and
  virStorageVolDownload APIs
* src/driver.h, src/libvirt.c, src/libvirt_public.syms: Stub
  code for new APIs
* src/storage/storage_driver.c, src/esx/esx_storage_driver.c:
  Add dummy entries in driver table for new APIs

14 years agoEnhance the streams helper to support plain file I/O
Daniel P. Berrange [Tue, 22 Feb 2011 12:05:20 +0000 (12:05 +0000)]
Enhance the streams helper to support plain file I/O

The O_NONBLOCK flag doesn't work as desired on plain files
or block devices. Introduce an I/O helper program that does
the blocking I/O operations, communicating over a pipe that
can support O_NONBLOCK

* src/fdstream.c, src/fdstream.h: Add non-blocking I/O
  on plain files/block devices
* src/Makefile.am, src/util/iohelper.c: I/O helper program
* src/qemu/qemu_driver.c, src/lxc/lxc_driver.c,
  src/uml/uml_driver.c, src/xen/xen_driver.c: Update for
  streams API change

14 years agoUpdate event loop example programs to demonstrate best practice
Daniel P. Berrange [Wed, 23 Mar 2011 14:30:30 +0000 (14:30 +0000)]
Update event loop example programs to demonstrate best practice

The example C event loop code is a nasty hack and not compliant
with the require API semantics. Delete this, so that developers
don't mistakenly copy it. Instead call the new public event loop
APIs.

Update the python event loop example, so that it can optionally
use the public event APIs, as an alternative to the pure python
code. The pure python event code is a good working example, so
don't delete it.

Also make the python example use a read only connection to avoid
authentication prompts

* examples/domain-events/events-c/event-test.c: Replace event
  loop code with use of public APIs
* examples/domain-events/events-python/event-test.py: Allow
  optional use of new public event APIs

14 years agoqemu: fix regression that hangs on save failure
Eric Blake [Mon, 28 Mar 2011 22:59:15 +0000 (16:59 -0600)]
qemu: fix regression that hangs on save failure

Regression introduced in commit 6034ddd55.

* src/qemu/qemu_driver.c (qemudDomainSaveFlag): Jump to correct
label.

14 years agobuild: fix compilation on mingw
Eric Blake [Mon, 28 Mar 2011 20:12:15 +0000 (14:12 -0600)]
build: fix compilation on mingw

* src/util/command.c (virCommandAbort) [WIN32]: Provide stub.
Reported by Daniel P. Berrange's autobuilder.

14 years agoqemu: support fd: migration with compression
Eric Blake [Fri, 25 Mar 2011 17:02:27 +0000 (11:02 -0600)]
qemu: support fd: migration with compression

Spawn the compressor ourselves, instead of requiring the shell.

* src/qemu/qemu_migration.c (qemuMigrationToFile): Spawn
compression helper process when needed.

14 years agoqemu: skip granting access during fd migration
Eric Blake [Thu, 10 Mar 2011 00:49:54 +0000 (17:49 -0700)]
qemu: skip granting access during fd migration

SELinux labeling and cgroup ACLs aren't required if we hand a
pre-opened fd to qemu.  All the more reason to love fd: migration.

* src/qemu/qemu_migration.c (qemuMigrationToFile): Skip steps
that are irrelevant in fd migration.

14 years agoqemu: consolidate migration to file code
Eric Blake [Thu, 10 Mar 2011 00:35:13 +0000 (17:35 -0700)]
qemu: consolidate migration to file code

This points out that core dumps (still) don't work for root-squash
NFS, since the fd is not opened correctly.  This patch should not
introduce any functionality change, it is just a refactoring to
avoid duplicated code.

* src/qemu/qemu_migration.h (qemuMigrationToFile): New prototype.
* src/qemu/qemu_migration.c (qemuMigrationToFile): New function.
* src/qemu/qemu_driver.c (qemudDomainSaveFlag, doCoreDump): Use
it.

14 years agoqemu: use common API for reading difficult files
Eric Blake [Fri, 4 Mar 2011 19:30:35 +0000 (12:30 -0700)]
qemu: use common API for reading difficult files

Direct access to an open file is so much simpler than passing
everything through a pipe!

* src/qemu/qemu_driver.c (qemudOpenAsUID)
(qemudDomainSaveImageClose): Delete.
(qemudDomainSaveImageOpen): Rename...
(qemuDomainSaveImageOpen): ...and drop read_pid argument.  Use
virFileOpenAs instead of qemudOpenAsUID.
(qemudDomainSaveImageStartVM, qemudDomainRestore)
(qemudDomainObjRestore): Rename...
(qemuDomainSaveImageStartVM, qemuDomainRestore)
(qemDomainObjRestore): ...and simplify accordingly.
(qemudDomainObjStart, qemuDriver): Update callers.

14 years agoqemu, storage: improve type safety
Eric Blake [Fri, 4 Mar 2011 00:19:12 +0000 (17:19 -0700)]
qemu, storage: improve type safety

* src/storage/storage_backend.c (createRawFileOpHook): Change
signature.
(struct createRawFileOpHookData): Delete unused struct.
(virStorageBackendCreateRaw): Adjust caller.
* src/qemu/qemu_driver.c (struct fileOpHookData): Delete unused
struct.
(qemudDomainSaveFileOpHook): Rename...
(qemuDomainSaveFileOpHook): ...and change signature.
(qemudDomainSaveFlag): Adjust caller.

14 years agoutil: adjust indentation in previous patch
Eric Blake [Fri, 4 Mar 2011 00:02:22 +0000 (17:02 -0700)]
util: adjust indentation in previous patch

Separating the indentation from the real patch made review easier.

* src/util/util.c (virFileOpenAs): Whitespace changes.

14 years agoutil: rename virFileOperation to virFileOpenAs
Eric Blake [Tue, 22 Mar 2011 19:15:44 +0000 (13:15 -0600)]
util: rename virFileOperation to virFileOpenAs

This patch intentionally doesn't change indentation, in order to
make it easier to review the real changes.

* src/util/util.h (VIR_FILE_OP_RETURN_FD, virFileOperationHook):
Delete.
(virFileOperation): Rename...
(virFileOpenAs): ...and reduce parameters.
* src/util/util.c (virFileOperationNoFork, virFileOperation):
Rename and simplify.
* src/qemu/qemu_driver.c (qemudDomainSaveFlag): Adjust caller.
* src/storage/storage_backend.c (virStorageBackendCreateRaw):
Likewise.
* src/libvirt_private.syms: Reflect rename.

14 years agostorage: simplify fd handling
Eric Blake [Thu, 3 Mar 2011 19:30:35 +0000 (12:30 -0700)]
storage: simplify fd handling

* src/storage/storage_backend.c (virStorageBackendCreateRaw): Use
new virFileOperation flag.

14 years agoqemu: simplify domain save fd handling
Eric Blake [Thu, 3 Mar 2011 19:23:19 +0000 (12:23 -0700)]
qemu: simplify domain save fd handling

This makes root-squash NFS saves more efficient.

* src/qemu/qemu_driver.c (qemudDomainSaveFlag): Use new
virFileOperation flag to open fd only once.

14 years agoutil: use SCM_RIGHTS in virFileOperation when needed
Eric Blake [Thu, 3 Mar 2011 15:50:19 +0000 (08:50 -0700)]
util: use SCM_RIGHTS in virFileOperation when needed

Currently, the hook function in virFileOperation is extremely limited:
it must be async-signal-safe, and cannot modify any memory in the
parent process.  It is much handier to return a valid fd and operate
on it in the parent than to deal with hook restrictions.

* src/util/util.h (VIR_FILE_OP_RETURN_FD): New flag.
* src/util/util.c (virFileOperationNoFork, virFileOperation):
Honor new flag.

14 years agoqemu: allow simple domain save to use fd: protocol
Eric Blake [Wed, 2 Mar 2011 04:59:25 +0000 (21:59 -0700)]
qemu: allow simple domain save to use fd: protocol

This allows direct saves (no compression, no root-squash NFS) to use
the more efficient fd: migration, which in turn avoids a race where
qemu exec: migration can sometimes fail because qemu does a generic
waitpid() that conflicts with the pclose() used by exec:.  Further
patches will solve compression and root-squash NFS.

* src/qemu/qemu_driver.c (qemudDomainSaveFlag): Use new function
when there is no compression.

14 years agoqemu: fix restoring a compressed save image
Eric Blake [Sat, 26 Mar 2011 11:27:57 +0000 (05:27 -0600)]
qemu: fix restoring a compressed save image

Latent bug introduced in commit 2d6a581960 (Aug 2009), but not exposed
until commit 1859939a (Jan 2011).  Basically, when virExec creates a
pipe, it always marks libvirt's side as cloexec.  If libvirt then
wants to hand that pipe to another child process, things work great if
the fd is dup2()'d onto stdin or stdout (as with stdin: or exec:
migration), but if the pipe is instead used as-is (such as with fd:
migration) then qemu sees EBADF because the fd was closed at exec().

This is a minimal fix for the problem at hand; it is slightly racy,
but no more racy than the rest of libvirt fd handling, including the
case of uncompressed save images.  A more invasive fix, but ultimately
safer at avoiding leaking unintended fds, would be to _always and
atomically_ open all fds as cloexec in libvirt (thanks to primitives
like open(O_CLOEXEC), pipe2(), accept4(), ...), then teach virExec to
clear that bit for all fds explicitly marked to be handed to the child
only after forking.

* src/qemu/qemu_command.c (qemuBuildCommandLine): Clear cloexec
flag.
* tests/qemuxml2argvtest.c (testCompareXMLToArgvFiles): Tweak test.

14 years agoutil: allow clearing cloexec bit
Eric Blake [Sat, 26 Mar 2011 11:19:28 +0000 (05:19 -0600)]
util: allow clearing cloexec bit

* src/util/util.h (virSetInherit): New prototype.
* src/util/util.c (virSetCloseExec): Move guts...
(virSetInherit): ...to new function, and allow clearing.
* src/libvirt_private.syms (util.h): Export it.

14 years agologging: always NUL-terminate circular buffer
Eric Blake [Wed, 23 Mar 2011 19:23:59 +0000 (13:23 -0600)]
logging: always NUL-terminate circular buffer

* src/util/logging.c (virLogStartup, virLogSetBufferSize):
Over-allocate, so that a debugger can just print the circular
buffer.  Suggested by Daniel Veillard.

14 years agomaint: use space, not tab, in remote_protocol-structs
Eric Blake [Thu, 10 Mar 2011 22:28:28 +0000 (15:28 -0700)]
maint: use space, not tab, in remote_protocol-structs

* src/Makefile.am (remote_protocol-structs): Flatten tabs.
* src/remote_protocol-structs: Likewise.  Also add a hint to emacs
to make it easier to keep spaces in the file.

14 years agotests: don't alter state in $HOME
Eric Blake [Wed, 23 Mar 2011 20:16:02 +0000 (14:16 -0600)]
tests: don't alter state in $HOME

Diego reported a bug where virsh tries to initialize a readline
history directory during 'make check' run as root, but fails
because /root was read-only.

It turns out that I could reproduce this as non-root, by using:

mv ~/.virsh{,.bak}
chmod a-w ~
make check -C tests TESTS=int-overflow
chmod u+w ~
mv ~/.virsh{.bak,}

* tests/int-overflow: Don't trigger interactive mode.
Reported by Diego Elio Pettenò.

14 years agodocs: document recent hook additions
Eric Blake [Wed, 23 Mar 2011 20:50:29 +0000 (14:50 -0600)]
docs: document recent hook additions

* src/qemu/qemu_process.c (qemuProcessStart, qemuProcessStop): Fix
typos.
* docs/hooks.html.in: Document 'prepare' and 'release' hooks.

14 years agoqemu: don't restore state label twice
Eric Blake [Fri, 25 Mar 2011 16:06:41 +0000 (10:06 -0600)]
qemu: don't restore state label twice

Otherwise, if something like doStopVcpus fails after the first
restore, a second restore is attempted and throws a useless
warning.

* src/qemu/qemu_driver.c (qemudDomainSaveFlag): Avoid second
restore of state label.

14 years agoRemove the Open Nebula driver
Daniel P. Berrange [Tue, 22 Mar 2011 16:12:34 +0000 (16:12 +0000)]
Remove the Open Nebula driver

The Open Nebula driver has been unmaintained since it was first
introduced. The only commits have been for tree-wide cleanups.
It also has a major design flaw, in that it only knows about guests
that it has created itself, which makes it of very limited use.

Discussions wrt evolution of the VMWare ESX driver, concluded that
it should limit itself to single-node ESX operation and not try to
manage the multi-node architecture of VirtualCenter. Open Nebula
is a cluster like Virtual Center, not a single node system, so
the same reasoning applies.

The DeltaCloud project includes an Open Nebula driver and is a much
better fit architecturally, since it is explicitly targetting the
distributed multihost cluster scenario.

Thus this patch deletes the libvirt Open Nebula driver with the
recommendation that people use DeltaCloud for managing it instead.

* configure.ac: Remove probe for xmlrpc & --with-one arg
* daemon/Makefile.am, daemon/libvirtd.c, src/Makefile.am: Remove
  ONE driver build
* src/opennebula/one_client.c, src/opennebula/one_client.h,
  src/opennebula/one_conf.c, src/opennebula/one_conf.h,
  src/opennebula/one_driver.c, src/opennebula/one_driver.c: Delete
  files
* autobuild.sh, libvirt.spec.in, mingw32-libvirt.spec.in: Remove
  build rules for Open Nebula
* docs/drivers.html.in, docs/sitemap.html.in: Remove reference
  to OpenNebula
* docs/drvone.html.in: Delete file

14 years agoFix syntax error in configure.ac
Osier Yang [Mon, 28 Mar 2011 10:05:32 +0000 (18:05 +0800)]
Fix syntax error in configure.ac

Which will lead "./configure --with-audit=yes" breaks.

14 years agoUpdate of localisations, switch to transifex
Daniel Veillard [Mon, 28 Mar 2011 02:44:35 +0000 (10:44 +0800)]
Update of localisations, switch to transifex

Last pull from i18n CVS, then push to transifex.net which is now
our localization upstream:

http://www.transifex.net/projects/p/libvirt/resource/strings/

14 years agoUpdate on the goal page
Daniel Veillard [Mon, 28 Mar 2011 02:40:24 +0000 (10:40 +0800)]
Update on the goal page

Some things to note in this patch:
   - we do extend libvirt scope beyond purely managing domains, there is
     already a number of blocks which are here as helpr functions to
     manage the resources on the host.
   - we are expanding in the direction of libvirt being sufficient to do
     most of the management on the Host (but within the limits of the need
     for virtualization, e.g. managing users on the host is out of scope)
   - we don't require anymore APIs to be supported by multiple
     hypervisors to get in, it's already the case in practice, but we
     should still make sure the semantic of those APIs are clear. We
     added quite a bit for QEmu, but for example I saw on IRC that VBox
     could emulate a network unplug/replug on a domain interface, and
     that would be a good addition even if a priori no other hypervisor
     supports it.
   - Make clear that all libvirt APIs are available remotely, which is
     key to use libvirt for building management tools.
   - link the goal page from the project main page

As for libvirt project directions, I think it just reflects the natural
evolution in the last couple of years. We are less hypervisor agnostic
and extending in the Host management. Clearly there is interest in
making sure libvirt is complete in term of features for the hypervisors
supported, especially the ones like KVM or LXC which don't really have
integrated management library.

* docs/goals.html.in: update the goals page
* docs/index.html.in: link it from the top page

14 years agoremote: Don't leak gnutls session on negotiation error
Matthias Bolte [Sat, 26 Mar 2011 15:43:44 +0000 (16:43 +0100)]
remote: Don't leak gnutls session on negotiation error

14 years agohooks: fix regression in previous patch
Eric Blake [Fri, 25 Mar 2011 21:14:27 +0000 (15:14 -0600)]
hooks: fix regression in previous patch

* src/util/hooks.c (virHookCheck): Missing hooks should just be
debug, not warn.

14 years agoAdd missing { for qemudDomainInterfaceStats
Philipp Hahn [Fri, 25 Mar 2011 15:42:32 +0000 (16:42 +0100)]
Add missing { for qemudDomainInterfaceStats

Add missing open curly brace between function declaration of non-linux
variant of qemudDomainInterfaceStats() and its body.

Signed-off-by: Philipp Hahn <hahn@univention.de>
14 years agobuild: shorten libxenlight summary for consistent alignment
Eric Blake [Fri, 25 Mar 2011 15:04:51 +0000 (09:04 -0600)]
build: shorten libxenlight summary for consistent alignment

* configure.ac: Use xenlight: rather than libxenlight: in summary.
Suggested by Daniel Veillard.

14 years agodaemon: Avoid resetting errors before they are reported
Jiri Denemark [Fri, 25 Mar 2011 11:03:00 +0000 (12:03 +0100)]
daemon: Avoid resetting errors before they are reported

Commit f44bfb7 was supposed to make sure no additional libvirt API (esp.
*Free) is called before remoteDispatchConnError() is called on error.
However, the patch missed two instances.

14 years agocommand: add virCommandAbort for cleanup paths
Eric Blake [Tue, 22 Mar 2011 22:22:37 +0000 (16:22 -0600)]
command: add virCommandAbort for cleanup paths

Sometimes, an asynchronous helper is started (such as a compressor
or iohelper program), but a later error means that we want to
abort that child.  Make this easier.

Note that since daemons and virCommandRunAsync can't mix, the only
time virCommandFree can reap a process is if someone did
virCommandRunAsync for a non-daemon and didn't stash the pid.

* src/util/command.h (virCommandAbort): New prototype.
* src/util/command.c (_virCommand): Add new field.
(virCommandRunAsync, virCommandWait): Track whether pid was used.
(virCommandFree): Reap child if caller did not request pid.
(virCommandAbort): New function.
* src/libvirt_private.syms (command.h): Export it.
* tests/commandtest.c (test19): New test.

14 years agocommand: don't mix RunAsync and daemons
Eric Blake [Wed, 23 Mar 2011 23:42:27 +0000 (17:42 -0600)]
command: don't mix RunAsync and daemons

It doesn't make sense to run a daemon without synchronously
waiting for the child process to reply whether the daemon has
been kicked off and pidfile written yet.

* src/util/command.c (VIR_EXEC_RUN_SYNC): New constant.
(virCommandRun): Set temporary flag.
(virCommandRunAsync): Use it to prevent async runs of intermediate
child when spawning asynchronous daemon grandchild.

14 years agocommand: properly diagnose process exit via signal
Eric Blake [Tue, 22 Mar 2011 17:55:45 +0000 (11:55 -0600)]
command: properly diagnose process exit via signal

Child processes don't always reach _exit(); if they die from a
signal, then any messages should still be accurate.  Most users
either expect a 0 status (thankfully, if status==0, then
WIFEXITED(status) is true and WEXITSTATUS(status)==0 for all
known platforms) or were filtering on WIFEXITED before printing
a status, but a few were missing this check.  Additionally,
nwfilter_ebiptables_driver was making an assumption that works
on Linux (where WEXITSTATUS shifts and WTERMSIG just masks)
but fails on other platforms (where WEXITSTATUS just masks and
WTERMSIG shifts).

* src/util/command.h (virCommandTranslateStatus): New helper.
* src/libvirt_private.syms (command.h): Export it.
* src/util/command.c (virCommandTranslateStatus): New function.
(virCommandWait): Use it to also diagnose status from signals.
* src/security/security_apparmor.c (load_profile): Likewise.
* src/storage/storage_backend.c
(virStorageBackendQEMUImgBackingFormat): Likewise.
* src/util/util.c (virExecDaemonize, virRunWithHook)
(virFileOperation, virDirCreate): Likewise.
* daemon/remote.c (remoteDispatchAuthPolkit): Likewise.
* src/nwfilter/nwfilter_ebiptables_driver.c (ebiptablesExecCLI):
Likewise.

14 years agoAdd memory functions to libxl driver
Markus Groß [Mon, 21 Mar 2011 09:35:53 +0000 (10:35 +0100)]
Add memory functions to libxl driver

14 years agofix the check of the output of monitor command 'device_add'
Wen Congyang [Thu, 24 Mar 2011 08:56:40 +0000 (16:56 +0800)]
fix the check of the output of monitor command 'device_add'

Hotpluging host usb device by text mode will fail, because the monitor
command 'device_add' outputs 'husb: using...' if it succeeds, but we
think the command should not output anything.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
14 years agobuild: enforce reference count checking
Eric Blake [Fri, 18 Mar 2011 17:32:35 +0000 (11:32 -0600)]
build: enforce reference count checking

Add the compiler attribute to ensure we don't introduce any more
ref bugs like were just patched in commit 9741f34, then explicitly
mark the remaining places in code that are safe.

* src/qemu/qemu_monitor.h (qemuMonitorUnref): Mark
ATTRIBUTE_RETURN_CHECK.
* src/conf/domain_conf.h (virDomainObjUnref): Likewise.
* src/conf/domain_conf.c (virDomainObjParseXML)
(virDomainLoadStatus): Fix offenders.
* src/openvz/openvz_conf.c (openvzLoadDomains): Likewise.
* src/vmware/vmware_conf.c (vmwareLoadDomains): Likewise.
* src/qemu/qemu_domain.c (qemuDomainObjBeginJob)
(qemuDomainObjBeginJobWithDriver)
(qemuDomainObjExitRemoteWithDriver): Likewise.
* src/qemu/qemu_monitor.c (QEMU_MONITOR_CALLBACK): Likewise.
Suggested by Daniel P. Berrange.

14 years agomaint: prohibit access(,X_OK)
Eric Blake [Fri, 18 Mar 2011 20:41:13 +0000 (14:41 -0600)]
maint: prohibit access(,X_OK)

This simplifies several callers that were repeating checks already
guaranteed by util.c, and makes other callers more robust to now
reject directories.  remote_driver.c was over-strict - access(,R_OK)
is only needed to execute a script file; a binary only needs
access(,X_OK) (besides, it's unusual to see a file with x but not
r permissions, whether script or binary).

* cfg.mk (sc_prohibit_access_xok): New syntax-check rule.
(exclude_file_name_regexp--sc_prohibit_access_xok): Exempt one use.
* src/network/bridge_driver.c (networkStartRadvd): Fix offenders.
* src/qemu/qemu_capabilities.c (qemuCapsProbeMachineTypes)
(qemuCapsInitGuest, qemuCapsInit, qemuCapsExtractVersionInfo):
Likewise.
* src/remote/remote_driver.c (remoteFindDaemonPath): Likewise.
* src/uml/uml_driver.c (umlStartVMDaemon): Likewise.
* src/util/hooks.c (virHookCheck): Likewise.

14 years agoGet cpu time and current memory balloon from libxl
Markus Groß [Mon, 21 Mar 2011 09:35:51 +0000 (10:35 +0100)]
Get cpu time and current memory balloon from libxl

14 years agoMake error reporting in libvirtd thread safe
Jiri Denemark [Wed, 23 Mar 2011 15:00:58 +0000 (16:00 +0100)]
Make error reporting in libvirtd thread safe

Bug https://bugzilla.redhat.com/show_bug.cgi?id=689374 reported libvirtd
crash during error dispatch.

The reason is that libvirtd uses remoteDispatchConnError() with non-NULL
conn parameter which means that virConnGetLastError() is used instead of
its thread safe replacement virGetLastError().

So when several libvirtd threads are reporting errors at the same time,
the errors can get mixed or corrupted or in case of bad luck libvirtd
itself crashes.

Since Daniel B. is going to rewrite this code from scratch on top of his
RPC infrastructure, I tried to come up with a minimal fix. Thus,
remoteDispatchConnError() now just ignores its conn argument and always
calls virGetLastError(). However, several callers had to be touched as
well, since no libvirt API is allowed to be called before dispatching
the error. Doing so would reset the error and we would have nothing to
dispatch. As a result of that, the code is not very nice but that
doesn't really make daemon/remote.c worse than it is now :-) And it will
all die soon, which is good.

The bug report also contains a reproducer in C which detects both mixed
up error messages and libvirtd crash. Before this patch, I was able to
crash libvirtd in about 20 seconds up to 3 minutes depending on number
of CPU cores (more is better) and luck.

14 years agoupdate domain status forcibly even if attach a device failed
Wen Congyang [Thu, 17 Feb 2011 03:32:13 +0000 (11:32 +0800)]
update domain status forcibly even if attach a device failed

Steps to reproduce this bug:
1. virsh attach-disk domain --source diskimage --target sdb --sourcetype file --driver qemu --subdriver qcow2
   error: Failed to attach disk
   error: operation failed: adding scsi-disk,bus=scsi0.0,scsi-id=1,drive=drive-scsi0-0-1,id=scsi0-0-1 device failed: Property 'scsi-disk.drive' can't find value 'drive-scsi0-0-1'
2. service libvirtd restart
   Stopping libvirtd daemon:                                  [  OK  ]
   Starting libvirtd daemon:                                  [  OK  ]
3. virsh attach-disk domain --source diskimage --target sdb --sourcetype file --driver qemu --subdriver raw
   error: Failed to attach disk
   error: operation failed: adding lsi,id=scsi0,bus=pci.0,addr=0x6 device failed: Duplicate ID 'scsi0' for device

The reason is that we create a new scsi controller but we do not update
/var/run/libvirt/qemu/domain.xml.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
14 years agobuild: nuke all .x-sc* files, and fix VPATH syntax-check
Eric Blake [Wed, 16 Mar 2011 21:25:56 +0000 (15:25 -0600)]
build: nuke all .x-sc* files, and fix VPATH syntax-check

Not every day you see a patch that nukes 27 files!

* .gnulib: Update to latest, for maint.mk improvements
* bootstrap: Resync to gnulib.
* bootstrap.conf (ACLOCAL): Swap the secondary aclocal include
directory, now that bootstrap picks up gnulib/m4 instead of m4.
* Makefile.am (syntax_check_exceptions, EXTRA_DIST): No longer
worry about nuked files.
* cfg.mk (sc_x_sc_dist_check): Delete dead rule.
(VC_LIST_ALWAYS_EXCLUDE_REGEX): Add HACKING.
(exclude_file_name_regexp--sc_*): Inline and simplify contents...
* .x-sc_*: ...from here, then delete the files.

14 years agocommand: reject pidfile on non-daemon
Eric Blake [Tue, 22 Mar 2011 22:39:01 +0000 (16:39 -0600)]
command: reject pidfile on non-daemon

* src/util/command.c (virCommandRunAsync): Since virExec only
creates pidfiles for daemon, enforce this in virCommand.

14 years agodomain_conf: drop unused ref-count in snapshot object
Eric Blake [Fri, 18 Mar 2011 15:20:35 +0000 (09:20 -0600)]
domain_conf: drop unused ref-count in snapshot object

The ref count was assigned to 1 at creation, then never modified again
until it was decremented just before freeing the object.

* src/conf/domain_conf.h (_virDomainSnapshotObj): Delete unused
field.
(virDomainSnapshotObjUnref): Delete unused prototype.
* src/libvirt_private.syms: Likewise.
* src/conf/domain_conf.c (virDomainSnapshotObjNew)
(virDomainSnapshotObjListDataFree): Update users.
(virDomainSnapshotObjUnref): Delete.

14 years agorpm: add missing dependencies
Eric Blake [Wed, 23 Mar 2011 16:30:49 +0000 (10:30 -0600)]
rpm: add missing dependencies

Among others, the missing radvd dependency showed up as:

error: Failed to start network ipv6net
error: Cannot find radvd - Possibly the package isn't installed: No such file
or directory

even when radvd was installed, because the RADVD preprocessor
symbol was missing at configure time.

* libvirt.spec.in (with_network): Add BuildRequires for radvd,
iptables, and ip6tables.
(BuildRequires): Add libxslt and augeas for docs and test.
(with_libvirtd): Add module-init-tools for modprobe.
(with_nwfilter): Add BuildRequires for ebtables.
(with_esx): Fix esx build on RHEL 5, thanks to curl-devel rename.

14 years agorpm: separate runtime and build requirements
Eric Blake [Wed, 23 Mar 2011 16:20:14 +0000 (10:20 -0600)]
rpm: separate runtime and build requirements

* libvirt.spec.in (Requires): Reorganize requirements a bit; no
functional change.

14 years agoutil: Fix return value for virJSONValueFromString if it fails
Osier Yang [Wed, 23 Mar 2011 14:57:44 +0000 (22:57 +0800)]
util: Fix return value for virJSONValueFromString if it fails

Problem:
  "parser.head" is not NULL even if it's free'ed by "virJSONValueFree",
returning "parser.head" when "virJSONValueFromString" fails will cause
unexpected errors (libvirtd will crash sometimes), e.g.
  In function "qemuMonitorJSONArbitraryCommand":

        if (!(cmd = virJSONValueFromString(cmd_str)))
            goto cleanup;

        if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
            goto cleanup;

        ......

     cleanup:
        virJSONValueFree(cmd);

  It will continues to send command to monitor even if "virJSONValueFromString"
is failed, and more worse, it trys to free "cmd" again.

  Crash example:
{"error":{"class":"QMPBadInputObject","desc":"Expected 'execute' in QMP input","data":{"expected":"execute"}}}
{"error":{"class":"QMPBadInputObject","desc":"Expected 'execute' in QMP input","data":{"expected":"execute"}}}
error: server closed connection:
error: unable to connect to '/var/run/libvirt/libvirt-sock', libvirtd may need to be started: Connection refused
error: failed to connect to the hypervisor

  This fix is to:
    1) return NULL for failure of "virJSONValueFromString",
    2) and it seems "virJSONValueFree" uses incorrect loop index for type
       of "VIR_JSON_TYPE_OBJECT", fix it together.

* src/util/json.c

14 years agoInitialization error of qemuCgroupData in Qemu host usb hotplug
Wen Congyang [Wed, 23 Mar 2011 02:02:15 +0000 (10:02 +0800)]
Initialization error of qemuCgroupData in Qemu host usb hotplug

Steps to reproduce this bug:
# cat usb.xml
<hostdev mode='subsystem' type='usb'>
  <source>
    <address bus='0x001' device='0x003'/>
  </source>
</hostdev>
# virsh attach-device vm1 usb.xml
error: Failed to attach device from usb.xml
error: server closed connection:

The reason of this bug is that we set data.cgroup to NULL, and this will cause
libvirtd crashed.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
14 years agoqemu: simplify monitor callbacks
Eric Blake [Fri, 18 Mar 2011 17:27:14 +0000 (11:27 -0600)]
qemu: simplify monitor callbacks

A future patch will change reference counting idioms; consolidating
this pattern now makes the next patch smaller (touch only the new
macro rather than every caller).

* src/qemu/qemu_monitor.c (QEMU_MONITOR_CALLBACK): New helper.
(qemuMonitorGetDiskSecret, qemuMonitorEmitShutdown)
(qemuMonitorEmitReset, qemuMonitorEmitPowerdown)
(qemuMonitorEmitStop, qemuMonitorEmitRTCChange)
(qemuMonitorEmitWatchdog, qemuMonitorEmitIOError)
(qemuMonitorEmitGraphics): Use it to reduce duplication.

14 years agobuild: fix missing initializer
Eric Blake [Tue, 22 Mar 2011 20:36:46 +0000 (14:36 -0600)]
build: fix missing initializer

Commit cb4aba9b6 forgot xenapi.

* src/xenapi/xenapi_driver.c (xenapiDriver): Adjust to recent API.

14 years ago8021Qbh: use preassociate-rr during the migration prepare stage
Roopa Prabhu [Tue, 22 Mar 2011 19:27:01 +0000 (15:27 -0400)]
8021Qbh: use preassociate-rr during the migration prepare stage

This patch introduces PREASSOCIATE-RR during incoming VM migration on the
destination host. This is similar to the usage of PREASSOCIATE during
migration in 8021qbg libvirt code today. PREASSOCIATE-RR is a VDP operation.
With the latest at IEEE, 8021qbh will need to support VDP operations.
A corresponding enic driver patch to support PREASSOCIATE-RR for 8021qbh
will be posted for net-next-2.6 inclusion soon.

14 years agoFix uninitialized variable & error reporting in LXC veth setup
Daniel P. Berrange [Thu, 17 Mar 2011 15:54:24 +0000 (15:54 +0000)]
Fix uninitialized variable & error reporting in LXC veth setup

THe veth setup in LXC had a couple of flaws, first brInit did
not report any error when it failed. Second vethCreate() did
not correctly initialize the variable containing the return
code, so could report failure even when it succeeded.

* src/lxc/lxc_driver.c: Report error when brInit fails
* src/lxc/veth.c: Fix uninitialized variable

14 years agoWire up virDomainMigrateSetSpeed into QEMU driver
Daniel P. Berrange [Thu, 17 Feb 2011 14:33:00 +0000 (14:33 +0000)]
Wire up virDomainMigrateSetSpeed into QEMU driver

Enhance the QEMU migration monitoring loop, so that it can get
a signal to change migration speed on the fly

* src/qemu/qemu_domain.h: Add signal for changing speed on the fly
* src/qemu/qemu_driver.c: Wire up virDomainMigrateSetSpeed driver
* src/qemu/qemu_migration.c: Support signal for changing speed

14 years agoWire up virDomainMigrateSetSpeed for the remote RPC driver
Daniel P. Berrange [Thu, 17 Feb 2011 14:26:14 +0000 (14:26 +0000)]
Wire up virDomainMigrateSetSpeed for the remote RPC driver

* src/remote/remote_protocol.x: Define wire protocol
* daemon/remote.c, src/remote/remote_driver.c: Add new
  functions for virDomainMigrateSetSpeed API
* src/remote/remote_protocol.c, src/remote/remote_protocol.h,
  daemon/remote_dispatch_args.h, daemon/remote_dispatch_prototypes.h,
  daemon/remote_dispatch_table.h: Re-generate files

14 years agoAdd public API for setting migration speed on the fly
Daniel P. Berrange [Thu, 17 Feb 2011 13:57:53 +0000 (13:57 +0000)]
Add public API for setting migration speed on the fly

It is possible to set a migration speed limit when starting
migration. This new API allows the speed limit to be changed
on the fly to adjust to changing conditions

* src/driver.h, src/libvirt.c, src/libvirt_public.syms,
  include/libvirt/libvirt.h.in: Add virDomainMigrateSetMaxSpeed
* src/esx/esx_driver.c, src/lxc/lxc_driver.c,
  src/opennebula/one_driver.c, src/openvz/openvz_driver.c,
  src/phyp/phyp_driver.c, src/qemu/qemu_driver.c,
  src/remote/remote_driver.c, src/test/test_driver.c,
  src/uml/uml_driver.c, src/vbox/vbox_tmpl.c,
  src/vmware/vmware_driver.c, src/xen/xen_driver.c,
  src/libxl/libxl_driver.c: Stub new API

14 years agomaint: update authors
Eric Blake [Tue, 22 Mar 2011 14:33:22 +0000 (08:33 -0600)]
maint: update authors

* AUTHORS: Update, to satisfy 'make syntax-check'.

14 years agoDisable libxl build in RPM on Fedora < 16
Daniel P. Berrange [Fri, 18 Mar 2011 16:45:18 +0000 (16:45 +0000)]
Disable libxl build in RPM on Fedora < 16

The xen RPM in Fedora isn't new enough to support libxl builds
yet. Disable it until Fedora 16

* libvirt.spec.in: Disable libxl on Fedora < 16

14 years agoqemu: fallback to HMP drive_add/drive_del
Hu Tao [Thu, 17 Mar 2011 14:41:15 +0000 (15:41 +0100)]
qemu: fallback to HMP drive_add/drive_del

fallback to HMP drive_add/drive_del commands if not found in QMP

14 years agoqemu: Only use HMP passthrough if it is supported
Jiri Denemark [Mon, 21 Mar 2011 12:34:16 +0000 (13:34 +0100)]
qemu: Only use HMP passthrough if it is supported

Avoids calling text monitor methods when it is know they will not
succeed and also results in nicer error messages.

14 years agoqemu: Detect support for HMP passthrough
Jiri Denemark [Wed, 16 Mar 2011 19:34:01 +0000 (20:34 +0100)]
qemu: Detect support for HMP passthrough

14 years agoqemu: add two hook script events "prepare" and "release"
Thibault Vincent [Tue, 22 Mar 2011 13:12:36 +0000 (21:12 +0800)]
qemu: add two hook script events "prepare" and "release"

Fix for bug https://bugzilla.redhat.com/show_bug.cgi?id=618970

The "prepare" hook is called very early in the VM statup process
before device labeling, so that it can allocate ressources not
managed by libvirt, such as DRBD, or for instance create missing
bridges and vlan interfaces.
* src/util/hooks.c src/util/hooks.h: add definitions for new hooks
  VIR_HOOK_QEMU_OP_PREPARE and VIR_HOOK_QEMU_OP_RELEASE
* src/qemu/qemu_process.c: use them in qemuProcessStart and
  qemuProcessStop()

14 years agoUpdate the set of maintainers for the project
Daniel Veillard [Tue, 22 Mar 2011 02:10:15 +0000 (10:10 +0800)]
Update the set of maintainers for the project

Wen Congyang gained commiter access

Created a new section of previous commiters to the project
but not involved much anymore: Karel Zak, Atsushi SAKAI,
Dave Leskovec and Dan Smith

14 years agoqemu: simplify interface fd handling in monitor
Eric Blake [Wed, 16 Mar 2011 02:21:45 +0000 (20:21 -0600)]
qemu: simplify interface fd handling in monitor

With only a single caller to these two monitor commands, I
didn't need to wrap a new WithFds version, but just change
the command itself.

* src/qemu/qemu_monitor.h (qemuMonitorAddNetdev)
(qemuMonitorAddHostNetwork): Add parameters.
* src/qemu/qemu_monitor.c (qemuMonitorAddNetdev)
(qemuMonitorAddHostNetwork): Add support for fd passing.
* src/qemu/qemu_hotplug.c (qemuDomainAttachNetDevice): Use it to
simplify code.

14 years agoqemu: simplify PCI configfd handling in monitor
Eric Blake [Tue, 15 Mar 2011 23:10:16 +0000 (17:10 -0600)]
qemu: simplify PCI configfd handling in monitor

This is also a bug fix - on the error path, qemu_hotplug would
leave the configfd file leaked into qemu.  At least the next
attempt to hotplug a PCI device would reuse the same fdname,
and when the qemu getfd monitor command gets a new fd by the
same name as an earlier one, it closes the earlier one, so there
is no risk of qemu running out of fds.

* src/qemu/qemu_monitor.h (qemuMonitorAddDeviceWithFd): New
prototype.
* src/qemu/qemu_monitor.c (qemuMonitorAddDevice): Move guts...
(qemuMonitorAddDeviceWithFd): ...to new function, and add support
for fd passing.
* src/qemu/qemu_hotplug.c (qemuDomainAttachHostPciDevice): Use it
to simplify code.
Suggested by Daniel P. Berrange.

14 years agoqemu: simplify monitor fd error handling
Eric Blake [Wed, 16 Mar 2011 01:38:06 +0000 (19:38 -0600)]
qemu: simplify monitor fd error handling

qemu_monitor was already returning -1 and setting errno to EINVAL
on any attempt to send an fd without a unix socket, but this was
a silent failure in the case of qemuDomainAttachHostPciDevice.
Meanwhile, qemuDomainAttachNetDevice was doing some sanity checking
for a better error message; it's better to consolidate that to a
central point in the API.

* src/qemu/qemu_hotplug.c (qemuDomainAttachNetDevice): Move sanity
checking...
* src/qemu/qemu_monitor.c (qemuMonitorSendFileHandle): ...into
central location.
Suggested by Chris Wright.

14 years agoudev: fix regression with qemu:///session
Eric Blake [Wed, 16 Mar 2011 21:47:32 +0000 (15:47 -0600)]
udev: fix regression with qemu:///session

https://bugzilla.redhat.com/show_bug.cgi?id=684655 points out
a regression introduced in commit 2215050edd - non-root users
can't connect to qemu:///session because libvirtd dies when
it can't use pciaccess initialization.

* src/node_device/node_device_udev.c (udevDeviceMonitorStartup):
Don't abort udev driver (and libvirtd overall) if non-root user
can't use pciaccess.

14 years agologging: fix off-by-one bug
Eric Blake [Sat, 19 Mar 2011 02:19:31 +0000 (20:19 -0600)]
logging: fix off-by-one bug

Valgrind caught that our log wrap-around was going 1 past the end.
Regression introduced in commit b16f47a; previously the
buffer was static and size+1 bytes, but now it is dynamic and
exactly size bytes.

* src/util/logging.c (virLogStr): Don't write past end of log.

14 years agodo not report OOM error when prepareCall() failed
Wen Congyang [Mon, 21 Mar 2011 06:29:35 +0000 (14:29 +0800)]
do not report OOM error when prepareCall() failed

We have reported error in the function prepareCall(), and
the error is not only OOM error. So we should not report
OOM error in the function call() when prepareCall() failed.

14 years agoutil: guarantee sane errno in virFileIsExecutable
Eric Blake [Fri, 18 Mar 2011 20:22:19 +0000 (14:22 -0600)]
util: guarantee sane errno in virFileIsExecutable

If virFileIsExecutable is to replace access(file,X_OK), then
errno must be usable on failure.

* src/util/util.c (virFileIsExecutable): Set errno on failure.

14 years agodocs: Document first release with spice and qxl
Cole Robinson [Thu, 17 Mar 2011 16:04:35 +0000 (12:04 -0400)]
docs: Document first release with spice and qxl

14 years agodoc: Add schema definition for imagelabel
Osier Yang [Mon, 21 Mar 2011 07:58:51 +0000 (15:58 +0800)]
doc: Add schema definition for imagelabel

<imagelable> is not generated by running domain, actually we parse
it in src/conf/domain_conf.c, this patch is to fix it, otherwise any
validation (virt-xml-validate) on the domain xml dumped from shutoff
domain containing <imagelable> will fail.

* docs/schemas/domain.rng

14 years agoupdate virGetVersion description
Tiziano Mueller [Sat, 5 Mar 2011 17:36:23 +0000 (18:36 +0100)]
update virGetVersion description

The current description suggests that you always have to provide
a valid typeVer pointer. But if you want only the libvirt version
it's also possible to set type and typeVer to NULL to skip the
hypervisor part.

14 years agoDon't return an error on failure to create blkio controller
Hu Tao [Mon, 7 Mar 2011 03:49:12 +0000 (11:49 +0800)]
Don't return an error on failure to create blkio controller

This patch enables cgroup controllers as much as possible by skipping
the creation of blkio controller when running with old kernels that
doesn't support multi-level directory for blkio controller.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
14 years agoDon't build libxenlight driver for Xen 4.0
Jim Fehlig [Fri, 18 Mar 2011 20:54:13 +0000 (14:54 -0600)]
Don't build libxenlight driver for Xen 4.0

The libxenlight driver does not build against the tech preview
version of libxenlight in Xen 4.0.  Only enable building the
driver against more complete libxenlight found in Xen 4.1.