]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/log
people/liuw/libxenctrl-split/libvirt.git
12 years agolist: Change MATCH for common use in virsh
Osier Yang [Tue, 4 Sep 2012 15:16:31 +0000 (23:16 +0800)]
list: Change MATCH for common use in virsh

Move definition of MATCH from virsh-domain-monitor.c into
virsh.h, and rename it as VSH_MATCH for further use.

* tools/virsh-domain-monitor.c: Change MATCH into VSH_MATCH
* tools/virsh.h: Define VSH_MATCH

12 years agovirsh: Fix the wrong doc for pool-list
Osier Yang [Tue, 4 Sep 2012 15:16:30 +0000 (23:16 +0800)]
virsh: Fix the wrong doc for pool-list

The storage pool's management doesn't relate with a domain, it
probably was an intention, but not achieved yet. And the fact
is only active pools are listed by default.

12 years agolist: Add helper to convert strings separated by ', ' to array
Osier Yang [Tue, 4 Sep 2012 15:16:29 +0000 (23:16 +0800)]
list: Add helper to convert strings separated by ', ' to array

tools/virsh.c: New helper function vshStringToArray.
tools/virsh.h: Declare vshStringToArray.
tools/virsh-domain.c: use the helper in cmdUndefine.

12 years agolist: Implement listAllStoragePools for test driver
Osier Yang [Tue, 4 Sep 2012 15:16:28 +0000 (23:16 +0800)]
list: Implement listAllStoragePools for test driver

src/test/test_driver.c: Implement listAllStoragePools

12 years agolist: Implement listAllStoragePools for storage driver
Osier Yang [Tue, 4 Sep 2012 15:16:27 +0000 (23:16 +0800)]
list: Implement listAllStoragePools for storage driver

src/storage/storage_driver.c: Implement listAllStoragePools.

12 years agolist: Implement the RPC calls for virConnectListAllStoragePools
Osier Yang [Tue, 4 Sep 2012 15:16:26 +0000 (23:16 +0800)]
list: Implement the RPC calls for virConnectListAllStoragePools

The RPC generator doesn't support returning list of object, this patch does
the work manually.

  * daemon/remote.c:
    Implement the server side handler remoteDispatchConnectListAllStoragePools

  * src/remote/remote_driver.c:
    Add remote driver handler remoteConnectListAllStoragePools.

  * src/remote/remote_protocol.x:
    New RPC procedure REMOTE_PROC_CONNECT_LIST_ALL_STORAGE_POOLS and
    structs to represent the args and ret for it.

  * src/remote_protocol-structs: Likewise.

12 years agolist: Add helpers for listing storage pool objects
Osier Yang [Tue, 4 Sep 2012 15:16:25 +0000 (23:16 +0800)]
list: Add helpers for listing storage pool objects

src/conf/storage_conf.c: Add virStoragePoolMatch to filter the
pools; Add virStoragePoolList to iterate over the pool objects
with filter.

src/conf/storage_conf.h: Declare virStoragePoolMatch,
virStoragePoolList, and the macros for filters.

src/libvirt_private.syms: Export helper virStoragePoolList.

12 years agolist: Define new API virStorageListAllStoragePools
Osier Yang [Tue, 4 Sep 2012 15:16:24 +0000 (23:16 +0800)]
list: Define new API virStorageListAllStoragePools

This introduces a new API to list the storage pool objects,
4 groups of flags are provided to filter the returned pools:

  * Active or not

  * Autostarting or not

  * Persistent or not

  * And the pool type.

include/libvirt/libvirt.h.in: New enum virConnectListAllStoragePoolFlags;
                              Declare the API.
python/generator.py: Skip the generating
src/driver.h: (virDrvConnectListAllStoragePools)
src/libvirt.c: Implementation for the API.
src/libvirt_public.syms: Export the symbol.

12 years agoesx: Add implementation for virConnectListAllDomains()
Peter Krempa [Tue, 5 Jun 2012 12:24:40 +0000 (14:24 +0200)]
esx: Add implementation for virConnectListAllDomains()

ESX doesn't use the common virDomainObj implementation so this patch
adds a separate implementation.

This driver supports all currently defined filtering flags, but as with
other drivers some combinations yield a empty result list.

12 years agohyperv: Add implementation for virConnectListAllDomains()
Peter Krempa [Tue, 5 Jun 2012 12:20:58 +0000 (14:20 +0200)]
hyperv: Add implementation for virConnectListAllDomains()

Hyperv doesn't use the common virDomainObj implementation so this patch
adds a separate implementation.

This driver supports all currently added flags for filtering although
some of those don't make sense with this driver (no support yet) and
thus produce no output when used.

12 years agoDefine DYNLIB_NAME on OpenBSD.
Jasper Lievisse Adriaanse [Tue, 4 Sep 2012 14:48:51 +0000 (16:48 +0200)]
Define DYNLIB_NAME on OpenBSD.

12 years agobuild: avoid test failure when sasl was not compiled in
Eric Blake [Wed, 5 Sep 2012 21:02:01 +0000 (15:02 -0600)]
build: avoid test failure when sasl was not compiled in

On systems without cyrus-sasl-devel available (I happened to be
in that situation on my FreeBSD testing), this test fails rather
miserably:

TEST: libvirtdconftest
      .....!!!!!!...!!!!!!!!!!!!!!!!!!!!!!!!!  39  FAIL
FAIL: libvirtdconftest

with verbose output showing things like:

39) Test corruption                                          ... libvir: Config File error : unsupporeted configuration: remoteReadConfigFile: /usr/home/dummy/libvirt/tests/../daemon/libvirtd.conf: auth_tcp: unsupported auth sasl

* tests/libvirtdconftest.c (testCorrupt): Avoid failure when sasl
is missing.

12 years agobuild: avoid check-symfile on non-Linux
Eric Blake [Wed, 5 Sep 2012 19:10:18 +0000 (13:10 -0600)]
build: avoid check-symfile on non-Linux

I tested both OpenBSD and cygwin; both failed 'make check' with:

  GEN    check-symfile
Can't return outside a subroutine at ./check-symfile.pl line 13.

