]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/log
people/liuw/libxenctrl-split/libvirt.git
15 years agomaint: fix quoting in autogen.sh
Eric Blake [Tue, 23 Feb 2010 00:01:31 +0000 (17:01 -0700)]
maint: fix quoting in autogen.sh

* autogen.sh (srcdir, THEDIR, OBJ_DIR): Use proper quoting.
(.git-module-status): Abort if bootstrap fails.

15 years agobuild: update gnulib submodule to latest
Jim Meyering [Tue, 23 Feb 2010 16:54:32 +0000 (17:54 +0100)]
build: update gnulib submodule to latest

* cfg.mk (local-checks-to-skip): Disable sc_prohibit_hash_without_use
for now, since it fails with a false-positive match.

15 years agovirFork: placate static analyzers: ignore pthread_sigmask return value
Jim Meyering [Fri, 19 Feb 2010 17:40:14 +0000 (18:40 +0100)]
virFork: placate static analyzers: ignore pthread_sigmask return value

* src/util/util.c: Include "ignore-value.h".
(virFork): We really do want to ignore pthread_sigmask failure.

15 years agodocs: Fix syntax warnings from recent changes.
Cole Robinson [Tue, 23 Feb 2010 15:25:17 +0000 (10:25 -0500)]
docs: Fix syntax warnings from recent changes.

15 years agodocs: network: Document <domain> element
Cole Robinson [Mon, 22 Feb 2010 21:39:55 +0000 (16:39 -0500)]
docs: network: Document <domain> element

15 years agodocs: network: Document STP and delay attributes
Cole Robinson [Mon, 22 Feb 2010 21:26:44 +0000 (16:26 -0500)]
docs: network: Document STP and delay attributes

15 years agodocs: domain: Document <description> element
Cole Robinson [Mon, 22 Feb 2010 21:06:04 +0000 (16:06 -0500)]
docs: domain: Document <description> element

15 years agodocs: storage: Document multipath pools
Cole Robinson [Mon, 22 Feb 2010 22:02:08 +0000 (17:02 -0500)]
docs: storage: Document multipath pools

15 years agodocs: storage: Document SCSI pools
Cole Robinson [Mon, 22 Feb 2010 21:50:04 +0000 (16:50 -0500)]
docs: storage: Document SCSI pools

15 years agodocs: storage: Fix backingStore <format> docs
Cole Robinson [Mon, 22 Feb 2010 21:01:12 +0000 (16:01 -0500)]
docs: storage: Fix backingStore <format> docs

15 years agodocs: storage: <volume><key> is always generated.
Cole Robinson [Mon, 22 Feb 2010 20:54:06 +0000 (15:54 -0500)]
docs: storage: <volume><key> is always generated.

15 years agodocs: storage: Document capacity/alloc 'unit'
Cole Robinson [Mon, 22 Feb 2010 20:52:14 +0000 (15:52 -0500)]
docs: storage: Document capacity/alloc 'unit'

15 years agostorage: conf: Correctly calculate exabyte unit
Cole Robinson [Mon, 22 Feb 2010 20:49:27 +0000 (15:49 -0500)]
storage: conf: Correctly calculate exabyte unit

We were using 'Y' to mean exabyte, when the correct abbreviation would be
'E' ('Y' is yettabyte, which is exabyte * 1024 * 1024). While it isn't
strictly backwards compatible, I highly doubt anyone was actually using
this broken behavior, so I don't see any harm in in dropping 'Y' handling.

15 years agovirsh.c: avoid all leaks in OOM path in cmdCPUBaseline
Jiri Denemark [Tue, 23 Feb 2010 11:01:20 +0000 (12:01 +0100)]
virsh.c: avoid all leaks in OOM path in cmdCPUBaseline

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
15 years agoCreate raw storage files with O_DSYNC (again)
Jiri Denemark [Mon, 22 Feb 2010 11:24:02 +0000 (12:24 +0100)]
Create raw storage files with O_DSYNC (again)

Recently we introduced O_DSYNC flag when creating raw storage files to
avoid filling all disk cache with dirty pages. However, the patch got
lost when virStorageBackendCreateRaw was reworked using
virFileOperation. Let's use O_DSYNC again.

15 years agoFixed reference count in virsh pool-build command
David Allan [Sun, 21 Feb 2010 14:28:34 +0000 (15:28 +0100)]
Fixed reference count in virsh pool-build command

* tools/virsh.c: call virStoragePoolFree() in the main path too

15 years agodocs: add 3 missing spaces
Dan Kenigsberg [Sun, 21 Feb 2010 13:56:23 +0000 (14:56 +0100)]
docs: add 3 missing spaces

15 years agoFix daemon-conf invalid failures
David Allan [Fri, 19 Feb 2010 17:37:00 +0000 (18:37 +0100)]
Fix daemon-conf invalid failures

The daemon-conf test would fail on my system if there was a system libvirtd
running.  In the course of troubleshooting that problem, I discovered that the
daemon-conf script would always fail if run by itself because it found the line:

\# that each "PARAMETER = VALUE" line in this file have the parameter

which it mistook for a line containing a parameter.  I have changed the test to
avoid mistaking a line containing \"PARAMETER = VALUE\" for a parameter line.

The corrupted config tests turned out to be failing because the test daemon was
discovering the pid file from the running daemon and exiting before it processed
the test config file.  Specifying the pid file for the corrupt config tests in
the same way as for the valid config test solved that problem.

