]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
12 years agoutil: Prepare helpers for unpriv_sgio setting
Osier Yang [Wed, 2 Jan 2013 14:37:06 +0000 (22:37 +0800)] 
util: Prepare helpers for unpriv_sgio setting

"virGetDeviceID" could be used across the sources, but it doesn't
relate with this series, and could be done later.

* src/util/virutil.h: (Declare virGetDeviceID, and
                       vir{Get,Set}DeviceUnprivSGIO)
* src/util/virutil.c: (Implement virGetDeviceID and
                       vir{Get,Set}DeviceUnprivSGIO)
* src/libvirt_private.syms: Export private symbols of upper helpers

12 years agosnapshot: qemu: Allow redefinition of external snapshots
Peter Krempa [Thu, 3 Jan 2013 13:30:07 +0000 (14:30 +0100)] 
snapshot: qemu: Allow redefinition of external snapshots

A redefinition of an external inactive snapshot/checkpoint wasn't
possible without this change.

12 years agosnapshot: qemu: Fix segfault and vanishing snapshots when redefining
Peter Krempa [Thu, 3 Jan 2013 13:20:09 +0000 (14:20 +0100)] 
snapshot: qemu: Fix segfault and vanishing snapshots when redefining

When the disk alignment check done while redefining an existing snapshot
failed, the qemu driver attempted to free the existing snapshot. As in
the cleanup path the definition of the snapshot wasn't assigned, the
cleanup code dereferenced a NULL pointer.

This patch changes the behavior on error paths while redefining snapshot
in two ways:

1) On failure, modifications done on the snapshot definition object are
rolled back.

2) The previous definition of the data isn't freed until it's certain it
won't be needed any more.

This change avoids the segfault and additionally the snapshot doesn't
vanish if redefinition fails for some reason.

12 years agosnapshot: qemu: Separate logic blocks with newlines
Peter Krempa [Thu, 3 Jan 2013 13:13:05 +0000 (14:13 +0100)] 
snapshot: qemu: Separate logic blocks with newlines

12 years agosnapshot: conf: Make virDomainSnapshotIsExternal more reusable
Peter Krempa [Thu, 3 Jan 2013 13:10:39 +0000 (14:10 +0100)] 
snapshot: conf: Make virDomainSnapshotIsExternal more reusable

Allow to use definition objects with this predicate function.

12 years agoqemu: Implement virDomainOpenChannel API
John Eckersberg [Wed, 2 Jan 2013 15:38:54 +0000 (10:38 -0500)] 
qemu: Implement virDomainOpenChannel API

12 years agoconf: Add unix socket support to virChrdevOpen
John Eckersberg [Wed, 2 Jan 2013 15:38:53 +0000 (10:38 -0500)] 
conf: Add unix socket support to virChrdevOpen

This also changes the function signature to take a
virDomainChrSourceDefPtr instead of just a path, since it needs to
differentiate behavior based on source->type.

12 years agoconf: Rename console-specific identifiers to be more generic
John Eckersberg [Wed, 2 Jan 2013 15:38:52 +0000 (10:38 -0500)] 
conf: Rename console-specific identifiers to be more generic

The functionality provided in virchrdev.c (previously virconsole.c) is
applicable to other types of character devices besides consoles, such
as channels.  This patch is just code motion, renaming things such as
"console" or "pty", instead using more general terms such as
"character device" or "device path".

12 years agoconf: Rename virconsole.* to virchrdev.*
John Eckersberg [Wed, 2 Jan 2013 15:38:51 +0000 (10:38 -0500)] 
conf: Rename virconsole.* to virchrdev.*

This is just code motion, in preparation to rename identifiers to be
less console-specific.

12 years agoapi: Add API to tunnel a guest channel via stream
John Eckersberg [Thu, 13 Dec 2012 16:24:16 +0000 (11:24 -0500)] 
api: Add API to tunnel a guest channel via stream

This patch adds a new API, virDomainOpenChannel, that uses streams to
connect to a virtio channel on a guest.  This creates a secure
communication channel between a guest and a libvirt client.

This behaves the same as virDomainOpenConsole, except on channels
instead of console/serial/parallel devices.

12 years agobuild: fix mingw rpm build
Eric Blake [Fri, 4 Jan 2013 23:36:57 +0000 (16:36 -0700)] 
build: fix mingw rpm build

Commit d13155c changed which files get installed for the
libvirt-guests service, but did not touch up the mingw spec
file.  As a result, rpmbuild complained:

RPM build errors:
    Installed (but unpackaged) file(s) found:
   /usr/i686-w64-mingw32/sys-root/mingw/libexec/libvirt-guests.sh
   /usr/x86_64-w64-mingw32/sys-root/mingw/libexec/libvirt-guests.sh

which in turn breaks ./autobuild.sh when cross-compilers are present.

* mingw-libvirt.spec.in: Remove files not relevant to mingw.

12 years agonetwork: fix check for ambiguous lookup
Eric Blake [Fri, 4 Jan 2013 22:02:42 +0000 (15:02 -0700)] 
network: fix check for ambiguous lookup

