]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
14 years agoqemu: Replace deprecated option of qemu-img
Osier Yang [Thu, 10 Mar 2011 02:05:14 +0000 (10:05 +0800)]
qemu: Replace deprecated option of qemu-img

qemu-img silently disable "-e", so we can't use it for volume
encryption anymore, change it into "-o encryption=on" if qemu
supports "-o" option.

14 years agoaudit: also audit cgroup ACL permissions
Eric Blake [Wed, 9 Mar 2011 03:06:26 +0000 (20:06 -0700)]
audit: also audit cgroup ACL permissions

* src/qemu/qemu_audit.h (qemuAuditCgroupMajor)
(qemuAuditCgroupPath): Add parameter.
* src/qemu/qemu_audit.c (qemuAuditCgroupMajor)
(qemuAuditCgroupPath): Add 'acl=rwm' to cgroup audit entries.
* src/qemu/qemu_cgroup.c: Update clients.
* src/qemu/qemu_driver.c (qemudDomainSaveFlag): Likewise.

14 years agocgroup: allow fine-tuning of device ACL permissions
Eric Blake [Wed, 9 Mar 2011 03:13:18 +0000 (20:13 -0700)]
cgroup: allow fine-tuning of device ACL permissions

Adding audit points showed that we were granting too much privilege
to qemu; it should not need any mknod rights to recreate any
devices.  On the other hand, lxc should have all device privileges.
The solution is adding a flag parameter.

This also lets us restrict write access to read-only disks.

* src/util/cgroup.h (virCgroup*Device*): Adjust prototypes.
* src/util/cgroup.c (virCgroupAllowDevice)
(virCgroupAllowDeviceMajor, virCgroupAllowDevicePath)
(virCgroupDenyDevice, virCgroupDenyDeviceMajor)
(virCgroupDenyDevicePath): Add parameter.
* src/qemu/qemu_driver.c (qemudDomainSaveFlag): Update clients.
* src/lxc/lxc_controller.c (lxcSetContainerResources): Likewise.
* src/qemu/qemu_cgroup.c: Likewise.
(qemuSetupDiskPathAllow): Also, honor read-only disks.

14 years agoaudit: rename remaining qemu audit functions
Eric Blake [Tue, 8 Mar 2011 21:28:51 +0000 (14:28 -0700)]
audit: rename remaining qemu audit functions

Also add ATTRIBUTE_NONNULL markers.

* src/qemu/qemu_audit.h: The pattern qemuDomainXXXAudit is
inconsistent; prefer qemuAuditXXX instead.
* src/qemu/qemu_audit.c: Reflect the renames.
* src/qemu/qemu_driver.c: Likewise.
* src/qemu/qemu_hotplug.c: Likewise.
* src/qemu/qemu_migration.c: Likewise.
* src/qemu/qemu_process.c: Likewise.

14 years agoaudit: also audit cgroup controller path
Eric Blake [Mon, 7 Mar 2011 23:41:40 +0000 (16:41 -0700)]
audit: also audit cgroup controller path

Although the cgroup device ACL controller path can be worked out
by researching the code, it is more efficient to include that
information directly in the audit message.

* src/util/cgroup.h (virCgroupPathOfController): New prototype.
* src/util/cgroup.c (virCgroupPathOfController): Export.
* src/libvirt_private.syms: Likewise.
* src/qemu/qemu_audit.c (qemuAuditCgroup): Use it.

14 years agoaudit: split cgroup audit types to allow more information
Eric Blake [Mon, 7 Mar 2011 23:17:26 +0000 (16:17 -0700)]
audit: split cgroup audit types to allow more information

Device names can be manipulated, so it is better to also log
the major/minor device number corresponding to the cgroup ACL
changes that libvirt made.  This required some refactoring
of the relatively new qemu cgroup audit code.

Also, qemuSetupChardevCgroup was only auditing on failure, not success.

* src/qemu/qemu_audit.h (qemuDomainCgroupAudit): Delete.
(qemuAuditCgroup, qemuAuditCgroupMajor, qemuAuditCgroupPath): New
prototypes.
* src/qemu/qemu_audit.c (qemuDomainCgroupAudit): Rename...
(qemuAuditCgroup): ...and drop a parameter.
(qemuAuditCgroupMajor, qemuAuditCgroupPath): New functions, to
allow listing device major/minor in audit.
(qemuAuditGetRdev): New helper function.
* src/qemu/qemu_driver.c (qemudDomainSaveFlag): Adjust callers.
* src/qemu/qemu_cgroup.c (qemuSetupDiskPathAllow)
(qemuSetupHostUsbDeviceCgroup, qemuSetupCgroup)
(qemuTeardownDiskPathDeny): Likewise.
(qemuSetupChardevCgroup): Likewise, fixing missing audit.

14 years agoaudit: tweak audit messages to match conventions
Eric Blake [Sat, 26 Feb 2011 00:28:21 +0000 (17:28 -0700)]
audit: tweak audit messages to match conventions

* src/qemu/qemu_audit.c (qemuDomainHostdevAudit): Avoid use of
"type", which has a pre-defined meaning.
(qemuDomainCgroupAudit): Likewise, as well as "item".

14 years agodocs: silence warnings about generated API docs
Eric Blake [Wed, 9 Mar 2011 03:42:19 +0000 (20:42 -0700)]
docs: silence warnings about generated API docs

I noticed these while testing 'make dist'.

Parsing ./../src/util/event.c
Function comment for virEventRegisterDefaultImpl lacks description of return value
Function comment for virEventRunDefaultImpl lacks description of return value
Parsing ./../src/util/virterror.c
Missing comment for function virSetErrorLogPriorityFunc

* src/util/event.c (virEventRegisterDefaultImpl)
(virEventRunDefaultImpl): Document return types.
* src/util/virterror.c (virSetErrorLogPriorityFunc): Provide docs.

14 years agodocs: document <driver name='vhost'/> for interfaces
Eric Blake [Tue, 8 Mar 2011 23:35:17 +0000 (16:35 -0700)]
docs: document <driver name='vhost'/> for interfaces

* docs/formatdomain.html.in: Document virtio backend selection.

14 years agoMake sure the rundir is accessible by the user
Guido Günther [Wed, 9 Mar 2011 13:15:48 +0000 (14:15 +0100)]
Make sure the rundir is accessible by the user

otherwise the user might not have enough permissions to access the
socket if root's umask is 077.

http://bugs.debian.org/614210

14 years agoDon't overwrite virRun error messages
Cole Robinson [Tue, 8 Mar 2011 18:46:29 +0000 (13:46 -0500)]
Don't overwrite virRun error messages

virRun gives pretty useful error output, let's not overwrite it unless there
is a good reason. Some places were providing more information about what
the commands were _attempting_ to do, however that's usually less useful from
a debugging POV than what actually happened.

14 years agolibvirtd: Remove indirect linking
Guido Günther [Tue, 8 Mar 2011 20:44:14 +0000 (21:44 +0100)]
libvirtd: Remove indirect linking