15 years agovirsh.c: avoid leak on OOM error path
Jim Meyering [Fri, 19 Feb 2010 17:03:41 +0000 (18:03 +0100)]
virsh.c: avoid leak on OOM error path

* tools/virsh.c (cmdCPUBaseline): Also free "buffer" and "list" upon OOM.

15 years agovirBufferVSprintf: do not omit va_end(argptr) call
Jim Meyering [Thu, 18 Feb 2010 20:25:01 +0000 (21:25 +0100)]
virBufferVSprintf: do not omit va_end(argptr) call

* src/util/buf.c (virBufferVSprintf): Do not omit va_end(argptr).
Improved-by: Daniel Veillard.
15 years agoxend_internal.c: don't dereference NULL for unexpected input
Jim Meyering [Fri, 19 Feb 2010 16:45:41 +0000 (17:45 +0100)]
xend_internal.c: don't dereference NULL for unexpected input

* src/xen/xend_internal.c (xenDaemonDomainSetAutostart): Avoid a NULL
dereference upon non-SEXPR_VALUE'd on_xend_start.  This bug was
introduced by commit 37ce5600c0bb1aed9e2f2888922388de4340ebd3.

15 years agoUse virFileOperation hook function in virStorageBackendFileSystemVolBuild
Laine Stump [Fri, 19 Feb 2010 17:12:01 +0000 (18:12 +0100)]
Use virFileOperation hook function in virStorageBackendFileSystemVolBuild

There were a few operations on the storage volume file that were still
being done as root, which will fail if the file is on a root-squashed
NFS share. The result was that attempts to create a storage volume of
type "raw" on a root-squashed NFS share would fail.

This patch uses the newly introduced "hook" function in
virFileOperation to execute all those file operations in the child
process that's run under the uid that owns the file (and, presumably,
has permission to write to the NFS share)

* src/storage/storage_backend.c: use virFileOperation() in
  virStorageBackendCreateRaw, turning virStorageBackendCreateRaw()
  into a new createRawFileOpHook() hook

15 years agoRename virFileCreate to virFileOperation, add hook function
Laine Stump [Fri, 19 Feb 2010 16:43:22 +0000 (17:43 +0100)]
Rename virFileCreate to virFileOperation, add hook function

It turns out it is also useful to be able to perform other operations
on a file created while running as a different uid (eg, write things
to that file), and possibly to do this to a file that already
exists. This patch adds an optional hook function to the renamed (for
more accuracy of purpose) virFileOperation; the hook will be called
after the file has been opened (possibly created) and gid/mode
checked/set, before closing it.

As with the other operations on the file, if the VIR_FILE_OP_AS_UID
flag is set, this hook function will be called in the context of a
child process forked from the process that called virFileOperation.
The implication here is that, while all data in memory is available to
this hook function, any modification to that data will not be seen by
the caller - the only indication in memory of what happened in the
hook will be the return value (which the hook should set to 0 on
success, or one of the standard errno values on failure).

Another piece of making the function more flexible was to add an
"openflags" argument. This arg should contain exactly the flags to be
passed to open(2), eg O_RDWR | O_EXCL, etc.

In the process of adding the hook to virFileOperation, I also realized
that the bits to fix up file owner/group/mode settings after creation
were being done in the parent process, which could fail, so I moved
them to the child process where they should be.

* src/util/util.[ch]: rename and rework virFileCreate-->virFileOperation,
  and redo flags in virDirCreate
* storage/storage_backend.c, storage/storage_backend_fs.c: update the
  calls to virFileOperation/virDirCreate to reflect changes in the API,
  but don't yet take advantage of the hook.

15 years agoqemu: Check for IA64 kvm
Dustin Xiong [Thu, 18 Feb 2010 15:48:51 +0000 (10:48 -0500)]
qemu: Check for IA64 kvm

ACPI feature bit dropped: I asked internally if the -no-acpi option
had any meaning for IA64, and was told 'probably not'.

15 years agoremote: Print ssh stderr on connection failure
Cole Robinson [Thu, 11 Feb 2010 22:39:38 +0000 (17:39 -0500)]
remote: Print ssh stderr on connection failure

15 years agofix multiple veth problem for OpenVZ
Yuji NISHIDA [Fri, 19 Feb 2010 15:49:56 +0000 (16:49 +0100)]
fix multiple veth problem for OpenVZ

Fix multiple veth problem.
NETIF setting was overwritten after first CT because any CT could not be
found by name.
* src/openvz/openvz_conf.c src/openvz/openvz_conf.h: add the
  openvzGetVEID lookup function
* src/openvz/openvz_driver.c: use it in openvzDomainSetNetwork()

15 years agoBetter error reporting for failed migration
Chris Lalancette [Fri, 19 Feb 2010 15:15:21 +0000 (16:15 +0100)]
Better error reporting for failed migration

If the hostname as returned by "gethostname" resolves
to "localhost" (as it does with the broken Fedora-12
installer), then live migration will fail because the
source will try to migrate to itself.  Detect this
situation up-front and abort the live migration before
we do any real work.

* src/util/util.h src/util/util.c: add a new virGetHostnameLocalhost
  with an optional localhost check, and rewire virGetHostname() to use
  it
* src/libvirt_private.syms: expose the new function
* src/qemu/qemu_driver.c: use it in qemudDomainMigratePrepare2()