gcc -O2 complained:
../../src/conf/network_conf.c: In function 'virNetworkDefUpdateDNSSrv':
../../src/conf/network_conf.c:3232: error: 'foundIdx' may be used uninitialized in this function [-Wuninitialized]

It turned out to be a spurious warning (we didn't use foundIdx
unless foundCt was non-zero).  But in investigating that, I noticed
a worse problem: we were using 'if (foundCt > 1)', but since foundCt
was bool, it could never be > 1.

* src/conf/network_conf.c (virNetworkDefUpdateDNSHost): Use
correct type.
(virNetworkDefUpdateDNSSrv): Likewise, and silence compiler
warning.

12 years agoCheck and handle select() errors from waitsocket().
John Ferlan [Thu, 3 Jan 2013 19:16:22 +0000 (14:16 -0500)] 
Check and handle select() errors from waitsocket().

12 years agotests: check and handle error for virAsprintf() calls
John Ferlan [Thu, 3 Jan 2013 19:16:19 +0000 (14:16 -0500)] 
tests: check and handle error for virAsprintf() calls

12 years agoCheck return on mkdir for LOCKSPACE_DIR
John Ferlan [Thu, 3 Jan 2013 19:16:18 +0000 (14:16 -0500)] 
Check return on mkdir for LOCKSPACE_DIR

12 years agovmware: silence Coverity warning
John Ferlan [Thu, 3 Jan 2013 19:16:16 +0000 (14:16 -0500)] 
vmware: silence Coverity warning

Ignore the return status check for vmwareUpdateVMStatus in convenience
routine vmwareDomainObjListUpdateDomain

12 years agoqemu: Detect VGA_QXL capability correctly
Michal Privoznik [Fri, 4 Jan 2013 08:47:55 +0000 (09:47 +0100)] 
qemu: Detect VGA_QXL capability correctly

Since 4c993d8a we failed to set this important capability, which
allows starting a domain with QXL video card. We set DEVICE_QXL
capability bit instead, which is not necessary wrong. Anyway, if
qemu supports the new '-device qxl' it supports older '-vga qxl'
as well. The latter is used for the primary (the first) qxl video
card, the former for other video cards.

12 years agoInstall virtlockd.{socket,service} non executable
Guido Günther [Thu, 3 Jan 2013 21:39:14 +0000 (22:39 +0100)] 
Install virtlockd.{socket,service} non executable

since they're not scripts but systemd service files.

12 years agoqemu: fix a segfault in qemuProcessWaitForMonitor
Ján Tomko [Thu, 3 Jan 2013 18:07:55 +0000 (19:07 +0100)] 
qemu: fix a segfault in qemuProcessWaitForMonitor

Commit b3f2b4ca5cfe98b08ffdb96f0455e3e333e5ace6 left buf unallocated in
the case of QMP capability probing being used, leading to a segfault in
strlen in the cleanup path.

This patch opens the log and allocates the buffer if QMP probing was
used, so we can display the helpful error message.

12 years agoparallels: check and handle error for virAsprintf() calls
John Ferlan [Thu, 3 Jan 2013 19:16:14 +0000 (14:16 -0500)] 
parallels: check and handle error for virAsprintf() calls

Ignore the return in parallelsMakePoolName() since subsequent check
validates name was allocated.

12 years agoudev: check and handle error for virAsprintf() calls
John Ferlan [Thu, 3 Jan 2013 19:16:13 +0000 (14:16 -0500)] 
udev: check and handle error for virAsprintf() calls

12 years agobuild: fix build with optimization enabled
Eric Blake [Thu, 3 Jan 2013 17:12:47 +0000 (10:12 -0700)] 
build: fix build with optimization enabled

Build failure detected by Jenkins autobuilder:
http://honk.sigxcpu.org:8001/job/libvirt-build/472/changes

* .gnulib: Update to latest, for stdio.h rpl_fwrite fix.

12 years agoqemu: Don't parse log output when starting up a domain
Michal Privoznik [Wed, 2 Jan 2013 14:36:33 +0000 (15:36 +0100)] 
qemu: Don't parse log output when starting up a domain

Despite our great effort we still parsed qemu log output.
We wouldn't notice unless upcoming qemu 1.4 changed the
format of the logs slightly. Anyway, now we should gather
all interesting knobs like pty paths from monitor. Moreover,
since for historical reasons the first console can be just
an alias to the first serial port, we need to check this and
copy the pty path if that's the case to the first console.

12 years agobuild: use autobuild module to make build logs nicer
Eric Blake [Wed, 2 Jan 2013 18:10:42 +0000 (11:10 -0700)] 
build: use autobuild module to make build logs nicer

A recent build failure made me realize that we could usefully add
a bit more information to configure output, for aid in analysis of
failed builds.  Pulling in the autobuild module merely adds these
four lines to configure output:

configure: autobuild project... libvirt
configure: autobuild revision... v1.0.1-113-g7a74eea
configure: autobuild hostname... myhost
configure: autobuild timestamp... 20130102T233543Z

which can be useful even if not using the Autobuild project to parse
build logs.

* bootstrap.conf (gnulib_modules): Add autobuild.
* configure.ac: Favor git version over release version, when available.

12 years agomaint: update to latest gnulib
Eric Blake [Wed, 2 Jan 2013 15:38:33 +0000 (08:38 -0700)] 
maint: update to latest gnulib