Perl requires 'exit 77' instead of 'return 77' in that context,
but even with that tweak, the build still fails, since the exit
code of 77 is only special to explicit TESTS=foo listings, and
not to make-only dependency rules where we are not going through
automake's test framework.

* src/check-symfile.pl: Kill bogus platform check...
* src/Makefile.am (check-symfile): ...and replace with an automake
conditional.

12 years agonetwork: prevent infinite hang if ovs-vswitchd isn't running
Laine Stump [Tue, 4 Sep 2012 19:26:29 +0000 (15:26 -0400)]
network: prevent infinite hang if ovs-vswitchd isn't running

This fixes https://bugzilla.redhat.com/show_bug.cgi?id=852984

If a network or interface is configured to use Open vSwitch, but
ovs-vswitchd (the Open vSwitch database service) isn't running, the
ovs-vsctl add-port/del-port commands will hang indefinitely rather
than returning an error. There is a --nowait option, but that appears
to have no effect on add-port and del-port commands, so instead we add
a --timeout=5 to the commands - they will retry for up to 5 seconds,
then fail if there is no response.

12 years agobuild: require netcf-0.2.2 when installing on Fedora18+
Laine Stump [Tue, 4 Sep 2012 17:05:54 +0000 (13:05 -0400)]
build: require netcf-0.2.2 when installing on Fedora18+