15 years agoMake virDomainObjFormat static
Chris Lalancette [Fri, 19 Feb 2010 15:06:08 +0000 (16:06 +0100)]
Make virDomainObjFormat static

* src/conf/domain_conf.c: make function static
* src/conf/domain_conf.h: remove it from header

15 years agoMake an error message in PCI util code clearer
Chris Lalancette [Fri, 19 Feb 2010 15:04:35 +0000 (16:04 +0100)]
Make an error message in PCI util code clearer

* src/util/pci.c: update 2 message on pciRead errors

15 years agomacvtap mac_filter support
Stefan Berger [Fri, 19 Feb 2010 14:41:30 +0000 (15:41 +0100)]
macvtap mac_filter support

This patch adds the mac_filter support to the macvtap device.

15 years agovirsh: be careful to return "FALSE" upon OOM
Jim Meyering [Thu, 18 Feb 2010 10:05:38 +0000 (11:05 +0100)]
virsh: be careful to return "FALSE" upon OOM

* tools/virsh.c (cmdCPUBaseline): Add an explicit "return" statement
after the "no_memory:" label.

15 years agovirBufferStrcat: do not skip va_end
Jim Meyering [Thu, 18 Feb 2010 19:46:24 +0000 (20:46 +0100)]
virBufferStrcat: do not skip va_end

* src/util/buf.c (virBufferStrcat): Do not skip va_end due to
an early return.

15 years agoqparams.c: do not skip va_end, twice
Jim Meyering [Thu, 18 Feb 2010 19:27:22 +0000 (20:27 +0100)]
qparams.c: do not skip va_end, twice

* src/util/qparams.c (new_qparam_set, append_qparams): Do not skip
va_end due to an early return.

15 years agoxenDaemonDomainSetAutostart: avoid appearance of impropriety
Jim Meyering [Wed, 17 Feb 2010 21:14:25 +0000 (22:14 +0100)]
xenDaemonDomainSetAutostart: avoid appearance of impropriety

* src/xen/xend_internal.c (xenDaemonDomainSetAutostart): Rewrite to
avoid dereferencing the result of sexpr_lookup.  While in this
particular case, it was guaranteed never to be NULL, due to the
preceding "if sexpr_node(...)" guard, it's cleaner to skip the
sexpr_node call altogether, and also saves a lookup.

15 years agomacvtap IFF_VNET_HDR configuration
Stefan Berger [Fri, 19 Feb 2010 10:38:57 +0000 (11:38 +0100)]
macvtap IFF_VNET_HDR configuration

This patch sets or unsets the IFF_VNET_HDR flag depending on what device
is used in the VM. The manipulation of the flag is done in the open
function and is only fatal if the IFF_VNET_HDR flag could not be cleared
although it has to be (or if an ioctl generally fails). In that case the
macvtap tap is closed again and the macvtap interface torn.

* src/qemu/qemu_conf.c src/qemu/qemu_conf.h: pass qemuCmdFlags to
  qemudPhysIfaceConnect()
* src/util/macvtap.c src/util/macvtap.h: add vnet_hdr boolean to
  openMacvtapTap(), and private function configMacvtapTap()
* src/qemu/qemu_driver.c: add extra qemuCmdFlags when calling
  qemudPhysIfaceConnect()

15 years agoUse virFork() in __virExec(), virFileCreate() and virDirCreate()
Laine Stump [Thu, 18 Feb 2010 21:20:07 +0000 (22:20 +0100)]
Use virFork() in __virExec(), virFileCreate() and virDirCreate()

For __virExec() this is a semantic NOP except for when fork()
fails. __virExec() would previously forget to restore the signal mask
in this case; virFork() corrects this behavior.

virFileCreate() and virDirCreate() gain the code to reset the logging
and properly deal with the signal handling race condition.

This also removes a log message that had a typo ("cannot fork o create
file '%s'") - this error is now logged in a more generic manner in
virFork() (more generic, but really just as informative, since the
fact that it's forking to create a file is immaterial to the fact that
it simply can't fork)

* src/util/util.c: use the generic virFork() in the 3 functions

15 years agoAdd virFork() function to utils
Laine Stump [Thu, 18 Feb 2010 21:13:48 +0000 (22:13 +0100)]
Add virFork() function to utils

virFork() contains bookkeeping that must be done any time a process
forks. Currently this includes:

1) Call virLogLock() prior to fork() and virLogUnlock() just after,
   to avoid a deadlock if some other thread happens to hold that lock
   during the fork.

2) Reset the logging hooks and send all child process log messages to
   stderr.

3) Block all signals prior to fork(), then either a) reset the signal
   mask for the parent process, or b) clear the signal mask for the
   child process.

Note that the signal mask handling in __virExec erroneously fails to
restore the signal mask when fork() fails. virFork() fixes this
problem.

Other than this, it attempts to behave as closely to fork() as
possible (including preserving errno for the caller), with a couple
exceptions:

1) The return value is 0 (success) or -1 (failure), while the pid is
   returned via the pid_t* argument. Like fork(), if pid < 0 there is
   no child process, otherwise both the child and the parent will
   return to the caller, and both should look at the return value,
   which will indicate if some of the extra processing outlined above
   encountered an error.

2) If virFork() returns with pid < 0 or with a return value < 0
   indicating an error condition, the error has already been
   reported. You can log an additional message if you like, but it
   isn't necessary, and may be awkwardly extraneous.