as described at
http://wiki.debian.org/ToolChain/DSOLinking
https://fedoraproject.org/wiki/UnderstandingDSOLinkChange

otherwise the build fails on current Debian unstable with:

CCLD   libvirtd
/usr/bin/ld: ../src/.libs/libvirt_driver_lxc.a(libvirt_driver_lxc_la-lxc_container.o): undefined reference to symbol 'capng_apply'
/usr/bin/ld: note: 'capng_apply' is defined in DSO //usr/lib/libcap-ng.so.0 so try adding it to the linker command line

CCLD   libvirtd
/usr/bin/ld: ../src/.libs/libvirt_driver_storage.a(libvirt_driver_storage_la-storage_backend.o): undefined reference to symbol 'fgetfilecon'
/usr/bin/ld: note: 'fgetfilecon' is defined in DSO //lib/libselinux.so.1 so try adding it to the linker command line
//lib/libselinux.so.1: could not read symbols: Invalid operation

and similar errors.

14 years agoFix a wrong error message thrown to user
Hu Tao [Wed, 9 Mar 2011 12:09:25 +0000 (20:09 +0800)]
Fix a wrong error message thrown to user

* src/qemu/qemu_driver.c: qemuDomainUpdateDeviceFlags() is not disk
  specific as the message suggests

14 years agobuild: avoid compiler warning on cygwin
Eric Blake [Wed, 9 Mar 2011 04:47:49 +0000 (21:47 -0700)]
build: avoid compiler warning on cygwin

On cygwin:

  CC       libvirt_driver_security_la-security_dac.lo
security/security_dac.c: In function 'virSecurityDACSetProcessLabel':
security/security_dac.c:618: warning: format '%d' expects type 'int', but argument 7 has type 'uid_t' [-Wformat]

We've done this before (see src/util/util.c).

* src/security/security_dac.c (virSecurityDACSetProcessLabel): On
cygwin, uid_t is a 32-bit long.

14 years agobuild: fix build on cygwin
Eric Blake [Wed, 9 Mar 2011 04:43:26 +0000 (21:43 -0700)]
build: fix build on cygwin

On cygwin:

  CC        libvirt_util_la-cgroup.lo
util/cgroup.c: In function 'virCgroupKillRecursiveInternal':
util/cgroup.c:1458: warning: implicit declaration of function 'virCgroupNew' [-Wimplicit-function-declaration]

* src/util/cgroup.c (virCgroupKill): Don't build on platforms
where virCgroupNew is unsupported.

14 years agobuild: fix building error when building without libvirtd
Wen Congyang [Wed, 9 Mar 2011 03:18:36 +0000 (11:18 +0800)]
build: fix building error when building without libvirtd

When building libvirt without libvirtd, I receive the following errors:
make[1]: Leaving directory `/home/wency/source/test/libvirt/src'
 (cd daemon && make  top_distdir=../libvirt-0.8.8 distdir=../libvirt-0.8.8/daemon \
     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)
make[1]: Entering directory `/home/wency/source/test/libvirt/daemon'
make[1]: *** No rule to make target `libvirtd.8.in', needed by `distdir'.  Stop.

This bug was caused by commit 6db98a2d.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
14 years agodocs: correct range of default NAT subnet
Eric Blake [Tue, 8 Mar 2011 23:15:47 +0000 (16:15 -0700)]
docs: correct range of default NAT subnet

* docs/formatdomain.html.in: Fix typo.

14 years agovirsh: Remove indirect link against libxml2
Guido Günther [Tue, 8 Mar 2011 18:24:28 +0000 (19:24 +0100)]
virsh: Remove indirect link against libxml2

as described at
http://wiki.debian.org/ToolChain/DSOLinking
https://fedoraproject.org/wiki/UnderstandingDSOLinkChange

otherwise the build fails on current Debian unstable with:

CCLD   virsh
/usr/bin/ld: virsh-virsh.o: undefined reference to symbol 'xmlSaveTree@@LIBXML2_2.6.8'
/usr/bin/ld: note: 'xmlSaveTree@@LIBXML2_2.6.8' is defined in DSO //usr/lib/libxml2.so.2 so try adding it to the linker command line
//usr/lib/libxml2.so.2: could not read symbols: Invalid operation

14 years agovirsh: Change option parsing functions to return tri-state information
Michal Privoznik [Tue, 8 Mar 2011 16:29:31 +0000 (17:29 +0100)]
virsh: Change option parsing functions to return tri-state information

This is needed to detect situations when optional argument was
specified with non-integer value: '--int-opt foo'. To keep functions
uniform vshCommandOptString function was also changed, because it
returns tri-state value as well. Given result pointer is updated only
in case of success. If parsing fails, result is not updated at all.

14 years agovirsh: change vshCommandOptString return type and fix const-correctness
Michal Privoznik [Tue, 8 Mar 2011 16:29:30 +0000 (17:29 +0100)]
virsh: change vshCommandOptString return type and fix const-correctness

This function should return pointer to const, because we don't want
to change command option value. Therefore we can ensure const-correctness.

14 years agodocs/formatdomain: Add release info for disk <driver> attributes
Cole Robinson [Tue, 8 Mar 2011 18:02:43 +0000 (13:02 -0500)]
docs/formatdomain: Add release info for disk <driver> attributes

14 years agoFix build on cygwin
Daniel Veillard [Tue, 8 Mar 2011 08:01:25 +0000 (16:01 +0800)]
Fix build on cygwin

Apparently some signals found on Unix are not exposed, this led
to a compilation failure
* src/util/logging.c: make code related to each signal dependant
  upon the definition of that signal

14 years agosupport to detach USB disk
Wen Congyang [Mon, 7 Mar 2011 03:36:48 +0000 (11:36 +0800)]
support to detach USB disk

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
14 years agorename qemuDomainDetachSCSIDiskDevice to qemuDomainDetachDiskDevice
Wen Congyang [Mon, 7 Mar 2011 03:31:48 +0000 (11:31 +0800)]
rename qemuDomainDetachSCSIDiskDevice to qemuDomainDetachDiskDevice

The way to detach a USB disk is the same as that to detach a SCSI
disk. Rename this function and we can use it to detach a USB disk.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
14 years agoqemu_hotplug: Reword error if spice password change not available
Cole Robinson [Mon, 7 Mar 2011 18:09:35 +0000 (13:09 -0500)]
qemu_hotplug: Reword error if spice password change not available

Currently it sounds like spice is completely unsupported, which is
confusing.

14 years agounlock eventLoop before calling callback function
Wen Congyang [Mon, 7 Mar 2011 06:06:49 +0000 (14:06 +0800)]
unlock eventLoop before calling callback function

When I use newest libvirt to save a domain, libvirtd will be deadlock.
Here is the output of gdb:
(gdb) thread 3
[Switching to thread 3 (Thread 0x7f972a1fc710 (LWP 30265))]#0  0x000000351fe0e034 in __lll_lock_wait () from /lib64/libpthread.so.0
(gdb) bt
    at qemu/qemu_driver.c:2074
    ret=0x7f972a1fbbe0) at remote.c:2273
