]> xenbits.xensource.com Git - people/dariof/libvirt.git/log
people/dariof/libvirt.git
11 years agolibxl: correctly handle affinity reset in virDomainPinVcpu[Flags] libxl/VcpuPinX
Dario Faggioli [Wed, 18 Dec 2013 11:29:42 +0000 (12:29 +0100)]
libxl: correctly handle affinity reset in virDomainPinVcpu[Flags]

By actually removing the <vcpupin> element (from within the
<cputune> section) from the XML, rather than jus update it with
a fully set vcpu affinity mask.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Cc: Jim Fehlig <jfehlig@suse.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
11 years agolibxl: implement virDomainPinVcpuFlags
Dario Faggioli [Tue, 17 Dec 2013 18:11:28 +0000 (19:11 +0100)]
libxl: implement virDomainPinVcpuFlags

And use it to implement libxlDomainPinVcpu(), similarly to what
happens in the QEMU driver. This way, it is possible to both
query and change the vcpu affinity of a persistent but not
running domain.

In face, before this patch, we have:
 # virsh list --all
  Id    Name                           State
 ----------------------------------------------------
  5     debian_32                      running
  -     fedora20_64                    shut off
 # virsh vcpupin fedora20_64 0 2-4 --current
 error: this function is not supported by the connection driver: virDomainPinVcpuFlags

After (same situation as above):
 # virsh vcpupin  fedora20_64 0 2-4 --current
 # virsh vcpupin  fedora20_64 0
 VCPU: CPU Affinity
 ----------------------------------
    0: 2-4

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Cc: Jim Fehlig <jfehlig@suse.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
11 years agolibxl: implement virDomainGetVcpuPinInfo
Dario Faggioli [Thu, 12 Dec 2013 16:18:53 +0000 (17:18 +0100)]
libxl: implement virDomainGetVcpuPinInfo

So that it is possible to query vcpu related information of
a persistent but not running domain, like it is for the QEMU
driver.

In fact, before this patch, we have:
 # virsh list --all
  Id    Name                           State
 ----------------------------------------------------
  5     debian_32                      running
  -     fedora20_64                    shut off
 # virsh vcpuinfo fedora20_64
 error: this function is not supported by the connection driver: virDomainGetVcpuPinInfo

After (same situation as above, i.e., fedora20_64 not running):
 # virsh vcpuinfo fedora20_64
 VCPU:           0
 CPU:            N/A
 State:          N/A
 CPU time        N/A
 CPU Affinity:   yyyyyyyy

 VCPU:           1
 CPU:            N/A
 State:          N/A
 CPU time        N/A
 CPU Affinity:   yyyyyyyy

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Cc: Jim Fehlig <jfehlig@suse.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
11 years agoconfigure: make --with-test-suite work
Martin Kletzander [Wed, 18 Dec 2013 06:59:19 +0000 (07:59 +0100)]
configure: make --with-test-suite work

Our option '--with-test-suite' could have never worked since it was
defined as AC_ARG_ENABLE([with-test-suite], ...), thus working only as
'--enable-with-test-suite', but documented in configure.ac as
AC_HELP_STRING([--with-test-suite], ...).
In my opinion, the help string is as it should be, but the option is
wrong.

The option has been broken since the introduction in commit 3a2fc27.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
11 years agoSet the 'container_ttys' env variable for LXC consoles
Daniel P. Berrange [Fri, 13 Dec 2013 16:50:28 +0000 (16:50 +0000)]
Set the 'container_ttys' env variable for LXC consoles

Systemd specified that any /dev/pts/NNN device on which it
is expected to spawn a agetty login, should be listed in
the 'container_ttys' env variable. It should just contain
the relative paths, eg 'pts/0' not '/dev/pts/0' and should
be space separated.

http://cgit.freedesktop.org/systemd/systemd/commit/?id=1d97ff7dd71902a5604c2fed8964925d54e09de9

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agostorage: resize vol against real allocated size
Michal Privoznik [Mon, 16 Dec 2013 05:00:00 +0000 (13:00 +0800)]
storage: resize vol against real allocated size

Currently, 'vol-resize --allocate' allocates new space at the
vol->capacity offset. But the vol->capacity is not necessarily the same
as vol->allocation. For instance:.

[root@localhost ~]# virsh vol-list --pool tmp-pool --details
 Name      Path                   Type  Capacity  Allocation
-------------------------------------------------------------
 tmp-vol  /root/tmp-pool/tmp-vol  file  1.00 GiB  1.00 GiB

[root@localhost ~]# virsh vol-resize tmp-vol --pool tmp-pool 2G

[root@localhost ~]# virsh vol-list --pool tmp-pool --details
 Name      Path                   Type  Capacity  Allocation
-------------------------------------------------------------
 tmp-vol  /root/tmp-pool/tmp-vol  file  2.00 GiB  1.00 GiB

So, if we want to allocate more bytes, so the file is say 3G big, the
real allocated size is 2G actually:

[root@localhost ~]# virsh vol-resize tmp-vol --pool tmp-pool 3G --allocate

[root@localhost ~]# virsh vol-list --pool tmp-pool --details
 Name      Path                   Type  Capacity  Allocation
-------------------------------------------------------------
 tmp-vol  /root/tmp-pool/tmp-vol  file  3.00 GiB  2.00 GiB

This commit uses the correct vol->allocation instead of incorrect
vol->capacity, so the output of the commands above looks like this:

[root@localhost ~]# virsh vol-resize tmp-vol --pool tmp-pool 3G --allocate