Note that virFork()'s child process will *never* call _exit() - if a
child process is created, it will return to the caller.

* util.c util.h: add virFork() function, based on what is currently
                 done in __virExec().

15 years agoAdd QEMU support for virtio channel
Matthew Booth [Thu, 18 Feb 2010 16:56:50 +0000 (17:56 +0100)]
Add QEMU support for virtio channel

Support virtio-serial controller and virtio channel in QEMU backend.
Will output
the following for virtio-serial controller:

-device
virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x4,max_ports=16,vectors=4

and the following for a virtio channel:

-chardev pty,id=channel0 \
-device
virtserialport,bus=virtio-serial0.0,chardev=channel0,name=org.linux-kvm.port.0

* src/qemu/qemu_conf.c: Add argument output for virtio
* tests/qemuxml2argvtest.c
  tests/qemuxml2argvdata/qemuxml2argv-channel-virtio.args: Add test for
  QEMU command line generation

15 years agoAdd domain support for virtio channel
Matthew Booth [Thu, 18 Feb 2010 16:52:03 +0000 (17:52 +0100)]
Add domain support for virtio channel

Add support for virtio-serial by defining a new 'virtio' channel target type
and a virtio-serial controller. Allows the following to be specified in a
domain:

<controller type='virtio-serial' index='0' ports='16' vectors='4'/>
<channel type='pty'>
  <target type='virtio' name='org.linux-kvm.port.0'/>
  <address type='virtio-serial' controller='0' bus='0'/>
</channel>

* docs/schemas/domain.rng: Add virtio-serial controller and virtio
  channel type.
* src/conf/domain_conf.[ch]: Domain parsing/serialization for
  virtio-serial controller and virtio channel.
* tests/qemuxml2xmltest.c
  tests/qemuxml2argvdata/qemuxml2argv-channel-virtio.xml: add domain xml
  parsing test
* src/libvirt_private.syms src/qemu/qemu_conf.c:
  virDomainDefAddDiskControllers() renamed to
  virDomainDefAddImplicitControllers()

15 years agoRemove unused functions from domain_conf
Matthew Booth [Thu, 18 Feb 2010 15:45:18 +0000 (16:45 +0100)]
Remove unused functions from domain_conf

Remove virDomainDevicePCIAddressEqual and virDomainDeviceDriveAddressEqual,
which are defined but not used anywhere.

* src/conf/domain_conf.[ch] src/libvirt_private.syms: Remove
  virDomainDevicePCIAddressEqual and virDomainDeviceDriveAddressEqual.

15 years agoFix typo in comment
Matthew Booth [Thu, 18 Feb 2010 15:40:48 +0000 (16:40 +0100)]
Fix typo in comment

* src/qemu/qemu_driver.c: qemudStartVMDaemon() fix typo in comment

15 years agoget_virtual_functions_linux: would mistakenly always return zero
Jim Meyering [Thu, 18 Feb 2010 10:12:17 +0000 (11:12 +0100)]
get_virtual_functions_linux: would mistakenly always return zero

* src/node_device/node_device_linux_sysfs.c(get_virtual_functions_linux):
Return "ret", rather than always returning 0.

15 years agoqemu: Explicitly error if guest virtual network is inactive
Cole Robinson [Tue, 16 Feb 2010 18:11:27 +0000 (13:11 -0500)]
qemu: Explicitly error if guest virtual network is inactive

Currently we just error with ex. 'virbr0: No such device'.

Since we are using public API calls here, we need to ensure that any
raised error is properly saved and restored, since API entry points
always reset messages.

15 years agonetwork: bridge: Fix IsActive, IsPersistent
Cole Robinson [Tue, 16 Feb 2010 18:09:31 +0000 (13:09 -0500)]
network: bridge: Fix IsActive, IsPersistent

We were accessing the wrong private data structure, which would
cause a segfault.

15 years agovirterror: Make SetError work if no previous error was set
Cole Robinson [Tue, 16 Feb 2010 18:07:31 +0000 (13:07 -0500)]
virterror: Make SetError work if no previous error was set

virGetLastError returns NULL if no error has been set, not on
allocation error like virSetError assumed. Use virLastErrorObject
instead. This fixes virSetError when no error is currently stored.

15 years agolibvirt: Update docs for hotplug only commands
Cole Robinson [Tue, 16 Feb 2010 18:59:21 +0000 (13:59 -0500)]
libvirt: Update docs for hotplug only commands

The commands updated are SetMem, SetMaxMem, SetVcpus, and PinVcpu.

15 years agomacvtap teardown rework
Stefan Berger [Thu, 18 Feb 2010 14:13:48 +0000 (15:13 +0100)]
macvtap teardown rework

Rework and simplification of teardown of the macvtap device.

Basically all devices with the same MAC address and link device are kept
alive and not attempted to be torn down. If a macvtap device linked to a
physical interface with a certain MAC address 'M' is to be created it
will automatically fail if the interface is 'up'ed and another macvtap
with the same properties (MAC addr 'M', link dev) happens to be 'up'.
This will prevent the VM from starting or the device from being attached
to a running VM. Stale interfaces are assumed to be there for some
reason and not stem from libvirt.

In the VM shutdown path, it's assuming that an interface name is always
available so that if the device type is DIRECT it can be torn down
using its name.