(gdb) thread 7
[Switching to thread 7 (Thread 0x7f9730bcd710 (LWP 30261))]#0  0x000000351fe0e034 in __lll_lock_wait () from /lib64/libpthread.so.0
(gdb) bt
(gdb) p *(virMutexPtr)0x6fdd60
$2 = {lock = {__data = {__lock = 2, __count = 0, __owner = 30261, __nusers = 1, __kind = 0, __spins = 0, __list = {__prev = 0x0, __next = 0x0}},
    __size = "\002\000\000\000\000\000\000\000\065v\000\000\001", '\000' <repeats 26 times>, __align = 2}}
(gdb) p *(virMutexPtr)0x1a63ac0
$3 = {lock = {__data = {__lock = 2, __count = 0, __owner = 30265, __nusers = 1, __kind = 0, __spins = 0, __list = {__prev = 0x0, __next = 0x0}},
    __size = "\002\000\000\000\000\000\000\000\071v\000\000\001", '\000' <repeats 26 times>, __align = 2}}
(gdb) info threads
  7 Thread 0x7f9730bcd710 (LWP 30261)  0x000000351fe0e034 in __lll_lock_wait () from /lib64/libpthread.so.0
  6 Thread 0x7f972bfff710 (LWP 30262)  0x000000351fe0b43c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
  5 Thread 0x7f972b5fe710 (LWP 30263)  0x000000351fe0b43c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
  4 Thread 0x7f972abfd710 (LWP 30264)  0x000000351fe0b43c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
* 3 Thread 0x7f972a1fc710 (LWP 30265)  0x000000351fe0e034 in __lll_lock_wait () from /lib64/libpthread.so.0
  2 Thread 0x7f97297fb710 (LWP 30266)  0x000000351fe0b43c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
  1 Thread 0x7f9737aac800 (LWP 30260)  0x000000351fe0803d in pthread_join () from /lib64/libpthread.so.0

The reason is that we will try to lock some object in callback function, and we may call event API with locking the same object.
In the function virEventDispatchHandles(), we unlock eventLoop before calling callback function. I think we should
do the same thing in the function virEventCleanupTimeouts() and virEventCleanupHandles().

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
14 years agoExpose event loop implementation as a public API
Daniel P. Berrange [Wed, 2 Mar 2011 16:59:54 +0000 (16:59 +0000)]
Expose event loop implementation as a public API

Not all applications have an existing event loop they need
to integrate with. Forcing them to implement the libvirt
event loop integration APIs is an undue burden. This just
exposes our simple poll() based implementation for apps
to use. So instead of calling

   virEventRegister(....callbacks...)

The app would call

   virEventRegisterDefaultImpl()

And then have a thread somewhere calling

    static bool quit = false;
    ....
    while (!quit)
      virEventRunDefaultImpl()

* daemon/libvirtd.c, tools/console.c,
  tools/virsh.c: Convert to public event loop APIs
* include/libvirt/libvirt.h.in, src/libvirt_private.syms: Add
  virEventRegisterDefaultImpl and virEventRunDefaultImpl
* src/util/event.c: Implement virEventRegisterDefaultImpl
  and virEventRunDefaultImpl using poll() event loop
* src/util/event_poll.c: Add full error reporting
* src/util/virterror.c, include/libvirt/virterror.h: Add
  VIR_FROM_EVENTS

14 years agoMove event code out of the daemon/ into src/util/
Daniel P. Berrange [Thu, 24 Feb 2011 17:58:04 +0000 (17:58 +0000)]
Move event code out of the daemon/ into src/util/

The event loop implementation is used by more than just the
daemon, so move it into the shared area.

* daemon/event.c, src/util/event_poll.c: Renamed
* daemon/event.h, src/util/event_poll.h: Renamed
* tools/Makefile.am, tools/console.c, tools/virsh.c: Update
  to use new virEventPoll APIs
* daemon/mdns.c, daemon/mdns.c, daemon/Makefile.am: Update
  to use new virEventPoll APIs

14 years agoConvert daemon/virsh over to use primary event APIs, rather than impl
Daniel P. Berrange [Wed, 2 Mar 2011 15:08:31 +0000 (15:08 +0000)]
Convert daemon/virsh over to use primary event APIs, rather than impl

The daemon code calls virEventAddHandleImpl directly instead
of calling the wrapper virEventAddHandle.

* tools/console.c, daemon/libvirtd.c, daemon/mdns.c: Convert to
  use primary event APIs

14 years agoCleaning up some of the logging code
Daniel Veillard [Mon, 7 Mar 2011 13:23:53 +0000 (21:23 +0800)]
Cleaning up some of the logging code

* src/util/logging.c: fix virLogDumpAllFD() to avoid snprintf, simplify
  the code and provide more useful signal descriptions. Also remove an
  unused variable.

14 years agoqemu: Support vram for video of qxl type
Osier Yang [Sun, 6 Mar 2011 14:00:27 +0000 (22:00 +0800)]
qemu: Support vram for video of qxl type

For qemu names the primary vga as "qxl-vga":

  1) if vram is specified for 2nd qxl device:

    -vga qxl -global qxl-vga.vram_size=$SIZE \
    -device qxl,id=video1,vram_size=$SIZE,...

  2) if vram is not specified for 2nd qxl device, (use the default
     set by global):

    -vga qxl -global qxl-vga.vram_size=$SIZE \
    -device qxl,id=video1,...

For qemu names all qxl devices as "qxl":

  1) if vram is specified for 2nd qxl device:

    -vga qxl -global qxl.vram_size=$SIZE \
    -device qxl,id=video1,vram_size=$SIZE ...

  2) if vram is not specified for 2nd qxl device:

    -vga qxl -global qxl-vga.vram_size=$SIZE \
    -device qxl,id=video1,...

"-global" is the only way to define vram_size for the primary qxl
device, regardless of how qemu names it, (It's not good a good
way, as original idea of "-global" is to set a global default for
a driver property, but to specify vram for first qxl device, we
have to use it).

For other qxl devices, as they are represented by "-device", could
specify it directly and seperately for each, and it overrides the
default set by "-global" if specified.

v1 - v2:
  * modify "virDomainVideoDefaultRAM" so that it returns 16M as the
    default vram_size for qxl device.

  * vram_size * 1024 (qemu accepts bytes for vram_size).

  * apply default vram_size for qxl device for which vram_size is
    not specified.

  * modify "graphics-spice" tests (more sensiable vram_size)

  * Add an argument of virDomainDefPtr type for qemuBuildVideoDevStr,
    to use virDomainVideoDefaultRAM in qemuBuildVideoDevStr).

v2 - v3:
  * Modify default video memory size for qxl device from 16M to 24M

  * Update codes to be consistent with changes on qemu_capabilities.*

14 years agofixes for several memory leaks
Phil Petty [Fri, 4 Mar 2011 16:52:12 +0000 (09:52 -0700)]
fixes for several memory leaks

Signed-off-by: Eric Blake <eblake@redhat.com>
14 years agoDump the debug buffer to libvirtd.log on fatal signal
Daniel Veillard [Thu, 3 Mar 2011 09:41:44 +0000 (17:41 +0800)]
Dump the debug buffer to libvirtd.log on fatal signal