[root@localhost ~]# virsh vol-list --pool tmp-pool --details
 Name      Path                   Type  Capacity  Allocation
-------------------------------------------------------------
 tmp-vol  /root/tmp-pool/tmp-vol  file  3.00 GiB  3.00 GiB

Moreover, if the '--alocate' flag was used, we must update the
vol->allocation member in storageVolResize API too, not just
vol->capacity.

Reported-by: Wang Sen <wangsen@linux.vnet.ibm.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoSupport transient attribute on vmware disks
Wout Mertens [Tue, 17 Dec 2013 17:04:35 +0000 (18:04 +0100)]
Support transient attribute on vmware disks

vmx/vmx.c ignores the transient attribute on the disk xml format. This patch
adds a 1-1 relationship between it and [disk].mode = "independent-nonpersistent".

The other modes are ignored as before. It works in my testing.

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

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoFix build when default python is python3
Lénaïc Huard [Tue, 17 Dec 2013 17:53:28 +0000 (18:53 +0100)]
Fix build when default python is python3

As the python generator scripts are written in python2,
the ./configure script must check for python2 before checking for python
otherwise, on platforms where both python2 and python3 are available and
on which the default python points to python3, ./configure will try to use
the wrong one.

Signed-off-by: Lénaïc Huard <lenaic@lhuard.fr.eu.org>
11 years agospecfile: fix make rpm when with_driver_modules is 1
Laine Stump [Fri, 13 Dec 2013 15:03:26 +0000 (17:03 +0200)]
specfile: fix make rpm when with_driver_modules is 1

Commit ff76566 moved around things in the specfiles to put
driver-specific files into their appropriate sub-packages (when
with_driver_modules == 1), but accidentally changed things so that the
deamon-driver-network and daemon-config-network files were only
included in a package when with_driver_modules == 0. This broke "make
rpm" on fedora (where with_driver_modules == 1).

This patch follows the pattern (already used for the files in other
sub-modules) of duplicating the files for the main package
(!with_driver_modules) and the sub-package (with_driver_modules).

11 years agodocs: fix address type for disks
Martin Kletzander [Mon, 16 Dec 2013 16:04:15 +0000 (17:04 +0100)]
docs: fix address type for disks

Disks have type='drive', not type='disk'.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
11 years agoqemu: fix typo PCi => PCI
Martin Kletzander [Mon, 16 Dec 2013 16:25:36 +0000 (17:25 +0100)]
qemu: fix typo PCi => PCI

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
11 years agotools: Fix virsh connect man page
Jiri Denemark [Mon, 16 Dec 2013 12:37:12 +0000 (13:37 +0100)]
tools: Fix virsh connect man page

The URI parameter is optional and xen:/// is not the default connection
URI.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
11 years agoLXC: Change incorrect error report in lxcContainerPivotRoot
Gao feng [Fri, 22 Nov 2013 07:11:07 +0000 (15:11 +0800)]
LXC: Change incorrect error report in lxcContainerPivotRoot

The newroot is not mounted as tmpfs, we bind root->src to it.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
11 years agoAdd debug output when registering event handlers
Daniel P. Berrange [Wed, 11 Dec 2013 15:27:13 +0000 (15:27 +0000)]
Add debug output when registering event handlers

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoRemove the event namespace concept
Daniel P. Berrange [Wed, 11 Dec 2013 14:10:34 +0000 (14:10 +0000)]
Remove the event namespace concept

The event namespace concept is mostly redundant information.
With the re-written dispatcher, the namespace is only used
for equality comparisons between event IDs. This can be solved
by just comparing virClassPtr instances instead.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAssociate a dispatch function with the event objects
Daniel P. Berrange [Thu, 12 Dec 2013 17:47:42 +0000 (17:47 +0000)]
Associate a dispatch function with the event objects

Instead of having the object event code have to know about each
type of event and their dispatch functions, associate a dispatch
function with the object instance. The dispatch code can thus be
significantly simplified.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoIntroduce abstract virNetworkEvent class
Daniel P. Berrange [Wed, 11 Dec 2013 14:09:01 +0000 (14:09 +0000)]
Introduce abstract virNetworkEvent class

Inject a virNetworkEvent class between virObjectEvent
and virNetworkEventLifecycle to mirror virDomainEvent.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAdd 'detail' arg to network lifecycle event internals
Daniel P. Berrange [Wed, 11 Dec 2013 13:40:41 +0000 (13:40 +0000)]
Add 'detail' arg to network lifecycle event internals

While the public API & wire protocol included the 'detail'
arg for network lifecycle events, the internal event handling
code did not process it. This meant that if a future libvirtd
server starts sending non-0 'detail' args, the current libvirt
client will not process them.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoUpdate event demo program to support network events too
Daniel P. Berrange [Wed, 11 Dec 2013 14:23:24 +0000 (14:23 +0000)]
Update event demo program to support network events too

11 years agoMove examples/domain-events/event-c to examples/object-events
Daniel P. Berrange [Wed, 11 Dec 2013 15:11:18 +0000 (15:11 +0000)]
Move examples/domain-events/event-c to examples/object-events

The domain events demo program isn't really tied to domain
events anymore, so rename it to object events.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix memory leak in virObjectEventCallbackListRemoveID()
Nehal J Wani [Fri, 13 Dec 2013 12:38:57 +0000 (18:08 +0530)]
Fix memory leak in virObjectEventCallbackListRemoveID()

While running objecteventtest, it was found that valgrind pointed out the
following memory leak:

==13464== 5 bytes in 1 blocks are definitely lost in loss record 7 of 134
==13464==    at 0x4A0887C: malloc (vg_replace_malloc.c:270)
==13464==    by 0x341F485E21: strdup (strdup.c:42)
==13464==    by 0x4CAE28F: virStrdup (virstring.c:554)
==13464==    by 0x4CF3CBE: virObjectEventCallbackListAddID (object_event.c:286)
==13464==    by 0x4CF49CA: virObjectEventStateRegisterID (object_event.c:729)
==13464==    by 0x4CF73FE: virDomainEventStateRegisterID (domain_event.c:1424)
==13464==    by 0x4D7358F: testConnectDomainEventRegisterAny (test_driver.c:6032)
==13464==    by 0x4D600C8: virConnectDomainEventRegisterAny (libvirt.c:19128)
==13464==    by 0x402409: testDomainStartStopEvent (objecteventtest.c:232)
==13464==    by 0x403451: virtTestRun (testutils.c:138)
==13464==    by 0x402012: mymain (objecteventtest.c:395)
==13464==    by 0x403AF2: virtTestMain (testutils.c:593)
==13464==

11 years agoqemu: check for reboot-timeout on monitor
Martin Kletzander [Fri, 13 Dec 2013 13:51:24 +0000 (14:51 +0100)]
qemu: check for reboot-timeout on monitor

The support for <boot rebootTimeout="12345"/> was added before we were
checking for qemu command line options in QMP, so we haven't properly
adapted virQEMUCaps when using it and thus we report unsupported
option with new enough qemu.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
11 years agolxc: return -1 if failed to kill lxc process
Chen Hanxiao [Fri, 13 Dec 2013 08:30:36 +0000 (16:30 +0800)]
lxc: return -1 if failed to kill lxc process

We missed a return when virProcessKillPainfully
failed to kill lxc process

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
11 years agoobject: require maximal alignment in base class
Eric Blake [Thu, 12 Dec 2013 23:01:15 +0000 (16:01 -0700)]
object: require maximal alignment in base class

Recent changes to events (commit 8a29ffcf) resulted in new compile
failures on some targets (such as ARM OMAP5):
conf/domain_event.c: In function 'virDomainEventDispatchDefaultFunc':
conf/domain_event.c:1198:30: error: cast increases required alignment of
target type [-Werror=cast-align]
conf/domain_event.c:1314:34: error: cast increases required alignment of
target type [-Werror=cast-align]
cc1: all warnings being treated as errors

The error is due to alignment; the base class is merely aligned
to the worst of 'int' and 'void*', while the child class must
be aligned to a 'long long'.  The solution is to include a
'long long' (and for good measure, a function pointer) in the
base class to ensure correct alignment regardless of what a
child class may add, but to wrap the inclusion in a union so
as to not incur any wasted space.  On a typical x86_64 platform,
the base class remains 16 bytes; on i686, the base class remains
12 bytes; and on the impacted ARM platform, the base class grows
from 12 bytes to 16 bytes due to the increase of alignment from
4 to 8 bytes.

Reported by Michele Paolino and others.

* src/util/virobject.h (_virObject): Use a union to ensure that
subclasses never have stricter alignment than the parent.
* src/util/virobject.c (virObjectNew, virObjectUnref)
(virObjectRef): Adjust clients.
* src/libvirt.c (virConnectRef, virDomainRef, virNetworkRef)
(virInterfaceRef, virStoragePoolRef, virStorageVolRef)
(virNodeDeviceRef, virSecretRef, virStreamRef, virNWFilterRef)
(virDomainSnapshotRef): Likewise.
* src/qemu/qemu_monitor.c (qemuMonitorOpenInternal)
(qemuMonitorClose): Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoqemu: add support for -device pvpanic
Hu Tao [Mon, 9 Dec 2013 09:11:15 +0000 (17:11 +0800)]
qemu: add support for -device pvpanic

Map the new <panic> device in XML to the '-device pvpanic' command
line of qemu.  Clients can then couple the <panic> device and the
<on_crash> directive to control behavior when the guest reports
a panic to qemu.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoconf: add support for panic device
Hu Tao [Mon, 9 Dec 2013 09:11:14 +0000 (17:11 +0800)]
conf: add support for panic device

panic device is a device that enables libvirt to receive notification
of guest panic event.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoconf: introduce generic ISA address
Hu Tao [Mon, 9 Dec 2013 09:11:13 +0000 (17:11 +0800)]
conf: introduce generic ISA address

For example:
<address type='isa' iobase='0x505' irq='0x1'/>

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoBump version to 1.2.1 for new dev cycle
Daniel P. Berrange [Thu, 12 Dec 2013 14:53:14 +0000 (14:53 +0000)]
Bump version to 1.2.1 for new dev cycle

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAdd another missing % on %{_libdir} macro
Laine Stump [Thu, 12 Dec 2013 13:49:19 +0000 (15:49 +0200)]
Add another missing % on %{_libdir} macro

Signed-off-by: Laine Stump <laine@laine.org>
11 years agoAdd missing % on %{_libdir} macro in RPM
Daniel P. Berrange [Thu, 12 Dec 2013 13:35:40 +0000 (13:35 +0000)]
Add missing % on %{_libdir} macro in RPM

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agorename virBlkioDeviceWeightPtr to virBlkioDevicePtr
Gao feng [Wed, 11 Dec 2013 08:29:48 +0000 (16:29 +0800)]
rename virBlkioDeviceWeightPtr to virBlkioDevicePtr