'make syntax-check' warned that gnulib's copyright is now out of date.

* .gnulib: Update to latest, for copyright year bump.
* gnulib/local/m4/ssize_t.m4.diff: Regenerate.
* bootstrap: Synchronize from upstream.

12 years agoFix the comment grammar
Osier Yang [Wed, 2 Jan 2013 15:29:20 +0000 (23:29 +0800)] 
Fix the comment grammar

12 years agoRemove the inexistent function in comments
Osier Yang [Wed, 2 Jan 2013 09:27:07 +0000 (17:27 +0800)] 
Remove the inexistent function in comments

virNodeDeviceLookupByKey is inexistent.

12 years agoRevert "qemu: Adapt to new log format"
Michal Privoznik [Wed, 2 Jan 2013 10:52:18 +0000 (11:52 +0100)] 
Revert "qemu: Adapt to new log format"

This reverts commit 28224c4d2a2d623b9a0a714bc0454d47de5d7a35
which shouldn't be needed at all because with current qemu
we obtain all paths from 'query-chardev' output. We ought
not parse log output at all anymore.

12 years agoqemu: Adapt to new log format
Michal Privoznik [Sat, 29 Dec 2012 08:44:33 +0000 (09:44 +0100)] 
qemu: Adapt to new log format

Since 586502189edf9fd0f89a83de96717a2ea826fdb0 qemu commit, the log
lines reporting chardev's path has changed from:

$ ./x86_64-softmmu/qemu-system-x86_64 -serial pty -serial pty -monitor pty
char device redirected to /dev/pts/5
char device redirected to /dev/pts/6
char device redirected to /dev/pts/7

to:

$ ./x86_64-softmmu/qemu-system-x86_64 -serial pty -serial pty -monitor pty
char device compat_monitor0 redirected to /dev/pts/5
char device serial0 redirected to /dev/pts/6
char device serial1 redirected to /dev/pts/7

However, with current code we are not prepared for such change, which
results in us being unable to start any domain.

12 years agosanlock: Chown lease files as well
Michal Privoznik [Fri, 21 Dec 2012 11:35:21 +0000 (12:35 +0100)] 
sanlock: Chown lease files as well

Since sanlock doesn't run under root:root, we have chown()'ed the
__LIBVIRT__DISKS__ lease file to the user:group defined in the
sanlock config. However, when writing the patch I've forgot about
lease files for each disk (this is the
/var/lib/libvirt/sanlock/<md5>) file.

12 years agopython: Adapt to virevent rename
Michal Privoznik [Fri, 28 Dec 2012 15:22:09 +0000 (16:22 +0100)] 
python: Adapt to virevent rename

