]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
13 years agostorage: Ensure the device path exists before refreshing disk pool
Osier Yang [Mon, 19 Sep 2011 07:35:15 +0000 (15:35 +0800)]
storage: Ensure the device path exists before refreshing disk pool

Doing libvirt_parthelper on an not existed device path will get
an unfriendly error message. This patch is to prohibit it.

13 years agodaemon: Error and exit if specified value for timeout is not valid
Osier Yang [Mon, 19 Sep 2011 04:16:45 +0000 (12:16 +0800)]
daemon: Error and exit if specified value for timeout is not valid

Silently setting "timeout" as -1 if the specified value is invalid
is a bit confused.

13 years agoRemove devname identifier from autogenerated RPC code
Peter Krempa [Mon, 19 Sep 2011 14:14:34 +0000 (16:14 +0200)]
Remove devname identifier from autogenerated RPC code

Patch 79cf07a missed one instance of "devname" in source for RPC code
generator.

13 years agovirsh: tweak previous domblkstat patch
Eric Blake [Mon, 19 Sep 2011 20:49:08 +0000 (14:49 -0600)]
virsh: tweak previous domblkstat patch

Translators are likely to botch trailing spacing; by doing the
formatting outside of the translation, we can generally get
better alignment.  Also, for consistency, use 'bytes read' to
match 'bytes written'.

* tools/virsh.c (domblkstat_output): Drop trailing space. Tweak
rd_bytes output.
(cmdDomblkstat, DOMBLKSTAT_LEGACY_PRINT): Update formatting.

13 years agovirsh: doc: Fix supported driver types for attach-disk command
Peter Krempa [Mon, 19 Sep 2011 12:57:07 +0000 (14:57 +0200)]
virsh: doc: Fix supported driver types for attach-disk command

Virsh man page lists driver types to be used with attach-device
command, but does not specify that those are usable only with the XEN
Hypervisor.

This patch adds statement, that those options specified are applicable
only on the Xen hypervisor and adds option usable with qemu emulator.

This patch also changes type of error returned by QEMU driver if the
user specifies incompatible driver type from VIR_ERR_INTERNAL_ERROR to
VIR_ERR_CONFIG_UNSUPPORTED.

13 years agomaint: Prefer names over email in 'git shortlog'
Eric Blake [Mon, 19 Sep 2011 22:34:10 +0000 (16:34 -0600)]
maint: Prefer names over email in 'git shortlog'

Alex recently committed some patches with just an email instead
of a preferred name; this fixes things so 'git shortlog' gives
nicer output.

* .mailmap: Update.

13 years agovirsh: Add more human-friendly output of domblkstat command
Peter Krempa [Mon, 19 Sep 2011 12:23:12 +0000 (14:23 +0200)]
virsh: Add more human-friendly output of domblkstat command

Users of virsh complain that output of the domblkstat command
is not intuitive enough. This patch adds explanation of fields
returned by this command to the help section for domblkstat and
the man page of virsh. Also a switch --human is added for
domblkstat that prints the fields with more descriptive
texts.

This patch also changes sequence of the output fields and their
names back to the order and spelling established by previous
versions of virsh to maintain compatibility with scripts.

Example of ordered and "translated" output:

PRE-patch:

virsh # domblkstat 1 vda
vda wr_bytes 5170176
vda wr_operations 511
vda rd_bytes 82815488
vda rd_operations 3726

POST-patch:

virsh # domblkstat 1 vda
vda rd_req 3726
vda rd_bytes 82815488
vda wr_req 478
vda wr_bytes 4965376

Example of human readable output:

virsh # domblkstat 1 vda --human
Device: vda
 number of read operations:      3726
 number of read bytes:           82815488
 number of write operations:     478
 number of bytes written:        4965376

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

13 years agovmx: avoid memory leak
ajia@redhat.com [Mon, 19 Sep 2011 02:34:06 +0000 (10:34 +0800)]
vmx: avoid memory leak

* src/vmx/vmx.c: fix memory leak, 'def' has a initial value 'NULL', so
  'goto cleanup' is perfected instead of adding a virConfFree before
  'return NULL'.

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agoutil: avoid memory leak
ajia@redhat.com [Sun, 18 Sep 2011 16:36:13 +0000 (00:36 +0800)]
util: avoid memory leak

Leak in pciGetVirtualFunctionIndex present since commit 17d64ca.

* src/util/pci.c: fix memory leak.

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agoremote: avoid memory leak
ajia@redhat.com [Sun, 18 Sep 2011 16:36:12 +0000 (00:36 +0800)]
remote: avoid memory leak

Leak present since introduction of remoteDomainBuildEventGraphics
in commit 987e31e.

* src/remote/remote_driver.c: fix memory leak.

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agoqemu: avoid memory leak
ajia@redhat.com [Sun, 18 Sep 2011 16:36:11 +0000 (00:36 +0800)]
qemu: avoid memory leak

Leak introduced in commit 036ad50, affects only error case.

* src/qemu/qemu_command.c: fix memory leak.

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agodaemon: avoid memory leak
ajia@redhat.com [Sun, 18 Sep 2011 16:36:10 +0000 (00:36 +0800)]
daemon: avoid memory leak

Introduced in commit efa7fc9f.

* daemon/remote.c: fix memory leak in remoteDispatchDomainBlockStatsFlags

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agospec: silence warnings when installing in F16
Eric Blake [Fri, 16 Sep 2011 22:40:25 +0000 (16:40 -0600)]
spec: silence warnings when installing in F16

https://bugzilla.redhat.com/show_bug.cgi?id=738725 documents that
'yum install libvirt' in Fedora 16 is rather noisy.  This fixes
the problems.

* libvirt.spec.in (%post client): Silence chkconfig warning about
SysV services.
(%post) [with_cgconfig]: Drop for Fedora 15 and newer, where
systemd does this automatically.

13 years agosnapshot: allow disk snapshots of qcow2 disks
Eric Blake [Sat, 17 Sep 2011 12:16:08 +0000 (06:16 -0600)]
snapshot: allow disk snapshots of qcow2 disks

For all types of disks other than qcow2, we were requesting that
SELinux labeling visit the new file as if it were qcow2, which
means labeling would try to find the backing files of an empty file.
And for a pre-existing qcow2 disk, we were passing NULL, which meant
that labelling tried to probe the file type (and if probing is
disabled, per the default qemu.conf, this made snapshots fail).
What we really want is to make SELinux labeling visit the new
file as raw; it will later be converted to qcow2 if qemu successfully
made the snapshot.

* src/qemu/qemu_driver.c
(qemuDomainSnapshotCreateSingleDiskActive): Force SELinux labeling
to avoid probe of new file.