In case of imminent crash or upon request (signal USR2),
dump the logging buffer to the libvirtd.log file for
post-mortem analysis
* daemon/libvirtd.c: create a sig_fatal() handler connected to
  SIGFPE SIGSEGV SIGILL SIGABRT SIGBUS and SIGUSR2, just dumping
  the log buffer using virLogEmergencyDumpAll

14 years agoAdd an an internal API for emergency dump of debug buffer
Daniel Veillard [Thu, 3 Mar 2011 08:32:18 +0000 (16:32 +0800)]
Add an an internal API for emergency dump of debug buffer

virLogEmergencyDumpAll() allows to dump the content of the
debug buffer from within a signal handler. It saves to all
log file or stderr if none is found
* src/util/logging.h src/util/logging.c: add the new API
  and cleanup the old virLogDump code
* src/libvirt_private.syms: exports it as a private symbol

14 years agoFix a counter bug in the log buffer
Daniel Veillard [Thu, 3 Mar 2011 07:45:52 +0000 (15:45 +0800)]
Fix a counter bug in the log buffer

* src/util/logging.c: the start pointer need to wrap around too

14 years agoAdd logrotate support for libvirtd.log
Daniel Veillard [Thu, 3 Mar 2011 07:26:22 +0000 (15:26 +0800)]
Add logrotate support for libvirtd.log

As the file may grow quite a bit especially with debug turned on.
* daemon/libvirtd.logrotate.in daemon/Makefile.am libvirt.spec.in:
  add new logrotate file for the daemon log

14 years agoChange default log policy to libvirtd.log instead of syslog
Daniel Veillard [Thu, 3 Mar 2011 06:48:06 +0000 (14:48 +0800)]
Change default log policy to libvirtd.log instead of syslog

Syslog is not the best place to go search for libvirt error
logs, change it to a default file output libvirtd.log, but
still keep standard error if not run as a daemon.
Depending on whether it's run as root or user, the log is saved
in the local state dir or in $HOME/.libvirt.
* daemon/libvirtd.c: change default logging to go to libvirtd.log

14 years agoForce all logs to go to the round robbin memory buffer
Daniel Veillard [Wed, 2 Mar 2011 12:26:02 +0000 (20:26 +0800)]
Force all logs to go to the round robbin memory buffer

Initially only the log actually written out by libvirt were
saved on the memory buffer, this patch forces all informations
including info and debug to be saved in memory too. This is
useful to get full data in case of crash.

14 years agoqemu: avoid corruption of domain hashtable and misuse of freed domains
Laine Stump [Thu, 3 Mar 2011 18:21:07 +0000 (13:21 -0500)]
qemu: avoid corruption of domain hashtable and misuse of freed domains

This was also found while investigating

   https://bugzilla.redhat.com/show_bug.cgi?id=670848

An EOF on a domain's monitor socket results in an event being queued
to handle the EOF. The handler calls qemuProcessHandleMonitorEOF. If
it is a transient domain, this leads to a call to
virDomainRemoveInactive, which removes the domain from the driver's
hashtable and unref's it. Nowhere in this code is the qemu driver lock
acquired.

However, all modifications to the driver's domain hashtable *must* be
done while holding the driver lock, otherwise the hashtable can become
corrupt, and (even more likely) another thread could call a different
hashtable function and acquire a pointer to the domain that is in the
process of being destroyed.

To prevent such a disaster, qemuProcessHandleMonitorEOF must get the
qemu driver lock *before* it gets the DomainObj's lock, and hold it
until it is finished with the DomainObj. This guarantees that nobody
else modifies the hashtable at the same time, and that anyone who had
already gotten the DomainObj from the hashtable prior to this call has
finished with it before we remove/destroy it.

14 years agoqemu: Add missing lock of virDomainObj before calling virDomainUnref
Laine Stump [Thu, 3 Mar 2011 16:54:08 +0000 (11:54 -0500)]
qemu: Add missing lock of virDomainObj before calling virDomainUnref

This was found while researching the root cause of:

https://bugzilla.redhat.com/show_bug.cgi?id=670848

virDomainUnref should only be called with the lock held for the
virDomainObj in question. However, when a transient qemu domain gets
EOF on its monitor socket, it queues an event which frees the monitor,
which unref's the virDomainObj without first locking it. If another
thread has already locked the virDomainObj, the modification of the
refcount could potentially be corrupted. In an extreme case, it could
also be potentially unlocked by virDomainObjFree, thus left open to
modification by anyone else who would have otherwise waited for the
lock (not to mention the fact that they would be accessing freed
data!).

The solution is to have qemuMonitorFree lock the domain object right
before unrefing it. Since the caller to qemuMonitorFree doesn't expect
this lock to be held, if the refcount doesn't go all the way to 0,
qemuMonitorFree must unlock it after the unref.

14 years agoAUTHORS: adjust to preferred spelling
KAMEZAWA Hiroyuki [Thu, 3 Mar 2011 04:52:14 +0000 (13:52 +0900)]
AUTHORS: adjust to preferred spelling

maybe sounds strange but I've used this signature for years.
see http://en.wikipedia.org/wiki/Family_name

14 years agoesx: Escape password for XML
Matthias Bolte [Thu, 3 Mar 2011 21:11:24 +0000 (22:11 +0100)]
esx: Escape password for XML

Passwords are allowed to contain <, >, &, ', " characters.
Those need to be replaced by the corresponding entities.

Reported by Hereward Cooper.

14 years agoutil: correct retry path in virFileOperation
Eric Blake [Wed, 2 Mar 2011 23:25:57 +0000 (16:25 -0700)]
util: correct retry path in virFileOperation

In virFileOperation, the parent does a fallback to a non-fork
attempt if it detects that the child returned EACCES.  However,
the child was calling _exit(-EACCES), which does _not_ appear
as EACCES in the parent.

* src/util/util.c (virFileOperation): Correctly pass EACCES from
child to parent.

14 years agoPass virSecurityManagerPtr to virSecurityDAC{Set, Restore}ChardevCallback
Soren Hansen [Thu, 3 Mar 2011 14:47:48 +0000 (15:47 +0100)]
Pass virSecurityManagerPtr to virSecurityDAC{Set, Restore}ChardevCallback

virSecurityDAC{Set,Restore}ChardevCallback expect virSecurityManagerPtr,
but are passed virDomainObjPtr instead. This makes
virSecurityDACSetChardevLabel set a wrong uid/gid on chardevs. This
patch fixes this behaviour.

Signed-off-by: Soren Hansen <soren@linux2go.dk>
14 years agomaint: update to latest gnulib
Eric Blake [Fri, 25 Feb 2011 22:30:01 +0000 (15:30 -0700)]
maint: update to latest gnulib

* .gnulib: Update to latest, for syntax-check improvement.
* .x-sc_prohibit_empty_lines_at_EOF: Add more exemptions.

