Commit Graph

6505 Commits

Author SHA1 Message Date
Daniel Veillard
d17e438ad3 Release of libvirt-0.9.0
* configure.ac docs/news.html.in libvirt.spec.in: update for the release
* po/*.po*: update polish translation and regenerate
2011-04-04 20:15:45 +08:00
Wen Congyang
4a3976211d fix memory leak in qemuProcessHandleGraphics()
If strdup("x509dname") or strdup("saslUsername") success, but
strdup(x509dname) or strdup(saslUsername) failed, subject->nidentity
is not the num elements of subject->identities, and we will leak some
memory.
2011-04-03 09:13:53 +08:00
Wen Congyang
19f916a764 do not lock vm while allocating memory
There is no need to lock vm while allocating memory. If allocating
memory failed, we forgot to unlock vm.
2011-04-03 09:13:46 +08:00
Eric Blake
d958874780 docs: fix typo
* docs/formatdomain.html.in: Fix KVM name.
2011-04-01 16:18:18 -06:00
Eric Blake
b5ec89d955 docs: correct invalid xml
* docs/internals.html.in: Fix xml errors.
* docs/formatstorageencryption.html.in: Likewise.
* docs/drvesx.html.in: Likewise.
* docs/archnetwork.html.in: Likewise.
* docs/logging.html.in: Likewise.
* docs/drvvmware.html.in: Likewise.
* docs/api.html.in: Likewise.
* docs/formatnwfilter.html.in: Likewise.
* docs/formatdomain.html.in: Likewise.
* docs/windows.html.in: Likewise.
2011-04-01 16:03:11 -06:00
Eric Blake
da3c471467 virsh: fix mingw failure on creating nonblocking pipe
* .gnulib: Update to latest, for nonblocking module.
* bootstrap.conf (gnulib_modules): Add nonblocking.
* src/util/util.c (virSetBlocking): Defer to gnulib.
2011-04-01 08:43:10 -06:00
Daniel Veillard
03ede2f69d Fix libxl driver startup
When you happen to have a libvirtd binary compiled with the
libxenlight driver (say you have installed xen-4.1 libraries)
but not running a xen enabled system, then libvirtd fails to start.

The cause is that libxlStartup() returns -1 when failing to initialize
the library, and this propagates to virStateInitialize() which consider
this a failure. We should only exit libxlStartup with an error code
if something like an allocation error occurs, not if the driver failed
to initialize.

* src/libxl/libxl_driver.c: fix libxlStartup() to not return -1
  when failing to initialize the libxenlight library
2011-04-01 19:30:53 +08:00
Jiri Denemark
1e8f20799c virsh: Fix documentation for memtune command
Commit 78ba748ef1 claims to fix
documentation for swap_hard_limit virsh memtune option but it only fixes
documentation in formatdomain.html and libvirt.h. This patch completes
the task by fixing "virsh help memtune" output and memtune section of
virsh man page.
2011-04-01 11:31:10 +02:00
Guido Günther
d0bd206a61 Make check_fc_host() and check_vport_capable() usable as rvalues
as needed on non linux ports using HAL.
2011-04-01 11:23:51 +02:00
Jiri Denemark
72ab0b6dc8 qemu: Ignore libvirt debug messages in qemu log
qemu driver uses a 4K buffer for reading qemu log file. This is enough
when only qemu's output is present in the log file. However, when
debugging messages are turned on, intermediate libvirt process fills the
log with a bunch of debugging messages before it executes qemu binary.
In such a case the buffer may become too small. However, we are not
really interested in libvirt messages so they can be filtered out from
the buffer.
2011-04-01 08:48:32 +02:00
Osier Yang
0ca16a78af qemu: Fix improper logic of qemuCgroupSetup
It throws errors as long as the cgroup controller is not available,
regardless of whether we really want to use it to do setup or not,
which is not what we want, fixing it with throwing error when need
to use the controller.

And change "VIR_WARN" to "qemuReportError" for memory controller
incidentally.
2011-04-01 11:41:33 +08:00
Wen Congyang
e206946da7 free tmp after unlinking it
We create a temporary file to save memory, and we will remove it after reading
memory to buffer. But we free the variable that contains the temporary filename
before we remove it. So we should free tmp after unlinking it.
2011-04-01 12:15:21 +08:00
Michal Privoznik
51434d3bef Fix several formatting mistakes in doc 2011-03-31 14:36:19 -06:00
Daniel P. Berrange
e44e8e253c Remove iohelper on Win32 since it is not required
The iohelper binary is not required on Win32, although it compiles
without trouble. Simply remove it from the RPM.

* mingw32-libvirt.spec.in: Remove iohelper
2011-03-31 17:41:51 +01:00
Daniel P. Berrange
242195425c Fix domain events C example on Win32
printf on Win32 does not necessarily support %lld and we don't
have GNULIBs wrapper for printf(). Switch to use asprintf() for
which we do have a gnulib wrapper with %lld support

* examples/domain-events/events-c/event-test.c: Fix formatting
  of %lld on Win32
* cfg.mk: Don't require use of virAsprintf since this is an
  example app for out of tree users to follow
2011-03-31 16:01:49 +01:00
Eric Blake
6c9e89bbd2 maint: avoid locale-sensitivity in string case comparisons
strcase{cmp/str} have the drawback of being sensitive to the global
locale; this is unacceptable in a library setting.  Prefer a
hard-coded C locale alternative for all but virsh, which is user
facing and where the global locale isn't changing externally.

* .gnulib: Update to latest, for c-strcasestr change.
* bootstrap.conf (gnulib_modules): Drop strcasestr, add c-strcase
and c-strcasestr.
* cfg.mk (sc_avoid_strcase): New rule.
(exclude_file_name_regexp--sc_avoid_strcase): New exception.
* src/internal.h (STRCASEEQ, STRCASENEQ, STRCASEEQLEN)
(STRCASENEQLEN): Adjust offenders.
* src/qemu/qemu_monitor_text.c (qemuMonitorTextEjectMedia):
Likewise.
* tools/virsh.c (namesorter): Document exception.
2011-03-30 20:26:27 -06:00
Eric Blake
06732e1a7d docs: mention C89 syntax preferences
* docs/hacking.html.in (Code formatting): Document that // comment
and declaration-after-statement are discouraged.
* HACKING: Regenerate.
2011-03-30 13:51:22 -06:00
Jiri Denemark
e586f57487 qemu: Fix media eject with qemu-0.12.*
In qemu-0.12.* "device '...' is locked" message was changed to "Device
..." so libvirt was no longer detecting this as an error.
2011-03-30 20:43:55 +02:00
Daniel Veillard
6c8f24751e The next release is 0.9.0 not 0.8.9
Fix this which went into documentation
2011-03-30 21:30:54 +08:00
Wen Congyang
0ecfa7f2e1 check whether qemuMonitorJSONHMP() failed
If qemu quited unexpectedly when we call qemuMonitorJSONHMP(),
libvirt will crash.
Steps to reproduce this bug:
1. use gdb to attach libvirtd, and set a breakpoint in the function
   qemuMonitorSetCapabilities()
2. start a vm
3. let the libvirtd to run until qemuMonitorJSONSetCapabilities() returns.
4. kill the qemu process
5. continue running libvirtd

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
2011-03-30 16:32:22 +08:00
Wen Congyang
cc2424fc65 do not send monitor command after monitor meet error
If the monitor met a error, and we will call qemuProcessHandleMonitorEOF().
But we may try to send monitor command after qemuProcessHandleMonitorEOF()
returned. Then libvirtd will be blocked in qemuMonitorSend().

Steps to reproduce this bug:
1. use gdb to attach libvirtd, and set a breakpoint in the function
   qemuConnectMonitor()
2. start a vm
3. let the libvirtd to run until qemuMonitorOpen() returns.
4. kill the qemu process
5. continue running libvirtd

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
2011-03-30 16:32:22 +08:00
Hu Tao
025e199810 qemu: unlock qemu driver before return from domain save
qemuDriverUnlock() wasn't called on 2 exit paths
* src/qemu/qemu_driver.c: fix qemudDomainSave() to always unlock
  the driver before exiting on error
2011-03-30 10:34:16 +08:00
Naoya Horiguchi
343a27aff8 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
2011-03-30 09:19:47 +08:00
Daniel Veillard
1613912dc2 Add libvirt_iohelper to spec file
The new iohelper binary was missing from the packaging spec
2011-03-30 08:54:23 +08:00
Osier Yang
079ae9c7a1 cputune: New tests for cputune XML
v1 - v2:
  * Add missed tests/qemuxml2argvdata/qemuxml2argv-cputune.args
2011-03-29 22:13:46 +08:00
Osier Yang
01692bb167 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?
2011-03-29 22:13:46 +08:00
Osier Yang
e98eb7f4a5 cputune: Support cputune for lxc driver
LXC driver doesn't support vcpu affinity yet, so just need
to modify it to support cpu shares.
2011-03-29 22:13:46 +08:00
Osier Yang
1cc4d0259c 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.
2011-03-29 22:13:46 +08:00
Osier Yang
b8853925fa 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"
2011-03-29 22:13:46 +08:00
Osier Yang
853f0fdfd9 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
2011-03-29 22:13:46 +08:00
Osier Yang
6b3644202a cputune: Add document for cputune XML
v1 - v3:
  * More clear document for "cpu shares", adopted suggestions from
    Matthias Bottle and Daniel Veillard.
2011-03-29 22:13:45 +08:00
Osier Yang
e3ea882821 cputune: Add XML schema for cputune xml
v1 - v2:
  * Remove upper limit of cpu shares. (Suggested by Matthias Bottle)
2011-03-29 22:13:45 +08:00
Eric Blake
daa6aa687a 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.
2011-03-29 07:12:29 -06:00
Eric Blake
285e8a1769 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.
2011-03-29 07:12:29 -06:00
Eric Blake
e54a2f9340 maint: ignore new built file
* .gitignore: Exclude libvirt_iohelper.
2011-03-29 07:12:29 -06:00
Markus Groß
6ebcb0c777 Add domainSuspend/Resume to libxl driver
* src/libxl/libxl_driver.c: implements libxlDomainSuspend and
  libxlDomainResume
2011-03-29 20:57:02 +08:00
Markus Groß
f367a1dfce Add domainGetOSType to libxl driver
* src/libxl/libxl_driver.c: implements libxlDomainGetOSType
2011-03-29 20:57:02 +08:00
Markus Groß
d53bca4868 Add domainGetSchedulerType to libxl driver
* src/libxl/libxl_driver.c: implements libxlDomainGetSchedulerType
2011-03-29 20:57:02 +08:00
Markus Groß
0244977180 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
2011-03-29 20:57:02 +08:00
Markus Groß
3d6fe99c5c 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
2011-03-29 20:57:02 +08:00
Markus Groß
cbf2717cfd List authors in copyright headers
* src/libxl/libxl_conf.[ch] src/libxl/libxl_driver.[ch]: add authors
  after the licence template
2011-03-29 20:57:02 +08:00
Markus Groß
68e1032378 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)
2011-03-29 20:57:02 +08:00
Markus Groß
6d60ca5d58 Ignore return value of virDomainObjUnref
* src/libxl/libxl_driver.c: use ignore_value() in libxlDomainObjUnref
  and libxlCreateDomEvents
2011-03-29 20:57:02 +08:00
Daniel P. Berrange
88416593e1 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
2011-03-29 12:17:58 +01:00
Daniel P. Berrange
230a5d8b4a 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
2011-03-29 12:17:52 +01:00
Daniel P. Berrange
925639627c 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
2011-03-29 12:17:45 +01:00
Daniel P. Berrange
6299ca71c4 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
2011-03-29 12:17:38 +01:00
Daniel P. Berrange
7300f68dff 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
2011-03-29 12:17:33 +01:00
Daniel P. Berrange
e886237af5 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
2011-03-29 12:17:28 +01:00
Daniel P. Berrange
0c97e70b74 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
2011-03-29 10:59:46 +01:00