* src/util/macvtap.h src/libvirt_macvtap.syms: change of deleting routine
* src/util/macvtap.c: cleanups and change of deleting routine
* src/qemu/qemu_driver.c: change cleanup on shutdown
* src/qemu/qemu_conf.c: don't delete Macvtap in qemudPhysIfaceConnect()

15 years agoFix whitespace in domain.rng
Matthew Booth [Wed, 17 Feb 2010 16:16:42 +0000 (17:16 +0100)]
Fix whitespace in domain.rng

* src/schemas/domain.rng: Replace tabs with 8 spaces

15 years agoUpdate QEMU JSON balloon command handling
Daniel P. Berrange [Tue, 16 Feb 2010 16:31:19 +0000 (16:31 +0000)]
Update QEMU JSON balloon command handling

The QEMU JSON monitor changed balloon commands to return/accept
bytes instead of kilobytes. Update libvirt to cope with this

* src/qemu/qemu_monitor_json.c: Expect/use bytes for ballooning

15 years agoopenvzLoadDomains: don't ignore failing virUUIDFormat
Jim Meyering [Wed, 17 Feb 2010 14:06:01 +0000 (15:06 +0100)]
openvzLoadDomains: don't ignore failing virUUIDFormat

* src/openvz/openvz_conf.c (openvzLoadDomains): Diagnose failure of
virUUIDFormat.

15 years agopython: Actually add virConnectGetVersion to generated bindings
Cole Robinson [Wed, 17 Feb 2010 20:55:46 +0000 (15:55 -0500)]
python: Actually add virConnectGetVersion to generated bindings

The recent commit to implement a python version of this function
didn't drop an explicit 'ignore' check in the generator, so this
never ended up in the bindings.

15 years agobuild: inform libtool of m4 directory
Eric Blake [Wed, 17 Feb 2010 13:45:10 +0000 (06:45 -0700)]
build: inform libtool of m4 directory

Silence a libtoolize warning.
*  configure.ac (AC_CONFIG_MACRO_DIR): Add.

15 years agoAdds a cpu-baseline command for virsh
Jiri Denemark [Wed, 17 Feb 2010 13:52:07 +0000 (14:52 +0100)]
Adds a cpu-baseline command for virsh

* tools/virsh.c: add a command to compute a CPU baseline based on
  multiple CPU definitions in an XML chunk
* tools/virsh.pod: add it to the man page

15 years agovshCommandParse: placate coverity
Jim Meyering [Tue, 16 Feb 2010 13:34:48 +0000 (14:34 +0100)]
vshCommandParse: placate coverity

There is no real leak here, but Coverity-Prevent thinks there is.
It does not see that while there are four ways to return from
vshCommandGetToken with VSH_TK_END, none of them results in allocation
of a result.
* tools/virsh.c (vshCommandParse): Add a (currently) useless VIR_FREE,
to ensure that we never leak when vshCommandGetToken returns VSH_TK_END.

15 years agoqemuMonitorTextAddUSBDisk: avoid unconditional leak
Jim Meyering [Tue, 16 Feb 2010 12:51:38 +0000 (13:51 +0100)]
qemuMonitorTextAddUSBDisk: avoid unconditional leak

* src/qemu/qemu_monitor_text.c (qemuMonitorTextAddUSBDisk): Free
command output buffer.

15 years agotests: avoid NULL deref upon OOM failure
Jim Meyering [Tue, 16 Feb 2010 08:36:57 +0000 (09:36 +0100)]
tests: avoid NULL deref upon OOM failure

* tests/qemuxml2argvtest.c (testCompareXMLToArgvFiles): Handle malloc
failure.

15 years agoqemuInitPasswords: avoid unconditional leak
Jim Meyering [Tue, 16 Feb 2010 08:22:02 +0000 (09:22 +0100)]
qemuInitPasswords: avoid unconditional leak

* src/qemu/qemu_driver.c (qemuInitPasswords): Free pass-phrase buffer.

15 years agoqemuMonitorTextAddDevice: avoid unconditional leak
Jim Meyering [Tue, 16 Feb 2010 07:22:34 +0000 (08:22 +0100)]
qemuMonitorTextAddDevice: avoid unconditional leak

* src/qemu/qemu_monitor_text.c (qemuMonitorTextAddDevice): Free the
device name buffer.

15 years agolibvirt-override.c: avoid a leak upon call with invalid argument
Jim Meyering [Tue, 16 Feb 2010 07:07:38 +0000 (08:07 +0100)]
libvirt-override.c: avoid a leak upon call with invalid argument

* python/libvirt-override.c (libvirt_virConnectBaselineCPU): Don't leak
the xmlcpus buffer upon encountering a non-string list element.

15 years agovboxDomainDumpXML: avoid a leak on OOM error path
Jim Meyering [Mon, 15 Feb 2010 19:09:55 +0000 (20:09 +0100)]
vboxDomainDumpXML: avoid a leak on OOM error path

* src/vbox/vbox_tmpl.c (vboxDomainDumpXML): Free vboxCallback buffer
upon OOM.

15 years agovirNodeDevCapScsiHostParseXML: avoid an unconditional leak
Jim Meyering [Mon, 15 Feb 2010 18:54:45 +0000 (19:54 +0100)]
virNodeDevCapScsiHostParseXML: avoid an unconditional leak