14 years agomaint: avoid long lines in more tests
Eric Blake [Fri, 25 Feb 2011 22:20:58 +0000 (15:20 -0700)]
maint: avoid long lines in more tests

* tests/xml2sexprdata/*.sexpr: Add backslash-newlines.
* tests/sexpr2xmldata/*.sexpr: Likewise.
* tests/qemuxml2argvdata/qemuxml2argv-disk-aio.args: Likewise.

14 years agoutil: Allow removing hash entries in virHashForEach
Jiri Denemark [Thu, 3 Mar 2011 13:10:51 +0000 (14:10 +0100)]
util: Allow removing hash entries in virHashForEach

This fixes a possible crash of libvirtd during its startup. When qemu
driver reconnects to running domains, it iterates over all domain
objects in a hash. When reconnecting to an associated qemu monitor
fails and the domain is transient, it's immediately removed from the
hash. Despite the fact that it's explicitly forbidden to do so. If
libvirtd is lucky enough, virHashForEach will access random memory when
the callback finishes and the deamon will crash.

Since it's trivial to fix virHashForEach to allow removal of hash
entries while iterating through them, I went this way instead of fixing
qemuReconnectDomain callback (and possibly others) to avoid deleting the
entries.

14 years agoAttempt to improve an error message
Daniel P. Berrange [Fri, 18 Feb 2011 15:52:20 +0000 (15:52 +0000)]
Attempt to improve an error message

Replace the 'Unknown failure' error message with something a
little bit more descriptive.

* src/util/virterror.c: Improve error message

14 years agoqemu: avoid double close on domain restore
Eric Blake [Wed, 2 Mar 2011 03:59:38 +0000 (20:59 -0700)]
qemu: avoid double close on domain restore

qemudDomainSaveImageStartVM was evil - it closed the incoming fd
argument on some, but not all, code paths, without informing the
caller about that action.  No wonder that this resulted in
double-closes: https://bugzilla.redhat.com/show_bug.cgi?id=672725

* src/qemu/qemu_driver.c (qemudDomainSaveImageStartVM): Alter
signature, to avoid double-close.
(qemudDomainRestore, qemudDomainObjRestore): Update callers.

14 years agoadd additional event debug points
Daniel P. Berrange [Tue, 1 Mar 2011 23:53:32 +0000 (16:53 -0700)]
add additional event debug points

Followup to commit 2222bd24

14 years agoqemu: only request sound cgroup ACL when required
Eric Blake [Fri, 25 Feb 2011 18:55:44 +0000 (11:55 -0700)]
qemu: only request sound cgroup ACL when required

When a SPICE or VNC graphics controller is present, and sound is
piggybacked over a channel to the graphics device rather than
directly accessing host hardware, then there is no need to grant
host hardware access to that qemu process.

* src/qemu/qemu_cgroup.c (qemuSetupCgroup): Prevent sound with
spice, and with vnc when vnc_allow_host_audio is 0.
Reported by Daniel Berrange.

14 years agoAdd check for kill() to fix build of cgroups on win32
Daniel P. Berrange [Mon, 28 Feb 2011 14:13:58 +0000 (14:13 +0000)]
Add check for kill() to fix build of cgroups on win32

The kill() function doesn't exist on Win32, so it needs to be
checked for at build time & code disabled in cgroups

* configure.ac: Check for kill()
* src/util/cgroup.c: Stub out virCGroupKill* functions
  when kill() isn't available

14 years agoAdd support for multiple serial ports into the Xen driver
Michal Novotny [Fri, 25 Feb 2011 14:41:12 +0000 (15:41 +0100)]
Add support for multiple serial ports into the Xen driver

this is the patch to add support for multiple serial ports to the
libvirt Xen driver. It support both old style (serial = "pty") and
new style (serial = [ "/dev/ttyS0", "/dev/ttyS1" ]) definition and
tests for xml2sexpr, sexpr2xml and xmconfig have been added as well.

Written and tested on RHEL-5 Xen dom0 and working as designed but
the Xen version have to have patch for RHBZ #614004 but this patch
is for upstream version of libvirt.

Also, this patch is addressing issue described in RHBZ #670789.

Signed-off-by: Michal Novotny <minovotn@redhat.com>
14 years agoFix port value parsing for serial and parallel ports
Michal Novotny [Fri, 25 Feb 2011 14:41:11 +0000 (15:41 +0100)]
Fix port value parsing for serial and parallel ports

this is the patch to fix the virDomainChrDefParseTargetXML() functionality
to parse the target port from XML if available. This is necessary for
multiple serial port support which is the second part of this patch.

Signed-off-by: Michal Novotny <minovotn@redhat.com>
14 years agoAdd APIs for killing off processes inside a cgroup
Daniel P. Berrange [Tue, 22 Feb 2011 17:33:59 +0000 (17:33 +0000)]
Add APIs for killing off processes inside a cgroup

The virCgroupKill method kills all PIDs found in a cgroup

The virCgroupKillRecursively method does this recursively
for child cgroups.

The virCgroupKillPainfully method does a recursive kill
several times in a row until everything has really died

14 years agoAllow hash tables to use generic pointers as keys
Daniel P. Berrange [Tue, 22 Feb 2011 15:11:59 +0000 (15:11 +0000)]
Allow hash tables to use generic pointers as keys

Relax the restriction that the hash table key must be a string
by allowing an arbitrary hash code generator + comparison func
to be provided

* util/hash.c, util/hash.h: Allow any pointer as a key
* internal.h: Include stdbool.h as standard.
* conf/domain_conf.c, conf/domain_conf.c,
  conf/nwfilter_params.c, nwfilter/nwfilter_gentech_driver.c,
  nwfilter/nwfilter_gentech_driver.h, nwfilter/nwfilter_learnipaddr.c,
  qemu/qemu_command.c, qemu/qemu_driver.c,
  qemu/qemu_process.c, uml/uml_driver.c,
  xen/xm_internal.c: s/char */void */ in hash callbacks

14 years agoRemove deallocator parameter from hash functions
Daniel P. Berrange [Tue, 22 Feb 2011 15:11:59 +0000 (15:11 +0000)]
Remove deallocator parameter from hash functions

Since the deallocator is passed into the constructor of
a hash table it is not desirable to pass it into each
function again. Remove it from all functions, but provide
a virHashSteal to allow a item to be removed from a hash
table without deleteing it.

* src/util/hash.c, src/util/hash.h: Remove deallocator
  param from all functions. Add virHashSteal
* src/libvirt_private.syms: Add virHashSteal
* src/conf/domain_conf.c, src/conf/nwfilter_params.c,
  src/nwfilter/nwfilter_learnipaddr.c,
  src/qemu/qemu_command.c, src/xen/xm_internal.c: Update
  for changed hash API

14 years agoMake commandtest more robust wrt its execution environment
Daniel P. Berrange [Thu, 24 Feb 2011 12:12:27 +0000 (12:12 +0000)]
Make commandtest more robust wrt its execution environment

When executed from cron, commandtest would fail to correctly
identify daemon processes. Set session ID and process group
IDs at startup to ensure we have a consistent environment to
run in.

