]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
12 years agovirsh-volume: Update volume commands to use vshCommandOptStringReq
Peter Krempa [Fri, 18 Jan 2013 15:40:08 +0000 (16:40 +0100)]
virsh-volume: Update volume commands to use vshCommandOptStringReq

12 years agovirsh-pool: Update pool commands to use vshCommandOptStringReq
Peter Krempa [Mon, 21 Jan 2013 14:15:01 +0000 (15:15 +0100)]
virsh-pool: Update pool commands to use vshCommandOptStringReq

Rework most of option string retrievals to the new helper.

12 years agovirsh: Add helper to request string arguments with error reporting
Peter Krempa [Mon, 14 Jan 2013 13:38:38 +0000 (14:38 +0100)]
virsh: Add helper to request string arguments with error reporting

This patch adds a helper function with similar semantics to
vshCommandOptString that requests a string argument, but does some error
reporting without the need to do it in the functions themselves.

The error reporting also provides information about the parameter whose
retrieval failed.

12 years agovirsh-pool: Rename helper function buildPoolXML to vshBuildPoolXML
Peter Krempa [Mon, 21 Jan 2013 14:11:12 +0000 (15:11 +0100)]
virsh-pool: Rename helper function buildPoolXML to vshBuildPoolXML

12 years agovirsh-volume: Rename helper function makeCloneXML to vshMakeCloneXML
Peter Krempa [Fri, 18 Jan 2013 15:33:34 +0000 (16:33 +0100)]
virsh-volume: Rename helper function makeCloneXML to vshMakeCloneXML

12 years agovirsh-snapshot: Fix coding style and remove dead code
Peter Krempa [Mon, 21 Jan 2013 16:48:26 +0000 (17:48 +0100)]
virsh-snapshot: Fix coding style and remove dead code

buffer won't be NULL in any case when reaching the check and the first
block of the if statement was lacking parentheses

12 years agohyperv: Simplify hypervPrivate pointer handling in hypervOpen
Matthias Bolte [Thu, 10 Jan 2013 21:39:43 +0000 (22:39 +0100)]
hyperv: Simplify hypervPrivate pointer handling in hypervOpen

12 years agoesx: Simplify esxPrivate pointer handling in esxOpen
Matthias Bolte [Thu, 10 Jan 2013 21:32:13 +0000 (22:32 +0100)]
esx: Simplify esxPrivate pointer handling in esxOpen

Commit 4445e16bfa8056980ac643fabf17186f9e685925 changed the signature
of esxConnectToHost and esxConnectToVCenter by replacing the esxPrivate
pointer with virConnectPtr. The esxPrivate pointer was then retrieved
again from virConnectPtr's privateData. This resulted in a NULL pointer
dereference, because the privateData pointer was not yet initialized at
the point where esxConnectToHost and esxConnectToVCenter are called.

This was fixed in commit b126715a48cd0cbe32ec6468c267cd8cf2961c55 that
moved the initialization of privateData before the problematic calls.

Simplify the logic by making the call to esxFreePrivate unconditional and
changing esxConnectToHost and esxConnectToVCenter back to take a esxPrivate
pointer directly. This allows to assign esxPrivate to the virConnectPtr's
privateData pointer as one of the last steps in esxOpen making it more
obvious that it is not initialized during the earlier steps of esxOpen.

12 years agodocs: don't ignore virEvent API
Eric Blake [Fri, 1 Feb 2013 22:50:34 +0000 (15:50 -0700)]
docs: don't ignore virEvent API

Commit 6094ad7b (0.9.3 release) promoted several functions from
internal to public, but forgot to fix the documentation generator
to provide details about those functions.

For an example of what this fixes, look at:
file:///path/to/libvirt/docs/html/libvirt-libvirt.html#virEventAddHandle
before and after the patch.

* docs/apibuild.py (ignored_functions): Don't ignore functions
that were turned into official API.
* src/util/virevent.c: Fix comments to pass through parser.

12 years agomaint: update to latest gnulib
Eric Blake [Sat, 26 Jan 2013 20:41:31 +0000 (13:41 -0700)]
maint: update to latest gnulib

CVE-2013-0242 in glibc's regex() can cause a DoS in any daemon
that runs a regex search on user input while in a multibyte locale.
I'm not sure how hard it would be to trigger such a setup for
libvirtd, but rather than risk things, we can avoid the issue:
gnulib has worked around the problem, and by updating to the latest
gnulib, we can avoid the bug even on platforms where glibc has yet
to be patched.

* .gnulib: Update to latest, for various fixes, including regex.
* bootstrap: Resync from upstream.

12 years agodocs: use div, not table, for notices on opaque types
Claudio Bley [Tue, 22 Jan 2013 10:11:11 +0000 (11:11 +0100)]
docs: use div, not table, for notices on opaque types

It's simpler to render and it prevents wrapping the line too early
because of the table spacing, border et cetera.

12 years agodocs: abort when missing return or argument documentation
Claudio Bley [Tue, 29 Jan 2013 14:35:28 +0000 (15:35 +0100)]
docs: abort when missing return or argument documentation

When a function has no associated information to one of its
arguments or its return type we report it and stop with an error.

12 years agolibvirt.h.in: document virConnectDomainEventCallback's return value
Claudio Bley [Wed, 30 Jan 2013 13:47:53 +0000 (14:47 +0100)]
libvirt.h.in: document virConnectDomainEventCallback's return value

12 years agolibvirt.h.in: add missing return doc for virEventRemoveHandleFunc
Claudio Bley [Wed, 30 Jan 2013 08:25:16 +0000 (09:25 +0100)]
libvirt.h.in: add missing return doc for virEventRemoveHandleFunc

12 years agolibvirt.h.in: fix documentation for virConnectDomainEventBlockJobCallback
Claudio Bley [Wed, 30 Jan 2013 07:38:25 +0000 (08:38 +0100)]
libvirt.h.in: fix documentation for virConnectDomainEventBlockJobCallback

In commit 3ac26e2645e6456389a918455213d7e3824f63f9 parameter "path" was
renamed to "disk" but this change was not reflected in the documentation.

Additionally, documentation of the "opaque" parameter was missing.

12 years agolibvirt.h.in: add missing documentation for virConnectCloseFunc
Claudio Bley [Wed, 30 Jan 2013 07:35:38 +0000 (08:35 +0100)]
libvirt.h.in: add missing documentation for virConnectCloseFunc