13 years agosnapshot: affect persistent xml after disk snapshot
Eric Blake [Sat, 17 Sep 2011 03:46:21 +0000 (21:46 -0600)]
snapshot: affect persistent xml after disk snapshot

For external snapshots to be useful on persistent domains, we must
alter the persistent definition alongside the running definition.
Thanks to the possibility of disk hotplug as well as of edits that
only affect the persistent xml, we can't assume that vm->def and
vm->newDef have the same disk at the same index, so we can only
update the persistent copy if the device destination matches up.

* src/qemu/qemu_driver.c (qemuDomainSnapshotCreateDiskActive)
(qemuDomainSnapshotCreateSingleDiskActive): Also affect newDef, if
present.

13 years agobuild: work around lack of MacOS fdatasync
Eric Blake [Fri, 16 Sep 2011 15:12:07 +0000 (09:12 -0600)]
build: work around lack of MacOS fdatasync

Mingw lacks fsync, but gnulib provides that.  Meanwhile, gnulib does
not (yet) provide fdatasync, so this is a quick hack to fake that
function on MacOS X; we can revert this configure change once gnulib
gives us a real module.

We have been implicitly relying on gnulib's largefile module being
pulled in by other modules, but it's better to make that explicit.

* bootstrap.conf (gnulib_modules): Add fsync.  Make largefile use
explicit.
* configure.ac (AC_CHECK_FUNCS_ONCE): Check for fdatasync, and
fake it with fsync when not present.

13 years agoPrevent crash from dlclose() of libvirt.so
Daniel P. Berrange [Thu, 1 Sep 2011 16:57:06 +0000 (17:57 +0100)]
Prevent crash from dlclose() of libvirt.so

When libvirt calls virInitialize it creates a thread local
for the virErrorPtr storage, and registers a callback to
cleanup memory when a thread exits. When libvirt is dlclose()d
or otherwise made non-resident, the callback function is
removed from memory, but the thread local may still exist
and if a thread later exists, it will invoke the callback
and SEGV. There may also be other thread locals with callbacks
pointing to libvirt code, so it is in general never safe to
unload libvirt.so from memory once initialized.

To allow dlclose() to succeed, but keep libvirt.so resident
in memory, link with '-z nodelete'. This issue was first
found with the libvirt CIM provider, but can potentially
hit many of the dynamic language bindings which all ultimately
involve dlopen() in some way, either on libvirt.so itself,
or on the glue code for the binding which in turns links
to libvirt

* configure.ac, src/Makefile.am: Ensure libvirt.so is linked
  with -z nodelete
* cfg.mk, .gitignore, tests/Makefile.am, tests/shunloadhelper.c,
  tests/shunloadtest.c: A test case to unload libvirt while
  a thread is still running.

13 years agoqemu: add return value check
Alex Jia [Fri, 16 Sep 2011 15:51:20 +0000 (23:51 +0800)]
qemu: add return value check

* src/qemu/qemu_command.c: missing return value check.

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agoqemu: Introduce shutdown reason for paused state
Jiri Denemark [Thu, 15 Sep 2011 13:07:51 +0000 (15:07 +0200)]
qemu: Introduce shutdown reason for paused state

Qemu sends STOP event as part of the shutdown process. Detect such STOP
event and consider shutdown to be reason of emitting such event. That's
the best we can do until qemu provides us the reason directly in STOP
event. This allows us to report shutdown reason for paused state so that
apps can detect domains that failed to finish the shutdown process
(e.g., because qemu is buggy and doesn't exit on SIGTERM or it is
blocked in flushing disk buffers).

13 years agoqemu: Prevent disk corruption on domain shutdown
Jiri Denemark [Tue, 13 Sep 2011 16:11:26 +0000 (18:11 +0200)]
qemu: Prevent disk corruption on domain shutdown

Ever since we introduced fake reboot, we call qemuProcessKill as a
reaction to SHUTDOWN event. Unfortunately, qemu doesn't guarantee it
flushed all internal buffers before sending SHUTDOWN, in which case
killing the process forcibly may result in (virtual) disk corruption.

By sending just SIGTERM without SIGKILL we give qemu time to to flush
all buffers and exit. Once qemu exits, we will see an EOF on monitor
connection and tear down the domain. In case qemu ignores SIGTERM or
just hangs there, the process stays running but that's not any different
from a possible hang anytime during the shutdown process so I think it's
just fine.