* tests/commandtest.c: Call setsid() and setpgid()

14 years agoFix spelling mistake: seek
Philipp Hahn [Thu, 24 Feb 2011 07:06:03 +0000 (08:06 +0100)]
Fix spelling mistake: seek

Replace wrong "set" by correct "seek" in error message.

Signed-off-by: Philipp Hahn <hahn@univention.de>
14 years agoaudit: audit qemu pci and usb device passthrough
Eric Blake [Wed, 23 Feb 2011 23:15:23 +0000 (16:15 -0700)]
audit: audit qemu pci and usb device passthrough

* src/qemu/qemu_audit.h (qemuDomainHostdevAudit): New prototype.
* src/qemu/qemu_audit.c (qemuDomainHostdevAudit): New function.
(qemuDomainStartAudit): Call as appropriate.
* src/qemu/qemu_hotplug.c (qemuDomainAttachHostPciDevice)
(qemuDomainAttachHostUsbDevice, qemuDomainDetachHostPciDevice)
(qemuDomainDetachHostUsbDevice): Likewise.

14 years agoaudit: audit qemu memory and vcpu adjusments
Eric Blake [Tue, 22 Feb 2011 00:02:17 +0000 (17:02 -0700)]
audit: audit qemu memory and vcpu adjusments

* src/qemu/qemu_audit.h (qemuDomainMemoryAudit)
(qemuDomainVcpuAudit): New prototypes.
* src/qemu/qemu_audit.c (qemuDomainResourceAudit)
(qemuDomainMemoryAudit, qemuDomainVcpuAudit): New functions.
(qemuDomainStartAudit): Call as appropriate.
* src/qemu/qemu_driver.c (qemudDomainSetMemory)
(qemudDomainHotplugVcpus): Likewise.

14 years agoaudit: add qemu hooks for auditing cgroup events
Eric Blake [Wed, 16 Feb 2011 02:35:43 +0000 (19:35 -0700)]
audit: add qemu hooks for auditing cgroup events

* src/qemu/qemu_audit.h (qemuDomainCgroupAudit): New prototype.
* src/qemu/qemu_audit.c (qemuDomainCgroupAudit): Implement it.
* src/qemu/qemu_driver.c (qemudDomainSaveFlag): Add audit.
* src/qemu/qemu_cgroup.c (qemuSetupDiskPathAllow)
(qemuSetupChardevCgroup, qemuSetupHostUsbDeviceCgroup)
(qemuSetupCgroup, qemuTeardownDiskPathDeny): Likewise.

14 years agoaudit: prepare qemu for listing vm in cgroup audits
Eric Blake [Wed, 16 Feb 2011 02:18:40 +0000 (19:18 -0700)]
audit: prepare qemu for listing vm in cgroup audits

* src/qemu/qemu_cgroup.h (struct qemuCgroupData): New helper type.
(qemuSetupDiskPathAllow, qemuSetupChardevCgroup)
(qemuTeardownDiskPathDeny): Drop unneeded prototypes.
(qemuSetupDiskCgroup, qemuTeardownDiskCgroup): Adjust prototype.
* src/qemu/qemu_cgroup.c
(qemuSetupDiskPathAllow, qemuSetupChardevCgroup)
(qemuTeardownDiskPathDeny): Mark static and use new type.
(qemuSetupHostUsbDeviceCgroup): Use new type.
(qemuSetupDiskCgroup): Alter signature.
(qemuSetupCgroup): Adjust caller.
* src/qemu/qemu_hotplug.c (qemuDomainAttachHostUsbDevice)
(qemuDomainDetachPciDiskDevice, qemuDomainDetachSCSIDiskDevice):
Likewise.
* src/qemu/qemu_driver.c (qemudDomainAttachDevice)
(qemuDomainUpdateDeviceFlags): Likewise.

14 years agocgroup: determine when skipping non-devices
Eric Blake [Thu, 17 Feb 2011 00:05:54 +0000 (17:05 -0700)]
cgroup: determine when skipping non-devices

* src/util/cgroup.c (virCgroupAllowDevicePath)
(virCgroupDenyDevicePath): Don't fail with EINVAL for
non-devices.
* src/qemu/qemu_driver.c (qemudDomainSaveFlag): Update caller.
* src/qemu/qemu_cgroup.c (qemuSetupDiskPathAllow)
(qemuSetupChardevCgroup, qemuSetupHostUsbDeviceCgroup)
(qemuSetupCgroup, qemuTeardownDiskPathDeny): Likewise.

14 years agovirExec: avoid uninitialized memory usage
Eric Blake [Mon, 21 Feb 2011 21:27:04 +0000 (14:27 -0700)]
virExec: avoid uninitialized memory usage

valgrind warns:

==21079== Syscall param rt_sigaction(act->sa_mask) points to uninitialised byte(s)
==21079==    at 0x329840F63E: __libc_sigaction (sigaction.c:67)
==21079==    by 0x4E5A8E7: __virExec (util.c:661)

Regression introduced in commit ab07533e.  Technically, sa_mask
shouldn't affect operation if sa_flags selects sa_handler, and
sa_handler selects SIG_IGN, but better safe than sorry.

* src/util/util.c (__virExec): Supply missing sigemptyset.

14 years agoAllow 32-on-64 execution for LXC guests
Daniel P. Berrange [Wed, 23 Feb 2011 17:17:53 +0000 (17:17 +0000)]
Allow 32-on-64 execution for LXC guests

Using the 'personality(2)' system call, we can make a container
on an x86_64 host appear to be i686. Likewise for most other
Linux 64bit arches.

* src/lxc/lxc_conf.c: Fill in 32bit capabilities for x86_64 hosts
* src/lxc/lxc_container.h, src/lxc/lxc_container.c: Add API to
  check if an arch has a 32bit alternative
* src/lxc/lxc_controller.c: Set the process personality when
  starting guest

14 years agoPut <stdbool.h> into internal.h so it is available everywhere
Daniel P. Berrange [Wed, 23 Feb 2011 11:37:03 +0000 (11:37 +0000)]
Put <stdbool.h> into internal.h so it is available everywhere

Remove the <stdbool.h> header from all source files / headers
and just put it into internal.h

* src/internal.h: Add <stdbool.h>

14 years agoqemu: Switch over command line capabilities to virBitmap
Jiri Denemark [Tue, 8 Feb 2011 14:22:39 +0000 (15:22 +0100)]
qemu: Switch over command line capabilities to virBitmap

This is done for two reasons:
- we are getting very close to 64 flags which is the maximum we can use
  with unsigned long long
- by using LL constants in enum we already violates C99 constraint that
  enum values have to fit into int

14 years agoqemu: Rename qemud\?CmdFlags to qemuCaps
Jiri Denemark [Tue, 8 Feb 2011 14:28:53 +0000 (15:28 +0100)]
qemu: Rename qemud\?CmdFlags to qemuCaps

The new name complies more with the fact that it contains a set of
qemuCapsFlags.