The throttle blkio cgroup will reuse this struct.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
11 years agorename virBlkioDeviceWeightArrayClear to virBlkioDeviceArrayClear
Gao feng [Wed, 11 Dec 2013 08:29:47 +0000 (16:29 +0800)]
rename virBlkioDeviceWeightArrayClear to virBlkioDeviceArrayClear

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
11 years agorename virDomainBlkioDeviceWeightParseXML to virDomainBlkioDeviceParseXML
Gao feng [Wed, 11 Dec 2013 08:29:46 +0000 (16:29 +0800)]
rename virDomainBlkioDeviceWeightParseXML to virDomainBlkioDeviceParseXML

virDomainBlkioDeviceWeightParseXML will be used to parse
the xml element read_bps, write_bps, read_iops, write_iops.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
11 years agostorage: show gluster option in virsh --version=long
Eric Blake [Thu, 12 Dec 2013 03:08:10 +0000 (20:08 -0700)]
storage: show gluster option in virsh --version=long

Adding output to 'virsh --version=long' makes it easier to
tell if a distro built with particular libraries (it doesn't
tell you what a remote libvirtd is built with, but is still
better than nothing).  But we forgot to mention gluster.

* tools/virsh.c (vshShowVersion): Add gluster witness.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoAdded default case with error for object event dispatching
Cédric Bosdonnat [Wed, 11 Dec 2013 10:38:04 +0000 (11:38 +0100)]
Added default case with error for object event dispatching

Hitting this should be pretty rare, but at least developers will know
that they are providing a weird event ID. Otherwise for namespace that
are added in the normal way, gcc will raise a warning about unhandled
case in the switch.