Also qemu (since 0.14 until it's fixed) has a bug in SIGTERM processing
which causes it not to exit but instead send new SHUTDOWN event and keep
waiting. I think the best we can do is to ignore duplicate SHUTDOWN
events to avoid a SHUTDOWN-SIGTERM loop and leave the domain in paused
state.

13 years agoqemu: Properly detect crash of a rebooted domain
Jiri Denemark [Tue, 13 Sep 2011 16:48:13 +0000 (18:48 +0200)]
qemu: Properly detect crash of a rebooted domain

When a domain is rebooted using libvirt API, we use fake reboot
consisting of shutting down and resetting the domain. Thus we see a
SHUTDOWN event and set gotShutdown flag. But we never reset it back and
if the domain crashes after it was rebooted this way, we consider it was
a normal shutdown and not a crash.

13 years agoqemu: Fix shutoff reason when domain crashes
Jiri Denemark [Tue, 13 Sep 2011 16:35:21 +0000 (18:35 +0200)]
qemu: Fix shutoff reason when domain crashes

Commit 4454a9efc728b91e791b1f14c26ea23a19d57f48 changed shutoff reason
from VIR_DOMAIN_SHUTOFF_CRASHED to VIR_DOMAIN_SHUTOFF_FAILED in case we
see an unexpected EOF on monitor connection. But FAILED reason is
dedicated for domains that fail to start. CRASHED reason is the right
one to use in this situation.

13 years agopython: Fix bindings generated in VPATH build
Jiri Denemark [Fri, 16 Sep 2011 09:46:46 +0000 (11:46 +0200)]
python: Fix bindings generated in VPATH build

13 years agoRevert "virsh: Use old API if remote libvirtd does not support new"
Eric Blake [Wed, 14 Sep 2011 18:47:07 +0000 (12:47 -0600)]
Revert "virsh: Use old API if remote libvirtd does not support new"

This reverts commit 799912fa05b8c3aa37bd04c57b196755f3f70552; now
that the rpc regression is fixed, virsh no longer needs the special
case here.

13 years agorpc: convert unknown procedures to VIR_ERR_NO_SUPPORT
Eric Blake [Wed, 14 Sep 2011 18:41:17 +0000 (12:41 -0600)]
rpc: convert unknown procedures to VIR_ERR_NO_SUPPORT

Libvirt special-cases a specific VIR_ERR_RPC from the remote driver
back into VIR_ERR_NO_SUPPORT on the client, so that clients can
handle missing rpc functions the same whether the hypervisor driver
is local or remote.  However, commit c1b22644 introduced a regression:
VIR_FROM_THIS changed from VIR_FROM_REMOTE to VIR_FROM_RPC, so the
special casing no longer works if the server uses the newer error
domain.

* src/rpc/virnetclientprogram.c
(virNetClientProgramDispatchError): Also cater to 0.9.3 and newer.

13 years agoFix buzzilla 738778
Stefan Berger [Fri, 16 Sep 2011 13:44:43 +0000 (09:44 -0400)]
Fix buzzilla 738778

This patch fixes the bug shown in bugzilla 738778. It's not an nwfilter problem but a connection sharing / closure issue.

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

Depending on the speed / #CPUs of the machine you are using you may not see this bug all the time.

13 years agoconf: avoid memory leak on virDomainDefParseXML
Alex Jia [Fri, 16 Sep 2011 05:54:47 +0000 (13:54 +0800)]
conf: avoid memory leak on virDomainDefParseXML

* conf/domain_conf.c: allocate memory to def->redirdevs in
  virDomainDefParseXML such as VIR_ALLOC_N(def->redirdevs, n),
  however, virDomainDefFree(def) hasn't released these memory.

* Detected in valgrind run:

==19820== 209 (16 direct, 193 indirect) bytes in 1 blocks are definitely lost in loss record 25 of 26
==19820==    at 0x4A04A28: calloc (vg_replace_malloc.c:467)
==19820==    by 0x4A13AF: virAllocN (memory.c:129)
==19820==    by 0x4D4A0E: virDomainDefParseXML (domain_conf.c:7258)
==19820==    by 0x4D4C93: virDomainDefParseNode (domain_conf.c:7512)
==19820==    by 0x4D562F: virDomainDefParse (domain_conf.c:7465)
==19820==    by 0x415863: testCompareXMLToXMLFiles (qemuxml2xmltest.c:35)
==19820==    by 0x415982: testCompareXMLToXMLHelper (qemuxml2xmltest.c:80)
==19820==    by 0x416D31: virtTestRun (testutils.c:140)
==19820==    by 0x415604: mymain (qemuxml2xmltest.c:192)
==19820==    by 0x416437: virtTestMain (testutils.c:689)
==19820==    by 0x3CA7A1ECDC: (below main) (in /lib64/libc-2.12.so)
==19820==
==19820== LEAK SUMMARY:
==19820==    definitely lost: 16 bytes in 1 blocks
==19820==    indirectly lost: 193 bytes in 5 blocks
==19820==      possibly lost: 0 bytes in 0 blocks
==19820==    still reachable: 1,054 bytes in 21 blocks

* How to reproduce?
% valgrind -v --leak-check=full ./tests/qemuxml2xmltest

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agobuild: storage: Macro 'MKFS' is undefined on some platforms.
Peter Krempa [Fri, 16 Sep 2011 12:14:16 +0000 (14:14 +0200)]
build: storage: Macro 'MKFS' is undefined on some platforms.

Mac OS X 10.6. Snow Leopard and probably other do not provide a mkfs
command to create filesystems. Macro MKFS then remained undefined and
did not provide any substitute, so that build failed on a missing
argument.

13 years agobuild: storage: Conditionaly compiled structure caused build fail on OSX
Peter Krempa [Fri, 16 Sep 2011 12:14:15 +0000 (14:14 +0200)]
build: storage: Conditionaly compiled structure caused build fail on OSX

Struct virStoragePoolProbeResult was compiled in conditionaly, but
virStorageBackendFileSystemProbe used it unconditionaly. This patch
exempts the struct from conditional include.

13 years agoAvoid using "devname" as an identifier.
Peter Krempa [Fri, 16 Sep 2011 12:05:58 +0000 (14:05 +0200)]
Avoid using "devname" as an identifier.

/usr/lib/stdlib.h in Mac OS X and probably also in BSD's
exports this symbol :(

13 years agodoc: Add statment about permissions needed to do a core dump
Peter Krempa [Fri, 16 Sep 2011 10:04:40 +0000 (12:04 +0200)]
doc: Add statment about permissions needed to do a core dump

Documentation did not specify, that some permissions are required on
target path for coredump for the user running the hypervisor.

Diff to v1:
- reword statements

13 years agosnapshot: tweak snapshot-create-as diskspec docs
Eric Blake [Wed, 14 Sep 2011 21:20:08 +0000 (15:20 -0600)]
snapshot: tweak snapshot-create-as diskspec docs

With this patch, it is hopefully a bit more obvious that for
snapshot-create-as, a literal '--diskspec' is mandatory if name
or description was omitted, but optional if all earlier options
were provided.

These all denote two diskspecs and a description:
virsh snapshot-create-as dom name desc vda vdb
virsh snapshot-create-as dom name desc --diskspec vda --diskspec vdb
virsh snapshot-create-as dom name desc --diskspec vda vdb
virsh snapshot-create-as dom name desc vda --diskspec vdb
virsh snapshot-create-as dom --diskspec vda --diskspec vdb name desc

This gives two diskspecs but no description:
virsh snapshot-create-as dom name --diskspec vda --diskspec vdb

And this treats 'vda' as the description, with only one diskspec:
virsh snapshot-create-as dom name vda vdb

The help output now shows:
    snapshot-create-as <domain> [<name>] [<description>] [--print-xml] [--no-metadata] [--halt] [--disk-only] [[--diskspec] <string>]...

I also checked the help output for echo and send-key, which are two
other variants of argv commands.

* tools/virsh.pod (snapshot-create-as): Document when a literal
--diskspec must preceed a diskspec argument.
* tools/virsh.c (vshCmddefHelp): Update help output for argv when
naming the option is useful.
(vshCmddefGetData): Fix logic on when argv was seen.
* tests/virsh-optparse: Add tests to avoid regressions.

13 years agopython: Fix libvirt.py generation to include virterror info
Cole Robinson [Wed, 14 Sep 2011 20:25:42 +0000 (16:25 -0400)]
python: Fix libvirt.py generation to include virterror info

Recent generator refactoring broke libvirt.py. With this patch, libvirt.py
is generated exactly the same as before offending commit 9eba0d25.

13 years agoqemu_api: doc improvements
Eric Blake [Wed, 14 Sep 2011 15:49:08 +0000 (09:49 -0600)]
qemu_api: doc improvements

The new doc text had a few readability issues.  Also, the
monitor command text copied a bit too much from the attach case.

* src/libvirt-qemu.c (virDomainQemuMonitorCommand)
(virDomainQemuAttach): Fix typos and grammar.

13 years agodoc: virsh: Fix command name in man page
Peter Krempa [Thu, 15 Sep 2011 08:31:52 +0000 (10:31 +0200)]
doc: virsh: Fix command name in man page

Fix cut&paste error having command named domif-setlink instead of
domif-getlink.

13 years agosanlock: add missing test command in virt-sanlock-cleanup.in
Alex Jia [Thu, 15 Sep 2011 06:13:28 +0000 (14:13 +0800)]
sanlock: add missing test command in virt-sanlock-cleanup.in

* tools/virt-sanlock-cleanup.in: fix missing test command when judging
  second condition.

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

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agospec: Require augeas for sanlock
Michal Privoznik [Thu, 15 Sep 2011 14:55:36 +0000 (16:55 +0200)]
spec: Require augeas for sanlock

Even though we BuildRequire augeas in some cases, we need to require
it even after if we build with sanlock. virt-sanlock-cleanup use it.

13 years agoFix build after commit 829bce17
Jim Fehlig [Wed, 14 Sep 2011 23:57:55 +0000 (17:57 -0600)]
Fix build after commit 829bce17

Pushing under build-breaker rule.

13 years agoUse max bandwidth from qemuDomainObjPrivate struct when migrating
Jim Fehlig [Fri, 26 Aug 2011 18:10:27 +0000 (12:10 -0600)]
Use max bandwidth from qemuDomainObjPrivate struct when migrating

Adjust qemuMigrationRun() to use migMaxBandwidth in qemuDomainObjPrivate
structure when setting qemu migration speed.  Caller-specified 'resource'
parameter overrides migMaxBandwidth.

13 years agoSet qemu migration speed unlimited when migrating to file
Jim Fehlig [Fri, 26 Aug 2011 18:10:26 +0000 (12:10 -0600)]
Set qemu migration speed unlimited when migrating to file

The qemu migration speed default is 32MiB/s as defined in migration.c

/* Migration speed throttling */
static int64_t max_throttle = (32 << 20);

There's no need to throttle migration when targeting a file, so set migration
speed to unlimited prior to migration, and restore to libvirt default value
after migration.

Default units is MB for migrate_set_speed monitor command, so
(INT64_MAX / (1024 * 1024)) is used for unlimited migration speed.

Tested with both json and text monitors.

13 years agoSave migration speed in qemuDomainMigrateSetMaxSpeed
Jim Fehlig [Fri, 26 Aug 2011 18:10:25 +0000 (12:10 -0600)]
Save migration speed in qemuDomainMigrateSetMaxSpeed

Now that migration speed is stored in qemuDomainObjPrivate structure,
save the new value when invoking qemuDomainMigrateSetMaxSpeed().

Allow setting migration speed on inactive domain too.

13 years agoImpl virDomainMigrateGetMaxSpeed in qemu driver
Jim Fehlig [Fri, 26 Aug 2011 18:10:23 +0000 (12:10 -0600)]
Impl virDomainMigrateGetMaxSpeed in qemu driver

13 years agoStore max migration bandwidth in qemuDomainObjPrivate struct
Jim Fehlig [Fri, 26 Aug 2011 18:10:22 +0000 (12:10 -0600)]
Store max migration bandwidth in qemuDomainObjPrivate struct

The maximum bandwidth that can be consumed when migrating a domain
is better classified as an operational vs configuration parameter of
the dommain.  As such, store this parameter in qemuDomainObjPrivate
structure.

13 years agoconf: add missing break in virDomainAuditRedirdev
Marc-André Lureau [Wed, 14 Sep 2011 20:02:30 +0000 (22:02 +0200)]
conf: add missing break in virDomainAuditRedirdev

Also initialize to NULL a few variables that might get
free before being set.

13 years agonetwork: add missing exports
Eric Blake [Wed, 14 Sep 2011 17:55:17 +0000 (11:55 -0600)]
network: add missing exports

Commit c246b025 added new functions, but forgot to export them,
resulting in a build failure when using modules.

* src/libvirt_private.syms (network.h): Export new functions.

13 years agosnapshot: ABI stability must include memory sizing
Eric Blake [Tue, 13 Sep 2011 20:21:10 +0000 (14:21 -0600)]
snapshot: ABI stability must include memory sizing

Commit 973fcd8f introduced the ability for qemu to reject snapshot
reversion on an ABI incompatibility; but the very example that was
first proposed on-list[1] as a demonstration of an ABI incompatibility,
namely that of changing the max memory allocation, was not being
checked for, resulting in a cryptic failure when running with larger
max mem than what the snapshot was created with:
error: operation failed: Error -22 while loading VM state

This commit merely protects the three variables within mem that are
referenced by qemu_command.c, rather than all 7 (the other 4 variables
affect cgroup handling, but as far as I can tell, have no visible effect
to the qemu guest).  This also affects migration and save file handling,
which are other places where we perform ABI compatibility checks.

[1] https://www.redhat.com/archives/libvir-list/2010-December/msg00331.html

* src/conf/domain_conf.c (virDomainDefCheckABIStability): Add
memory sizing checks.

13 years agomaint: ignore generated files
Eric Blake [Wed, 14 Sep 2011 15:30:33 +0000 (09:30 -0600)]
maint: ignore generated files

* .gitignore: Exempt recently added generated files.

13 years agoxml: Clean up rest of virtual XML document names for XML strings
Peter Krempa [Wed, 14 Sep 2011 14:17:57 +0000 (16:17 +0200)]
xml: Clean up rest of virtual XML document names for XML strings

Commit 498d783 cleans up some of virtual file names for parsing strings
in memory. This patch cleans up (hopefuly) the rest forgotten by the
first patch.

This patch also changes all of the previously modified "filenames" to
valid URI's replacing spaces for underscores.

Changes to v1:
- Replace all spaces for underscores, so that the strings form valid
  URI's
- Replace spaces in places changed by commit 498d783

13 years agoRemove two references to files not generated
Daniel Veillard [Wed, 14 Sep 2011 14:57:46 +0000 (22:57 +0800)]
Remove two references to files not generated

This was breaking "make dist"

13 years agomake: Fix 'make syntax-check' failing.
Peter Krempa [Wed, 14 Sep 2011 12:20:07 +0000 (14:20 +0200)]
make: Fix 'make syntax-check' failing.

Commit 2a0d75e5 added file python/libvirt-qemu-override.c that contains
code that does not pass "make syntax-check". This patch adds an
exception for this file and the check.

prohibit_always_true_header_tests
python/libvirt-qemu-override.c:17:#undef HAVE_PTHREAD_H
maint.mk: do not test the above HAVE_<header>_H symbol(s);
  with the corresponding gnulib module, they are always true
make: *** [sc_prohibit_always_true_header_tests] Error 1

13 years agoqemu_api: Update libvirt spec file
Osier Yang [Fri, 9 Sep 2011 11:11:36 +0000 (19:11 +0800)]
qemu_api: Update libvirt spec file

13 years agoqemu_api: Update Makefile to generate libvirtmod_qemu lib
Osier Yang [Fri, 9 Sep 2011 11:10:43 +0000 (19:10 +0800)]
qemu_api: Update Makefile to generate libvirtmod_qemu lib

13 years agoqemu_api: Update Py binding generator to generate files for QEMU APIs
Osier Yang [Fri, 9 Sep 2011 11:09:44 +0000 (19:09 +0800)]
qemu_api: Update Py binding generator to generate files for QEMU APIs

It will generate:
  libvirt-qemu.py
  libvirt-qemu.h
  libvirt-qemu.c
  libvirt-qemu-export.c

13 years agoqemu_api: Add override XML and C files for QEMU APIs
Osier Yang [Fri, 9 Sep 2011 11:07:56 +0000 (19:07 +0800)]
qemu_api: Add override XML and C files for QEMU APIs

There is only one function (virDomainQemuMonitorCommand) need to
be hand-craft.

13 years agoqemu_api: Add comments for API virDomainQemuMonitorCommand
Osier Yang [Fri, 9 Sep 2011 11:00:09 +0000 (19:00 +0800)]
qemu_api: Add comments for API virDomainQemuMonitorCommand

And fix argument @pid's type of virDomainQemuAttach.

13 years agoqemu_api: Update Makefile for subdir docs
Osier Yang [Wed, 14 Sep 2011 03:38:39 +0000 (11:38 +0800)]
qemu_api: Update Makefile for subdir docs

13 years agoqemu_api: Modify apibuild.py to generate docs for QEMU APIs
Osier Yang [Fri, 9 Sep 2011 10:55:21 +0000 (18:55 +0800)]
qemu_api: Modify apibuild.py to generate docs for QEMU APIs

The generated docs are: libvirt-qemu-api.xml, libvirt-qemu-refs.xml

13 years agovirsh: Use old API if remote libvirtd does not support new
Peter Krempa [Tue, 13 Sep 2011 15:16:45 +0000 (17:16 +0200)]
virsh: Use old API if remote libvirtd does not support new

Commit ffe28ab74b821c916ec4ba8efb5c992454e4bd24 introduced regression
while communicating with older libvirtd command 'domblkstat' used the new
API and did not check for VIR_ERR_RPC error code signalling the remote
server does not support this API and did not fall back to older API.
Thereafter 'domblkstat' ended with "error: unknown procedure: 243".

13 years agosnapshot: fix double free of qemuImgBinary
Guannan Ren [Sun, 11 Sep 2011 05:43:35 +0000 (13:43 +0800)]
snapshot: fix double free of qemuImgBinary

Regression introduced in commit 3881a470, due to an improper rebase
of a cleanup written beforehand but only applied after a rebased of
a refactoring that created a new function in commit 25fb3ef.

Also avoids passing NULL to printf %s.

* src/qemu/qemu_driver.c: In qemuDomainSnapshotForEachQcow2()
it free up the memory of qemu_driver->qemuImgBinary in the
cleanup tag which leads to the garbage value of qemuImgBinary
in qemu_driver struct and libvirtd crash when running
"virsh snapshot-create" command a second time.

Signed-off-by: Eric Blake <eblake@redhat.com>
13 years agoDo not log invalid operations in libvirtd logs
Daniel Veillard [Tue, 13 Sep 2011 10:24:13 +0000 (18:24 +0800)]
Do not log invalid operations in libvirtd logs

  This is a bit painful for example when starting virt-manager
it tends to clutter libvirtd.log with invalid operation on cpu pinning
for defined but not running domains. A priori those kind of errors
don't indicate an error when executing the command but on a precondition
for running the API, and honnestly while the application should report
it, logging it as an error in libvirtd.log is not really useful,

   Related bug: https://bugzilla.redhat.com/show_bug.cgi?id=590807

* daemon/libvirtd.c: extend daemonErrorLogFilter() to filter out
   errors of type VIR_ERR_OPERATION_INVALID

13 years agovirnetsocket: Pass KRB5CCNAME env variable
Michal Privoznik [Fri, 9 Sep 2011 13:59:26 +0000 (15:59 +0200)]
virnetsocket: Pass KRB5CCNAME env variable

So we can allow GSSAPI authentication for ssh.

Signed-off-by: Matthias Witte <witte@netzquadrat.de>
13 years agoselinux: Detect virt_use_nfs boolean set
Michal Privoznik [Thu, 8 Sep 2011 16:23:25 +0000 (18:23 +0200)]
selinux: Detect virt_use_nfs boolean set

If we fail setting label on a file and this file is on NFS share,
it is wise to advise user to set virt_use_nfs selinux boolean
variable.

13 years agoFix URL-escaping for domainDefine
Philipp Hahn [Thu, 8 Sep 2011 14:34:10 +0000 (16:34 +0200)]
Fix URL-escaping for domainDefine

'+' in strings get translated to ' ' when editing domains.
While xenDaemonDomainCreateXML() did URL-escape the sexpr,
xenDaemonDomainDefineXML() did not.

Remove the explicit urlencode() in xenDaemonDomainCreateXML() and add
the direct encoding calls to xend_op_ext() because it calls xend_post()
which uses "Content-Type: application/x-www-form-urlencoded". According
to <http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1> this
requires all parameters to be url-encoded as specified in rfc1738.

Notice: virBufferAsprintf(..., "%s=%s", ...) is again replaced by three
calls to virBufferURIEncodeString() and virBufferAddChar() because '='
is a "reserved" character, which would get escaped by
virBufferURIEncodeString(), which - by the way - escapes anything not
c_isalnum().

Signed-off-by: Philipp Hahn <hahn@univention.de>
13 years agoxml: Change virtual file names of xml documents parsed in memory
Peter Krempa [Thu, 8 Sep 2011 13:25:01 +0000 (15:25 +0200)]
xml: Change virtual file names of xml documents parsed in memory

While parsing XML strings from memory, the previous convention in
libvirt was to set the virtual file name to "domain.xml" or something
similar. This could potentialy trick the user into looking for a file
named domain.xml on the disk in an attempt to fix the error.

This patch changes these filenames to something that can't be as easily
confused for a valid filename.

Examples of error messages:
---------------------------
Error while loading file from disk:

15:07:59.015: 527: error : catchXMLError:709 : /path/to/domain.xml:1: StartTag: invalid element name
<domain type='kvm'><
--------------------^

Error while parsing definition in memory:

15:08:43.581: 525: error : catchXMLError:709 : (domain definition):2: error parsing attribute name
  <name>vm1</name>
--^

13 years agosnapshot: fix regression with system checkpoints
Eric Blake [Thu, 8 Sep 2011 13:06:45 +0000 (14:06 +0100)]
snapshot: fix regression with system checkpoints

Regression introduced in commit d6f6b2d194c.  Running
'virsh snapshot-create dom' would mistakenly report that
disks can only be specified for disk snapshots.

* src/conf/domain_conf.c (virDomainSnapshotDefParseString): Only
give error about no disk support when <disk> was found.

13 years agomaint: update to latest gnulib
Eric Blake [Thu, 8 Sep 2011 12:49:59 +0000 (13:49 +0100)]
maint: update to latest gnulib

* .gnulib: Update to latest.

13 years agosnapshot: use new API for less work
Eric Blake [Thu, 8 Sep 2011 12:16:57 +0000 (13:16 +0100)]
snapshot: use new API for less work

This has the added benefit of making 'snapshot-create dom --no-metadata'
now able to tell you the name of the just-generated snapshot.

* tools/virsh.c (vshSnapshotCreate, cmdSnapshotCurrent): Don't get
XML just for name.

13 years agosnapshot: new APIs for inspecting snapshot object
Eric Blake [Thu, 8 Sep 2011 11:19:25 +0000 (12:19 +0100)]
snapshot: new APIs for inspecting snapshot object

These functions access internals of the opaque object, and do
not need any rpc counterpart.  It could be argued that we should
have provided these when snapshot objects were first introduced,
since all the other vir*Ptr objects have at least a GetName accessor.

* include/libvirt/libvirt.h.in (virDomainSnapshotGetName)
(virDomainSnapshotGetDomain, virDomainSnapshotGetConnect): Declare.
* src/libvirt.c (virDomainSnapshotGetName)
(virDomainSnapshotGetDomain, virDomainSnapshotGetConnect): New
functions.
* src/libvirt_public.syms: Export them.

13 years agoDon't treat pci_system_init failure as fatal if no PCI bus is present
Soren Hansen [Mon, 5 Sep 2011 19:29:06 +0000 (21:29 +0200)]
Don't treat pci_system_init failure as fatal if no PCI bus is present

Xen PV domU's have no PCI bus. node_device_udev.c calls pci_system_init
which looks for /sys/bus/pci. If it does not find /sys/bus/pci (which it
won't in a Xen PV domU) it returns unsuccesfully (ENOENT), which libvirt
considers fatal. This makes libvirt unusable in this environment, even
though there are plenty of valid virtualisation options that work
there (LXC, UML, and QEmu spring to mind)

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

Signed-off-by: Soren Hansen <soren@linux2go.dk>
13 years agodoc: fix incorrect option in send-key
Alex Jia [Wed, 7 Sep 2011 16:53:46 +0000 (00:53 +0800)]
doc: fix incorrect option in send-key

* tools/virsh.pod: fix a option typo of send-key section.

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agovirsh: fix typo in opts_send_key
Alex Jia [Thu, 8 Sep 2011 03:11:27 +0000 (11:11 +0800)]
virsh: fix typo in opts_send_key

* tools/virsh.c: millseconds should be milliseconds in opts_send_key.

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agorpc: avoid memory leak on virNetTLSContextValidCertificate
Alex Jia [Sun, 4 Sep 2011 15:48:42 +0000 (23:48 +0800)]
rpc: avoid memory leak on virNetTLSContextValidCertificate

* src/rpc/virnettlscontext.c: fix memory leak on
  virNetTLSContextValidCertificate.

* Detected in valgrind run:

==25667==
==25667== 6,085 (44 direct, 6,041 indirect) bytes in 1 blocks are definitely
lost in loss record 326 of 351
==25667==    at 0x4005447: calloc (vg_replace_malloc.c:467)
==25667==    by 0x4F2791F3: _asn1_add_node_only (structure.c:53)
==25667==    by 0x4F27997A: _asn1_copy_structure3 (structure.c:421)
==25667==    by 0x4F276A50: _asn1_append_sequence_set (element.c:144)
==25667==    by 0x4F2743FF: asn1_der_decoding (decoding.c:1194)
==25667==    by 0x4F22B9CC: gnutls_x509_crt_import (x509.c:229)
==25667==    by 0x805274B: virNetTLSContextCheckCertificate
(virnettlscontext.c:1009)
==25667==    by 0x804DE32: testTLSSessionInit (virnettlscontexttest.c:693)
==25667==    by 0x804F14D: virtTestRun (testutils.c:140)
==25667==
==25667== 23,188 (88 direct, 23,100 indirect) bytes in 11 blocks are definitely
lost in loss record 346 of 351
==25667==    at 0x4005447: calloc (vg_replace_malloc.c:467)
==25667==    by 0x4F22B841: gnutls_x509_crt_init (x509.c:50)
==25667==    by 0x805272B: virNetTLSContextCheckCertificate
(virnettlscontext.c:1003)
==25667==    by 0x804DDD1: testTLSSessionInit (virnettlscontexttest.c:673)
==25667==    by 0x804F14D: virtTestRun (testutils.c:140)

* How to reproduce?
% cd libvirt && ./configure && make && make -C tests valgrind
or
% valgrind -v --leak-check=full ./tests/virnettlscontexttest

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agotests: avoid memory leak on testTLSSessionInit
Alex Jia [Sun, 4 Sep 2011 15:48:41 +0000 (23:48 +0800)]
tests: avoid memory leak on testTLSSessionInit

* tests/virnettlscontexttest: fix memory leak on virnettlscontext test case.

* Detected in valgrind run:

==25667==
==25667== 86,651 (34,680 direct, 51,971 indirect) bytes in 10 blocks are
definitely lost in loss record 350 of 351
==25667==    at 0x4005447: calloc (vg_replace_malloc.c:467)
==25667==    by 0x4F1F515D: gnutls_init (gnutls_state.c:270)
==25667==    by 0x8053432: virNetTLSSessionNew (virnettlscontext.c:1181)
==25667==    by 0x804DD24: testTLSSessionInit (virnettlscontexttest.c:624)
==25667==    by 0x804F14D: virtTestRun (testutils.c:140)
==25667==
==25667== 100,578 (38,148 direct, 62,430 indirect) bytes in 11 blocks are
definitely lost in loss record 351 of 351
==25667==    at 0x4005447: calloc (vg_replace_malloc.c:467)
==25667==    by 0x4F1F515D: gnutls_init (gnutls_state.c:270)
==25667==    by 0x8053432: virNetTLSSessionNew (virnettlscontext.c:1181)
==25667==    by 0x804DD3C: testTLSSessionInit (virnettlscontexttest.c:625)
==25667==    by 0x804F14D: virtTestRun (testutils.c:140)

* How to reproduce?
% cd libvirt && ./configure && make && make -C tests valgrind
or
% valgrind -v --leak-check=full ./tests/virnettlscontexttest

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agolibxl: avoid a dereference of a null pointer
Alex Jia [Sun, 4 Sep 2011 17:01:03 +0000 (01:01 +0800)]
libxl: avoid a dereference of a null pointer

Variable 'l_disk' initialized to a null pointer value, control jumps to 'case
VIR_DOMAIN_DISK_DEVICE_DISK and then taking false branch, Within the expansion
of the macro 'libxlError': Field access results in a dereference of a null
pointer (loaded from variable 'l_disk').

* src/libxl/libxl_driver.c: Field access results in a dereference of a null
  pointer (loaded from variable 'l_disk')

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agoblockinfo: fix qemu regression in handling disk name
Eric Blake [Thu, 8 Sep 2011 09:10:14 +0000 (10:10 +0100)]
blockinfo: fix qemu regression in handling disk name

Regression introduced in commit 89b6284fd, due to an incorrect
conversion to the new means of converting disk names back to
the correct object.

* src/qemu/qemu_driver.c (qemuDomainGetBlockInfo): Avoid NULL deref.

13 years agoesx: Fix managed object lookup with optional occurrence
Matthias Bolte [Tue, 6 Sep 2011 17:05:08 +0000 (19:05 +0200)]
esx: Fix managed object lookup with optional occurrence

Exit early if managed object is not found, instead of dereferencing
a NULL pointer and triggering a segfault.

13 years agoThreadpool: Initialize new dynamic workers
Michal Privoznik [Wed, 7 Sep 2011 12:08:14 +0000 (14:08 +0200)]
Threadpool: Initialize new dynamic workers

Although we were initializing worker threads during pool creating,
we missed this during virThreadPoolSendJob. This bug led to segmenation
fault as worker thread free() given argument.

13 years agomingw: Don't use interface as an identifier
Matthias Bolte [Tue, 6 Sep 2011 13:43:15 +0000 (15:43 +0200)]
mingw: Don't use interface as an identifier

Because it's a define used in MSCOM and its usage as
identifier results in a compile error.

13 years agolink-state: virsh: Add wrapper commands for changing link state
Peter Krempa [Tue, 6 Sep 2011 08:31:59 +0000 (16:31 +0800)]
link-state: virsh: Add wrapper commands for changing link state

Two new commands are added to virsh that wrap usage of
virDomainUpdateDeviceFlags for changing link state of domain's network
interfaces. These wrappers extract network devices's xml configuration
and modify the link state for easy manipulation from an user's perspective.

 - domif-setlink - set link state of a domains virtual network interface
 - domif-getlink - get link state

* tools/virsh.c   - Add functionality to virsh
* tools/virsh.pod - Manpage documentation

13 years agolink-state: qemu: Add net intf modification to virUpdateDeviceFlags
Peter Krempa [Tue, 6 Sep 2011 08:23:47 +0000 (16:23 +0800)]
link-state: qemu: Add net intf modification to virUpdateDeviceFlags

This patch enables modifying network device configuration using the
virUpdateDeviceFlags API method. Matching of devices is accomplished
using MAC addresses.

While updating live configuration of a running domain, the user is
allowed only to change link state of the interface. Additional
modifications may be added later. For now the code checks for
unsupported changes and thereafter changes the link state, if
applicable.

When updating persistent configuration of guest's network interface the
whole configuration (except for the MAC address) may be modified and
is stored for the next startup.

* src/qemu/qemu_driver.c   - Add dispatching of virUpdateDevice for
                             network devices update (live/config)
* src/qemu/qemu_hotplug.c  - add setting of initial link state on live
                             device addition
                           - add function to change network device
                             configuration. By now it supports only
                             changing of link state
* src/qemu/qemu_hotplug.h  - Headers to above functions
* src/qemu/qemu_process.c  - set link states before virtual machine
                             start. Qemu does not support setting of
                             this on the command line.

13 years agolink-state: qemu: Add monitor handling for link state modification
Peter Krempa [Tue, 6 Sep 2011 08:18:57 +0000 (16:18 +0800)]
link-state: qemu: Add monitor handling for link state modification

This patch adds handlers for modification of guest's interface
link state. Both HMP and QMP commands are supported, but as the
link state functionality is from the beginning supported in QMP
the HMP code will probably never be used.

13 years agolink-state: conf: Add element to XML for controling link state
Peter Krempa [Tue, 6 Sep 2011 08:08:15 +0000 (16:08 +0800)]
link-state: conf: Add element to XML for controling link state

A new element is introduced to XML that allows to control
state of virtual network interfaces in hypervisors.

Live modification of the link state allows networking tools
propagate topology changes to guest OS or testing of
scenarios in complex (virtual) networks.

This patch adds elements to XML grammars and parsing and generating
code.

13 years agolink-state: util: Add equality comparison functions for structures
Peter Krempa [Tue, 6 Sep 2011 08:05:53 +0000 (16:05 +0800)]
link-state: util: Add equality comparison functions for structures

This patch adds functions to compare structures containing network
device configuration for equality. They serve for the purpose of
disallowing unsupported changes to live network devices.

13 years agoXML: Improve XML parsing error messages
Peter Krempa [Tue, 6 Sep 2011 07:48:22 +0000 (15:48 +0800)]
XML: Improve XML parsing error messages

This patch modifies error handling function for the XML parser provided
by libxml2.

Originaly only a line number and error message were logged. With this
new error handler function, the user is provided with a more complex
description of the parsing error.

Context of the error is printed in libXML2 style and filename of the
file, that caused the error is printed. Example of an parse error:

13:41:36.262: 16032: error : catchXMLError:706 :
/etc/libvirt/qemu/rh_bad.xml:58: Opening and ending tag mismatch: name
line 2 and domain
</domain>
---------^

Context of the error gives the user hints that may help to quickly
locate a corrupt xml file.

fixes BZs:
----------
Bug 708735 - [RFE] Show column and line on XML parsing error
https://bugzilla.redhat.com/show_bug.cgi?id=708735

Bug 726771 - libvirt does not specify problem file if persistent xml is
invalid
https://bugzilla.redhat.com/show_bug.cgi?id=726771

13 years agoredirdev: allows to specify device address
Marc-André Lureau [Tue, 6 Sep 2011 07:06:59 +0000 (15:06 +0800)]
redirdev: allows to specify device address

It is important to be able to attach USB redirected devices to a
particular controller (one that supports USB2 for instance).
Without this patch, only the default bus was used.

     <redirdev bus='usb' type='spicevmc'>
       <address type='usb' bus='0' port='4'/>
     </redirdev>

13 years agolatency: fix make check for remote protocol structs and numbers
Daniel Veillard [Tue, 6 Sep 2011 07:11:44 +0000 (15:11 +0800)]
latency: fix make check for remote protocol structs and numbers

13 years agolatency: Update virsh command domblkstat to use new API
Osier Yang [Mon, 5 Sep 2011 08:24:51 +0000 (16:24 +0800)]
latency: Update virsh command domblkstat to use new API

The modified function fallbacks to use virDomainBlockStats if
virDomainBlockStatsFlags is not supported by the hypervisor driver.
If the new API is supported, it will be invoked instead of the
old API.

13 years agolatency: Expose the new API for Python binding
Osier Yang [Mon, 5 Sep 2011 08:24:21 +0000 (16:24 +0800)]
latency: Expose the new API for Python binding

13 years agolatency: Implemente internal API for qemu driver
Osier Yang [Mon, 5 Sep 2011 08:22:58 +0000 (16:22 +0800)]
latency: Implemente internal API for qemu driver

13 years agolatency: Update monitor functions for new latency fields
Osier Yang [Mon, 5 Sep 2011 08:22:17 +0000 (16:22 +0800)]
latency: Update monitor functions for new latency fields

The mainly changes are:

1) Update qemuMonitorGetBlockStatsInfo and it's children (Text/JSON)
   functions to return the value of new latency fields.
2) Add new function qemuMonitorGetBlockStatsParamsNumber, which is
   to count how many parameters the underlying QEMU supports.
3) Update virDomainBlockStats in src/qemu/qemu_driver.c to be
   compatible with the changes by 1).