A previous patch forced libnl-3 and netcf-0.2.2 (which itself requires
libnl-3) when *building* for Fedora 18+ (and RHEL 7+), but the
install-time Requires: for netcf has always been implicit due to
libvirtd linking with libnetcf.so. However, the since the API of netcf
didn't change when it was rebuilt to use libnl-3, the internal library
version didn't change either, making it possible (from rpm's point of
view) to upgrade libvirt without upgrading netcf (in reality, that
leads to a segfault - see
https://bugzilla.redhat.com/show_bug.cgi?id=853381).

The solution is to put an explicit Requires: line in libvirt's
specfile for fedora >= 18 and rhel >= 7.

12 years agobuild: don't fail when xsltproc is missing
Eric Blake [Wed, 5 Sep 2012 17:55:42 +0000 (11:55 -0600)]
build: don't fail when xsltproc is missing

On a machine without xsltproc, the build failed with:

Scripting search.php
/usr/local/bin/bash: line 1: search.php.tmp: No such file or directory
rm: ./search.php: No such file or directory

Regression introduced in commit 28183590.

* docs/Makefile.am (%.php): Skip in the same conditions when the
.tmp file is skipped.

12 years agobuild: avoid warnings from gcc 4.2.1
Eric Blake [Wed, 5 Sep 2012 17:40:31 +0000 (11:40 -0600)]
build: avoid warnings from gcc 4.2.1

OpenBSD ships with gcc 4.2.1, which annoyingly treats all format
strings as though they were also attribute((nonnull)).  The two
concepts are orthogonal, though, as evidenced by the number of
spurious warnings it generates on uses where we know that
virReportError specifically handles NULL instead of a format
string; worse, since we now force -Werror on git builds, it
prevents development builds on OpenBSD.

I hate to do this, as it disables ALL format checking on older
gcc, and therefore misses out on some useful checks (code that
happened to compile on Linux may still have type mismatches
when compiled on other platforms, as evidenced by the number
of times I have fixed formatting mismatches for uid_t as found
by warnings on Cygwin), but I don't see any other way to keep
-Werror alive and still compile on OpenBSD.

A more invasive change would be to make virReportError() mark
its format attribute as nonnull, and fix (a lot of) fallout;
we may end up doing that anyways as part of danpb's error
refactoring improvements, but not today.

* src/internal.h (ATTRIBUTE_FMT_PRINTF): Use preferred spellings.
* m4/virt-compile-warnings.m4 (-Wformat): Disable on older gcc.

12 years agoqemu: don't pin all the cpus
Martin Kletzander [Tue, 4 Sep 2012 13:26:46 +0000 (15:26 +0200)]
qemu: don't pin all the cpus

This is another fix for the emulator-pin series. When going through
the cputune pinning settings, the current code is trying to pin all
the CPUs, even when not all of them are specified. This causes error
in the subsequent function which, of course, cannot find the cpu to
pin. Since it's enough to pass the correct VCPU ID to the function,
the fix is trivial.

12 years agomaint: avoid doubled name in syntax check failures
Eric Blake [Tue, 4 Sep 2012 23:40:04 +0000 (17:40 -0600)]
maint: avoid doubled name in syntax check failures

Based on the similar gnulib commit 96ad9077.  The use of
$(_sc_search_regexp) already injects $(ME) into any output
messages, so a failure of these rules would look like this,
pre-patch:

maint.mk: maint.mk: use virStrToLong_*, not strtol variants

* cfg.mk (sc_prohibit_strncmp, sc_prohibit_strtol)
(sc_libvirt_unmarked_diagnostics): Drop redundant $(ME).

12 years agobuild: use re-entrant functions in virsh
Eric Blake [Tue, 4 Sep 2012 23:35:27 +0000 (17:35 -0600)]
build: use re-entrant functions in virsh

Yesterday's commit 15d2c9f pointed out that virsh was still using
localtime(), which is not thread-safe, even though virsh is
definitely multi-threaded.  Even if we only ever triggered it from
one thread, it's better safe than sorry for maintenance purposes.

* cfg.mk (exclude_file_name_regexp--sc_prohibit_nonreentrant):
Tighten the rule.
* tools/virsh.c (vshOutputLogFile): Avoid localtime.
(vshEditWriteToTempFile, vshEditReadBackFile, cmdCd, cmdPwd)
(vshCloseLogFile): Avoid strerror.
* tools/console.c (vshMakeStdinRaw): Likewise.
* tools/virsh-domain.c (vshGenFileName): Fix spacing in previous
patch.

12 years agoRemove explicit dependency on ceph RPM
Daniel P. Berrange [Wed, 5 Sep 2012 07:58:50 +0000 (08:58 +0100)]
Remove explicit dependency on ceph RPM

The libvirt storage driver uses librbd.so for its functionality.
RPM will automatically add a dependency on the library, so there
is no need to have an explicit dependency on the ceph RPM itself.
This allows newer Fedora distros to avoid pulling in the huge
ceph RPM, in favour of just having the libraries installed

12 years agoqemu: Do not require auth scheme in graphics events
Jiri Denemark [Tue, 4 Sep 2012 14:52:47 +0000 (16:52 +0200)]
qemu: Do not require auth scheme in graphics events

Only VNC_{{DIS,}CONNECTED,INITIALIZED} and SPICE_INITIALIZED events are
documented to support server/auth field and even there it is marked as
optional. Emit "" auth scheme in case QEMU didn't send it.

12 years agoconf: describe security_driver behavior
Martin Kletzander [Tue, 4 Sep 2012 14:09:43 +0000 (16:09 +0200)]
conf: describe security_driver behavior

As a request was raised for this, I added few lines in the "Notes"
part of the "security_driver" comments about allowed values.

12 years agodocs: correct dompmwakeup description
Martin Kletzander [Tue, 4 Sep 2012 10:01:41 +0000 (12:01 +0200)]
docs: correct dompmwakeup description

12 years agoPass a correct pointer type to localtime_r(3).
Paul Eggert [Tue, 4 Sep 2012 17:03:41 +0000 (10:03 -0700)]
Pass a correct pointer type to localtime_r(3).

On 09/04/2012 08:20 AM, Eric Blake wrote:
> tv_sec is required by POSIX to be
> of type time_t; so this is a bug in the OpenBSD header
> [for declaring it as long]

Most likely this problem arose because of the patch I pushed
in gnulib commit e07d7c40f3ca5ec410cf5aa6fa03cfe51e712039.
Previously, gnulib required timeval's tv_sec to be
the same size as time_t.  But now, it requires only that
tv_sec be big enough to hold a time_t.

This patch was needed for Emacs.  Without the patch, gnulib
replaced struct timeval on OpenBSD, and this messed up
utimens.c, and Emacs wouldn't build.

Alternatively, gnulib could substitute its own struct timeval
for the system's, wrapping every struct timeval-using function
(gettimeofday, futimesat, futimes, lutimes, etc.  That'd be
more work, though.  And it would introduce some performance
issues with gettimeofday, which is supposed to be fast.

I've been trying to get away from using struct timeval,
and to use the higher-resolution struct timespec instead,
so messing with these obsolescent interfaces has been
lower priority for me.  But if someone wants to take the
more-ambitious approach that'd be fine, I expect.

For this particular case, though, how about if we avoid
the problem entirely?  libvirt doesn't need to use struct
timeval here at all.  It makes libvirt smaller and probably
faster, and it ports to OpenBSD without messing with gnulib.

12 years agobuild: use correct libraries for clock_gettime
Eric Blake [Tue, 4 Sep 2012 16:57:25 +0000 (10:57 -0600)]
build: use correct libraries for clock_gettime

On OpenBSD, clock_gettime() exists in libc rather than librt, and
blindly linking with -lrt made the build fail.  Gnulib already
did the work for determining which libraries to use, so we should
reuse that work rather than doing it ourselves.

* bootstrap.conf (gnulib_modules): Pull in clock-time.
* configure.ac (RT_LIBS): Drop.
* src/Makefile.am (libvirt_util_la_LIBADD): Use gnulib variable
instead.
* src/util/virtime.c (includes): Simplify.

12 years agoInclude an extra header needed for OpenBSD.
Jasper Lievisse Adriaanse [Tue, 4 Sep 2012 14:57:09 +0000 (16:57 +0200)]
Include an extra header needed for OpenBSD.

12 years agoRename iolimit to blockio.
Viktor Mihajlovski [Tue, 4 Sep 2012 14:30:55 +0000 (16:30 +0200)]
Rename iolimit to blockio.

After discussion with DB we decided to rename the new iolimit
element as it creates the impression it would be there to
limit (i.e. throttle) I/O instead of specifying immutable
characteristics of a block device.
This is also backed by the fact that the term I/O Limits has
vanished from newer storage admin documentation.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoqemu: Fix reboot with guest agent
Jiri Denemark [Tue, 4 Sep 2012 10:01:43 +0000 (12:01 +0200)]
qemu: Fix reboot with guest agent

When reboot using qemu guest agent was requested, qemu driver kept
waiting for SHUTDOWN event from qemu. However, such event is never
emitted during guest reboot and qemu driver would keep waiting forever.

12 years agoFix mingw64 build by using intptr_t for int->void* casts
Daniel P. Berrange [Tue, 4 Sep 2012 10:16:55 +0000 (11:16 +0100)]
Fix mingw64 build by using intptr_t for int->void* casts

The viratomictest.c was casting from an int to a void* via a
long. This works on Linux or Mingw32, but fails on Mingw64
due to a pointer/integer size mis-match. Replacing 'long'
with 'intptr_t' ensures matching type sizes

12 years agoqemu: Don't update graphic definitions on password change failure
Peter Krempa [Mon, 3 Sep 2012 14:52:27 +0000 (16:52 +0200)]
qemu: Don't update graphic definitions on password change failure

When the password change failed we updated the graphic definition
anyways, which is not desired.

12 years agotests: Add tests for qemu S3/S4 state configuration
Martin Kletzander [Thu, 2 Aug 2012 10:18:16 +0000 (12:18 +0200)]
tests: Add tests for qemu S3/S4 state configuration

Few tests were added which are checking whether the parsing of the xml
and command-line arguments is working and compatible with each other.

12 years agoqemu: Add support for S3/S4 state configuration
Martin Kletzander [Thu, 2 Aug 2012 10:14:39 +0000 (12:14 +0200)]
qemu: Add support for S3/S4 state configuration

This patch adds support for running qemu guests with the required
parameters to forcefully enable or disable BIOS advertising of S3 and
S4 states.  The support for this is added to capabilities and there is
also a qemu command parameter parsing implemented.

12 years agoAdd per-guest S3/S4 state configuration
Martin Kletzander [Thu, 2 Aug 2012 10:12:50 +0000 (12:12 +0200)]
Add per-guest S3/S4 state configuration

There is a new <pm/> element implemented that can control what ACPI
sleeping states will be advertised by BIOS and allowed to be switched
to by libvirt. The default keeps defaults on hypervisor, otherwise
forces chosen setting.
The documentation of the pm element is added as well.

12 years agopython: don't mask libvirt errors
Eric Blake [Fri, 31 Aug 2012 17:07:19 +0000 (10:07 -0700)]
python: don't mask libvirt errors

A user reported this crash when using python bindings:

  File "/home/nox/workspace/NOX/src/NOX/hooks.py", line 134, in trigger
    hook.trigger(event)
  File "/home/nox/workspace/NOX/src/NOX/hooks.py", line 33, in trigger
    self.handlers[event]()
  File "/home/nox/workspace/NOX/hooks/volatility.py", line 81, in memory_dump
    for block in Memory(self.ctx):
  File "/home/see/workspace/NOX/src/NOX/lib/libtools.py", line 179, in next
    libvirt.VIR_MEMORY_PHYSICAL)
  File "/usr/lib/python2.7/dist-packages/libvirt.py", line 1759, in memoryPeek
    ret = libvirtmod.virDomainMemoryPeek(self._o, start, size, flags)
SystemError: error return without exception set

In the python bindings, returning NULL makes python think an
exception was thrown, while returning the None object lets the
wrappers know that a libvirt error exists.

Reported by Nox DaFox, fix suggested by Dan Berrange.

* python/libvirt-override.c (libvirt_virDomainBlockPeek)
(libvirt_virDomainMemoryPeek): Return python's None object, so
wrapper knows to check libvirt error.

12 years agoqemu: Support for Block Device IO Limits.
Viktor Mihajlovski [Wed, 29 Aug 2012 15:48:31 +0000 (17:48 +0200)]
qemu: Support for Block Device IO Limits.

Implementation of iolimits for the qemu driver with
capability probing for block size attribute and
command line generation for block sizes.
Including testcase for qemuxml2argvtest.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoconf: Support for Block Device IO Limits
Viktor Mihajlovski [Wed, 29 Aug 2012 15:48:30 +0000 (17:48 +0200)]
conf: Support for Block Device IO Limits

Introducing a new iolimits element allowing to override certain
properties of a guest block device like the physical and logical
block size.
This can be useful for platforms with 'non-standard' disk formats
like S390 DASD with its 4K block size.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agocommand: shell-quote when logging commands
Eric Blake [Tue, 28 Aug 2012 18:11:45 +0000 (11:11 -0700)]
command: shell-quote when logging commands

Without this patch, logged command executions can be ambiguous if
the command contained any shell metacharacters.  This has caused
more than one person to attempt to patch clients to add unnecessary
quoting, without realizing that the command itself was run with
correct args, and only the logged output was ambiguous.

* src/util/command.c (virCommandToString): Add shell escapes.
* tests/commandtest.c (test16): Test new behavior.
* tests/commanddata/test16.log: Update expected output.
* tests/qemuxml2argvdata/qemuxml2argv-*.args: Likewise.
* tests/networkxml2argvdata/*.argv: Likewise.

12 years agovirsh: remove unneeded usage of vshConnectionUsability()
Peter Krempa [Fri, 24 Aug 2012 11:57:01 +0000 (13:57 +0200)]
virsh: remove unneeded usage of vshConnectionUsability()

Now that vshCommandRun() checks for the connection automaticaly, remove
all of the redundant checks in the code.

vshConnectionUsability() no longer needs to be exported and this patch
marks it static.

12 years agovirsh: Improve checking for connection when running commands
Peter Krempa [Fri, 24 Aug 2012 10:39:53 +0000 (12:39 +0200)]
virsh: Improve checking for connection when running commands

Almost each virsh command uses the function vshConnectionUsability
before doing anything, to check if the connection is "alive".  Commands
that don't need an conection are already conveniently marked with
VSH_CMD_FLAG_NOCONNECT. We can automaticaly check for the connection
before calling any remote command so we don't forget to do so.

This patch also upgrades the connection check to use virConnectIsAlive
along with the current approach.

12 years agoqemu: fix remote port searching
Martin Kletzander [Fri, 31 Aug 2012 13:33:26 +0000 (15:33 +0200)]
qemu: fix remote port searching

After fixing the last review comments on remote port searching (commit
a14b4aea512d6c3a42af56207a65ef10ac4a12a1), the commit right after that
wasn't modified accordingly, therefore two values weren't changed as
they should and the configurable ports don't work as expected.

This simple commit changes last two values missed and fixes the issue.

12 years agoschemas: Fix wwn pattern
Osier Yang [Wed, 29 Aug 2012 16:28:40 +0000 (00:28 +0800)]
schemas: Fix wwn pattern

It should be [] instead of ().

12 years agoutil: Update the inconsistent and outdated comments
Osier Yang [Fri, 31 Aug 2012 13:44:21 +0000 (21:44 +0800)]
util: Update the inconsistent and outdated comments

The codes were updated to allow to reset the device as long as
there is no devices/functions behind the same bus. However, the
comments were kept without touched.

12 years agoRelease of libvirt-0.10.1
Daniel Veillard [Fri, 31 Aug 2012 12:39:36 +0000 (20:39 +0800)]
Release of libvirt-0.10.1

* configure.ac docs/news.html.in libvirt.spec.in: update for release
* po/*.po*: pulled localization updates for sp,ja,mr,pa,uk,zh_CN,zh_TW
  and regenerated

12 years agoconf: Avoid formatting auto-generated DAC labels
Marcelo Cerri [Fri, 31 Aug 2012 11:40:41 +0000 (13:40 +0200)]
conf: Avoid formatting auto-generated DAC labels

To avoid backward compatibility issues, this patch suppresses
auto-generated DAC labels from XML. This change affects commands such as
dumpxml and save.

Signed-off-by: Marcelo Cerri <mhcerri@linux.vnet.ibm.com>
12 years agoconf: Fix parsing of seclabels without model
Marcelo Cerri [Fri, 31 Aug 2012 11:40:40 +0000 (13:40 +0200)]
conf: Fix parsing of seclabels without model

With this patch libvirt tries to assign a model to a single seclabel
when model is missing. Libvirt will look up at host's capabilities and
assign the first model to seclabel.

This patch fixes:

1. The problem with existing guests that have a seclabel defined in its XML.
2. A XML parse error when a guest is restored.

Signed-off-by: Marcelo Cerri <mhcerri@linux.vnet.ibm.com>
12 years agovirsh: fixed incorrect timing report
Viktor Mihajlovski [Fri, 31 Aug 2012 11:32:45 +0000 (13:32 +0200)]
virsh: fixed incorrect timing report

When executing virsh -t <command> the reported timing was off
by 3 orders of magnitude if the command took more than one
second.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agovirsh: Document subdriver option of attach-disk
Jiri Denemark [Thu, 30 Aug 2012 15:51:35 +0000 (17:51 +0200)]
virsh: Document subdriver option of attach-disk

12 years agoqemu: Don't ignore CPU tuning config if required cgroups are missing
Jiri Denemark [Wed, 29 Aug 2012 14:08:59 +0000 (16:08 +0200)]
qemu: Don't ignore CPU tuning config if required cgroups are missing

When domain XML contains any of the elements for setting up CPU
scheduling parameters (period, quota, emulator_period, or
emulator_quota) we need cpu cgroup to enforce the configuration.
However, the existing code would just ignore silently such settings if
either cgroups were not available at all cpu cgroup was not available.
Moreover, APIs for manipulating CPU scheduler parameters were already
failing if cpu cgroup was not available. This patch makes cpu cgroup
mandatory for all domains that use CPU scheduling elements in their XML.

12 years agodoc: update option force to subcommand change-media
Guannan Ren [Fri, 31 Aug 2012 09:58:44 +0000 (17:58 +0800)]
doc: update option force to subcommand change-media

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

12 years agocgroup: fix libvirtd crash caused by messed memory
Guannan Ren [Fri, 31 Aug 2012 08:45:02 +0000 (16:45 +0800)]
cgroup: fix libvirtd crash caused by messed memory

The variable max_id is initialized again in the step of
getting cpu mapping variable map2. But in the next for loop
we still expect original value of max_id, the bug will
crash libvirtd when using on NUMA machine with big number
of cpus.

12 years agocgroup: fix a typo on extracting data from vcpu cgroup
Guannan Ren [Fri, 31 Aug 2012 08:40:10 +0000 (16:40 +0800)]
cgroup: fix a typo on extracting data from vcpu cgroup

12 years agocgroup: read more data from cgroup cpuacct.usage_percpu
Guannan Ren [Fri, 31 Aug 2012 08:31:30 +0000 (16:31 +0800)]
cgroup: read more data from cgroup cpuacct.usage_percpu

On NUMA machine, the length of string got from file
cpuacct.usage_percpu is quite large, so expand the
limit of 1024 bytes.

errors like:
Failed to read file \
'/cgroup/cpuacct/libvirt/qemu/rhel6q/cpuacct.usage_percpu': \
Value too large for defined data type

12 years agodocs: Fix typo in CPU tuning
Jiri Denemark [Fri, 31 Aug 2012 06:22:57 +0000 (08:22 +0200)]
docs: Fix typo in CPU tuning

12 years agodoc: Fix emulator pinning example in formatdomain.html
Peter Krempa [Fri, 31 Aug 2012 07:59:34 +0000 (09:59 +0200)]
doc: Fix emulator pinning example in formatdomain.html

Add correct closing tags.

12 years agonwfilter: adapt IP learning for broadcasted DHCP replies
Stefan Berger [Thu, 30 Aug 2012 18:29:51 +0000 (14:29 -0400)]
nwfilter: adapt IP learning for broadcasted DHCP replies

Adapt the IP learning code to also accept broadcasted DHCP replies

12 years agonwfilter: accept broadcasted DHCP replies in DHCP snooping code
Stefan Berger [Thu, 30 Aug 2012 18:29:50 +0000 (14:29 -0400)]
nwfilter: accept broadcasted DHCP replies in DHCP snooping code

Some DHCP servers send their DHCP replies to the broadcast MAC address
rather than to the MAC address of the VM. The existing DHCP snooping
code assumes that the reply always goes to the MAC address of the VM
thus filtering the traffic of some DHCP servers' replies.

The below patch adapts the code to

1) filter DHCP replies by comparing the MAC address in the reply against
   the MAC address of the VM (held in the snoop request)

2) adapts the pcap filter for traffic towards the VM to accept DHCP replies
   sent to any MAC address; for further filtering we rely on 1)

3) creates initial rules that are active while waiting for DHCP replies;
   these rules now accept DHCP replies to the VM's MAC address or to the
   MAC broadcast address

12 years agoImplement virMacAddrIsBroadcastRaw
Stefan Berger [Thu, 30 Aug 2012 18:29:49 +0000 (14:29 -0400)]
Implement virMacAddrIsBroadcastRaw

Add function for testing for Ethernet broadcast address

12 years agoFix adding ports to OVS bridges without VLAN tags
Kyle Mestery [Thu, 30 Aug 2012 20:38:06 +0000 (16:38 -0400)]
Fix adding ports to OVS bridges without VLAN tags

The introduction of the new VLAN code, along with the fix
from 5e465df6be8bcb00f0b4bff831e91f4042fae272, caused the
addition of OVS ports to fail with the following message:

ovs-vsctl: 00002|vsctl|ERR|: missing column name

This fix takes into account the VLAN arguments are optional,
and correctly sets up the command line to run the "ovs-vsctl"
command to add ports to the OVS bridge.

Signed-off-by: Kyle Mestery <kmestery@cisco.com>
CC: Eric Blake <eblake@redhat.com>
12 years agoFix xen driver following changes to make it stateful
Jim Fehlig [Thu, 30 Aug 2012 18:53:02 +0000 (12:53 -0600)]
Fix xen driver following changes to make it stateful

Recent work to improve support for loadable driver modules introduced
a regression in the xen driver.  The legacy xen driver is now a
stateful, libvirtd driver but was not being registered when building
without driver modules.

A slight behavior change was also noted in the xen drivers when
built as driver modules.  Previously, explicitly specifying a
connection URI was not necessary, but now

Compiled against library: libvirt 0.10.0
Using library: libvirt 0.10.0
Using API: QEMU 0.10.0
error: failed to get the hypervisor version
error: internal error Cannot find suitable emulator for x86_64

The xen drivers need to be registered before the qemu driver since
the qemu driver will return success with a null connection URI.
This ordering is safe since the xen drivers will decline when not
running the xen kernel.

12 years agoFix issue of PF brought down if VF is 8021.Qbh and pci passthrough
Nishank Trivedi [Thu, 30 Aug 2012 19:27:27 +0000 (15:27 -0400)]
Fix issue of PF brought down if VF is 8021.Qbh and pci passthrough

If a 8021.Qbh network device supports SRIOV and its VF is being used
in pci passthrough mode, when the guest is shutdown or destroyed, the
PF inteface is also brought down. qemuDomainHostdevNetConfigRestore()
finds out the PF for provided hostdev (which is VF) and passes it to
virNetDevPortProfileDisassociate() as linkdev. Later, linkdev gets passed
to virNetDevSetOnline() where the interface is brought down by clearing
IFF_UP flag.

Bringing down a PF, when only VF is being brought down is not expected
behavior. This patch adds a check so that virNetDevSetOnline() is called
only for PF and not if device is a VF.

Signed-off-by: Nishank Trivedi <nistrive@cisco.com>
12 years agonwfilter: loop generated too many rules
Stefan Berger [Thu, 30 Aug 2012 17:51:27 +0000 (13:51 -0400)]
nwfilter: loop generated too many rules

The loop processing the trusted DHCP server generated one too
many rules and added one final rules that accepted responses
from all DHCP servers. Below patch fixes this.

12 years agosecurity: Re-apply commit ce53382ba28179d3a504b29b4f888b6e130d53f0
Peter Krempa [Thu, 30 Aug 2012 14:05:53 +0000 (16:05 +0200)]
security: Re-apply commit ce53382ba28179d3a504b29b4f888b6e130d53f0

Recent changes in the security driver discarded changes that fixed
labeling un-confined guests.

12 years agovcpupin: Fix returning of arrays from virDomainVcpuPinAdd
Peter Krempa [Thu, 30 Aug 2012 13:38:37 +0000 (15:38 +0200)]
vcpupin: Fix returning of arrays from virDomainVcpuPinAdd

virDomainVcpuPinAdd does a realloc on vcpupin_list if the new vcpu pin
definition doesn't fit into the array. The list is an array of pointers
but the function definition didn't support returning the changed pointer
to the caller if it was realloced. This caused segfaults if realloc
would change the base pointer.

12 years agoqemu: Fix possible infinite loop and segfault on error path.
Peter Krempa [Thu, 30 Aug 2012 13:31:54 +0000 (15:31 +0200)]
qemu: Fix possible infinite loop and segfault on error path.

virDomainVcpuPinDefCopy when the control flow reaches out of memory
cleanup code, the flow would end in a infinite loop as the loop variable
wasn't decremented.

Also a dereference of NULL pointers was possible if allocation of the
Vcpu pinning definiton structure failed.

12 years agoqemu: Clean up security driver initialisation and config file
Peter Krempa [Thu, 30 Aug 2012 08:58:09 +0000 (10:58 +0200)]
qemu: Clean up security driver initialisation and config file

Commit d0c0e79ac646462aaa815f81ad324a0d3ef12954 left behind some dead
code (hasDAC can't be efectively set to true, because
virSecurityManagerNew fails to load the "dac" driver).

This patch also enhances the condition for adding the default
auto-detected security manager if the manager array is allocated but
empty.

Also the configuration file for qemu driver still contains reference to
the DAC driver that can't be enabled manualy.

12 years agoqemu: Revert to blocking behavior of qemuAgentCommand
Jiri Denemark [Thu, 30 Aug 2012 12:40:01 +0000 (14:40 +0200)]
qemu: Revert to blocking behavior of qemuAgentCommand

Before commit 05447e3af44ec153314ff97cd611330d9b4b5730, qemuAgentCommand
blocked until it got a reply or appropriate event. When new parameter
was added to qemuAgentCommand in the above commit, all existing callers
of it were updated in a wrong way changing them from blocking to
5-seconds timeout.

12 years agoqemu: Remove redundant parameter from qemuAgentSend
Jiri Denemark [Thu, 30 Aug 2012 12:19:02 +0000 (14:19 +0200)]
qemu: Remove redundant parameter from qemuAgentSend

The @timeout parameter of qemuAgentSend is both redundant and confusing.
This patch should not result in any functional changes.

12 years agonetwork: get vlan info for Open vSwitch interfaces from proper source
Laine Stump [Thu, 30 Aug 2012 09:14:32 +0000 (05:14 -0400)]
network: get vlan info for Open vSwitch interfaces from proper source

This bug was revealed by the crash described in

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

The vlan info pointer sent to virNetDevOpenvswitchAddPort should never
be non-NULL unless there is at least one tag. The factthat such a vlan
info pointer was receveid pointed out that a caller was passing the
wrong pointer. Instead of sending &net->vlan, the result of
virDomainNetGetActualVlan(net) should be sent - that function will
look for vlan info in net->data.network.actual->vlan, and in cany case
return NULL instead of a pointer if the vlan info it finds has no
tags.

Aside from causing the crash, sending a hardcoded &net->vlan has the
effect of ignoring vlan info from a <network> or <portgroup> config.

12 years agoSmall cleanup on previous patch
Daniel Veillard [Thu, 30 Aug 2012 07:18:02 +0000 (15:18 +0800)]
Small cleanup on previous patch

As pointed by Eric Blake

12 years agoFix a crash when using Open vSwitch virtual ports
Kyle Mestery [Wed, 29 Aug 2012 18:44:36 +0000 (14:44 -0400)]
Fix a crash when using Open vSwitch virtual ports

Fixup buffer usage when handling VLANs. Also fix the logic
used to determine if the virNetDevVlanPtr is valid or not.
Fixes crashes in the latest code when using Open vSwitch
virtualports.

Signed-off-by: Kyle Mestery <kmestery@cisco.com>
12 years agoqemu: Sort the numa params only when it affects the live config
Osier Yang [Wed, 29 Aug 2012 06:46:06 +0000 (14:46 +0800)]
qemu: Sort the numa params only when it affects the live config

As the next boot doesn't have to worry about the previous numa
params setting (there is no).

12 years agoFix configuration of QEMU security drivers
Daniel P. Berrange [Thu, 30 Aug 2012 00:37:01 +0000 (01:37 +0100)]
Fix configuration of QEMU security drivers

If no 'security_driver' config option was set, then the code
just loaded the 'dac' security driver. This is a regression
on previous behaviour, where we would probe for a possible
security driver. ie default to SELinux if available.

This changes things so that it 'security_driver' is not set,
we once again do probing. For simplicity we also always
create the stack driver, even if there is only one driver
active.

The desired semantics are:

 - security_driver not set
     -> probe for selinux/apparmour/nop
     -> auto-add DAC driver
 - security_driver set to a string
     -> add that one driver
     -> auto-add DAC driver
 - security_driver set to a list
     -> add all drivers in list
     -> auto-add DAC driver

It is not allowed, or possible to specify 'dac' in the
security_driver config param, since that is always
enabled.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoqemu: Refactor initialisation of security drivers.
Peter Krempa [Wed, 29 Aug 2012 12:19:39 +0000 (14:19 +0200)]
qemu: Refactor initialisation of security drivers.

The security driver loading code in qemu has a flaw that causes it to
register the DAC security driver twice. This causes problems (machines
unable to start) as the two DAC drivers clash together.

This patch refactors the code to allow loading the DAC driver even if
its specified in configuration (it can't be registered as a common
security driver), and does not add the driver twice.

12 years agoRevert "security: Add DAC to security_drivers"
Peter Krempa [Wed, 29 Aug 2012 12:29:43 +0000 (14:29 +0200)]
Revert "security: Add DAC to security_drivers"

This reverts commit 9f9b7b85c9b422e8f4e813f3920bf8f433246a4a.

The DAC security driver needs special handling and extra parameters and
can't just be added to regular security drivers.

12 years agoqemu: Fix starting domains with no cpu cgroup
Jiri Denemark [Wed, 29 Aug 2012 13:30:34 +0000 (15:30 +0200)]
qemu: Fix starting domains with no cpu cgroup

If cgroups are enabled in general but cpu cgroup is disabled in
qemu.conf or not mounted at all, libvirt would refuse to start any
domain even though scheduler parameters are not set in domain XML.

This patch makes cpu cgroup mandatory only for domains that actually
want to use it.

12 years agosecurity: remove dead code from virSecurityDACGenLabel
Alex Jia [Wed, 29 Aug 2012 10:00:51 +0000 (18:00 +0800)]
security: remove dead code from virSecurityDACGenLabel

* src/security/security_dac.c: remove useless dead code.

Signed-off-by: Alex Jia <ajia@redhat.com>
12 years agoRelease of libvirt-0.10.0
Daniel Veillard [Wed, 29 Aug 2012 03:57:02 +0000 (11:57 +0800)]
Release of libvirt-0.10.0

* configure.ac docs/news.html.in libvirt.spec.in: updates for the release
* po/*.po*: update localizations for zh_CN, uk, ja, pt_BR, as, sp, mr, zh_TW

12 years agonwfilter: Don't try to acquire DBus context when DBus is disabled
Peter Krempa [Tue, 28 Aug 2012 13:19:31 +0000 (15:19 +0200)]
nwfilter: Don't try to acquire DBus context when DBus is disabled

To silence error if DBus support is not compiled in.

12 years agoDon't require gawk for a simple print expression
Guido Günther [Tue, 28 Aug 2012 08:57:54 +0000 (10:57 +0200)]
Don't require gawk for a simple print expression

Fedora uses gawk as awk so there's no change and in behavior while
Debian/Ubuntu use mawk by default.

This was reported by Luca Capello in
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=636712

12 years agoutil: Prevent libvirtd crash from virNetDevOpenvswitchAddPort()
Alex Jia [Wed, 29 Aug 2012 02:56:04 +0000 (10:56 +0800)]
util: Prevent libvirtd crash from virNetDevOpenvswitchAddPort()

* src/util/virnetdevopenvswitch.c (virNetDevOpenvswitchAddPort): avoid libvirtd
crash due to derefing a NULL virtVlan->tag.

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

Signed-off-by: Alex Jia <ajia@redhat.com>
12 years agoqemu: Set placement when setting numa parameters
Osier Yang [Tue, 28 Aug 2012 12:13:31 +0000 (20:13 +0800)]
qemu: Set placement when setting numa parameters

To keep the internal data structure consistent.

12 years agoPortability fixes for non-linux or old linux platforms
Daniel Veillard [Wed, 29 Aug 2012 01:21:38 +0000 (09:21 +0800)]
Portability fixes for non-linux or old linux platforms

The commits d57567940153147f4d43875fb92c3030b3178b03 and
080bf330e3749d94ebe094f8deca0e3e67d3f2fe made use directly of
macro defined in recent linux netlink version. Make those
part conditional on the definition

* daemon/libvirtd.c: do not use NETLINK_ROUTE and NETLINK_KOBJECT_UEVENT
  without some check first

12 years agosecurity_dac: Don't return uninitialised uid and gid for image labels
Peter Krempa [Tue, 28 Aug 2012 23:15:04 +0000 (01:15 +0200)]
security_dac: Don't return uninitialised uid and gid for image labels

As in the previous commit, images are also chowned to uninitialised
uid and gid if the label is not present.

12 years agosecurity_dac: Don't return uninitialised value when parsing seclabels
Peter Krempa [Tue, 28 Aug 2012 16:29:38 +0000 (18:29 +0200)]
security_dac: Don't return uninitialised value when parsing seclabels

When starting a machine the DAC security driver tries to set the UID and
GID of the newly spawned process. This worked as desired if the desired
label was set. When the label was missing a logical bug in
virSecurityDACGenLabel() caused that uninitialised values were used as
uid and gid for the new process.

With this patch, default values (from qemu driver configuration)
are used if the label is not found.

12 years agosecurity_dac: Avoid segfault when no label is requested
Peter Krempa [Tue, 28 Aug 2012 16:27:31 +0000 (18:27 +0200)]
security_dac: Avoid segfault when no label is requested

When no DAC "label" was requested for a domain the DAC manager tried to
strdup a NULL string causing a segfault.

12 years agoutil: Fix error message when getpwuid_r fails to find the user
Peter Krempa [Tue, 28 Aug 2012 14:51:05 +0000 (16:51 +0200)]
util: Fix error message when getpwuid_r fails to find the user

getpwuid_r returns success but sets the return structure to NULL when it
fails to deliver data about the requested uid. In our helper code this
created following strange error messages:

" ... cannot getpwuid_r(1234): Success"

This patch creates a more helpful message:
" ... getpwuid_r failed to retrieve data for uid '1234'"

12 years agoconf: Fix the problem which cause libvirtd to crash
Osier Yang [Tue, 28 Aug 2012 11:31:56 +0000 (19:31 +0800)]
conf: Fix the problem which cause libvirtd to crash

* src/conf/domain_conf.c: Use STREQ_NULLABLE instead of STREQ,
as def->seclables[i]->model could be NULL.

12 years agobuild: define 'inline' iff HAVE_LIBNL1
Michal Privoznik [Tue, 28 Aug 2012 10:01:50 +0000 (12:01 +0200)]
build: define 'inline' iff HAVE_LIBNL1

Previous commit 0b4b53bb80 defined 'inline' to prevent broken build on
systems with libnl1 headers. However, it broke build on systems with
libnl3 headers. Therefore we must make that fix conditional.

12 years agodocs: CPU allocation and pinning clarification
Martin Kletzander [Mon, 27 Aug 2012 14:26:26 +0000 (16:26 +0200)]
docs: CPU allocation and pinning clarification

There was a request for clarifying this part of the
documentation. This also fixes a case used with CPU.

12 years agobuild: work with older libnl1 headers
Eric Blake [Mon, 27 Aug 2012 21:00:59 +0000 (15:00 -0600)]
build: work with older libnl1 headers

Ubuntu 10.04 shipped with out-of-the-box libnl1 headers, which
assumed the old gcc semantics of 'extern inline' as a C89 extension:
the function will _always_ be inline if it is used, and that
it may be declared extern inline in headers without a definition,
as long as the definition occurs before any use.  But when C99
added 'extern inline' as a mandatory feature of the language, with
slightly different semantics than gcc (the function MUST have
external linkage, and the inline definition MUST be present
alongside any declaration, where the compiler can then choose
which of the two versions to use), this rendered the use of
'inline' in libnl's header obsolete.  Most distros already solved
this by removing 'inline' (the resulting 'extern' is correct,
regardless of gcc semantics), and libnl-3 does not have the
problem (where it has switched to 'static inline' instead, again
with the definition present, and again, our hack will result in
plain 'static' with no ill effects).  But for the case of building
out of the box, we hack around the broken Ubuntu header.

* src/util/virnetlink.h: Work around libnl issue.

12 years agoqemu: Fix define logic
Michal Privoznik [Mon, 27 Aug 2012 15:40:33 +0000 (17:40 +0200)]
qemu: Fix define logic

With current flow in qemudDomainDefine we might lose data
when updating an existing domain. We parse given XML and
overwrite the configuration.  Then we try to save the new
config. However, this step may fail and we don't perform any
roll back.  In fact, we remove the domain from the list of
domains held up by qemu driver. This is okay as long as the
domain was brand new one.

12 years agoqemu_agent: Switch to virReportSystemError() on system error
Michal Privoznik [Mon, 27 Aug 2012 11:49:21 +0000 (13:49 +0200)]
qemu_agent: Switch to virReportSystemError() on system error

Currently, if a syscall in qemu_agent.c fails we report an internal
error even though we should be reporting a system error.

12 years agoIntroduce new VIR_ERR_AGENT_UNRESPONSIVE error code
Michal Privoznik [Mon, 27 Aug 2012 10:24:59 +0000 (12:24 +0200)]
Introduce new VIR_ERR_AGENT_UNRESPONSIVE error code

Currently, when guest agent is configured but not responsive
(e.g. due to appropriate service not running in the guest)
we return VIR_ERR_INTERNAL_ERROR. Both are wrong. Therefore
we need to introduce new error code to reflect this case.

12 years agoconf: prevent NULL pointer access in virSecurityLabelDefsParseXML
Ján Tomko [Mon, 27 Aug 2012 12:51:28 +0000 (14:51 +0200)]
conf: prevent NULL pointer access in virSecurityLabelDefsParseXML

When checking for seclabels without security models, def->nseclabels is
already set to n. In the case of an error def->seclabels is freed but
nseclabels is left untouched. This leads to a segmentation fault when
def is freed in virDomainDefParseXML.

12 years agoqemu: Switch to unified func name
Michal Privoznik [Mon, 27 Aug 2012 08:35:02 +0000 (10:35 +0200)]
qemu: Switch to unified func name

With the latest patches libvirt supports qemu agent monitor
passthrough. However, function in qemu driver is called
qemuDrvDomainAgentCommand. s/Drv// as used in all other names.

12 years agorpc: fix segmentation fault caused by null client-sock
Guannan Ren [Mon, 27 Aug 2012 08:59:25 +0000 (16:59 +0800)]
rpc: fix segmentation fault caused by null client-sock

The client-sock could have been set to NULL by eventloop thread
after async event fired.

12 years agoqemu: fix regression with spice tls port allocation
Martin Kletzander [Mon, 27 Aug 2012 07:41:36 +0000 (09:41 +0200)]
qemu: fix regression with spice tls port allocation

In my quest for reusing variables I failed to edit one variable when
fixing details between two patch versions. That results in a failure
to start qemu with autoport and spice tls, because qemu is trying to
bind two sockets to the same port.

12 years agoqemu: fix regression with pinning
Martin Kletzander [Fri, 24 Aug 2012 15:31:47 +0000 (17:31 +0200)]
qemu: fix regression with pinning

Commit 4b03d59167f4a4c6ec57def315a61d977466e75b changed the pinning
behavior in a way that makes some machines non-startable.

The comment mentioning that we cannot control each vcpu when there is
not VCPU<-> PID mapping available is true, however, this isn't
necessarily an error, because this can be caused by old QEMU without
support for "query-cpus" command as well as a software emulated
machines that don't create more than one process.

12 years agovirsh: fix missing return value
Alex Jia [Mon, 27 Aug 2012 05:58:46 +0000 (13:58 +0800)]
virsh: fix missing return value

Although virsh command raises a correct error information, the command status
returns 0(true), this patch is used for fixing this issue.

Signed-off-by: Alex Jia <ajia@redhat.com>