12 years agoAdd support for QEMU -add-fd support detection
Stefan Berger [Tue, 29 Jan 2013 16:52:17 +0000 (11:52 -0500)]
Add support for QEMU -add-fd support detection

Add support for QEMU -add-fd command line parameter detection.
This intentionally rejects qemu 1.2, where 'add-fd' QMP did
not allow full control of set ids, and where there was no command
line counterpart, but accepts qemu 1.3.

Signed-off-by: Eric Blake <eblake@redhat.com>
12 years agoqemu: expose qemu 1.3 add-fd monitor command
Eric Blake [Thu, 31 Jan 2013 00:18:44 +0000 (17:18 -0700)]
qemu: expose qemu 1.3 add-fd monitor command

Add entry points for calling the qemu 'add-fd' and 'remove-fd'
monitor commands.  There is no entry point for 'query-fdsets';
the assumption is that a developer can use
 virsh qemu-monitor-command domain '{"execute":"query-fdsets"}'
when debugging issues, and that meanwhile, libvirt is responsible
enough to remember what fds it associated with what fdsets.
Likewise, on the 'add-fd' command, it is assumed that libvirt
will always pass a set id, rather than letting qemu autogenerate
the next available id number.

* src/qemu/qemu_monitor.c (qemuMonitorAddFd, qemuMonitorRemoveFd):
New functions.
* src/qemu/qemu_monitor.h (qemuMonitorAddFd, qemuMonitorRemoveFd):
New prototypes.
* src/qemu/qemu_monitor_json.c (qemuMonitorJSONAddFd)
(qemuMonitorJSONRemoveFd): New functions.
* src/qemu/qemu_monitor_json.h (qemuMonitorJSONAddFd)
(qemuMonitorJSONRemoveFd): New prototypes.

12 years agotests: add a comment about our fake qmp
Eric Blake [Thu, 31 Jan 2013 01:50:09 +0000 (18:50 -0700)]
tests: add a comment about our fake qmp

While testing QMP, I used a simple qemu session of
'qemu-kvm -M none -nodefaults -nographic -qmp stdio'
for some experiments.  But it took me far too long to remember
the magic invocation to unlock QMP into accepting normal commands.
While I was able to grep libvirt sources and easily find where
libvirt expects the normal "QMP" greeting, I could not find the
proper reply to that greeting nearby.

Reading the testsuite didn't help either, since there we don't
emulate the mandatory handshake.  But since my grep hit the
testsuite, adding a bit of documentation will make it much easier
to jog my memory in the future.

* tests/qemumonitortestutils.c (QEMU_JSON_GREETING): Mention that
the normal counterpart reply is skipped.

12 years agospec: Avoid using makeinstall relic
Jiri Denemark [Thu, 31 Jan 2013 14:31:37 +0000 (15:31 +0100)]
spec: Avoid using makeinstall relic

The macro was made to help installing broken packages that did not use
DESTDIR correctly by overriding individual path variables (prefix,
sysconfdir, ...). Newer rpm provides fixed make_install macro that calls
make install with just the correct DESTDIR, however it is not available
everywhere (e.g., RHEL 5 does not have it). On the other hand the
make_install macro is simple and straightforward enough for us to use
its expansion directly.

12 years agocomplete virterror->virerror name change
Serge Hallyn [Thu, 31 Jan 2013 03:05:45 +0000 (21:05 -0600)]
complete virterror->virerror name change

Without these two string changes in generator.py, the
virGetLastError wrapper does not get created in
/usr/share/pyshared/libvirt.py.  Noticed when running
tests with virt-install.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
12 years agotests: Don't build securityselinuxlabeltest without qemu
Jiri Denemark [Wed, 30 Jan 2013 15:44:06 +0000 (16:44 +0100)]
tests: Don't build securityselinuxlabeltest without qemu

Sources for securityselinuxlabeltest are only defined if qemu driver is
enabled so we should not try to build the test if qemu driver is
disabled.

12 years agoapibuild.py: fix TypeError raised in except clause
Claudio Bley [Wed, 30 Jan 2013 08:33:36 +0000 (09:33 +0100)]
apibuild.py: fix TypeError raised in except clause

When an exception happened inside the try clause in serialize_function,
a new exception was raised in the except clause subsequently:

Traceback (most recent call last):
  File "./apibuild.py", line 2529, in <module>
    rebuild("libvirt")
  File "./apibuild.py", line 2513, in rebuild
    builder.serialize()
  File "./apibuild.py", line 2467, in serialize
    self.serialize_function(output, function)
  File "./apibuild.py", line 2208, in serialize_function
    self.warning("Failed to save function %s info: " % name, `id.info`)
TypeError: warning() takes exactly 2 arguments (3 given)

Use the correct number of arguments for self.warning and print the
original exception to stderr.

12 years agoEnforce return check on virAsprintf() calls
John Ferlan [Wed, 30 Jan 2013 20:43:39 +0000 (15:43 -0500)]
Enforce return check on virAsprintf() calls

Way back when I started making changes for Coverity messages my first set
were to a bunch of CHECKED_RETURN errors.  In particular virAsprintf() had
a few callers that Coverity noted didn't check their return (although some
did check if the buffer being printed to was NULL or not).

It was suggested at the time as a further patch an ATTRIBUTE_RETURN_CHECK
should be added to virAsprintf(), see:

https://www.redhat.com/archives/libvir-list/2013-January/msg00120.html

This patch does that and fixes a few more instances not found by Coverity
that failed the check.

12 years agoutil: Fix mask for 172.16.0.0 private address range
Jiri Denemark [Wed, 30 Jan 2013 11:01:01 +0000 (12:01 +0100)]
util: Fix mask for 172.16.0.0 private address range

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

Only the first 12 bits should be set in the mask for this range. All
addresses between 172.16.0.0 and 172.31.255.255 are private.

12 years agosnapshot: Mention disk-only snapshots in error message
Peter Krempa [Fri, 25 Jan 2013 10:50:43 +0000 (11:50 +0100)]
snapshot: Mention disk-only snapshots in error message

When a disk-only snapshot is requested the domain is treated as if it
was offline. This forbids to mix memory checkpoints with the DISK_ONLY
flag.

This patch improves the error message and mentions the restriction in
the virsh man page.