13 years agolatency: Wire up the remote protocol
Osier Yang [Mon, 5 Sep 2011 08:20:03 +0000 (16:20 +0800)]
latency: Wire up the remote protocol

13 years agolatency: Implemente the public API
Osier Yang [Mon, 5 Sep 2011 08:16:03 +0000 (16:16 +0800)]
latency: Implemente the public API

13 years agolatency: Define the internal driver callback
Osier Yang [Mon, 5 Sep 2011 08:15:14 +0000 (16:15 +0800)]
latency: Define the internal driver callback

13 years agolatency: Define new public API and structure
Osier Yang [Mon, 5 Sep 2011 08:14:29 +0000 (16:14 +0800)]
latency: Define new public API and structure

13 years agoqemu: Deal with stucked qemu on daemon startup
Michal Privoznik [Tue, 16 Aug 2011 10:51:36 +0000 (12:51 +0200)]
qemu: Deal with stucked qemu on daemon startup

If libvirt daemon gets restarted and there is (at least) one
unresponsive qemu, the startup procedure hangs up. This patch creates
one thread per vm in which we try to reconnect to monitor. Therefore,
blocking in one thread will not affect other APIs.

13 years agoqemu: Introduce job queue size limit
Michal Privoznik [Fri, 12 Aug 2011 13:29:37 +0000 (15:29 +0200)]
qemu: Introduce job queue size limit