With our recent renames under src/util/* we forgot to adapt
python wrapper code generator. This results in some methods being
not exposed:

$ python examples/domain-events/events-python/event-test.py
Using uri:qemu:///system
Traceback (most recent call last):
  File "examples/domain-events/events-python/event-test.py", line 585, in <module>
    main()
  File "examples/domain-events/events-python/event-test.py", line 543, in main
    virEventLoopPureStart()
  File "examples/domain-events/events-python/event-test.py", line 416, in virEventLoopPureStart
    virEventLoopPureRegister()
  File "examples/domain-events/events-python/event-test.py", line 397, in virEventLoopPureRegister
    libvirt.virEventRegisterImpl(virEventAddHandleImpl,
AttributeError: 'module' object has no attribute 'virEventRegisterImpl'

12 years agoqemu: Convert some APIs to use qemuDomObjFromDomain
Michal Privoznik [Thu, 13 Dec 2012 11:19:58 +0000 (12:19 +0100)] 
qemu: Convert some APIs to use qemuDomObjFromDomain

Many internal qemu APIs must find domain object from passed
virDomainPtr. And with function Peter's introduced, we can use it
instead of copying multiple lines among code.

12 years agoqemu: Relax locking in DomainHasManagedSaveImage and DomainMonitorCommand
Michal Privoznik [Thu, 13 Dec 2012 11:33:06 +0000 (12:33 +0100)] 
qemu: Relax locking in DomainHasManagedSaveImage and DomainMonitorCommand

There is no need to hold qemu lock during the whole execution
of these two APIs.

12 years agoS390: Re-enable capability probing for virtio devices.
Viktor Mihajlovski [Fri, 21 Dec 2012 09:16:12 +0000 (10:16 +0100)] 
S390: Re-enable capability probing for virtio devices.

Since we switched to QMP probing, the object types are spelled out
explicitly, i.e. virtio-net-pci. This has effectively disabled
the capability detection of s390 virtio devices. The trivial fix
is to add the s390 virtio types explicitly to qemuCapsObjectProps.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoutil: fix botched check for new netlink request filters
Laine Stump [Fri, 21 Dec 2012 20:09:33 +0000 (15:09 -0500)] 
util: fix botched check for new netlink request filters

This is an adjustment to the fix for

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

to account for two bonehead mistakes I made.

commit ac2797cf2af2fd0e64c58a48409a8175d24d6f86 attempted to fix a
problem with netlink in newer kernels requiring an extra attribute
with a filter flag set in order to receive an IFLA_VFINFO_LIST from
netlink. Unfortunately, the #ifdef that protected against compiling it
in on systems without the new flag went a bit too far, assuring that
the new code would *never* be compiled, and even if it had, the code
was incorrect.

The first problem was that, while some IFLA_* enum values are also
their existence at compile time, IFLA_EXT_MASK *isn't* #defined, so
checking to see if it's #defined is not a valid method of determining
whether or not to add the attribute. Fortunately, the flag that is
being set (RTEXT_FILTER_VF) *is* #defined, and it is never present if
IFLA_EXT_MASK isn't, so it's sufficient to just check for that flag.

And to top it off, due to the code not actually compiling when I
thought it did, I didn't realize that I'd been given the wrong arglist
to nla_put() - you can't just send a const value to nla_put, you have
to send it a pointer to memory containing what you want to add to the
message, along with the length of that memory.

This time I've actually sent the patch over to the other machine
that's experiencing the problem, applied it to the branch being used
(0.10.2) and verified that it works properly, i.e. it does fix the
problem it's supposed to fix. :-/

12 years agoblockjob: fix memleak that prevented block pivot
Eric Blake [Fri, 21 Dec 2012 00:13:50 +0000 (17:13 -0700)] 
blockjob: fix memleak that prevented block pivot

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

The code for doing a block-copy was supposed to track the destination
file in drive->mirror, but was set up to do all mallocs prior to
starting the copy so that OOM wouldn't leave things partially started.
However, the wrong variable was being written; later in the code we
silently did 'disk->mirror = mirror' which was still NULL, and thus
leaking memory and leaving libvirt to think that the mirror job was
never started, which prevented a pivot operation after a copy.
Problem introduced in commit 35c7701c6.

* src/qemu/qemu_driver.c (qemuDomainBlockCopy): Initialize correct
variable.

12 years agoSort util files in Makefile.am alphabetically
Daniel P. Berrange [Thu, 13 Dec 2012 18:26:46 +0000 (18:26 +0000)] 
Sort util files in Makefile.am alphabetically

12 years agoRename virterror.c virterror_internal.h to virerror.{c,h}
Daniel P. Berrange [Thu, 13 Dec 2012 18:21:53 +0000 (18:21 +0000)] 
Rename virterror.c virterror_internal.h to virerror.{c,h}

12 years agoRename xml.{c,h} to virxml.{c,h}
Daniel P. Berrange [Thu, 13 Dec 2012 18:13:21 +0000 (18:13 +0000)] 
Rename xml.{c,h} to virxml.{c,h}

12 years agoRename uuid.{c,h} to viruuid.{c,h}
Daniel P. Berrange [Thu, 13 Dec 2012 18:01:25 +0000 (18:01 +0000)] 
Rename uuid.{c,h} to viruuid.{c,h}

12 years agoRename util.{c,h} to virutil.{c,h}
Daniel P. Berrange [Thu, 13 Dec 2012 17:44:57 +0000 (17:44 +0000)] 
Rename util.{c,h} to virutil.{c,h}

12 years agoRename threads.{c,h} to virthread.{c,h}
Daniel P. Berrange [Thu, 13 Dec 2012 15:49:48 +0000 (15:49 +0000)] 
Rename threads.{c,h} to virthread.{c,h}

12 years agoRename threadpool.{c,h} to virthreadpool.{c,h}
Daniel P. Berrange [Thu, 13 Dec 2012 15:39:07 +0000 (15:39 +0000)] 
Rename threadpool.{c,h} to virthreadpool.{c,h}

12 years agoRename sysinfo.{c,h} to virsysinfo.{c,h}
Daniel P. Berrange [Thu, 13 Dec 2012 15:31:53 +0000 (15:31 +0000)] 
Rename sysinfo.{c,h} to virsysinfo.{c,h}

12 years agoRename storage_file.{c,h} to virstoragefile.{c,h}
Daniel P. Berrange [Thu, 13 Dec 2012 15:25:48 +0000 (15:25 +0000)] 
Rename storage_file.{c,h} to virstoragefile.{c,h}

12 years agoRename stats_linux.{c,h} to virstatslinux.{c,h}
Daniel P. Berrange [Thu, 13 Dec 2012 15:14:15 +0000 (15:14 +0000)] 
Rename stats_linux.{c,h} to virstatslinux.{c,h}

12 years agoRename sexpr.{c,h} to virsexpr.{c,h}
Daniel P. Berrange [Thu, 13 Dec 2012 15:07:43 +0000 (15:07 +0000)] 
Rename sexpr.{c,h} to virsexpr.{c,h}

12 years agoMerge processinfo.{c,h} into virprocess.{c,h}
Daniel P. Berrange [Thu, 13 Dec 2012 14:58:41 +0000 (14:58 +0000)] 
Merge processinfo.{c,h} into virprocess.{c,h}

12 years agoRename pci.{c,h} to virpci.{c,h}
Daniel P. Berrange [Thu, 13 Dec 2012 14:52:25 +0000 (14:52 +0000)] 
Rename pci.{c,h} to virpci.{c,h}

12 years agoRename memory.{c,h} to viralloc.{c,h}
Daniel P. Berrange [Wed, 12 Dec 2012 18:06:53 +0000 (18:06 +0000)] 
Rename memory.{c,h} to viralloc.{c,h}

12 years agoRename logging.{c,h} to virlog.{c,h}
Daniel P. Berrange [Wed, 12 Dec 2012 17:59:27 +0000 (17:59 +0000)] 
Rename logging.{c,h} to virlog.{c,h}

12 years agoRename json.{c,h} to virjson.{c,h}
Daniel P. Berrange [Wed, 12 Dec 2012 17:53:50 +0000 (17:53 +0000)] 
Rename json.{c,h} to virjson.{c,h}

12 years agoRename iptables.{c,h} to viriptables.{c,h}
Daniel P. Berrange [Wed, 12 Dec 2012 17:42:44 +0000 (17:42 +0000)] 
Rename iptables.{c,h} to viriptables.{c,h}

12 years agoRename hostusb.{c,h} to virusb.{c,h}
Daniel P. Berrange [Wed, 12 Dec 2012 17:04:51 +0000 (17:04 +0000)] 
Rename hostusb.{c,h} to virusb.{c,h}

12 years agoRename hooks.{c,h} to virhook.{c,h}
Daniel P. Berrange [Wed, 12 Dec 2012 17:00:34 +0000 (17:00 +0000)] 
Rename hooks.{c,h} to virhook.{c,h}

12 years agoRename event_poll.{c,h} to vireventpoll.{c,h}
Daniel P. Berrange [Wed, 12 Dec 2012 16:54:55 +0000 (16:54 +0000)] 
Rename event_poll.{c,h} to vireventpoll.{c,h}

12 years agoRename event.{c,h} to virevent.{c,h}
Daniel P. Berrange [Wed, 12 Dec 2012 16:52:12 +0000 (16:52 +0000)] 
Rename event.{c,h} to virevent.{c,h}

Since the event APIs are now in the public header, no internal
code should include virevent.h

12 years agoRename ebtables.{c,h} to virebtables.{c,h}
Daniel P. Berrange [Wed, 12 Dec 2012 16:48:24 +0000 (16:48 +0000)] 
Rename ebtables.{c,h} to virebtables.{c,h}

12 years agoRename dnsmasq.{c,h} to virdnsmasq.{c,h}
Daniel P. Berrange [Wed, 12 Dec 2012 16:43:54 +0000 (16:43 +0000)] 
Rename dnsmasq.{c,h} to virdnsmasq.{c,h}

12 years agoRename conf.{c,h} to virconf.{c,h}
Daniel P. Berrange [Wed, 12 Dec 2012 16:35:35 +0000 (16:35 +0000)] 
Rename conf.{c,h} to virconf.{c,h}

12 years agoRename command.{c,h} to vircommand.{c,h}
Daniel P. Berrange [Wed, 12 Dec 2012 16:27:01 +0000 (16:27 +0000)] 
Rename command.{c,h} to vircommand.{c,h}

12 years agoRename buf.{c,h} to virbuffer.{c,h}
Daniel P. Berrange [Tue, 4 Dec 2012 12:04:07 +0000 (12:04 +0000)] 
Rename buf.{c,h} to virbuffer.{c,h}

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRename bitmap.{c,h} to virbitmap.{c,h}
Daniel P. Berrange [Tue, 4 Dec 2012 11:56:32 +0000 (11:56 +0000)] 
Rename bitmap.{c,h} to virbitmap.{c,h}

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRename cgroup.{h,c} to vircgroup.{h,c}
Daniel P. Berrange [Mon, 3 Dec 2012 15:03:47 +0000 (15:03 +0000)] 
Rename cgroup.{h,c} to vircgroup.{h,c}

To bring in line with new naming practice, rename the=
src/util/cgroup.{h,c} files to vircgroup.{h,c}

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoSupport all backend serial devices for pSeries guest
Li Zhang [Thu, 20 Dec 2012 06:02:25 +0000 (14:02 +0800)] 
Support all backend serial devices for pSeries guest

Currently, it only considers PTY backend serial devices for pseries.
It need to support all kinds of serial devices.

This patch is to fix the problem which is that it doesn't work
when specifying source type as file.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
12 years agoRemove QEMU_CAPS_NO_ACPI capability for non-x86 platform
Li Zhang [Thu, 20 Dec 2012 06:02:24 +0000 (14:02 +0800)] 
Remove QEMU_CAPS_NO_ACPI capability for non-x86 platform

ACPI is only supported on x86 platform, PPC can't support it.
So QEMU_CAPS_NO_ACPI shouldn't be set.

This patch is to remove QEMU_CAPS_NO_ACPI capability for
non-x86 platform.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
12 years agoSet std VGA model as default model for ppc64.
Li Zhang [Thu, 20 Dec 2012 06:02:22 +0000 (14:02 +0800)] 
Set std VGA model as default model for ppc64.

Cirrus VGA model is not supported on ppc64 currently.
It needs to set std VGA model as the default model.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
12 years agoAdd sysinfo data and enable virSysinfoRead test case for POWER
Li Zhang [Thu, 20 Dec 2012 02:31:05 +0000 (10:31 +0800)] 
Add sysinfo data and enable virSysinfoRead test case for POWER

This patch is to enable virSysinfoRead test case for POWER,
and provide sysinfo data on POWER.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
Reviewed-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoutil: fix functions that retrieve SRIOV VF info
Laine Stump [Thu, 20 Dec 2012 18:22:17 +0000 (13:22 -0500)] 
util: fix functions that retrieve SRIOV VF info

This patch resolves:

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

When assigning an SRIOV virtual function to a guest using "intelligent
PCI passthrough" (<interface type='hostdev'>, which sets the MAC
address and vlan tag of the VF before passing its info to qemu),
libvirt first learns the current MAC address and vlan tag by sending
an NLM_F_REQUEST message for the VF's PF (physical function) to the
kernel via a NETLINK_ROUTE socket (see virNetDevLinkDump()); the
response message's IFLA_VFINFO_LIST section is examined to extract the
info for the particular VF being assigned.

This worked fine with kernels up until kernel commit
115c9b81928360d769a76c632bae62d15206a94a (first appearing in upstream
kernel 3.3) which changed the ABI to not return IFLA_VFINFO_LIST in
the response until a newly introduced IFLA_EXT_MASK field was included
in the request, with the (newly introduced, of course) RTEXT_FILTER_VF
flag set.

The justification for this ABI change was that new fields had been
added to the VFINFO, causing NLM_F_REQUEST messages to fail on systems
with large numbers of VFs if the requesting application didn't have a
large enough buffer for all the info. The idea is that most
applications doing an NLM_F_REQUEST don't care about VFINFO anyway, so
eliminating it from the response would lower the requirements on
buffer size. Apparently, the people who pushed this patch made the
mistaken assumption that iproute2 (the "ip" command) was the only
package that used IFLA_VFINFO_LIST, so it wouldn't break anything else
(and they made sure that iproute2 was fixed.

The logic of this "fix" is debatable at best (one could claim that the
proper fix would be for the applications in question to be fixed so
that they properly sized the buffer, which is what libvirt does
(purely by virtue of using libnl), but it is what it is and we have to
deal with it.

In order for <interface type='hostdev'> to work properly on systems
with a kernel 3.3 or later, libvirt needs to add the afore-mentioned
IFLA_EXT_MASK field with RTEXT_FILTER_VF set.

Of course we also need to continue working on systems with older
kernels, so that one bit of code is compiled conditionally. The one
time this could cause problems is if the libvirt binary was built on a
system without IFLA_EXT_MASK which was subsequently updated to a
kernel that *did* have it. That could be solved by manually providing
the values of IFLA_EXT_MASK and RTEXT_FILTER_VF and adding it to the
message anyway, but I'm uncertain what that might actually do on a
system that didn't support the message, so for the time being we'll
just fail in that case (which will very likely never happen anyway).

12 years agoutil: add missing error log messages when failing to get netlink VFINFO
Laine Stump [Thu, 20 Dec 2012 19:52:41 +0000 (14:52 -0500)] 
util: add missing error log messages when failing to get netlink VFINFO

This patch fixes the lack of error messages when libvirt fails to find
VFINFO in a returned netlinke response message.

https://bugzilla.redhat.com/show_bug.cgi?id=827519#c10 is an example
of the error message that was previously logged when the
IFLA_VFINFO_LIST object was missing from the netlink response. The
reason for this failure is detailed in

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

Even though that root problem has been fixed, the experience of
finding the root cause shows us how important it is to properly log an
error message in these cases. This patch *seems* to replace the entire
function, but really most of the changes are due to moving code that
was previously inside an if() statement out to the top level of the
function (the original if() was reversed and made to log an error and
return).

12 years agosecurity: fix #endif comment in security_stack.h
Ján Tomko [Thu, 20 Dec 2012 18:46:43 +0000 (19:46 +0100)] 
security: fix #endif comment in security_stack.h

12 years agomaint: formatting cleanups in buf.c
Eric Blake [Wed, 19 Dec 2012 22:00:13 +0000 (15:00 -0700)] 
maint: formatting cleanups in buf.c

* src/util/buf.c: Use consistent formatting.

12 years agobuild: use strchr now that we can work around broken gcc
Eric Blake [Wed, 19 Dec 2012 19:28:48 +0000 (12:28 -0700)] 
build: use strchr now that we can work around broken gcc

Revert the complex workaround of commit 39d91e9, now that we have
a nicer framework for shutting up broken gcc.

* src/util/buf.c (virBufferEscape): Simplify.

12 years agobuild: make broken -Wlogical-op test be gcc-only
Eric Blake [Wed, 19 Dec 2012 19:07:39 +0000 (12:07 -0700)] 
build: make broken -Wlogical-op test be gcc-only

Commit 8b8fcdea introduced a check for broken gcc -Wlogical-op,
but did not guard the check against non-gcc compilers, which might
lead to spurious failures when another compiler encounters an
unknown pragma.  Additionally, all of our compiler warning logic
should belong in a single file, and use cache variables to allow
overriding the decision at configure time if necessary.

* configure.ac (BROKEN_GCC_WLOGICALOP): Move...
* m4/virt-compile-warnings.m4 (LIBVIRT_COMPILE_WARNINGS): ...here,
and update to modern autoconf idioms.

12 years agoutil: FreeBSD: stub out CPU affinity functions
Roman Bogorodskiy [Sun, 16 Dec 2012 14:47:56 +0000 (18:47 +0400)] 
util: FreeBSD: stub out CPU affinity functions

12 years agonodeinfo: add FreeBSD support
Roman Bogorodskiy [Mon, 17 Dec 2012 18:12:44 +0000 (22:12 +0400)] 
nodeinfo: add FreeBSD support

Uses sysctl(3) interface to obtain CPU and memory information on FreeBSD

12 years agoFix arch datatype in vahControl in virt-aa-helper.c
Daniel P. Berrange [Wed, 19 Dec 2012 11:45:31 +0000 (11:45 +0000)] 
Fix arch datatype in vahControl in virt-aa-helper.c

When changing to virArch, the virt-aa-helper.c file was not
completely changed. The vahControl struct was left with a
char *arch field, instead of virArch arch field.

12 years agoChange string form of VIR_ARCH_ITANIUM back to ia64
Daniel P. Berrange [Wed, 19 Dec 2012 10:54:57 +0000 (10:54 +0000)] 
Change string form of VIR_ARCH_ITANIUM back to ia64

Historically there was an inconsistency in handling of the
itanium arch. The xen driver & CPU model code treated it
as 'ia64' but the QEMU capabilities code used 'itanium'. On
the grounds that no one has ever seriously used  itanium
with QEMU, while RHEL shipped itanium with Xen, we should
favour 'ia64' as the canonical format

12 years agoFix parsing of arch from domain XML
Daniel P. Berrange [Wed, 19 Dec 2012 10:49:30 +0000 (10:49 +0000)] 
Fix parsing of arch from domain XML

When parsing the arch from domain XML, the result was only
saved to a local variable, not the virDomainDefPtr

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix CPU baseline to not hardcode arch
Daniel P. Berrange [Wed, 19 Dec 2012 10:47:40 +0000 (10:47 +0000)] 
Fix CPU baseline to not hardcode arch

Prior to the virArch changes, the CPU baseline method would
free the arch string in the returned CPU. Fix the regression
by setting arch to VIR_ARCH_NONE at the end

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix SELinux security label test
Daniel P. Berrange [Wed, 19 Dec 2012 10:05:17 +0000 (10:05 +0000)] 
Fix SELinux security label test

If securityselinuxtest was run on a system with newer SELinux
policy it would fail, due to using svirt_tcg_t instead of
svirt_t. Fixing the domain type to be KVM avoids this issue.

12 years agoconf: eliminate redundant use of VIR_ALLOC
Martin Kletzander [Mon, 17 Dec 2012 15:03:15 +0000 (16:03 +0100)] 
conf: eliminate redundant use of VIR_ALLOC

We can use VIR_REALLOC_N with NULL pointer, which behaves the same way
as VIR_ALLOC_N in that case, so no need for a condition that's
checking if some data are allocated already.

---

I tried to find other parts of the code similar to this, so I can do a
full cleanup for the whole repository, so I used this (excuse the long
line, but that's how I was writing it):

git grep -nHC 5 -e VIR_REALLOC_N -e VIR_ALLOC_N | while read line; do if [[ "$line" == "--" ]]; then if [[ ${#tmpbuf} -gt 10 && "$REALLOC_N" == "true" && "$ALLOC_N" == "true" ]]; then echo $line; while [[ ${#tmpbuf[*]} -gt 0 ]]; do echo "${tmpbuf[0]}"; tmpbuf=( "${tmpbuf[@]:1:${#tmpbuf[*]}}" ); done; fi; unset tmpbuf REALLOC_N ALLOC_N; else if [[ "$ALLOC_N" != "true" && "${line/VIR_ALLOC_N//}" != "${line}" ]]; then ALLOC_N="true"; fi; if [[ "$REALLOC_N" != "true" && "${line/VIR_REALLOC_N//}" != "${line}" ]]; then REALLOC_N="true"; fi; tmpbuf[${#tmpbuf[*]}]="$line"; fi; done | less

And reviewed the output just to find out this was the only occurrence of
the inconsistency.

12 years agoconf: minor indentation cleanups
Martin Kletzander [Mon, 17 Dec 2012 15:02:14 +0000 (16:02 +0100)] 
conf: minor indentation cleanups

On few places there are too many levels of indentation when some of
them can be fixed with negating the option they are in or omitting
useless condition altogether.

12 years agofix typo in the word affinities
Martin Kletzander [Mon, 17 Dec 2012 15:01:41 +0000 (16:01 +0100)] 
fix typo in the word affinities

This patch fixes just the word Affinites to Affinities (it's really
painful to search in TAGS without being able to find the right
function).

12 years agoFix libxl driver for virArch changes
Daniel P. Berrange [Tue, 18 Dec 2012 19:50:24 +0000 (19:50 +0000)] 
Fix libxl driver for virArch changes

12 years agoFix test cases for virArch changes
Daniel P. Berrange [Tue, 18 Dec 2012 19:32:23 +0000 (19:32 +0000)] 
Fix test cases for virArch changes

12 years agoFix XenAPI driver for virArch changes
Daniel P. Berrange [Tue, 18 Dec 2012 19:32:15 +0000 (19:32 +0000)] 
Fix XenAPI driver for virArch changes

12 years agoExport all symbols from virarch.{c,h} to drivers/tests/etc
Daniel P. Berrange [Tue, 18 Dec 2012 19:31:47 +0000 (19:31 +0000)] 
Export all symbols from virarch.{c,h} to drivers/tests/etc

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert QEMU capabilities code to use virArch
Daniel P. Berrange [Tue, 11 Dec 2012 13:06:45 +0000 (13:06 +0000)] 
Convert QEMU capabilities code to use virArch

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agospec: Do not install *.py[co] in python examples
Jiri Denemark [Mon, 17 Dec 2012 18:27:38 +0000 (19:27 +0100)] 
spec: Do not install *.py[co] in python examples

Unfortunately, rpm is stupid enough to bytycompile python scripts even
though they are located in /usr/share/doc/libvirt-python-*/examples and
it does so after %install phase is finished. Thus there's no way we
could remove those files from BUILDROOT. As a workaround, we may safely
remove the examples subdirectory completely without losing anything. The
python scripts that were installed there are also copied directly into
/usr/share/doc/libvirt-python-*/ by

    %doc python/tests/*.py

rule. And yes, the files are actually tests, not examples.

12 years agoConvert CPU APIs to use virArch
Daniel P. Berrange [Tue, 11 Dec 2012 12:58:54 +0000 (12:58 +0000)] 
Convert CPU APIs to use virArch

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert capabilities / domain_conf to use virArch
Daniel P. Berrange [Mon, 10 Dec 2012 22:28:09 +0000 (22:28 +0000)] 
Convert capabilities / domain_conf to use virArch

Convert the host capabilities and domain config structs to
use the virArch datatype. Update the parsers and all drivers
to take account of datatype change

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert QEMU command line builder to virArch APIs
Daniel P. Berrange [Mon, 10 Dec 2012 22:02:41 +0000 (22:02 +0000)] 
Convert QEMU command line builder to virArch APIs

Use virArch APIs to determine host architecture when launching
QEMU.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert nodeGetInfo to virArch APIs
Daniel P. Berrange [Mon, 10 Dec 2012 21:58:16 +0000 (21:58 +0000)] 
Convert nodeGetInfo to virArch APIs

Replace use of uname in nodeGetInfo with virArch APIs to
provide canonicalization of host architecture name

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoIntroduce a set of APIs for managing architectures
Daniel P. Berrange [Mon, 10 Dec 2012 21:54:00 +0000 (21:54 +0000)] 
Introduce a set of APIs for managing architectures

Introduce a 'virArch' enum for CPU architectures. Include
data type providing wordsize and endianness, and APIs to
query this info and convert to/from enum and string form.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agospec: Fix script warning when uninstalling libvirt-client
Cole Robinson [Mon, 17 Dec 2012 23:34:25 +0000 (18:34 -0500)] 
spec: Fix script warning when uninstalling libvirt-client

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

12 years agodocs: Fix documentation for readonly element
Jiri Denemark [Tue, 18 Dec 2012 13:06:16 +0000 (14:06 +0100)] 
docs: Fix documentation for readonly element

12 years agoAdded Ján Tomko to the commiters list
Daniel Veillard [Tue, 18 Dec 2012 03:08:01 +0000 (11:08 +0800)] 
Added Ján Tomko to the commiters list

And Guannan Ren who was missing from the list

12 years agonetwork: don't require private addresses if dnsmasq uses SO_BINDTODEVICE
Laine Stump [Mon, 17 Dec 2012 17:49:18 +0000 (12:49 -0500)] 
network: don't require private addresses if dnsmasq uses SO_BINDTODEVICE

This is yet another refinement to the fix for CVE-2012-3411:

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

It turns out that it would be very intrusive to correctly backport the
entire --bind-dynamic option to older dnsmasq versions
(e.g. dnsmasq-2.48 that is used on RHEL6.x and CentOS 6.x), but very
simple to patch those versions to just use SO_BINDTODEVICE on all
their listening sockets (SO_BINDTODEVICE also has the desired effect
of permitting only traffic that was received on the interface(s) where
dnsmasq was set to listen.)

This patch modifies the dnsmasq capabilities detection to detect the
string:

    --bind-interfaces with SO_BINDTODEVICE

in the output of "dnsmasq --version", and in that case realize that
using the old --bind-interfaces option is just as safe as
--bind-dynamic (and therefore *not* forbid creation of networks that
use public IP address ranges).

If -bind-dynamic is available, it is still preferred over
--bind-interfaces.

Note that this patch does no harm in upstream, or in any distro's
downstream if it happens to end up there, but builds for distros that
have a new enough dnsmasq to support --bind-dynamic do *NOT* need to
specifically backport this patch; it's only required for distro
releases that have dnsmasq too old to have --bind-dynamic (and those
distros will need to add the SO_BINDTODEVICE patch to dnsmasq,
*including the extra string in the --version output*, as well.

12 years agoapparmor: Fix build
Jiri Denemark [Mon, 17 Dec 2012 20:17:15 +0000 (21:17 +0100)] 
apparmor: Fix build