* src/conf/node_device_conf.c (virNodeDevCapScsiHostParseXML):
Free the "nodes" buffer allocated by virXPathNodeSet.

15 years agouml_driver.c: avoid leak upon failure
Jim Meyering [Mon, 15 Feb 2010 18:22:38 +0000 (19:22 +0100)]
uml_driver.c: avoid leak upon failure

* src/uml/uml_driver.c (umlMonitorCommand): This function would
sometimes return -1, yet fail to free the "reply" it had allocated.
Hence, no caller would know to free the corresponding argument.
When returning -1, be sure to free all allocated resources.

15 years agovbox_tmpl.c: avoid an unconditional leak
Jim Meyering [Mon, 15 Feb 2010 16:54:15 +0000 (17:54 +0100)]
vbox_tmpl.c: avoid an unconditional leak

* src/vbox/vbox_tmpl.c (vboxDomainDumpXML): Free def.
Improved by Matthias Bolte.

15 years agoopenvz (openvzFreeDriver): avoid leaks
Jim Meyering [Mon, 15 Feb 2010 17:33:38 +0000 (18:33 +0100)]
openvz (openvzFreeDriver): avoid leaks

* src/openvz/openvz_conf.c (openvzFreeDriver): Also free driver buffer.
Based on a suggestion from Matthias Bolte.

15 years agovirStorageBackendIsMultipath: avoid dead store
Jim Meyering [Thu, 11 Feb 2010 14:26:37 +0000 (15:26 +0100)]
virStorageBackendIsMultipath: avoid dead store