This patch creates an optional BeginJob queue size limit. When
active, all other attempts above level will fail. To set this
feature assign desired value to max_queued variable in qemu.conf.
Setting it to 0 turns it off.

13 years agodaemon: Create priority workers pool
Michal Privoznik [Fri, 12 Aug 2011 12:04:31 +0000 (14:04 +0200)]
daemon: Create priority workers pool

This patch annotates APIs with low or high priority.
In low set MUST be all APIs which might eventually access monitor
(and thus block indefinitely). Other APIs may be marked as high
priority. However, some must be (e.g. domainDestroy).

For high priority calls (HPC), there are some high priority workers
(HPW) created in the pool. HPW can execute only HPC, although normal
worker can process any call regardless priority. Therefore, only those
APIs which are guaranteed to end in reasonable small amount of time
can be marked as HPC.

The size of this HPC pool is static, because HPC are expected to end
quickly, therefore jobs assigned to this pool will be served quickly.
It can be configured in libvirtd.conf via prio_workers variable.
Default is set to 5.

To mark API with low or high priority, append priority:{low|high} to
it's comment in src/remote/remote_protocol.x. This is similar to
autogen|skipgen. If not marked, the generator assumes low as default.

13 years agosnapshot: use SELinux and lock manager with external snapshots
Eric Blake [Tue, 23 Aug 2011 23:14:55 +0000 (17:14 -0600)]
snapshot: use SELinux and lock manager with external snapshots

