]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
12 years agoMove qemu-XXX commands from virsh-host.c to virsh-domain.c
Daniel P. Berrange [Fri, 21 Dec 2012 14:26:27 +0000 (14:26 +0000)] 
Move qemu-XXX commands from virsh-host.c to virsh-domain.c

The QEMU specific APIs all operate on domains, not the host,
so should be in the virsh-domain.c file / group

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd missing flags to migrate documentation
Guido Günther [Mon, 7 Jan 2013 12:23:43 +0000 (13:23 +0100)] 
Add missing flags to migrate documentation

12 years agocpu: Avoid NULL dereference
John Ferlan [Mon, 7 Jan 2013 17:09:34 +0000 (12:09 -0500)] 
cpu: Avoid NULL dereference

Don't dereference 'model' in PowerPCBaseline when there's no outputModel

12 years agolxc: Avoid possible NULL dereference on *root prior to opendir().
John Ferlan [Mon, 7 Jan 2013 17:09:33 +0000 (12:09 -0500)] 
lxc: Avoid possible NULL dereference on *root prior to opendir().

If running on older Linux without mounted cgroups then its possible that
*root would be NULL.

12 years agoremote: Avoid calling virAuthConfigLookup() if 'credname' is NULL.
John Ferlan [Mon, 7 Jan 2013 17:09:31 +0000 (12:09 -0500)] 
remote: Avoid calling virAuthConfigLookup() if 'credname' is NULL.

12 years agovmware: Avoid NULL dereference for 'caps'
John Ferlan [Mon, 7 Jan 2013 17:09:30 +0000 (12:09 -0500)] 
vmware: Avoid NULL dereference for 'caps'

When virCapabilitiesNew() fails, caps will be NULL resulting in possible
core when deref'd in cpuDataFree() call.

12 years agoxen: Avoid possible NULL dereference
John Ferlan [Mon, 7 Jan 2013 17:09:29 +0000 (12:09 -0500)] 
xen: Avoid possible NULL dereference

Change calling sequence to only call xenUnifiedDomainSetVcpusFlags() when
'dom' is not NULL. Use the GET_PRIVATE() macro to reference privateData.
Just return -1 if dom is NULL.

12 years agoFix virLXCPrepareHostDevices method
Daniel P. Berrange [Mon, 7 Jan 2013 18:16:54 +0000 (18:16 +0000)] 
Fix virLXCPrepareHostDevices method

The virLXCPrepareHostDevices method was returning success even
when it reported an error, and failed to handle several host
device types

12 years agoEnsure we always setup a private mount namespace for LXC controller
Daniel P. Berrange [Mon, 7 Jan 2013 18:14:34 +0000 (18:14 +0000)] 
Ensure we always setup a private mount namespace for LXC controller

The code for setting up a private /dev/pts for the containers
is also responsible for making the LXC controller have a
private mount namespace. Unfortunately the /dev/pts code is
not run if launching a container without a custom root. This
causes the LXC FUSE mount to leak into the host FS.

12 years agoSpeed up fallback to legacy non-QMP probing
Daniel P. Berrange [Mon, 7 Jan 2013 16:19:36 +0000 (16:19 +0000)] 
Speed up fallback to legacy non-QMP probing

Since we daemonized QEMU for capabilities probing there is a long
time if QEMU fails to launch. This is because we're not passing in
any virDomainObjPtr instance and thus the monitor code can not
check to see if the PID is still alive.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoOnly initialize capabilities after setting dir permissions
Daniel P. Berrange [Mon, 7 Jan 2013 16:18:33 +0000 (16:18 +0000)] 
Only initialize capabilities after setting dir permissions

The current code is initializing capabilities before setting
directory permissions. Thus the QEMU binaries being run may
not have the ability to create the UNIX monitor socket on
the first run of libvirtd.

12 years agobuild: Add libxenctrl to LIBXL_LIBS
Jim Fehlig [Mon, 7 Jan 2013 17:15:56 +0000 (10:15 -0700)] 
build: Add libxenctrl to LIBXL_LIBS

Commit dfa1e1dd removed libxenctrl from LIBXL_LIBS, but the libxl
driver uses a symbol from this library.  Explicitly link with
libxenctrl instead of relying on the build system to support
implicit DSO linking.

12 years agobuild: install libvirt sysctl file correctly
Eric Blake [Fri, 4 Jan 2013 21:21:59 +0000 (14:21 -0700)] 
build: install libvirt sysctl file correctly

https://bugzilla.redhat.com/show_bug.cgi?id=887017 reports that
even though libvirt attempts to set fs.aio-max-nr via sysctl,
the file was installed with the wrong name and gets ignored by
sysctl.  Furthermore, 'man systcl.d' recommends that packages
install into hard-coded /usr/lib/sysctl.d (even when libdir is
/usr/lib64), so that sysadmins can use /etc/sysctl.d for overrides.

* daemon/Makefile.am (install-sysctl, uninstall-sysctl): Use
correct location.
* libvirt.spec.in (network_files): Reflect this.

12 years agobuild: .service files don't need to be executable
Eric Blake [Fri, 4 Jan 2013 20:50:39 +0000 (13:50 -0700)] 
build: .service files don't need to be executable

See also commit 66ff2dd, where we avoided installing these files
as executables.