14 years agoqemu: Use helper functions for handling cmd line capabilities
Jiri Denemark [Tue, 8 Feb 2011 14:08:12 +0000 (15:08 +0100)]
qemu: Use helper functions for handling cmd line capabilities

Three new functions (qemuCapsSet, qemuCapsClear, and qemuCapsGet) were
introduced replacing direct bit operations.

14 years agoqemu: Rename QEMUD_CMD_FLAG_* to QEMU_CAPS_*
Jiri Denemark [Mon, 7 Feb 2011 14:54:08 +0000 (15:54 +0100)]
qemu: Rename QEMUD_CMD_FLAG_* to QEMU_CAPS_*

The new names comply more with the fact that they are all members of
enum qemuCapsFlags.

14 years agoutil: Add API for converting virBitmap into printable string
Jiri Denemark [Wed, 9 Feb 2011 12:14:51 +0000 (13:14 +0100)]
util: Add API for converting virBitmap into printable string

14 years agoutil: Use unsigned long as a base type for virBitmap
Jiri Denemark [Thu, 10 Feb 2011 10:11:15 +0000 (11:11 +0100)]
util: Use unsigned long as a base type for virBitmap

14 years agoExpose name + UUID to LXC containers via env variables
Daniel P. Berrange [Tue, 22 Feb 2011 13:09:19 +0000 (13:09 +0000)]
Expose name + UUID to LXC containers via env variables

When spawning 'init' in the container, set

  LIBVIRT_LXC_UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
  LIBVIRT_LXC_NAME=YYYYYYYYYYYY

to allow guest software to detect & identify that they
are in a container

* src/lxc/lxc_container.c: Set LIBVIRT_LXC_UUID and
  LIBVIRT_LXC_NAME env vars

14 years agoFix discard of expected errors
Daniel P. Berrange [Tue, 22 Feb 2011 17:31:35 +0000 (17:31 +0000)]
Fix discard of expected errors

In a couple of commands virsh catches & ignores errors, but fails
to reset last_error. Thus the error is ignored, but still reported
to the user.

* tools/virsh.c: Reset last_error if ignoring an error

14 years agoFix off-by-1 in virFileAbsPath.
Daniel P. Berrange [Tue, 22 Feb 2011 17:08:12 +0000 (17:08 +0000)]
Fix off-by-1 in virFileAbsPath.

The virFileAbsPath was not taking into account the '/' directory
separator when allocating memory for combining cwd + path. Convert
to use virAsprintf to avoid this type of bug completely.

* src/util/util.c: Convert virFileAbsPath to use virAsprintf

14 years agoFix group/mode for /dev/pts inside LXC container
Daniel P. Berrange [Tue, 22 Feb 2011 14:06:09 +0000 (14:06 +0000)]
Fix group/mode for /dev/pts inside LXC container

Normal practice for /dev/pts is to have it mode=620,gid=5
but LXC was leaving mode=000,gid=0 preventing unprivilegd
users in the guest use of PTYs

* src/lxc/lxc_controller.c: Fix /dev/pts setup

14 years agosecurity: avoid memory leak
Eric Blake [Mon, 21 Feb 2011 22:05:24 +0000 (15:05 -0700)]
security: avoid memory leak

Leak introduced in commit d6623003.

* src/qemu/qemu_driver.c (qemuSecurityInit): Avoid leak on failure.
* src/security/security_stack.c (virSecurityStackClose): Avoid
leaking component drivers.

14 years ago802.1Qbh: Delay IFF_UP'ing interface until migration final stage
Roopa Prabhu [Tue, 22 Feb 2011 12:48:54 +0000 (07:48 -0500)]
802.1Qbh: Delay IFF_UP'ing interface until migration final stage

Current code does an IFF_UP on a 8021Qbh interface immediately after a port
profile set. This is ok in most cases except when its the migration prepare
stage. During migration we want to postpone IFF_UP'ing the interface on the
destination host until the source host has disassociated the interface.
This patch moves IFF_UP of the interface to the final stage of migration.
The motivation for this change is to postpone any addr registrations on the
destination host until the source host has done the addr deregistrations.

While at it, for symmetry with associate move ifDown of a 8021Qbh interface
to before disassociate

14 years agostorage: make debug log more useful
Osier Yang [Tue, 22 Feb 2011 02:10:31 +0000 (10:10 +0800)]
storage: make debug log more useful

"__func__" is useless there, as VIR_DEBUG will print the function
name.

* src/storage/storage_backend_mpath.c

14 years agovirsh: replace vshPrint with vshPrintExtra for snapshot list
Osier Yang [Tue, 22 Feb 2011 02:06:08 +0000 (10:06 +0800)]
virsh: replace vshPrint with vshPrintExtra for snapshot list
Otherwise extra information will be printed even if "--quiet"
is specified.

* tools/virsh.c

14 years agocheck device-mapper when building with mpath or disk storage driver
Wen Congyang [Mon, 21 Feb 2011 01:57:24 +0000 (09:57 +0800)]
check device-mapper when building with mpath or disk storage driver

Currently, we need virIsDevMapperDevice() when we build libvirt with
disk or mpath storage drivers.  So we should check device-mapper-devel
when we build with disk storage driver but without mpath storage
driver.

14 years agobuild: add dependency on gnutls-utils
Eric Blake [Mon, 21 Feb 2011 17:43:29 +0000 (10:43 -0700)]
build: add dependency on gnutls-utils

* libvirt.spec.in (Requires): Add gnutls-utils, for virt-pki-validate.
Suggested by Daniel P. Berrange.

14 years agoRenamed functions in xenxs
Markus Groß [Mon, 21 Feb 2011 13:40:12 +0000 (14:40 +0100)]
Renamed functions in xenxs

14 years agoMoved XM formatting functions to xenxs
Markus Groß [Mon, 21 Feb 2011 13:40:11 +0000 (14:40 +0100)]
Moved XM formatting functions to xenxs

14 years agoMoved XM parsing functions to xenxs
Markus Groß [Mon, 21 Feb 2011 13:40:10 +0000 (14:40 +0100)]
Moved XM parsing functions to xenxs

14 years agoMoved SEXPR formatting functions to xenxs
Markus Groß [Mon, 21 Feb 2011 13:40:09 +0000 (14:40 +0100)]
Moved SEXPR formatting functions to xenxs

14 years agoMoved SEXPR parsing functions to xenxs
Markus Groß [Mon, 21 Feb 2011 13:40:08 +0000 (14:40 +0100)]
Moved SEXPR parsing functions to xenxs

14 years agoMoved some SEXPR functions from xen-unified
Markus Groß [Mon, 21 Feb 2011 13:40:07 +0000 (14:40 +0100)]
Moved some SEXPR functions from xen-unified

14 years agoMoved SEXPR unit to utils
Markus Groß [Mon, 21 Feb 2011 13:40:06 +0000 (14:40 +0100)]
Moved SEXPR unit to utils

14 years agoprotect the scsi controller to be deleted when it is in use
Wen Congyang [Mon, 21 Feb 2011 07:35:52 +0000 (15:35 +0800)]
protect the scsi controller to be deleted when it is in use