With this, it is now possible to create external snapshots even
when SELinux is enforcing, and to protect the new file with a
lock manager.

* src/qemu/qemu_driver.c
(qemuDomainSnapshotCreateSingleDiskActive): Create and register
new file with proper permissions and locks.
(qemuDomainSnapshotCreateDiskActive): Update caller.

13 years agosnapshot: wire up live qemu disk snapshots
Eric Blake [Sat, 20 Aug 2011 04:33:13 +0000 (22:33 -0600)]
snapshot: wire up live qemu disk snapshots

Lots of earlier patches led up to this point - the qemu snapshot_blkdev
monitor command can now be controlled by libvirt!  Well, insofar as
SELinux doesn't prevent qemu from open(O_CREAT) on the files.  There's
still some followup work before things work with SELinux enforcing,
but this patch is big enough to post now.

There's still room for other improvements, too (for example, taking a
disk snapshot of an inactive domain, by using qemu-img for both internal
and external snapshots; wiring up delete and revert control, including
additional flags from my RFC; supporting active QED disk snapshots;
supporting per-storage-volume snapshots such as LVM or btrfs snapshots;
etc.).  But this patch is the one that proves the new XML works!

* src/qemu/qemu_driver.c (qemuDomainSnapshotCreateXML): Wire in
active disk snapshots.
(qemuDomainSnapshotDiskPrepare)
(qemuDomainSnapshotCreateDiskActive)
(qemuDomainSnapshotCreateSingleDiskActive): New functions.

13 years agosnapshot: wire up new qemu monitor command
Eric Blake [Mon, 15 Aug 2011 23:25:54 +0000 (17:25 -0600)]
snapshot: wire up new qemu monitor command

No one uses this yet, but it will be important once
virDomainSnapshotCreateXML learns a VIR_DOMAIN_SNAPSHOT_DISK_ONLY
flag, and the xml allows passing in the new file names.

* src/qemu/qemu_monitor.h (qemuMonitorDiskSnapshot): New prototype.
* src/qemu/qemu_monitor_text.h (qemuMonitorTextDiskSnapshot):
Likewise.
* src/qemu/qemu_monitor_json.h (qemuMonitorJSONDiskSnapshot):
Likewise.
* src/qemu/qemu_monitor.c (qemuMonitorDiskSnapshot): New
function.
* src/qemu/qemu_monitor_json.c (qemuMonitorJSONDiskSnapshot):
Likewise.