* src/storage/storage_backend_mpath.c (virStorageBackendIsMultipath):
The result of dm_get_next_target was never used (and isn't needed),
so don't store it.

15 years agoqemu: Make SetVcpu command hotplug only
Cole Robinson [Tue, 9 Feb 2010 21:31:51 +0000 (16:31 -0500)]
qemu: Make SetVcpu command hotplug only

Similar to the Set*Mem commands, this implementation was bogus and
misleading. Make it clear this is a hotplug only operation, and that the
hotplug piece isn't even implemented.

Also drop the overkill maxvcpus validation: we don't perform this check
at XML define time so clearly no one is missing it, and there is
always the risk that our info will be out of date, possibly preventing
legitimate CPU values.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
15 years agoqemu: Make Set*Mem commands hotplug only
Cole Robinson [Tue, 9 Feb 2010 21:25:06 +0000 (16:25 -0500)]
qemu: Make Set*Mem commands hotplug only

SetMem and SetMaxMem are hotplug only APIs, any persistent config
changes are supposed to go via XML definition. The original implementation
of these calls were incorrect and had the nasty side effect of making
a psuedo persistent change that would be lost after libvirtd restart
(I didn't know any better).

Fix these APIs to rightly reject non running domains.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
15 years agoTreat missing QEMU 'thread_id' as non-fatal in JSON monitor
Daniel P. Berrange [Mon, 15 Feb 2010 14:41:50 +0000 (14:41 +0000)]
Treat missing QEMU 'thread_id' as non-fatal in JSON monitor

The plain QEMU tree does not include 'thread_id' in the JSON
output. Thus we need to treat it as non-fatal if missing.

* src/qemu/qemu_monitor_json.c: Treat missing thread_id as non-fatal

15 years agoFix check for primary IDE controller in QEMU PCI slot assignment
Daniel P. Berrange [Mon, 15 Feb 2010 14:37:04 +0000 (14:37 +0000)]
Fix check for primary IDE controller in QEMU PCI slot assignment

A typo in the check for the primary IDE controller could cause
a crash on restore depending on the exact guest config.

* src/qemu/qemu_conf.c: Fix s/video/controller/ typo & slot
  number typo

15 years agoMake error reporting for QEMU JSON mode more friendly
Daniel P. Berrange [Fri, 12 Feb 2010 16:45:11 +0000 (16:45 +0000)]
Make error reporting for QEMU JSON mode more friendly

Current error reporting for JSON mode returns the full JSON
command string and full JSON error string. This is not very
user friendly, so this change makes the error report only
contain the basic command name, and friendly error message
description string. The full JSON data is logged instead.

* src/qemu/qemu_monitor_json.c: Always return the 'desc' field from
  the JSON error message to users.

15 years agoRun 'qmp_capabilities' command at QEMU monitor startup
Daniel P. Berrange [Fri, 12 Feb 2010 13:45:20 +0000 (13:45 +0000)]
Run 'qmp_capabilities' command at QEMU monitor startup

When in JSON mode, QEMU requires that 'qmp_capabilities' is run as
the first command in the monitor. This is a no-op when run in the
text mode monitor

* src/qemu/qemu_driver.c: Run capabilities negotiation when
  connecting to the monitor
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
  src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h: Add
  support for the 'qmp_capabilities' command, no-op in text mode.

15 years agomacvtap support for libvirt -- schema extensions
Stefan Berger [Mon, 15 Feb 2010 16:43:42 +0000 (17:43 +0100)]
macvtap support for libvirt -- schema extensions

* docs/schemas/domain.rng: extends the domain xml schema to support the
  new interface type 'direct'

15 years agomacvtap support for libvirt -- qemu support
Stefan Berger [Mon, 15 Feb 2010 16:41:14 +0000 (17:41 +0100)]
macvtap support for libvirt -- qemu support

This part adds support for qemu making a macvtap tap device available
via file descriptor passed to qemu command line. This also attempts to
tear down the macvtap device when a VM terminates. This includes support
for attachment and detachment to/from running VM.
* src/qemu/qemu_conf.[ch] src/qemu/qemu_driver.c: add support in the
  QEmu driver

15 years agomacvtap support for libvirt -- helper code
Stefan Berger [Mon, 15 Feb 2010 15:58:13 +0000 (16:58 +0100)]
macvtap support for libvirt -- helper code

This part adds the helper code to setup and tear down macvtap devices
using direct communication with the device driver via netlink sockets.
The rather short messages received from the netlink layer are now
written into a dynamically allocated buffer

* src/util/macvtap.h src/util/macvtap.c: provides the new module
* po/POTFILES.in: the module contains translated strings

15 years agomacvtap support for libvirt -- parse new interface XML
Stefan Berger [Fri, 12 Feb 2010 17:07:06 +0000 (18:07 +0100)]
macvtap support for libvirt -- parse new interface XML

This part adds support to domain_conf.{c|h} for parsing the new
interface XML of type 'direct'. The parsed mode is now stored as
an int.
* src/conf/domain_conf.c src/conf/domain_conf.h: extend parsing code
* src/util/macvtap.h: empty header to not break compilation

15 years agomacvtap support for libvirt -- build support
Stefan Berger [Fri, 12 Feb 2010 17:03:07 +0000 (18:03 +0100)]
macvtap support for libvirt -- build support

This patch adds build support for libvirt checking for certain contents
of /usr/include/linux/if_link.h to see whether macvtap support is
compilable on that system. One can disable macvtap support in libvirt
via --without-macvtap passed to configure.
* configure.ac src/Makefile.am: new build support
* src/libvirt_macvtap.syms: list of exported symbols
* src/util/macvtap.c: empty module to not break compilation

15 years agointerface: Use proper return codes in the open function
Matthias Bolte [Sun, 14 Feb 2010 22:15:56 +0000 (23:15 +0100)]
interface: Use proper return codes in the open function

The open function returned -1 in case of an error, but -1 maps
to VIR_DRV_OPEN_DECLINED instead of VIR_DRV_OPEN_ERROR.

15 years agoConvert virSecurityReportError into a macro
Matthias Bolte [Thu, 11 Feb 2010 23:18:54 +0000 (00:18 +0100)]
Convert virSecurityReportError into a macro

The virRaiseError macro inside of virSecurityReportError expands to
virRaiseErrorFull and includes the __FILE__, __FUNCTION__ and __LINE__
information. But this three values are always the same for every call
to virSecurityReportError and do not reflect the actual error context.

Converting virSecurityReportError into a macro results in getting the
correct __FILE__, __FUNCTION__ and __LINE__ information.

15 years agoAdd persistence of PCI addresses to QEMU
Daniel P. Berrange [Thu, 11 Feb 2010 16:19:34 +0000 (16:19 +0000)]
Add persistence of PCI addresses to QEMU

Current PCI addresses are allocated at time of VM startup.
To make them truely persistent, it is neccessary to do this
at time of virDomainDefine/virDomainCreate. The code in
qemuStartVMDaemon still remains in order to cope with upgrades
from older libvirt releases

* src/qemu/qemu_driver.c: Rename existing qemuAssignPCIAddresses
  to qemuDetectPCIAddresses. Add new qemuAssignPCIAddresses which
  does auto-allocation upfront. Call qemuAssignPCIAddresses from
  qemuDomainDefine and qemuDomainCreate to assign PCI addresses that
  can then be persisted. Don't clear PCI addresses at shutdown if
  they are intended to be persistent

15 years agoFix crash in LXC driver open method when URI has no path
Daniel P. Berrange [Thu, 11 Feb 2010 15:00:25 +0000 (15:00 +0000)]
Fix crash in LXC driver open method when URI has no path

If giving a lxc://  URI instead of lxc:/// the open method
would crash ona NULL pointer

* src/lxc/lxc_driver.c: Cope with a NULL URI path

15 years agoFix USB device path formatting mixup
Daniel P. Berrange [Thu, 11 Feb 2010 14:39:13 +0000 (14:39 +0000)]
Fix USB device path formatting mixup

* src/util/hostusb.c: The device path for a USB device wants the
  bus/device IDs in decimal not octal

15 years agoSupport 'block_passwd' command for QEMU disk encryption
Daniel P. Berrange [Thu, 11 Feb 2010 14:28:16 +0000 (14:28 +0000)]
Support 'block_passwd' command for QEMU disk encryption

The old text mode monitor prompts for a password when disks are
encrypted. This interactive approach doesn't work for JSON mode
monitor. Thus there is a new 'block_passwd' command that can be
used.

* src/qemu/qemu_driver.c: Split out code for looking up a disk
  secret from findVolumeQcowPassphrase, into a new method
  getVolumeQcowPassphrase. Enhance qemuInitPasswords() to also
  set the disk encryption password via the monitor
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
  src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
  src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h: Add
  support for the 'block_passwd' monitor command.

15 years agoImplement cpuBaseline in remote and qemu drivers
Jiri Denemark [Tue, 2 Feb 2010 14:19:14 +0000 (15:19 +0100)]
Implement cpuBaseline in remote and qemu drivers

15 years agoWire protocol format and dispatcher for virConnectBaselineCPU
Jiri Denemark [Tue, 2 Feb 2010 13:39:05 +0000 (14:39 +0100)]
Wire protocol format and dispatcher for virConnectBaselineCPU

15 years agovirConnectBaselineCPU public API implementation
Jiri Denemark [Mon, 25 Jan 2010 14:08:05 +0000 (15:08 +0100)]
virConnectBaselineCPU public API implementation

15 years agoInternal driver API for virConnectBaselineCPU
Jiri Denemark [Tue, 2 Feb 2010 11:34:01 +0000 (12:34 +0100)]
Internal driver API for virConnectBaselineCPU

15 years agovirConnectBaselineCPU public API
Jiri Denemark [Fri, 22 Jan 2010 13:52:41 +0000 (14:52 +0100)]
virConnectBaselineCPU public API

15 years agoImplement cpuArchBaseline in x86 CPU driver
Jiri Denemark [Wed, 27 Jan 2010 13:33:20 +0000 (14:33 +0100)]
Implement cpuArchBaseline in x86 CPU driver

15 years agoImplement cpuArchBaseline in generic CPU driver
Jiri Denemark [Tue, 26 Jan 2010 16:40:04 +0000 (17:40 +0100)]
Implement cpuArchBaseline in generic CPU driver

15 years agoFunctions for computing baseline CPU from a set of host CPUs
Jiri Denemark [Mon, 25 Jan 2010 17:27:56 +0000 (18:27 +0100)]
Functions for computing baseline CPU from a set of host CPUs

Baseline CPU is the best CPU which can be used for a guest on any of the
hosts.

15 years agoFix compliation of AppArmor related code
Matthias Bolte [Thu, 11 Feb 2010 23:09:59 +0000 (00:09 +0100)]
Fix compliation of AppArmor related code

Broken by the latest commits to remove the virConnectPtr parameter
from internal functions.

15 years agoqemu_driver.c: honor dname parameter once again
Jim Meyering [Thu, 11 Feb 2010 15:46:21 +0000 (16:46 +0100)]
qemu_driver.c: honor dname parameter once again

Since c26cb9234f4b9fa46d7caa3385ae36704167c53f, the dname
parameter has been ignored by these two functions.  Use it.
* src/qemu/qemu_driver.c (qemudDomainMigratePrepareTunnel): Honor dname
parameter once again.
(qemudDomainMigratePrepare2): Likewise.

15 years agoplug four virStoragePoolSourceFree-related leaks
Jim Meyering [Fri, 5 Feb 2010 16:09:43 +0000 (17:09 +0100)]
plug four virStoragePoolSourceFree-related leaks

* src/conf/storage_conf.c (virStoragePoolDefParseSourceString):
* src/storage/storage_backend_fs.c:
(virStorageBackendFileSystemNetFindPoolSourcesFunc):
(virStorageBackendFileSystemNetFindPoolSources):
* src/test/test_driver.c (testStorageFindPoolSources):

15 years agoremote_driver.c: avoid leak on OOM error path
Jim Meyering [Thu, 11 Feb 2010 11:51:31 +0000 (12:51 +0100)]
remote_driver.c: avoid leak on OOM error path

* src/remote/remote_driver.c (doRemoteOpen): Don't leak a qparam_set
buffer upon OOM error.

15 years agoMark all error messages for translation
Jiri Denemark [Thu, 11 Feb 2010 15:27:26 +0000 (16:27 +0100)]
Mark all error messages for translation

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
15 years agoAdd cpu_generic.c to the list of translated files
Jiri Denemark [Thu, 11 Feb 2010 15:27:14 +0000 (16:27 +0100)]
Add cpu_generic.c to the list of translated files

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
15 years agoSwap position of nmodels and models parameters in cpuDecode()
Jiri Denemark [Thu, 11 Feb 2010 09:47:43 +0000 (10:47 +0100)]
Swap position of nmodels and models parameters in cpuDecode()

All other libvirt functions use array first and then number of elements
in that array. Let's make cpuDecode follow this rule.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
15 years agoFix <cpu> element in domain XML schema
Jiri Denemark [Tue, 9 Feb 2010 14:53:03 +0000 (15:53 +0100)]
Fix <cpu> element in domain XML schema

The current schema is more permissive than the XML parsing code in
libvirt. Precisely, 'match' attribute is optional in schema while in
reality its use is bound to <model> element:

- <cpu> element without 'match' attribute is allowed only if <topology>
  element is the only child element of <cpu>

- <cpu> element with 'match' attribute requires <model> element to be
  present; <topology> and <feature> elements are optional

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
15 years agoFix up a misspelled comment.
Chris Lalancette [Wed, 10 Feb 2010 21:11:42 +0000 (16:11 -0500)]
Fix up a misspelled comment.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoFix disk stats retrieval with QEMU >= 0.12
Daniel P. Berrange [Wed, 10 Feb 2010 17:46:44 +0000 (17:46 +0000)]
Fix disk stats retrieval with QEMU >= 0.12

With QEMU >= 0.12 the host and guest side of disks no longer have
the same naming convention. Specifically the host side will now
get a 'drive-' prefix added to its name. The 'info blockstats'
monitor command returns the host side name, so it is neccessary
to strip this off when looking up stats since libvirt stores the
guest side name !

* src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Move 'drive-' prefix
  string to a defined constant
* src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_text.c: Strip
  off 'drive-' prefix (if found) when looking up disk stats