* daemon/Makefile.am (libvirtd.service): Drop chmod.
* tools/Makefile.am (libvirt-guests.service): Likewise.
* src/Makefile.am (virtlockd.service, virtlockd.socket):
Likewise.

12 years agobuild: properly substitute virtlockd.socket
Eric Blake [Fri, 4 Jan 2013 20:48:30 +0000 (13:48 -0700)] 
build: properly substitute virtlockd.socket

virtlockd.service could be installed to a configurable root,
but virtlockd.socket was hardcoded to installation into a
distro.

* src/Makefile.am (virtlockd.service, virtlockd.socket): Drop
unused substitutions.
* src/locking/virtlockd.socket.in (ListenStream): Don't hard-code
/var.

12 years agobuild: use common .in replacement mechanism
Eric Blake [Fri, 4 Jan 2013 20:35:04 +0000 (13:35 -0700)] 
build: use common .in replacement mechanism

We had several different styles of .in conversion in our Makefiles:
ALLCAPS, @ALLCAPS@, @lower@, ::lower::
Canonicalize on one form, to make it easier to copy and paste
between .in files.

Also, we were using some non-portable sed constructs: \@ is an
undefined escape sequence (it happens to be @ itself in GNU sed,
but POSIX allows it to mean something else), as well as risky
behavior (failure to consistently quote things means a space
in $(sysconfdir) could throw things off; also, Autoconf recommends
using | rather than , or ! in the s||| operator, because | has to
be quoted in shell and is therefore less likely to appear in file
names than , or !).

Fix all of these uses to follow the same syntax.

* daemon/libvirtd.8.in: Switch to @var@.
* tools/virt-xml-validate.in: Likewise.
* tools/virt-pki-validate.in: Likewise.
* src/locking/virtlockd.init.in: Likewise.
* daemon/Makefile.am: Prefer | over ! in sed.
(libvirtd.8): Prefer consistent substitution.
(libvirtd.init, libvirtd.service): Avoid non-portable sed.
* tools/Makefile.am (libvirt-guests.sh, libvirt-guests.init)
(libvirt-guests.service): Likewise.
(virt-xml-validate, virt-pki-validate, virt-sanlock-cleanup):
Prefer consistent capitalization.
* src/Makefile.am (virtlockd.init, virtlockd.service)
(virtlockd.socket): Prefer consistent substitution.

12 years agoqemu: Check if the shared disk's cdbfilter conflicts with others
Osier Yang [Wed, 2 Jan 2013 14:37:11 +0000 (22:37 +0800)] 
qemu: Check if the shared disk's cdbfilter conflicts with others

This prevents domain starting and disk attaching if the shared disk's
setting conflicts with other active domain(s), E.g. A domain with
"sgio" set as "filtered", however, another active domain is using
it set as "unfiltered".

12 years agoqemu: set unpriv_sgio when starting domain and attaching disk
Osier Yang [Wed, 2 Jan 2013 14:37:10 +0000 (22:37 +0800)] 
qemu: set unpriv_sgio when starting domain and attaching disk

This ignores the default "filtered" if unpriv_sgio is not supported
by kernel, but for explicit request "filtered", it error out for
domain starting.

12 years agoconf: Parse and format the new XML
Osier Yang [Wed, 2 Jan 2013 14:37:09 +0000 (22:37 +0800)] 
conf: Parse and format the new XML

Like "rawio", "sgio" is only allowed for block disk of device
type "lun".

It doesn't default disk->sgio to "filtered" when parsing, as
it won't be able to distinguish explicitly requested "filtered"
and a default "filtered" in driver then. We have to error out for
explicit request when the kernel doesn't support the new sysfs
knob "unpriv_sgio", however, for defaulted "filtered", we can
just ignore it if the kernel doesn't support "unpriv_sgio".

12 years agodocs: Add docs and rng schema for new XML tag sgio
Osier Yang [Wed, 2 Jan 2013 14:37:08 +0000 (22:37 +0800)] 
docs: Add docs and rng schema for new XML tag sgio

This introduces new XML tag "sgio" for disk, its valid values
are "filtered" and "unfiltered", setting it as "filtered" will
set the disk's unpriv_sgio to 0, and "unfiltered" to set it
as 1, which allows the unprivileged SG_IO commands.

12 years agoqemu: Add a hash table for the shared disks
Osier Yang [Wed, 2 Jan 2013 14:37:07 +0000 (22:37 +0800)] 
qemu: Add a hash table for the shared disks

This introduces a hash table for qemu driver, to store the shared
disk's info as (@major:minor, @ref_count). @ref_count is the number
of domains which shares the disk.

Since we only care about if the disk support unprivileged SG_IO
commands, and the SG_IO commands only make sense for block disk,
this patch only manages (add/remove hash entry) the shared disk for
block disk.

* src/qemu/qemu_conf.h: (Add member 'sharedDisks' of type
                         virHashTablePtr; Declare helpers
                         qemuGetSharedDiskKey, qemuAddSharedDisk
                         and qemuRemoveSharedDisk)
* src/qemu/qemu_conf.c (Implement the 3 helpers)
* src/qemu/qemu_process.c (Update 'sharedDisks' when domain
                           starting and shutdown)
* src/qemu/qemu_driver.c (Update 'sharedDisks' when attaching
                          or detaching disk).

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>