Steps to reproduce this bug:
1. virsh attach-disk domain --source imagefile --target sdb --sourcetype file --driver qemu --subdriver raw
2. virsh detach-device controller.xml # remove scsi controller 0
3. virsh detach-disk domain sdb
   error: Failed to detach disk
   error: operation failed: detaching scsi0-0-1 device failed: Device 'scsi0-0-1' not found

I think we should not detach a controller when it is used by some other device.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
14 years agomaint: fix grammar in error message
Eric Blake [Mon, 21 Feb 2011 17:35:25 +0000 (10:35 -0700)]
maint: fix grammar in error message

* python/tests/create.py: Use correct wording.

14 years agovirt-*-validate.in: quote all variable references
Dan Kenigsberg [Sun, 20 Feb 2011 20:29:26 +0000 (22:29 +0200)]
virt-*-validate.in: quote all variable references

Alas, the shell is not a real programming language.

Patch generated by manual confirmation of vim's
s/[^"]\@<=\$\S\+\s\@=/"&"/gc
and
s/\(echo \)\@<=[^"].*\$.*$/"&"/c matches.

This patch generate a lot of noise and carries little benefits, as
I do not really expect $PKI to contain spaces or backticks. I'm just
fuming, and would not really mind if this patch is ignored

14 years agovirt-pki-validate: behave when CERTTOOL is missing
Dan Kenigsberg [Sun, 20 Feb 2011 20:29:25 +0000 (22:29 +0200)]
virt-pki-validate: behave when CERTTOOL is missing

14 years agoautobuild.sh: use VPATH build
Eric Blake [Fri, 30 Apr 2010 14:52:54 +0000 (08:52 -0600)]
autobuild.sh: use VPATH build

Try to avoid future regressions on the VPATH front.

* autobuild.sh: Uncomment VPATH use.
* .gitignore: Exclude build directory.

14 years agomaint: fix 'make dist' in VPATH build
Eric Blake [Fri, 18 Feb 2011 21:40:35 +0000 (14:40 -0700)]
maint: fix 'make dist' in VPATH build

A diff of 'make dist' from in-tree vs. a VPATH build showed
that we were missing docs/api_extension/*.patch files, but
shipping other files that we didn't need.

* bootstrap.conf (gnulib_extra_files): Don't distribute files we
don't care about.
* docs/Makefile.am (patches): Perform wildcard correctly.

14 years agobuild: don't require pod2man for tarball builds
Eric Blake [Wed, 16 Feb 2011 22:43:24 +0000 (15:43 -0700)]
build: don't require pod2man for tarball builds

Right now, 'man libvirtd' includes information that depends on
configure results, so it must be generated on the fly and live
in $(builddir); however, requiring pod2man on all end user
machines is overkill.  Meanwhile, 'man virsh' doesn't mention
any configure results, so it can be built at 'make dist' time.
If that situation changes in the future, we can generate virsh.1
in the same way that we generate libvirtd.8.

* daemon/Makefile.am (libvirtd.8.in): New rule, to run pod2man in
advance of distribution.
(libvirtd.8): Use only sed from tarball.
(EXTRA_DIST): Ship new file.
(libvirtd.pod): Delete unused rule.
(man8_MANS): Let automake know which section to use.
(CLEANFILES, MAINTAINERCLEANFILES): Adjust to new files.
* tools/Makefile.am (dist_man1_MANS): Distribute pre-built man
pages, fine since they don't require any substitution.
(virt-xml-validate.1, virt-pki-validate.1): Change input source.
(virsh.1): Build into srcdir.
(CLEANFILES, MAINTAINERCLEANFILES): Adjust to new build style.
* daemon/.gitignore: Update.
Reported by Diego Elio Pettenò.

14 years agomaint: kill all remaining uses of old DEBUG macro
Eric Blake [Wed, 16 Feb 2011 23:37:57 +0000 (16:37 -0700)]
maint: kill all remaining uses of old DEBUG macro

Done mechanically with:
$ git grep -l '\bDEBUG0\? *(' | xargs -L1 sed -i 's/\bDEBUG0\? *(/VIR_&/'

followed by manual deletion of qemudDebug in daemon/libvirtd.c, along
with a single 'make syntax-check' fallout in the same file, and the
actual deletion in src/util/logging.h.

* src/util/logging.h (DEBUG, DEBUG0): Delete.
* daemon/libvirtd.h (qemudDebug): Likewise.
* global: Change remaining clients over to VIR_DEBUG counterpart.

14 years agohash: make virHashFree more free-like
Eric Blake [Fri, 18 Feb 2011 21:30:24 +0000 (14:30 -0700)]
hash: make virHashFree more free-like

Two-argument free functions are uncommon; match the style elsewhere
by caching the callback at creation.

* src/util/hash.h (virHashCreate, virHashFree): Move deallocator
argument to creation.
* cfg.mk (useless_free_options): Add virHashFree.
* src/util/hash.c (_virHashTable): Track deallocator.
(virHashCreate, virHashFree): Update to new signature.
* src/conf/domain_conf.c (virDomainObjListDeinit)
(virDomainObjListInit, virDomainDiskDefForeachPath)
(virDomainSnapshotObjListDeinit, virDomainSnapshotObjListInit):
Update callers.
* src/conf/nwfilter_params.c (virNWFilterHashTableFree)
(virNWFilterHashTableCreate): Likewise.
* src/conf/nwfilter_conf.c (virNWFilterTriggerVMFilterRebuild):
Likewise.
* src/cpu/cpu_generic.c (genericHashFeatures, genericBaseline):
Likewise.
* src/xen/xm_internal.c (xenXMOpen, xenXMClose): Likewise.
* src/nwfilter/nwfilter_learnipaddr.c (virNWFilterLearnInit)
(virNWFilterLearnShutdown): Likewise.
* src/qemu/qemu_command.c (qemuDomainPCIAddressSetCreate)
(qemuDomainPCIAddressSetFree): Likewise.
* src/qemu/qemu_process.c (qemuProcessWaitForMonitor): Likewise.

14 years agobuild: Fix API docs generation in VPATH build
Jiri Denemark [Fri, 18 Feb 2011 11:12:28 +0000 (12:12 +0100)]
build: Fix API docs generation in VPATH build

XSLT allows for two ways of generating the output of transformation.
Either implicit, which xsltproc prints to stdout and can be redirected
to a file using -o file. Or explicit, which means the stylesheet
contains <xsl:document> element which specifies where the output should
be saved. This can be used for generating more files by a single run of
xsltproc and -o directory/ can change the directory where the output
files will be stored.

devhelp.xsl is special in that it combines both options in one
stylesheet, which doesn't work well with -o:

xsltproc --nonet -o ./devhelp/ ./devhelp/devhelp.xsl ./libvirt-api.xml

Outputs 4 *.html files into ./devhelp but then tries to write to
./devhelp/ as a file (hence the I/O error) rather than writing output to
the fifth file devhelp/libvirt.devhelp.

This patch modifies devhelp.xsl so that all files are generated using
<xsl:document> element and -o directory/ can be used to override output
directory where those files are saved.