12 years agoSync HACKING and hacking.html.in
Martin Kletzander [Wed, 30 Jan 2013 10:01:31 +0000 (11:01 +0100)]
Sync HACKING and hacking.html.in

After one last-minute change, only HACKING was updated and not
hacking.html.in, so this patch synchronizes that.

12 years agoRelease of libvirt-1.0.2
Daniel Veillard [Wed, 30 Jan 2013 09:42:05 +0000 (10:42 +0100)]
Release of libvirt-1.0.2

* configure.ac docs/news.html.in libvirt.spec.in: update for the release
* po/*.po*: updated localizations

12 years agoIgnore '.trs' files
Martin Kletzander [Mon, 28 Jan 2013 14:19:14 +0000 (15:19 +0100)]
Ignore '.trs' files

When doing checks with automake, there are '<testname>.trs' files left
behind, that might or might not be usable, however these show up in
'git status' even though we definitely don't want them to be tracked
in the repository'.  Automake adds the '--trs-files' option by default
since commit 0c81b43f711fb861f04227ced8dba889596d9c43 [1], which
consequently (from 1.13 in my case) started leaving these files behind
along with '<testname>.log' files as well (which we already ignore).

[1] http://git.savannah.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=0c81b43

12 years agodocs: aesthetical cleanups
Martin Kletzander [Mon, 17 Dec 2012 15:03:23 +0000 (16:03 +0100)]
docs: aesthetical cleanups

Adding dots inside "exempli gratia" where missing.  While on that, I
took the liberty of changing it where found with simple grep.

12 years agoconf: Don't format cputune element when not needed
Martin Kletzander [Mon, 17 Dec 2012 15:03:01 +0000 (16:03 +0100)]
conf: Don't format cputune element when not needed

Commit 60b176c3d0f0d5037acfa5e27c7753f657833a0b introduced a bug that
when editing an XML with cputune similar to this:

...
  <vcpu placement='static' current='1'>2</vcpu>
  <cputune>
    <vcpupin vcpu="1" cpuset="0"/>
  </cputune>
...

results in formatted XML that looks like this:

...
  <vcpu placement='static' current='1'>2</vcpu>
  <cputune>
  </cputune>
...

That is caused by a condition depending on def->cputune.vcpupin being
set rather than checking def->cputune.nvcpupin.  Notice that nvcpupin
can be 0 and vcpupin can still be allocated since it's a pointer to an
array, so no harm done there.

I also changed it on other places in the code where it depended on the
wrong variable.

12 years agodocs: fix missed documentation for virterror functions
Claudio Bley [Tue, 29 Jan 2013 15:24:35 +0000 (16:24 +0100)]
docs: fix missed documentation for virterror functions

Commit f24404a3244b50c1d6d3a735445b02450ac40981 renamed virterror.c to
virerror.c but forgot to change the reference in this file.

12 years agovirlog: remove old code comment
Doug Goldstein [Sun, 27 Jan 2013 00:22:41 +0000 (18:22 -0600)]
virlog: remove old code comment

Setting the log output prefix to 0 is not supported and in fact results
in the following message:
warning : virLogParseOutputs:1021 : Ignoring invalid log output setting.

12 years agobuild: Regenerate man pages on version bump
Jiri Denemark [Tue, 29 Jan 2013 10:32:41 +0000 (11:32 +0100)]
build: Regenerate man pages on version bump

Whenever libvirt version changes in configure.ac, we need to regenerate
man pages so that they contain correct version info.

12 years agoconf: Fix cpumask leak in virDomainDefFree
Ján Tomko [Fri, 25 Jan 2013 15:00:47 +0000 (16:00 +0100)]
conf: Fix cpumask leak in virDomainDefFree

def->cpumask is a bitmap and needs to be freed by virBitmapFree.

12 years agoqemu: Destroy domain on decompression binary error
Michal Privoznik [Mon, 28 Jan 2013 14:13:27 +0000 (15:13 +0100)]
qemu: Destroy domain on decompression binary error

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

Currently, if qemuProcessStart() succeeds, but it's decompression
binary that returns nonzero status, we don't kill the qemu process,
but remove it from internal domain list, leaving the qemu process
hanging around totally uncontrolled.

12 years agorpc: Fix crash on error paths of message dispatching
Peter Krempa [Fri, 4 Jan 2013 15:15:04 +0000 (16:15 +0100)]
rpc: Fix crash on error paths of message dispatching

This patch resolves CVE-2013-0170:
https://bugzilla.redhat.com/show_bug.cgi?id=893450

When reading and dispatching of a message failed the message was freed
but wasn't removed from the message queue.

After that when the connection was about to be closed the pointer for
the message was still present in the queue and it was passed to
virNetMessageFree which tried to call the callback function from an
uninitialized pointer.

This patch removes the message from the queue before it's freed.

* rpc/virnetserverclient.c: virNetServerClientDispatchRead:
    - avoid use after free of RPC messages

12 years agorng: Change the datatype for volume name for common use
Osier Yang [Wed, 23 Jan 2013 11:04:34 +0000 (19:04 +0800)]
rng: Change the datatype for volume name for common use

The "volName" will be used by later patch.

12 years agoeng: Remove the duplicate definition
Osier Yang [Wed, 23 Jan 2013 11:04:33 +0000 (19:04 +0800)]
eng: Remove the duplicate definition

The RE for data type "name" storagepool.rng uses is same with
"genericName" in basictypes.rng.

12 years agoqemu_hotplug: Rework media changing process
Michal Privoznik [Thu, 24 Jan 2013 14:14:14 +0000 (15:14 +0100)]
qemu_hotplug: Rework media changing process

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

It seems like with new udev within guest OS, the tray is locked,
so we need to:
- 'eject'
- wait for tray to open
- 'change'

Moreover, even when doing bare 'eject', we should check for
'tray_open' as guest may have locked the tray. However, the
waiting phase shouldn't be unbounded, so I've chosen 10 retries
maximum, each per 500ms. This should give enough time for guest
to eject a media and open the tray.

12 years agomaint: one missed syms file
Eric Blake [Sat, 26 Jan 2013 16:59:12 +0000 (09:59 -0700)]
maint: one missed syms file

Commit f0aa493 missed a file.

* src/libvirt_driver_modules.syms: Add editor hint.

12 years agovbox: Adjust the UTF FREE macros
John Ferlan [Thu, 24 Jan 2013 00:34:48 +0000 (19:34 -0500)]
vbox: Adjust the UTF FREE macros

Adjust the macros to free memory allocated during various calls to
perform the check if parameter is NULL prior to really freeing and to
set the pointer to NULL after done freeing.

12 years agovbox: Address false positive for NULL dereference
John Ferlan [Thu, 24 Jan 2013 00:34:47 +0000 (19:34 -0500)]
vbox: Address false positive for NULL dereference

Resolve a false positive from 'vboxIIDFromUUID_v2_x()'. The code sets
'iid->value = &iid->backing' unconditionally prior to calling 'nsIDFromChar()'.
The 'vboxIIDUnalloc_v2_x()' checks iid->value to not be &iid->backing. The
iid->backing is a static buffer within the initialized structure.

12 years agoMake sure we only abort without libcurl if $with_esx = yes
Guido Günther [Fri, 25 Jan 2013 21:06:53 +0000 (22:06 +0100)]
Make sure we only abort without libcurl if $with_esx = yes

12 years agovirsh: Add --print-xml flag for attach-disk command
Peter Krempa [Fri, 25 Jan 2013 12:21:23 +0000 (13:21 +0100)]
virsh: Add --print-xml flag for attach-disk command

The flag causes the XML of the disk that would be attached to be printed
instead.

12 years agolibxl: Domain event handler improvements
Jim Fehlig [Mon, 21 Jan 2013 17:36:03 +0000 (10:36 -0700)]
libxl: Domain event handler improvements

Since libxl provides the domain ID in the event handler callback,
find the domain object based on the ID.  This approach prevents
processing the callback on a domain that has already been reaped.

Also, similar to the xl implementation, ignore the SUSPEND shutdown
reason.  By calling libxl_domain_suspend(), we know a shutdown
event with SUSPEND reason will be generated, but it can be safely
ignored since any subsequent cleanup will be done by the callers.

12 years agolibxl: Fix removing non-persistent domain after save
Jim Fehlig [Mon, 21 Jan 2013 17:32:34 +0000 (10:32 -0700)]
libxl: Fix removing non-persistent domain after save

libxlDoDomainSave() was removing non-persistent domains, but
required callers to have the virDomainObj locked.  Callers could
potentially unlock an already freed virDomainObj.  Move this
logic to the callers of libxlDoDomainSave().

12 years agolibxl: Explicitly remove timeouts
Jim Fehlig [Mon, 21 Jan 2013 17:30:29 +0000 (10:30 -0700)]
libxl: Explicitly remove timeouts

I've noticed that libxl can invoke timeout reregister/modify hooks
after returning from libxl_ctx_free.  Explicitly remove the
timeouts before freeing the libxl ctx to avoid executing hooks on
stale objects.

12 years agolibxl: Fix race between destruction of objects
Jim Fehlig [Mon, 21 Jan 2013 17:22:07 +0000 (10:22 -0700)]
libxl: Fix race between destruction of objects

It is possible to destroy and cleanup a VM, resulting in freeing the
libxlDomainObjPrivate object and associated libxl ctx, before all fds and
timeouts have been deregistered and destroyed.

Fix this race by incrementing the reference count on libxlDomainObjPrivate
for each fd and timeout registration.  Only when all fds and timeouts are
deregistered and destroyed will the libxlDomainObjPrivate be destroyed.

12 years agolibxl: Fix races in libxl event code
Jim Fehlig [Mon, 21 Jan 2013 17:09:05 +0000 (10:09 -0700)]
libxl: Fix races in libxl event code

The libxl driver is racy in it's interactions with libxl and libvirt's
event loop.  The event loop can invoke callbacks after libxl has
deregistered the event, and possibly access freed data associated with
the event.

This patch fixes the race by converting libxlDomainObjPrivate to a
virObjectLockable, and locking it while executing libxl upcalls and
libvirt event loop callbacks.

Note that using the virDomainObj lock is not satisfactory since it may
be desirable to hold the virDomainObj lock even when libxl events such
as reading and writing to xenstore need processed.

12 years agolibxl: Fix handling of timeouts
Jim Fehlig [Mon, 21 Jan 2013 16:59:28 +0000 (09:59 -0700)]
libxl: Fix handling of timeouts

xen-unstable changeset 26469 makes changes wrt modifying and deregistering
timeouts.

First, timeout modify callbacks will only be invoked with an
abs_t of {0,0}, i.e. make the timeout fire immediately.  Prior to this
commit, timeout modify callbacks were never invoked.

Second, timeout deregister hooks will no longer be called.

This patch makes changes in the libvirt libxl driver that should be
compatible before and after changeset 26469.

While at it, fix a potential overflow in the timeout register callback.

12 years agoconf: avoid NULL deref for pmsuspended domain state
Eric Blake [Thu, 24 Jan 2013 00:06:06 +0000 (17:06 -0700)]
conf: avoid NULL deref for pmsuspended domain state

While working with a pmsuspend vs. snapshot issue, I noticed that
the state file in /var/run/libvirt/qemu/dom.xml contained a rather
suspicious "(null)" string, which does not round-trip well through
a libvirtd restart.  Had I been on a platform other than glibc
where printf("%s",NULL) crashes instead of printing (null), we might
have noticed the problem much sooner.

And in fixing that problem, I also noticed that we had several
missing states, because we were #defining several *_LAST names
to a value _different_ than what they were already given as enums
in libvirt.h.  Yuck.  I got rid of default: labels in the case
statements, because they get in the way of gcc's -Wswitch helping
us ensure we cover all enum values.

* src/conf/domain_conf.c (virDomainStateReasonToString)
(virDomainStateReasonFromString): Fill in missing domain states;
rewrite case statement to let compiler enforce checking.
(VIR_DOMAIN_NOSTATE_LAST, VIR_DOMAIN_RUNNING_LAST)
(VIR_DOMAIN_BLOCKED_LAST, VIR_DOMAIN_PAUSED_LAST)
(VIR_DOMAIN_SHUTDOWN_LAST, VIR_DOMAIN_SHUTOFF_LAST)
(VIR_DOMAIN_CRASHED_LAST): Drop dead defines.
(VIR_DOMAIN_PMSUSPENDED_LAST): Drop dead define.
(virDomainPMSuspendedReason): Add missing enum function.
(virDomainRunningReason, virDomainPausedReason): Add missing enum
value.
* src/conf/domain_conf.h (virDomainPMSuspendedReason): Declare
missing functions.
* src/libvirt_private.syms (domain_conf.h): Export them.

12 years agomaint: make it easier to sort syms files
Eric Blake [Thu, 24 Jan 2013 01:20:01 +0000 (18:20 -0700)]
maint: make it easier to sort syms files

I got bit by 'make check' complaining that the sort order I got
by emacs' sort-lines function differed from expectations.

* src/libvirt_private.syms: Add emacs trailer.
* src/libvirt_atomic.syms: Likewise.
* src/libvirt_daemon.syms: Likewise.
* src/libvirt_esx.syms: Likewise.
* src/libvirt_libssh2.syms: Likewise.
* src/libvirt_linux.syms: Likewise.
* src/libvirt_openvz.syms: Likewise.
* src/libvirt_sasl.syms: Likewise.
* src/libvirt_vmx.syms: Likewise.
* src/libvirt_xenxs.syms: Likewise.

12 years agoqemu_monitor: Fix tray-open attribute in query-block
Michal Privoznik [Fri, 25 Jan 2013 11:56:48 +0000 (12:56 +0100)]
qemu_monitor: Fix tray-open attribute in query-block

With our code, we fail to query for tray-open attribute currently.
That's because in HMP it is 'tray-open' and in QMP it's 'tray_open'.
It always has been. However, we got it exactly the opposite.

12 years agoFix bogus reporting of KVM support for non-native emulators
Daniel P. Berrange [Fri, 25 Jan 2013 10:46:49 +0000 (10:46 +0000)]
Fix bogus reporting of KVM support for non-native emulators

A logic bug meant we reported KVM was possible for every
architecture, merely based on whether the query-kvm command
exists. We should instead have been doing it based on whether
the query-kvm command returns 'present: 1'

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoMove QEMU capabilities initialization later in QEMU startup
Daniel P. Berrange [Thu, 24 Jan 2013 18:32:31 +0000 (18:32 +0000)]
Move QEMU capabilities initialization later in QEMU startup

Currently QEMU capabilities are initialized before the QEMU driver
sets ownership on its various directories. The upshot is that if
you change the user/group in the qemu.conf file, libvirtd will fail
to probe QEMU the first time it is run after the config change.
Moving QEMU capabilities initialization to after the chown() calls
fixes this

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix performance & reliabilty of QMP probing
Daniel P. Berrange [Thu, 24 Jan 2013 18:21:23 +0000 (18:21 +0000)]
Fix performance & reliabilty of QMP probing

This previous commit

  commit 1a50ba2cb07d8bb2aa724062889deb9efd7ad9e9
  Author: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
  Date:   Mon Nov 26 15:17:13 2012 +0100

    qemu: Fix QMP Capabability Probing Failure

which attempted to make sure the QEMU process used for probing
ran as the right user id, caused serious performance regression
and unreliability in probing. The -daemonize switch in QEMU
guarantees that the monitor socket is present before the parent
process exits. This means libvirtd is guaranteed to be able to
connect immediately. By switching from -daemonize to the
virCommandDaemonize API libvirtd was no longer synchronized with
QEMU's startup process. The result was that the QEMU monitor
failed to open and went into its 200ms sleep loop. This happened
for all 25 binaries resulting in 5 seconds worth of sleeping
at libvirtd startup. In addition sometimes when libvirt connected,
QEMU would be partially initialized and crash causing total
failure to probe that binary.

This commit reverts the previous change, ensuring we do use the
-daemonize flag to QEMU. Startup delay is cut from 7 seconds
to 2 seconds on my machine, which is on a par with what it was
prior to the capabilities rewrite.

To deal with the fact that QEMU needs to be able to create the
pidfile, we switch pidfile location fron runDir to libDir, which
QEMU is guaranteed to be able to write to.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoqemuDomainSendKey: Relax the qemu driver locking
Michal Privoznik [Thu, 24 Jan 2013 09:39:06 +0000 (10:39 +0100)]
qemuDomainSendKey: Relax the qemu driver locking

Currently, there is no reason to hold qemu driver locked
throughout whole API execution. Moreover, we can use the
new qemuDomObjFromDomain() internal API to lookup domain then.

12 years agonode_memory: Add '\n' to help message
Satoru Moriya [Thu, 24 Jan 2013 19:40:51 +0000 (19:40 +0000)]
node_memory: Add '\n' to help message

Linefeed is missed in the help of node-memory-tune.
This patch just adds '\n' to get a correct help message.

Signed-off-by: Satoru Moriya <satoru.moriya@hds.com>
12 years agoqemu: escape ipv6 for rbd network disk hosts
Josh Durgin [Fri, 25 Jan 2013 02:45:31 +0000 (18:45 -0800)]
qemu: escape ipv6 for rbd network disk hosts

Hosts for rbd are ceph monitor daemons. These have fixed IP addresses,
so they are often referenced by IP rather than hostname for
convenience, or to avoid relying on DNS. Using IPv4 addresses as the
host name works already, but IPv6 addresses require rbd-specific
escaping because the colon is used as an option separator in the
string passed to qemu.

Escape these colons, and enclose the IPv6 address in square brackets
so it is distinguished from the port, which is currently mandatory.

Acked-by: Osier Yang <jyang@redhat.com>
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
12 years agosnapshot: fix state after external snapshot of S3 domain
Eric Blake [Wed, 9 Jan 2013 04:54:45 +0000 (21:54 -0700)]
snapshot: fix state after external snapshot of S3 domain

https://bugzilla.redhat.com/show_bug.cgi?id=876829 complains that
if a guest is put into S3 state (such as via virsh dompmsuspend)
and then an external snapshot is taken, qemu forcefully transitions
the domain to paused, but libvirt doesn't reflect that change
internally.  Thus, a user has to use 'virsh suspend' to get libvirt
back in sync with qemu state, and if the user doesn't know this
trick, then the guest appears hung.

* src/qemu/qemu_driver.c (qemuDomainSnapshotCreateActiveExternal):
Track fact that qemu wakes up a suspended domain on migration.

12 years agolocking: use virStrcpyStatic instead of memcpy
John Ferlan [Fri, 18 Jan 2013 13:50:37 +0000 (08:50 -0500)]
locking: use virStrcpyStatic instead of memcpy

12 years agopython: Fix bindings for virDomainSnapshotGet{Domain,Connect}
Jiri Denemark [Wed, 23 Jan 2013 11:14:57 +0000 (12:14 +0100)]
python: Fix bindings for virDomainSnapshotGet{Domain,Connect}

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

virDomainSnapshot.getDomain() and virDomainSnapshot.getConnect()
wrappers around virDomainSnapshotGet{Domain,Connect} were not supposed
to be ever implemented. The class should contain proper domain() and
connect() accessors that fetch python objects stored internally within
the class. While domain() was already provided, connect() was missing.

This patch adds connect() method to virDomainSnapshot class and
reimplements getDomain() and getConnect() methods as aliases to domain()
and connect() for backward compatibility.

12 years agoFix crash free'ing securityDriverNames in QEMU driver
Daniel P. Berrange [Thu, 24 Jan 2013 18:36:04 +0000 (18:36 +0000)]
Fix crash free'ing securityDriverNames in QEMU driver

The previous fix to avoid leaking securityDriverNames forgot to
handle the case of securityDriverNames being NULL, leading to
a crash

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoMake python objects inherit from 'object' base class
Daniel P. Berrange [Thu, 24 Jan 2013 13:15:06 +0000 (13:15 +0000)]
Make python objects inherit from 'object' base class

As of python >= 2.2, it is recommended that all objects inherit
from the 'object' base class. We already require python >= 2.3
for libvirt for thread macro support, so we should follow this
best practice.

See also

  http://stackoverflow.com/questions/4015417/python-class-inherits-object

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix leak of securityDriverNames
Daniel P. Berrange [Wed, 23 Jan 2013 17:42:15 +0000 (17:42 +0000)]
Fix leak of securityDriverNames

When shutting down, the QEMU driver forgot to free the
securityDriverNames string list

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAvoid use of free'd memory in auto destroy callback
Daniel P. Berrange [Wed, 23 Jan 2013 17:22:27 +0000 (17:22 +0000)]
Avoid use of free'd memory in auto destroy callback

The autodestroy callback code has the following function
called from a hash iterator

  qemuDriverCloseCallbackRun(void *payload,
                             const void *name,
                             void *opaque)
  {
    ...
    char *uuidstr = name
    ...

    dom = closeDef->cb(data->driver, dom, data->conn);
    if (dom)
        virObjectUnlock(dom);

    virHashRemoveEntry(data->driver->closeCallbacks, uuidstr);
  }

The closeDef->cb function may well cause the current callback
to be removed, if it shuts down 'dom'. As such the use of
'uuidstr' in virHashRemoveEntry is accessing free'd memory.
We must make a copy of the uuid str before invoking the
callback to be safe.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoEnsure nodeinfo struct is initialized to zero
Daniel P. Berrange [Wed, 23 Jan 2013 15:43:21 +0000 (15:43 +0000)]
Ensure nodeinfo struct is initialized to zero

When linuxNodeInfoCPUPopulate() method triggered use of an
uninitialize value, since it did not initialize the 'sockets'
field in the virNodeInfoPtr struct:

==30020== Conditional jump or move depends on uninitialised value(s)
==30020==    at 0x5125DBD: linuxNodeInfoCPUPopulate (nodeinfo.c:513)
==30020==    by 0x51261A0: nodeGetInfo (nodeinfo.c:884)
==30020==    by 0x149B9B10: qemuCapsInit (qemu_capabilities.c:846)
==30020==    by 0x14A11B25: qemuCreateCapabilities (qemu_driver.c:424)
==30020==    by 0x14A12426: qemuStartup (qemu_driver.c:874)
==30020==    by 0x512A7AF: virStateInitialize (libvirt.c:822)
==30020==    by 0x40DE04: daemonRunStateInit (libvirtd.c:877)
==30020==    by 0x50ADCE5: virThreadHelper (virthreadpthread.c:161)
==30020==    by 0x328CA07D14: start_thread (pthread_create.c:308)
==30020==    by 0x328C6F246C: clone (clone.S:114)
(happened twice)

        if (socks > nodeinfo->sockets)    <--- here
            nodeinfo->sockets = socks;

Rather than doing this for each field, just make the caller memset
the entire struct to zero.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoselinux: Properly indent preprocessor directives
Jiri Denemark [Thu, 24 Jan 2013 13:10:50 +0000 (14:10 +0100)]
selinux: Properly indent preprocessor directives

12 years agoapparmor: Avoid freeing uninitialized pointer
Jiri Denemark [Thu, 24 Jan 2013 12:53:22 +0000 (13:53 +0100)]
apparmor: Avoid freeing uninitialized pointer

12 years agoxen: Actually fix the uninitialized variable
Peter Krempa [Thu, 24 Jan 2013 13:02:49 +0000 (14:02 +0100)]
xen: Actually fix the uninitialized variable

0eedb1d9bff672b24d6957dfaa0a8b42d9e851a7 fixed the wrong variable

12 years agoxen: Initialize variable before using
Peter Krempa [Thu, 24 Jan 2013 12:57:14 +0000 (13:57 +0100)]
xen: Initialize variable before using

Commit 87b4c10c6cf02251dd8c29b5b895bebc6ec297f9 added code that may call
the virCapabilitiesClearHostNUMACellCPUTopology function with
uninitialized second argument. Although the value wouldn't be used some
compilers whine about that.

12 years agoselinux: Only create the selabel_handle once.
Richard W.M. Jones [Wed, 23 Jan 2013 20:09:04 +0000 (20:09 +0000)]
selinux: Only create the selabel_handle once.

According to Eric Paris this is slightly more efficient because it
only loads the regular expressions in libselinux once.

12 years agoparallels_utils: Check return status properly from virCommandRun()
John Ferlan [Wed, 23 Jan 2013 22:04:48 +0000 (17:04 -0500)]
parallels_utils: Check return status properly from virCommandRun()

12 years agoutil: Need to add virCommandFree()
John Ferlan [Wed, 23 Jan 2013 22:04:47 +0000 (17:04 -0500)]
util: Need to add virCommandFree()

12 years agostorage: Need to add virCommandFree()
John Ferlan [Wed, 23 Jan 2013 22:04:46 +0000 (17:04 -0500)]
storage: Need to add virCommandFree()

12 years agosecurity: Need to add virCommandFree()
John Ferlan [Wed, 23 Jan 2013 22:04:45 +0000 (17:04 -0500)]
security: Need to add virCommandFree()

12 years agoparallels: Resolve some resource leaks
John Ferlan [Wed, 23 Jan 2013 22:04:44 +0000 (17:04 -0500)]
parallels: Resolve some resource leaks

Be sure to VIR_FREE(accel) and moved virDomainVideoDefFree() within no_memory
label to be consistent

Resolve resource leak in parallelsApplyIfaceParams() when the 'oldnet' is
allocated locally. Also virCommandFree(cmd) as necessary.

12 years agotest: Add support for thread and core information for the test driver
Peter Krempa [Tue, 22 Jan 2013 21:18:19 +0000 (22:18 +0100)]
test: Add support for thread and core information for the test driver

This patch adds demo processor topology information for the test driver.

12 years agocapabilities: Add additional data to the NUMA topology info
Peter Krempa [Fri, 18 Jan 2013 22:06:55 +0000 (23:06 +0100)]
capabilities: Add additional data to the NUMA topology info

This patch adds data gathering to the NUMA gathering files and adds
support for outputting the data. The test driver and xend driver need to
be adapted to fill sensible data to the structure in a future patch.

12 years agocapabilities: Switch CPU data in NUMA topology to a struct
Peter Krempa [Tue, 22 Jan 2013 17:42:08 +0000 (18:42 +0100)]
capabilities: Switch CPU data in NUMA topology to a struct

This will allow storing additional topology data in the NUMA topology
definition.

This patch changes the storage type and fixes fallout of the change
across the drivers using it.

This patch also changes semantics of adding new NUMA cell information.
Until now the data were re-allocated and copied to the topology
definition. This patch changes the addition function to steal the
pointer to a pre-allocated structure to simplify the code.

12 years agoconf: Split out NUMA topology formatting to simplify access to data
Peter Krempa [Fri, 18 Jan 2013 19:39:00 +0000 (20:39 +0100)]
conf: Split out NUMA topology formatting to simplify access to data

12 years agoschemas: Add schemas for more CPU topology information in the caps XML
Peter Krempa [Fri, 18 Jan 2013 18:30:00 +0000 (19:30 +0100)]
schemas: Add schemas for more CPU topology information in the caps XML

This patch adds RNG schemas for adding more information in the topology
output of the NUMA section in the capabilities XML.

The added elements are designed to provide more information about the
placement and topology of the processors in the system to management
applications.

A demonstration of supported XML added by this patch:
<capabilities>
  <host>
    <topology>
      <cells num='3'>
        <cell id='0'>
          <cpus num='4'> <!-- this is node with Hyperthreading -->
            <cpu id='0' socket_id='0' core_id='0' siblings='0-1'/>
            <cpu id='1' socket_id='0' core_id='0' siblings='0-1'/>
            <cpu id='2' socket_id='0' core_id='1' siblings='2-3'/>
            <cpu id='3' socket_id='0' core_id='1' siblings='2-3'/>
          </cpus>
        </cell>
        <cell id='1'>
          <cpus num='4'> <!-- this is node with modules (Bulldozer) -->
            <cpu id='4' socket_id='0' core_id='2' siblings='4-5'/>
            <cpu id='5' socket_id='0' core_id='3' siblings='4-5'/>
            <cpu id='6' socket_id='0' core_id='4' siblings='6-7'/>
            <cpu id='7' socket_id='0' core_id='5' siblings='6-7'/>
          </cpus>
         </cell>
        <cell id='2'>
          <cpus num='4'> <!-- this is a normal multi-core node -->
            <cpu id='8' socket_id='1' core_id='0' siblings='8'/>
            <cpu id='9' socket_id='1' core_id='1' siblings='9'/>
            <cpu id='10' socket_id='1' core_id='2' siblings='10'/>
            <cpu id='11' socket_id='1' core_id='3' siblings='11'/>
          </cpus>
         </cell>
      </cells>
    </topology>
  </host>
</capabilities>

The socket_id field represents identification of the physical socket the
CPU is plugged in. This ID may not be identical to the physical socket
ID reported by the kernel.

The core_id identifies a core within a socket. Also this field may not
accurately represent physical ID's.

The core_id is guaranteed to be unique within a cell and a socket. There
may be duplicates between sockets. Only cores sharing core_id within one
cell and one socket can be considered as threads. Cores sharing core_id
within sparate cells are distinct cores.

The siblings field is a list of CPU id's the cpu id's the CPU is sibling
with - thus a thread. The list is in the cpuset format.

12 years agoschema: Make the cpuset type reusable across schema files
Peter Krempa [Fri, 18 Jan 2013 18:29:40 +0000 (19:29 +0100)]
schema: Make the cpuset type reusable across schema files

12 years agoS390: Enhance memballoon handling for virtio-s390
Viktor Mihajlovski [Fri, 11 Jan 2013 15:30:07 +0000 (16:30 +0100)]
S390: Enhance memballoon handling for virtio-s390

The way in that memory balloon suppression was handled for S390
is flawed for a number or reasons.
1. Just preventing the default balloon to be created in the case
   of VIR_ARCH_S390[X] is not sufficient. An explicit memballoon
   element in the guest definition will still be honored, resulting
   both in a -balloon option and the allocation of a PCI bus address,
   neither being supported.
2. Prohibiting balloon for S390 altogether at a domain_conf level
   is no good solution either as there's work in progress on the QEMU
   side to implement a virtio-balloon device, although in
   conjunction with a new machine type. Suppressing the balloon
   should therefore be done at the QEMU driver level depending
   on the present capabilities.

Therefore we remove the conditional suppression of the default
balloon in domain_conf.c.
Further, we are claiming the memballoon device for virtio-s390
during device address assignment to prevent it from being considered
as a PCI device.
Finally, we suppress the generation of the balloon command line option
if this is a virtio-s390 machine.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
12 years agoqemu: Re-add driver unlock to qemuDomainSendKey
Viktor Mihajlovski [Wed, 23 Jan 2013 13:55:15 +0000 (14:55 +0100)]
qemu: Re-add driver unlock to qemuDomainSendKey

Should have been done in commit 56fd513 already, but was missed
due to oversight: qemuDomainSendKey didn't release the driver lock
in its cleanup section. This fixes an issue introduced by commit
8c5d2ba.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoconf: Fix usage of virBitmapParse
Peter Krempa [Wed, 23 Jan 2013 14:43:47 +0000 (15:43 +0100)]
conf: Fix usage of virBitmapParse

virNetworkObjUpdateParseFile used ',' as the termination character for
virBitmapParse. This would break if an non-contiguous range would be
parsed.

12 years agoutil: Fix docs for virBitmapParse
Peter Krempa [Wed, 23 Jan 2013 14:18:09 +0000 (15:18 +0100)]
util: Fix docs for virBitmapParse

This patch changes the name of the @sep argument to @terminator and
clarifies it's usage. This patch also explicitly documents that
whitespace can't be used as @terminator as it is skipped multiple times
in the implementation.

12 years agorng: Have colorful *.rng with editor
Osier Yang [Wed, 23 Jan 2013 15:03:17 +0000 (23:03 +0800)]
rng: Have colorful *.rng with editor

Just add the head line to let the editor know it's XML document.

12 years agoqemu_agent: Ignore expected EOFs
Michal Privoznik [Mon, 21 Jan 2013 10:52:44 +0000 (11:52 +0100)]
qemu_agent: Ignore expected EOFs

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

One of my previous patches (f2a4e5f176c408) tried to fix crashing
libvirtd on domain detroy. However, we need to copy pattern from
qemuProcessHandleMonitorEOF() instead of decrementing reference
counter. The rationale for this is, if qemu process is dying due
to domain being destroyed, we obtain EOF on both the monitor and
agent sockets. However, if the exit is expected, qemuProcessStop
is called, which cleans both agent and monitor sockets up. We
want qemuAgentClose() to be called iff the EOF is not expected,
so we don't leak an FD and memory. Moreover, there could be race
with qemuProcessHandleMonitorEOF() which could have already
closed the agent socket, in which case we don't want to do
anything.

12 years agovirbitmaptest: Resolve Coverity errors
John Ferlan [Tue, 22 Jan 2013 22:09:28 +0000 (17:09 -0500)]
virbitmaptest: Resolve Coverity errors

test1: Need to check for bitmap before using as well as free it properly
test2: need to check for bitsString2 before using it.

12 years agorpc: Revert Coverity tag message
John Ferlan [Tue, 22 Jan 2013 22:09:27 +0000 (17:09 -0500)]
rpc: Revert Coverity tag message

Turns out the fix for VIR_FREE made this particular Coverity tag
unnecessary, so I'm removing it.

12 years agolxc_process: Avoid passing NULL iface->iname
John Ferlan [Tue, 22 Jan 2013 22:09:26 +0000 (17:09 -0500)]
lxc_process: Avoid passing NULL iface->iname

A followon to commit id: 68dceb635 - if iface->iname is NULL, then
neither virNetDevOpenvswitchRemovePort() nor virNetDevVethDelete()
should be called.  Found by Coverity.

12 years agolxc_driver: Need to check for vm before calling virDomainUnlock(vm)
John Ferlan [Tue, 22 Jan 2013 22:09:25 +0000 (17:09 -0500)]
lxc_driver: Need to check for vm before calling virDomainUnlock(vm)

12 years agotests: Remove VIR_FREE() on static/stack buffer (der.data)
John Ferlan [Tue, 22 Jan 2013 22:09:24 +0000 (17:09 -0500)]
tests: Remove VIR_FREE() on static/stack buffer (der.data)

12 years agonodeinfo: Use sa_assert() instead of Coverity error tag
John Ferlan [Tue, 22 Jan 2013 22:09:23 +0000 (17:09 -0500)]
nodeinfo: Use sa_assert() instead of Coverity error tag

12 years agoFix nwfilter driver reload/shutdown handling when unprivileged
Daniel P. Berrange [Wed, 16 Jan 2013 13:12:16 +0000 (13:12 +0000)]
Fix nwfilter driver reload/shutdown handling when unprivileged

Although the nwfilter driver skips startup when running in a
session libvirtd, it did not skip reload or shutdown. This
caused errors to be reported when sending SIGHUP to libvirtd,
and caused an abort() in libdbus on shutdown due to trying
to remove a dbus filter that was never added

12 years agobuild: allow virObject to have no parent
Eric Blake [Tue, 22 Jan 2013 17:13:01 +0000 (10:13 -0700)]
build: allow virObject to have no parent

When building with static analysis enabled, we turn on attribute
nonnull checking.  However, this caused the build to fail with:

../../src/util/virobject.c: In function 'virObjectOnceInit':
../../src/util/virobject.c:55:40: error: null argument where non-null required (argument 1) [-Werror=nonnull]

Creation of the virObject class is the one instance where the
parent class is allowed to be NULL.  Making things conditional
will let us keep static analysis checking for all other .c file
callers, without breaking the build on this one exception.

* src/util/virobject.c: Define witness.
* src/util/virobject.h (virClassNew): Use it to force most callers
to pass non-null parameter.

12 years agoqemu: Support ram bar size for qxl devices
Alon Levy [Fri, 18 Jan 2013 18:36:36 +0000 (20:36 +0200)]
qemu: Support ram bar size for qxl devices

Adds a "ram" attribute globally to the video.model element, that changes
the resulting qemu command line only if video.type == "qxl".

<video>
  <model type='qxl' ram='65536' vram='65536' heads='1'/>
</video>

That attribute gets a default value of 64*1024. The schema is unchanged
for other video element types.

The resulting qemu command line change is the addition of

-global qxl-vga.ram_size=<ram>*1024

or

-global qxl.ram_size=<ram>*1024

For the main and secondary qxl devices respectively.

The default for the qxl ram bar is 64*1024 kilobytes (the same as the
default qxl vram bar size).

12 years agoviralloc: Adjust definition of VIR_FREE() for Coverity
John Ferlan [Tue, 22 Jan 2013 14:15:37 +0000 (09:15 -0500)]
viralloc: Adjust definition of VIR_FREE() for Coverity

The Coverity static analyzer was generating many false positives for the
unary operation inside the VIR_FREE() definition as it was trying to evaluate
the else portion of the "?:" even though the if portion was (1).

Signed-off-by: Eric Blake <eblake@redhat.com>