11 years agoFixed indentation in src/conf/*_event*
Cédric Bosdonnat [Wed, 11 Dec 2013 10:38:03 +0000 (11:38 +0100)]
Fixed indentation in src/conf/*_event*

11 years agoAdded network events to the bridged network driver
Cédric Bosdonnat [Wed, 11 Dec 2013 10:38:02 +0000 (11:38 +0100)]
Added network events to the bridged network driver

11 years agoAdd network events to the remote driver
Cédric Bosdonnat [Wed, 11 Dec 2013 10:38:01 +0000 (11:38 +0100)]
Add network events to the remote driver

11 years agoAdd network events unit tests
Cédric Bosdonnat [Wed, 11 Dec 2013 10:38:00 +0000 (11:38 +0100)]
Add network events unit tests

11 years agotest driver: implemented network events
Cédric Bosdonnat [Wed, 11 Dec 2013 10:37:59 +0000 (11:37 +0100)]
test driver: implemented network events

11 years agoAdded Network events API and virNetworkEventLifecycle.
Cédric Bosdonnat [Wed, 11 Dec 2013 10:37:58 +0000 (11:37 +0100)]
Added Network events API and virNetworkEventLifecycle.

Define the public API for (de-)registering network events
and the callbacks for receiving lifecycle events. The lifecycle
event includes a 'detail' parameter to match the domain lifecycle
event data, but this is currently unused.

The network events related code goes into its own set of internal
files src/conf/network_event.[ch]

11 years agodocs: fix a typo in libvirt.h
Chen Hanxiao [Wed, 11 Dec 2013 12:30:53 +0000 (20:30 +0800)]
docs: fix a typo in libvirt.h

s/pausde/paused

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
11 years agostorage_backend_rbd: rename "stat" variable
Michael Chapman [Wed, 11 Dec 2013 08:14:51 +0000 (19:14 +1100)]
storage_backend_rbd: rename "stat" variable

This variable shadows the stat(2) function, which only became visible in
this scope as of commit 9cac8639. Rename the variable so it doesn't
conflict.

Signed-off-by: Michael Chapman <mike@very.puzzling.org>
11 years agostorage: fix omitted slash in gluster volume URI
Eric Blake [Tue, 10 Dec 2013 12:45:26 +0000 (05:45 -0700)]
storage: fix omitted slash in gluster volume URI

When doing 'virsh vol-dumpxml' on a gluster pool's volume, the
resulting URI incorrectly omitted a slash between hostname and
path:  gluster://192.168.122.206rhsvol1/fedora-19.img

This is fallout from me rebasing earlier versions of my patch
that ended up as commit efee1af; I had originally played with
always requiring the gluster volume to have a leading slash,
but it was easier to use the gluster API if the gluster volume
name was guaranteed to have no slash.  While I got the URI of
the pool correct, I forgot to fix the URI of a libvirt volume.

* src/storage/storage_backend_gluster.c
(virStorageBackendGlusterRefreshVol): Use correct starting point
since uri construction requires leading slash.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoIf we do not specify a readonly mount, we don't need to
Chen Hanxiao [Tue, 10 Dec 2013 16:29:09 +0000 (16:29 +0000)]
If we do not specify a readonly mount, we don't need to
re-mount it again.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
11 years agoRevert "virtlockd: treat SIGHUP like SIGUSR1"
Michal Privoznik [Tue, 10 Dec 2013 14:49:06 +0000 (15:49 +0100)]
Revert "virtlockd: treat SIGHUP like SIGUSR1"

This reverts commit 8355d42dd3df514c8584e0e5082b945b79671fc5.

After some discussion upstream [1] this patch turns out to be spurious.
It better gets reverted prior to a release.

1: https://www.redhat.com/archives/libvir-list/2013-December/msg00563.html

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoqemu_process: Read errors from child
Michal Privoznik [Tue, 3 Dec 2013 16:38:14 +0000 (17:38 +0100)]
qemu_process: Read errors from child

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

There's a window when starting a qemu process between fork() and exec()
during which we are doing things that may fail but not tunnelling the
error to the daemon. This is basically all within qemuProcessHook().
So whenever we fail in something, e.g. placing a process onto numa node,
users are left with:

    error: Child quit during startup handshake: Input/output error

while the original error is thrown into the domain log:

    libvirt:  error : internal error: NUMA memory tuning in 'preferred'
    mode only supports single node

Hence, we should read the log file and search for the error message and
report it to users.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agodocs: fix recent typo
Eric Blake [Tue, 10 Dec 2013 14:03:58 +0000 (07:03 -0700)]
docs: fix recent typo

Introduced in commit 24fbbb82.

* docs/formatdomain.html.in: s/tunning/tuning/

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agodaemon/remote.c: renamed remoteDispatchDomainEventSend
Cédric Bosdonnat [Thu, 28 Nov 2013 15:06:40 +0000 (16:06 +0100)]
daemon/remote.c: renamed remoteDispatchDomainEventSend

into remoteDispatchObjectEventSend as it will later be used for both
the domain and network events.

11 years agotest driver: renamed testDomainEventQueue into testObjectEventQueue
Cédric Bosdonnat [Mon, 25 Nov 2013 13:16:02 +0000 (14:16 +0100)]
test driver: renamed testDomainEventQueue into testObjectEventQueue

11 years agoExtracted common parts of domain_event.[ch] to object_event.[ch]
Cédric Bosdonnat [Tue, 26 Nov 2013 14:10:15 +0000 (15:10 +0100)]
Extracted common parts of domain_event.[ch] to object_event.[ch]

11 years agoSplit the virObjectEvent and virDomainEvent* to separate them after
Cédric Bosdonnat [Tue, 26 Nov 2013 13:32:58 +0000 (14:32 +0100)]
Split the virObjectEvent and virDomainEvent* to separate them after

11 years agoRenamed virDomainEventTimer to virObjectEventTimer
Cédric Bosdonnat [Tue, 26 Nov 2013 13:24:47 +0000 (14:24 +0100)]
Renamed virDomainEventTimer to virObjectEventTimer

11 years agoAdd object event namespaces for the event IDs
Cédric Bosdonnat [Fri, 22 Nov 2013 14:55:12 +0000 (15:55 +0100)]
Add object event namespaces for the event IDs

Each unique event ID will thus be composed by 1 byte for the namespace
and 1 byte for a namespace-specific ID. The namespace for domain event
needs to be 0 for compatibility reasons.

11 years agoUse virObjectEventPtr instead of virDomainEventPtr
Cédric Bosdonnat [Fri, 22 Nov 2013 14:38:05 +0000 (15:38 +0100)]
Use virObjectEventPtr instead of virDomainEventPtr

The virDomainEvent class is kept as it indicates what meta informations
are valid for the children classes. This may be useful in the future.

11 years agoCreate virDomainEventDeviceRemoved and remove the huge union
Cédric Bosdonnat [Fri, 22 Nov 2013 12:03:31 +0000 (13:03 +0100)]
Create virDomainEventDeviceRemoved and remove the huge union

RIP virDomainEvent union. All data are now stored in each
virObjectEvent subclass.

11 years agoCreate virDomainEventBalloonChange to get rid of the huge union
Cédric Bosdonnat [Fri, 22 Nov 2013 10:08:20 +0000 (11:08 +0100)]
Create virDomainEventBalloonChange to get rid of the huge union

11 years agoCreate virDomainEventTrayChange to get rid of the huge union
Cédric Bosdonnat [Fri, 22 Nov 2013 10:00:45 +0000 (11:00 +0100)]
Create virDomainEventTrayChange to get rid of the huge union

11 years agoCreate virDomainEventDiskChange to get rid of the huge union
Cédric Bosdonnat [Fri, 22 Nov 2013 09:52:46 +0000 (10:52 +0100)]
Create virDomainEventDiskChange to get rid of the huge union

11 years agoCreate virDomainEventBlockJob to get rid of the huge union
Cédric Bosdonnat [Fri, 22 Nov 2013 09:42:49 +0000 (10:42 +0100)]
Create virDomainEventBlockJob to get rid of the huge union

11 years agoCreate virDomainEventGraphics to get rid of the huge union
Cédric Bosdonnat [Fri, 22 Nov 2013 09:32:51 +0000 (10:32 +0100)]
Create virDomainEventGraphics to get rid of the huge union

11 years agoCreate virDomainEventIOError to get rid of the huge union
Cédric Bosdonnat [Fri, 22 Nov 2013 09:15:35 +0000 (10:15 +0100)]
Create virDomainEventIOError to get rid of the huge union

11 years agoCreate virDomainEventWatchdog to get rid of the huge union
Cédric Bosdonnat [Fri, 22 Nov 2013 09:00:56 +0000 (10:00 +0100)]
Create virDomainEventWatchdog to get rid of the huge union

11 years agoCreate virDomainEventRTCChange to get rid of the huge union
Cédric Bosdonnat [Fri, 22 Nov 2013 08:18:47 +0000 (09:18 +0100)]
Create virDomainEventRTCChange to get rid of the huge union

11 years agoRenamed virDomainEventNewInternal to virDomainEventNew
Cédric Bosdonnat [Fri, 22 Nov 2013 08:00:01 +0000 (09:00 +0100)]
Renamed virDomainEventNewInternal to virDomainEventNew

This change may be confusing at first, but provides a much more
consistent naming scheme for the virObjectEvent children construction
functions.

11 years agoRenamed virDomainEventNew* to virDomainEventLifecycleNew*
Cédric Bosdonnat [Thu, 21 Nov 2013 17:03:26 +0000 (18:03 +0100)]
Renamed virDomainEventNew* to virDomainEventLifecycleNew*

This aims at providing some consistency with other domain events

11 years agoCreate virDomainEventLifecycle to start removing the huge union
Cédric Bosdonnat [Thu, 21 Nov 2013 16:48:41 +0000 (17:48 +0100)]
Create virDomainEventLifecycle to start removing the huge union

11 years agovirObject-ified virDomainEvent
Cédric Bosdonnat [Thu, 21 Nov 2013 16:04:33 +0000 (17:04 +0100)]
virObject-ified virDomainEvent

Added a parent class virObjectEvent for future event types

11 years agoCreated virObjectEventStateRegisterID
Cédric Bosdonnat [Thu, 21 Nov 2013 13:53:36 +0000 (14:53 +0100)]
Created virObjectEventStateRegisterID

Keep virDomainEventStateRegisterID as a convenience wrapper around
this new function.

11 years agoRenamed virDomainEventCallbackList* to virObjectEventCallbackList*
Cédric Bosdonnat [Thu, 21 Nov 2013 13:07:46 +0000 (14:07 +0100)]
Renamed virDomainEventCallbackList* to virObjectEventCallbackList*

Keep the legacy Domain lifecycle event functions as is.

11 years agoRenamed virDomainEventState to virObjectEventState
Cédric Bosdonnat [Thu, 21 Nov 2013 10:43:10 +0000 (11:43 +0100)]
Renamed virDomainEventState to virObjectEventState

Leave virDomainEventRegister and its Deregister brother as these are
legacy functions only for domain lifecycle events.

11 years agoRenamed virDomainEventQueue to virObjectEventQueue
Cédric Bosdonnat [Thu, 21 Nov 2013 10:23:16 +0000 (11:23 +0100)]
Renamed virDomainEventQueue to virObjectEventQueue

The event queue will be generalized to hold events related
to any object type.

11 years agoRenamed virDomainMeta to virObjectMeta
Cédric Bosdonnat [Thu, 21 Nov 2013 10:17:22 +0000 (11:17 +0100)]
Renamed virDomainMeta to virObjectMeta

The metadata struct will hold the unique identifiers for
any type of object, though not all fields will be used
for all types.

11 years agoRename virDomainEventCallback to virObjectEventCallback
Cédric Bosdonnat [Thu, 21 Nov 2013 10:06:56 +0000 (11:06 +0100)]
Rename virDomainEventCallback to virObjectEventCallback

The event callbacks will be generalized to handle events
for any object type.

11 years agoAdded domain start/stop/define/undefine event unit tests
Cédric Bosdonnat [Mon, 25 Nov 2013 16:43:46 +0000 (17:43 +0100)]
Added domain start/stop/define/undefine event unit tests

These unit tests are aiming at providing some help during the domain
events refactoring.

11 years agospec: clean up libvirtd and virtlockd service mgmt
Michael Chapman [Mon, 9 Dec 2013 06:23:30 +0000 (17:23 +1100)]
spec: clean up libvirtd and virtlockd service mgmt

- systemctl and the %systemd_* RPM macros can take multiple unit names
  in the one invocation. Make use of this to avoid repeated systemd
  daemon reloads.

- virtlockd was only properly enabled and disabled when using systemd,
  but when systemd RPM macros were not available (e.g. on Fedora < 18).
  Make sure it's enabled when systemd RPM macros are present, or when
  using initscripts.

- Always use "reload" on virtlockd, not "condrestart". This allows it to
  cleanly re-execute itself without losing running state. Ignore any
  error should the reload fail.

- Move the reloading of virtlockd and libvirtd via their initscripts
  into the daemon package's %postun scriptlet. These services must be
  restarted after all of the libvirt-daemon-driver-* packages have
  been upgraded during the same RPM transaction.

- Add a %triggerpostun executed only when upgrading an older
  libvirt-daemon. As an older package would only reload libvirtd during
  %post, and the newer package would only reload libvirtd during
  %postun, such an upgrade would not reload libvirtd at all without the
  trigger.

Signed-off-by: Michael Chapman <mike@very.puzzling.org>
11 years agovirtlockd: use common exit path when out-of-memory
Michael Chapman [Mon, 9 Dec 2013 06:23:28 +0000 (17:23 +1100)]
virtlockd: use common exit path when out-of-memory

Also use a distinct, valid exit status for daemon re-execution failure.

Signed-off-by: Michael Chapman <mike@very.puzzling.org>
11 years agovirtlockd: treat SIGHUP like SIGUSR1
Michael Chapman [Mon, 9 Dec 2013 06:23:27 +0000 (17:23 +1100)]
virtlockd: treat SIGHUP like SIGUSR1

SIGHUP is commonly used to instruct a daemon to reload its config. For
now we should handle it in virtlockd just like SIGUSR1, rather than
having it kill the process.

Signed-off-by: Michael Chapman <mike@very.puzzling.org>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agovirtlockd: improve initscripts
Michael Chapman [Mon, 9 Dec 2013 06:23:26 +0000 (17:23 +1100)]
virtlockd: improve initscripts

- Use SIGUSR1, not SIGHUP, on reload. At present, virtlockd only
  responds to the former.

- Fix PID file for virtlockd.

- Do not start virtlockd in any runlevels by default. It needs to be
  explicitly selected in libvirt's qemu.conf anyway, so there is no
  need to have it running on all systems regardless.

- Fix chkconfig priorities to ensure virtlockd is started before
  libvirtd is started, and stopped after libvirtd is stopped.

- Add "Should-Start: virtlockd" to the libvirtd initscript's LSB header,
  for the same reason.

- Add "Default-Stop" to both libvirtd and virtlockd initscripts. LSB
  does not guarantee that this defaults to the inverse of
  "Default-Start".

Signed-off-by: Michael Chapman <mike@very.puzzling.org>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agovirtlockd: improve systemd units
Michael Chapman [Mon, 9 Dec 2013 06:23:25 +0000 (17:23 +1100)]
virtlockd: improve systemd units

- Pass VIRTLOCKD_ARGS through to virtlockd.

- Use SIGUSR1, not SIGHUP, in ExecReload. At present, virtlockd only
  responds to the former.

- Have "systemctl enable virtlockd.service" enable virtlockd.socket,
  rather than throw an error.

- Make virtlockd.socket wanted by sockets.target, rather than
  multi-user.target. This is consistent with other socket units in
  Fedora, and it ensures that the socket is available before libvirtd is
  started.

Signed-off-by: Michael Chapman <mike@very.puzzling.org>
11 years agoconf: don't format memtune with unlimited values
Martin Kletzander [Mon, 9 Dec 2013 10:32:48 +0000 (11:32 +0100)]
conf: don't format memtune with unlimited values

When changing memtune limits to unlimited with AFFECT_CONFIG, the
values in virDomainDef are set to PARAM_UNLIMITED, which causes the
whole <memtune> to be formatted.  This can be changed in all drivers,
but it also makes sense to use the default (0) as another value for
"unlimited", since zero memory limit makes no sense.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
11 years agoqemu: Fix minor inconsistency in error message
Martin Kletzander [Wed, 4 Dec 2013 17:59:52 +0000 (18:59 +0100)]
qemu: Fix minor inconsistency in error message

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
11 years agoqemu: Report VIR_DOMAIN_MEMORY_PARAM_UNLIMITED properly
Martin Kletzander [Wed, 4 Dec 2013 17:56:02 +0000 (18:56 +0100)]
qemu: Report VIR_DOMAIN_MEMORY_PARAM_UNLIMITED properly

For dead domains that have no memtune limits, we return 0 instead of
"unlimited", this patch fixes it to return PARAM_UNLIMITED.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
11 years agocgroups: Redefine what "unlimited" means wrt memory limits
Martin Kletzander [Wed, 4 Dec 2013 15:54:29 +0000 (16:54 +0100)]
cgroups: Redefine what "unlimited" means wrt memory limits

Since kernel 3.12 (commit 34ff8dc08956098563989d8599840b130be81252 in
linux-stable.git in particular) the value for 'unlimited' in cgroup
memory limits changed from LLONG_MAX to ULLONG_MAX.  Due to rather
unfortunate choice of our VIR_DOMAIN_MEMORY_PARAM_UNLIMITED constant
(which we transfer as an unsigned long long in Kibibytes), we ended up
with the situation described below (applies to x86_64):

 - 2^64-1 (ULLONG_MAX) -- "unlimited" in kernel = 3.12

 - 2^63-1 (LLONG_MAX) -- "unlimited" in kernel < 3.12
 - 2^63-1024 -- our PARAM_UNLIMITED scaled to Bytes

 - 2^53-1 -- our PARAM_UNLIMITED unscaled (in Kibibytes)

This means that when any number within (2^63-1, 2^64-1] is read from
memory cgroup, we are transferring that number instead of "unlimited".
Unfortunately, changing VIR_DOMAIN_MEMORY_PARAM_UNLIMITED would break
ABI compatibility and thus we have to resort to a different solution.

With this patch every value greater than PARAM_UNLIMITED means
"unlimited".  Even though this may seem misleading, we are already in
such unclear situation when running 3.12 kernel with memory limits set
to 2^63.

One example showing most of the problems at once (with kernel 3.12.2):
 # virsh memtune asdf --hard-limit 9007199254740991 --swap-hard-limit -1
 # echo 12345678901234567890 >\
/sys/fs/cgroup/memory/machine/asdf.libvirt-qemu/memory.soft_limit_in_bytes
 # virsh memtune asdf
 hard_limit     : 18014398509481983
 soft_limit     : 12056327051986884
 swap_hard_limit: 18014398509481983

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
11 years agoqemu: hotplug: Fix adding USB devices to the driver list
Cole Robinson [Thu, 5 Dec 2013 19:59:05 +0000 (14:59 -0500)]
qemu: hotplug: Fix adding USB devices to the driver list

We were unconditionally removing the device from the host list, when it
should only be done on error.

This fixes USB collision detection when hotplugging the same device to
two guests.

11 years agoqemu: hotplug: Fix double free on USB collision
Cole Robinson [Thu, 5 Dec 2013 20:03:00 +0000 (15:03 -0500)]
qemu: hotplug: Fix double free on USB collision

If we hit a collision, we free the USB device while it is still part
of our temporary USBDeviceList. When the list is unref'd, the device
is free'd again.

Make the initial device freeing dependent on whether it is present
in the temporary list or not.

11 years agoqemu: hotplug: Only label hostdev after checking device conflicts
Cole Robinson [Thu, 5 Dec 2013 19:54:41 +0000 (14:54 -0500)]
qemu: hotplug: Only label hostdev after checking device conflicts

Similar to what Jiri did for cgroup setup/teardown in 05e149f94, push
it all into the device handler functions so we can do the necessary prep
work before claiming the device.

This also fixes hotplugging USB devices by product/vendor (virt-manager's
default behavior):

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

11 years agodocs: Enhance memoryBacking/locked documentation
Jiri Denemark [Mon, 9 Dec 2013 14:42:15 +0000 (15:42 +0100)]
docs: Enhance memoryBacking/locked documentation

Mention the need to set memtune/hard_limit.

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

11 years agospec: move driver-specific files to driver subpackages
Jim Fehlig [Thu, 5 Dec 2013 23:15:55 +0000 (16:15 -0700)]
spec: move driver-specific files to driver subpackages

The libvirt-daemon package contains several driver-specific files,
directories, and script, which can be problematic when building the
package with multiple hypervisor support, e.g. both QEMU and Xen.

E.g. installing a QEMU+Xen enabled libvirt-daemon on a Xen-only system
will result in the creation of qemu and kvm groups and a qemu user.

Move the driver-specific files, directories, and script to the
respective driver subpackages.

11 years agospec: Define hypervisor-specific files together
Jim Fehlig [Thu, 5 Dec 2013 22:18:57 +0000 (15:18 -0700)]
spec: Define hypervisor-specific files together

Collapse the various {with_<hypervisor>} conditionals in the
libvirt-daemon package files section into a single {with_<hypervisor>}
conditional

11 years agospec: Conditionally specify some hypervisor-specific files
Jim Fehlig [Thu, 5 Dec 2013 22:08:24 +0000 (15:08 -0700)]
spec: Conditionally specify some hypervisor-specific files

Move some hypervisor-specific files in the libvirt-daemon subpackage
within conditionals for those hypervisors.

11 years agospec: Fix files list when building without driver modules
Jim Fehlig [Thu, 5 Dec 2013 21:56:06 +0000 (14:56 -0700)]
spec: Fix files list when building without driver modules

The daemon-config-{network,nwfilter} subpackages are built regardless
of whether or not with_driver_modules is defined, therefore don't
conditionally define their files list.

11 years agospec: Only add libvirt-daemon pre install script if building with qemu
Jim Fehlig [Thu, 5 Dec 2013 21:49:48 +0000 (14:49 -0700)]
spec: Only add libvirt-daemon pre install script if building with qemu

The %pre script in libvirt-daemon is specific to qemu, so only include
it if building with qemu support.

11 years agospec: Fix unconditional references of nwfilter
Jim Fehlig [Thu, 5 Dec 2013 21:43:28 +0000 (14:43 -0700)]
spec: Fix unconditional references of nwfilter

Ensure nwfilter files lists and dependencies are conditional upon
with_nwfilter being defined.

11 years agolxcContainerMountFSDevPTS: Unify @ret usage pattern
Chen Hanxiao [Fri, 6 Dec 2013 06:20:21 +0000 (14:20 +0800)]
lxcContainerMountFSDevPTS: Unify @ret usage pattern

Currently, if virFileMakePath() fails, the @ret is left initialized from
virAsprintf() just a few lines above leading to a wrong return value of
zero whereas -1 should be returned.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoCgroup: Replace 'newpath' with 'newPath'
Zhou Yimin [Fri, 6 Dec 2013 03:38:14 +0000 (11:38 +0800)]
Cgroup: Replace 'newpath' with 'newPath'

Unifying codding style, replace 'newpath' with 'newPath'.

From: Zhou Yimin <zhouyimin@huawei.com>

11 years agoAdd qxl ram size to ABI stability check
Ján Tomko [Wed, 4 Dec 2013 12:11:39 +0000 (13:11 +0100)]
Add qxl ram size to ABI stability check

55bfd02 added a 'ram' attribute for qxl video devices
but didn't update the ABI check.

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

11 years agoqemu: Improve error when setting invalid count of vcpus via agent
Peter Krempa [Thu, 5 Dec 2013 16:47:14 +0000 (17:47 +0100)]
qemu: Improve error when setting invalid count of vcpus via agent

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

When attempting to enable more vCPUs in the guest than is currently
enabled in the guest but less than the maximum count for the VM we
currently reported an unhelpful message:

 error: internal error: guest agent reports less cpu than requested

This patch changes it to:

 error: invalid argument: requested vcpu count is greater than the count
 of enabled vcpus in the domain: 3 > 2

11 years agoconf: Fix XML formatting of RNG device info
Peter Krempa [Thu, 5 Dec 2013 17:33:01 +0000 (18:33 +0100)]
conf: Fix XML formatting of RNG device info

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

When outputting the XML for the RNG device, the code didn't format the
PCI address info. Additionally the schema wasn't expecting the info
although it was being parsed and used internally. Fix those mistakes and
add test for the PCI info section.

11 years agoqemu: snapshot: Fix incorrect disk type for auto-generated disks
Peter Krempa [Thu, 5 Dec 2013 14:58:31 +0000 (15:58 +0100)]
qemu: snapshot: Fix incorrect disk type for auto-generated disks

When changing the parsing and formatting functions in commit
43f2ccdc73090bd03f64de4d58d46ffa0134d705 I forgot to update the qemu
disk alignment function for snapshots that automatically adds snapshot
configs for disks that were not mentioned in the XML. The function
allocated a new disk snapshot definition but did not correctly
initialize the snapshot disk source type variable. This resulted into
the disks considered as block devices and invalid XML was generated.

Reported by John Ferlan.