]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
9 years agoutil: reset MAC address of macvtap passthrough physdev after disassociate
Laine Stump [Thu, 21 Jan 2016 19:19:56 +0000 (14:19 -0500)]
util: reset MAC address of macvtap passthrough physdev after disassociate

libvirt always resets the MAC address of the physdev used for macvtap
passthrough when the guest is finished with it. This was happening
prior to the 802.1Qb[gh] DISASSOCIATE command, and was quite often
failing, presumably because the driver wouldn't allow the MAC address
to be reset while the association was still active, with a log message
like this:

virNetDevSetMAC:168 : Cannot set interface MAC to 00:00:00:00:00:00 on 'eth13': Cannot assign requested address

This patch changes the order - we now do the 802.1Qb[gh] disassociate
and delete the macvtap interface first, then and reset the MAC
address.

9 years agolxc: fuse: Stub out Slab bits in /proc/meminfo
Cole Robinson [Thu, 21 Jan 2016 18:33:50 +0000 (13:33 -0500)]
lxc: fuse: Stub out Slab bits in /proc/meminfo

'free' on fedora23 wants to use the Slab field for calculated used
memory. The equation is:

used = MemTotal - MemFree - (Cached + Slab) - Buffers

We already set Cached and Buffers to 0, do the same for Slab and its
related values

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

9 years agolxc: fuse: Fill in MemAvailable for /proc/meminfo
Cole Robinson [Thu, 21 Jan 2016 18:18:04 +0000 (13:18 -0500)]
lxc: fuse: Fill in MemAvailable for /proc/meminfo

'free' on Fedora 23 will use MemAvailable to calculate its 'available'
field, but we are passing through the host's value. Set it to match
MemFree, which is what 'free' will do for older linux that don't have
MemAvailable

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

9 years agolxc: fuse: Fix /proc/meminfo size calculation
Cole Robinson [Thu, 21 Jan 2016 18:14:54 +0000 (13:14 -0500)]
lxc: fuse: Fix /proc/meminfo size calculation

We virtualize bits of /proc/meminfo by replacing host values with
values specific to the container.

However for calculating the final size of the returned data, we are
using the size of the original file and not the altered copy, which
could give garbelled output.

9 years agolxc: fuse: Unindent meminfo logic
Cole Robinson [Thu, 21 Jan 2016 18:06:03 +0000 (13:06 -0500)]
lxc: fuse: Unindent meminfo logic

Reverse the conditional at the start so we aren't stuffing all the logic
in an 'if' block

9 years agolibxl: Support cmdline= in xl config files
Ian Campbell [Thu, 21 Jan 2016 12:29:29 +0000 (12:29 +0000)]
libxl: Support cmdline= in xl config files

... and consolidate the cmdline/extra/root parsing to facilitate doing
so.

The logic is the same as xl's parse_cmdline from the current xen.git master
branch (e6f0e099d2c17de47fd86e817b1998db903cab61).

On the formatting side switch to producing cmdline= instead of extra=.

Update a few tests and add serveral more.
  - test-cmdline is added to test the exclusive use of cmdline.
  - test-fullvirt-direct-kernel-boot.cfg is updated due to the switch
    on the formatting side and now tests the exclusive use of cmdline=.
  - Tests are added for both paravirt and fullvirt where the .cfg uses
    extra= and (paravirt only) root=. These are format (xl->xml) only
    since the inverse will generate cmdline= hence is not a round trip
    (which was already true if using root=, which used to generate
    extra= on the way back).
  - Tests are added for both paravirt and fullvirt where the .cfg
    declares cmdline= as well as bogus extra= and (paravirt only) root=
    entries which should be ignored. Again these are format only tests
    since the inverse won't include the bogus lines.

The last two bullets here required splitting the DO_TEST macro into
two halves, as is done in the xmconfigtest.c case.

In order to introduce a use of VIR_WARN for logging I had to add
virerror.h and VIR_LOG_INIT.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
9 years agolibxl: dispose libxl_dominfo after libxl_domain_info()
Joao Martins [Thu, 21 Jan 2016 10:21:10 +0000 (10:21 +0000)]
libxl: dispose libxl_dominfo after libxl_domain_info()

As suggested in a previous thread [0] this patch adds some missing calls
to libxl_dominfo_{init,dispose} when doing some of the libxl_domain_info
operations which would otherwise lead to memory leaks.

[0]
https://www.redhat.com/archives/libvir-list/2015-September/msg00519.html

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
9 years agoXen: add XENXL to virErrorDomain enum
Jim Fehlig [Wed, 20 Jan 2016 18:51:55 +0000 (11:51 -0700)]
Xen: add XENXL to virErrorDomain enum

Add "Xen XL Config" to the virErrorDomain enum and use it in
src/xenconfig/xen_xl.c.

9 years agoXen: VIR_FROM_THIS cleanup
Jim Fehlig [Wed, 20 Jan 2016 18:36:26 +0000 (11:36 -0700)]
Xen: VIR_FROM_THIS cleanup

The virErrorDomain enum has VIR_FROM_XEN, VIR_FROM_XEND,
VIR_FROM_XENSTORE, VIR_FROM_SEXPR, and VIR_FROM_XENXM. Use
these elements in the corresponding .c files. While at it,
remove the VIR_FROM_THIS define in src/xenconfig/xenxs_private.h.

9 years agoqemu: Add support for migration iteration event
Jiri Denemark [Tue, 8 Dec 2015 14:23:35 +0000 (15:23 +0100)]
qemu: Add support for migration iteration event

The corresponding event in QEMU is called MIGRATION_PASS.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoIntroduce migration iteration event
Jiri Denemark [Thu, 10 Dec 2015 15:09:09 +0000 (16:09 +0100)]
Introduce migration iteration event

The VIR_DOMAIN_EVENT_ID_MIGRATION_ITERATION event will be triggered
whenever VIR_DOMAIN_JOB_MEMORY_ITERATION changes its value, i.e.,
whenever a new iteration over guest memory pages is started during
migration.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemuDomainReboot: use fakeReboot=true only for acpi mode
Dmitry Andreev [Wed, 20 Jan 2016 13:10:09 +0000 (16:10 +0300)]
qemuDomainReboot: use fakeReboot=true only for acpi mode

When acpi is used to reboot/shutdown qemu domain, qemu emits
SHUTDOWN event. Libvirt uses fakeReboot variable in order to
differentiate reboot or shutdown. fakeReboot value is reseted
to false after domain restart/reset.

When mode=agent is used to reboot qemu domain, qemu doesn't emit
SHUTDOWN event and libvirt doesn't reset fakeReboot value to false.
In this case next 'shutdown -h now' performs reboot. That's why
we don't need to set fakeReboot=true for mode=agent.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agovirsh: Don't fetch status for all domains in cmdList
Michal Privoznik [Wed, 20 Jan 2016 14:44:45 +0000 (15:44 +0100)]
virsh: Don't fetch status for all domains in cmdList

We are getting the list of domains and after that we iterate over
the list and try to get status for each domain hoping it will
skip over domains that disappeared meanwhile. However, this
solution to race is bogus - domain may disappear right after we
have checked its state and before we exec another API over it
(e.g. virDomainHasManagedSaveImage()). Also, when printing just
names or uuids (list --name / --uuid) we issue APIs to obtain the
values, however these require no RPC call as all requested info
is in virDomain object that client already has.
Therefore move the status obtaining only to the place that really
needs it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agodocs: fix syntax-check long line error
Cole Robinson [Wed, 20 Jan 2016 15:27:24 +0000 (10:27 -0500)]
docs: fix syntax-check long line error

9 years agobuild: predictably generate systemtap tapsets (bz 1173641)
Cole Robinson [Wed, 20 Jan 2016 03:19:56 +0000 (22:19 -0500)]
build: predictably generate systemtap tapsets (bz 1173641)

The generated output is dependent on perl hashtable ordering, which
gives different results for i686 and x86_64. Fix this by sorting
the hash keys before iterating over them

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

9 years agodocs: fix generation of docs from VPATH build
Daniel P. Berrange [Wed, 20 Jan 2016 12:22:19 +0000 (12:22 +0000)]
docs: fix generation of docs from VPATH build

When generating docs in a VPATH build we get a failure to
create a file due to the 'internals' subdir not existing:

  Generating internals/locking.html.tmp
  /bin/sh: line 3: internals/locking.html.tmp: No such file or directory
  rm: cannot remove ‘internals/locking.html.tmp’: No such file or directory
  Makefile:2229: recipe for target 'internals/locking.html.tmp' failed
  make: *** [internals/locking.html.tmp] Error 1

For some reason, make has decided to run the target

  %.html.tmp: %.html.in site.xsl page.xsl sitemap.html.in $(acl_generated)

instead of the target

  internals/%.html.tmp: internals/%.html.in subsite.xsl page.xsl sitemap.html.in

Removing '$(acl_generated)' from the first target, inexplicably
causes make to now run the correct target for the internals/
files.

Rather than figure this out, lets just combine the two targets
into one.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
9 years agoleaseshelper: reduce indentation level in virLeaseReadCustomLeaseFile
Ján Tomko [Fri, 15 Jan 2016 08:07:17 +0000 (09:07 +0100)]
leaseshelper: reduce indentation level in virLeaseReadCustomLeaseFile

Instead of nested ifs, jump out early.

Mostly whitespace changes.

9 years agoleaseshelper: remove useless comparison
Ján Tomko [Thu, 14 Jan 2016 15:49:56 +0000 (16:49 +0100)]
leaseshelper: remove useless comparison

We do not care if the mac was specified in the delete section,
we are going to delete the record anyway.

9 years agoleaseshelper: move comment about adding IPv6 leases
Ján Tomko [Wed, 20 Jan 2016 08:34:47 +0000 (09:34 +0100)]
leaseshelper: move comment about adding IPv6 leases

The comment is relevant to the ADD action, not DEL.

9 years agoleaseshelper: split out virLeasePrintLeases
Ján Tomko [Thu, 14 Jan 2016 15:22:43 +0000 (16:22 +0100)]
leaseshelper: split out virLeasePrintLeases

Introduce a function for printing the leases on the 'init' operation.

9 years agoleaseshelper: split out custom leases file read
Ján Tomko [Thu, 14 Jan 2016 12:32:23 +0000 (13:32 +0100)]
leaseshelper: split out custom leases file read

Introduce virLeaseReadCustomLeaseFile which will populate
the new leases array with all the leases, except for expired
ones and the ones matching 'ip_to_delete'.

This removes five variables from main().

9 years agoleaseshelper: store server_duid as an allocated string
Ján Tomko [Fri, 15 Jan 2016 13:36:45 +0000 (14:36 +0100)]
leaseshelper: store server_duid as an allocated string

We either use the value from the environment variable, or learn it from
the existing lease file.

In the second case, the pointer would be pointing into the JSON object
of the first lease with a DUID, owned by leases_array, then
leases_array_new.

Always allocate the string instead, making obvious who should free the
string.

9 years agoleaseshelper: fix crash when no mac is specified
Ján Tomko [Thu, 14 Jan 2016 13:31:17 +0000 (14:31 +0100)]
leaseshelper: fix crash when no mac is specified

If dnsmasq specified DNSMASQ_IAID (so we're dealing with an IPv6
lease) but no DNSMASQ_MAC, we skip creation of the new lease object.

Also skip adding it to the leases array.

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

9 years agostorage: Add new flag for libvirt_parthelper
John Ferlan [Thu, 7 Jan 2016 12:34:51 +0000 (07:34 -0500)]
storage: Add new flag for libvirt_parthelper

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

In order to be able to process disk storage pool's using a multipath
device to handle the partitions, libvirt_parthelper will need a way to
not automatically add a partition separator "p" to the generated device
name for each partition found. This is designed to mimic the multipath
features known as 'user_friendly_names' and custom 'alias' name.

If the part_separator attribute is set to "no", then generation of the
multipath partition name will not include the "p" partition separator
unless the source device path name ends with a number. The generated
partition names that get passed back to libvirt are processed in order
to find the device mapper multipath (dm-#) path device.

For example, device path "/dev/mapper/mpatha" would create partitions
"/dev/mapper/mpatha1", "/dev/mapper/mpatha2", etc. instead of
"/dev/mapper/mpathap1", "/dev/mapper/mpathap2", etc. If the device
path ends with a number "/dev/mapper/mpatha1", then the algorithm
to generate names "/dev/mapper/mpatha1p1", "/dev/mapper/mpatha1p2", etc.
would be utilized.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoconf: Add storage pool device attribute part_separator
John Ferlan [Thu, 7 Jan 2016 11:57:28 +0000 (06:57 -0500)]
conf: Add storage pool device attribute part_separator

Add a new storage pool source device attribute 'part_separator=[yes|no]'
in order to allow a 'disk' storage pool using a device mapper multipath
device to not add the "p" partition separator to the generated device
name when libvirt_parthelper is run.

This will allow libvirt to find device mapper multipath devices which were
configured in /etc/multipath.conf to use 'user_friendly_names' or custom
'alias' names for the LUN.

9 years agovirLogManagerDomainReadLogFile: Don't do dummy allocs
Michal Privoznik [Mon, 18 Jan 2016 10:13:22 +0000 (11:13 +0100)]
virLogManagerDomainReadLogFile: Don't do dummy allocs

Since we pass dummy variables @fdout and @fdoutlen into
virNetClientProgramCall() we make it alloc @fdout array (even
though it's an array of 0 elements since vitlogd can hardly pass
us some FDs at this stage). Nevertheless, it's an allocation not
followed by free():

==29385== 0 bytes in 60 blocks are definitely lost in loss record 2 of 1,009
==29385==    at 0x4C2C070: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==29385==    by 0x54B99EF: virAllocN (viralloc.c:191)
==29385==    by 0x56821B1: virNetClientProgramCall (virnetclientprogram.c:359)
==29385==    by 0x563B304: virLogManagerDomainReadLogFile (log_manager.c:272)
==29385==    by 0x217CD613: qemuDomainLogContextRead (qemu_domain.c:2485)
==29385==    by 0x217EDC76: qemuProcessReadLog (qemu_process.c:1660)
==29385==    by 0x217EDE1D: qemuProcessReportLogError (qemu_process.c:1696)
==29385==    by 0x217EE8C1: qemuProcessWaitForMonitor (qemu_process.c:1957)
==29385==    by 0x217F6636: qemuProcessLaunch (qemu_process.c:4955)
==29385==    by 0x217F71A4: qemuProcessStart (qemu_process.c:5152)
==29385==    by 0x21846582: qemuDomainObjStart (qemu_driver.c:7396)
==29385==    by 0x218467DE: qemuDomainCreateWithFlags (qemu_driver.c:7450)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemuProcessReadLog: Fix memmove arguments
Michal Privoznik [Mon, 18 Jan 2016 09:50:14 +0000 (10:50 +0100)]
qemuProcessReadLog: Fix memmove arguments

So I can observe this crasher that with freshly started daemon
(and virtlogd enabled) I am trying to startup a domain that
immediately dies (because it's said to use huge pages but I
haven't allocated a single one in the pool). Hardly reproducible
with -O0 or under valgrind. But I just got lucky:

==20469== Invalid write of size 8
==20469==    at 0x4C2E99B: memcpy@GLIBC_2.2.5 (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==20469==    by 0x217EDD07: qemuProcessReadLog (qemu_process.c:1670)
==20469==    by 0x217EDE1D: qemuProcessReportLogError (qemu_process.c:1696)
==20469==    by 0x217EE8C1: qemuProcessWaitForMonitor (qemu_process.c:1957)
==20469==    by 0x217F6636: qemuProcessLaunch (qemu_process.c:4955)
==20469==    by 0x217F71A4: qemuProcessStart (qemu_process.c:5152)
==20469==    by 0x21846582: qemuDomainObjStart (qemu_driver.c:7396)
==20469==    by 0x218467DE: qemuDomainCreateWithFlags (qemu_driver.c:7450)
==20469==    by 0x21846845: qemuDomainCreate (qemu_driver.c:7468)
==20469==    by 0x5611CD0: virDomainCreate (libvirt-domain.c:6753)
==20469==    by 0x125D9A: remoteDispatchDomainCreate (remote_dispatch.h:3613)
==20469==    by 0x125CB7: remoteDispatchDomainCreateHelper (remote_dispatch.h:3589)
==20469==  Address 0x27a52ad0 is 0 bytes after a block of size 5,584 alloc'd
==20469==    at 0x4C29F80: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==20469==    by 0x9B8D1DB: xdr_string (in /lib64/libc-2.21.so)
==20469==    by 0x563B39C: xdr_virLogManagerProtocolNonNullString (log_protocol.c:24)
==20469==    by 0x563B6B7: xdr_virLogManagerProtocolDomainReadLogFileRet (log_protocol.c:123)
==20469==    by 0x164B34: virNetMessageDecodePayload (virnetmessage.c:407)
==20469==    by 0x5682360: virNetClientProgramCall (virnetclientprogram.c:379)
==20469==    by 0x563B30E: virLogManagerDomainReadLogFile (log_manager.c:272)
==20469==    by 0x217CD613: qemuDomainLogContextRead (qemu_domain.c:2485)
==20469==    by 0x217EDC76: qemuProcessReadLog (qemu_process.c:1660)
==20469==    by 0x217EDE1D: qemuProcessReportLogError (qemu_process.c:1696)
==20469==    by 0x217EE8C1: qemuProcessWaitForMonitor (qemu_process.c:1957)
==20469==    by 0x217F6636: qemuProcessLaunch (qemu_process.c:4955)

This points to memmove() in qemuProcessReadLog(). Imagine we just
read the following string from qemu:

"abc\n2016-01-18T09:40:44.022744Z qemu-system-x86_64: Error\n"

After the first pass of the while() loop in the
qemuProcessReadLog() (in which we have taken the false branch in
the if) @buf still points to the beginning of the string,
@filter_next points to the beginning of the second line.  So we
start second iteration because there is yet another newline
character at the end. In this iteration @eol points to it
actually. Now, the control gets inside true branch of if(). Just
to remind you:

got = 58
filter_next = buf + 5,
eol = buf + 58.

Therefore skip = 54 which is correct. The message we want to skip
is 54 bytes long. However:

memmove(filter_next, eol + 1, (got - skip) +1);

which is

memmove(filter_next, eol + 1, 5)

is obviously wrong as there is only one byte we can access, not 5!

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoFix make check with gcc version 5
Martin Kletzander [Tue, 12 Jan 2016 15:47:13 +0000 (16:47 +0100)]
Fix make check with gcc version 5

When building with gcc-5 (particularly gcc-5.3.0 now) and having pdwtags
installed (package dwarves) make check fails with the following error:

  $ make lock_protocol-struct
  GEN      lock_protocol-struct
  --- lock_protocol-structs 2016-01-13 15:04:59.318809607 +0100
  +++ lock_protocol-struct-t3 2016-01-13 15:05:17.703501234 +0100
  @@ -26,10 +26,6 @@
           virLockSpaceProtocolNonNullString name;
           u_int                      flags;
   };
  -enum virLockSpaceProtocolAcquireResourceFlags {
  -        VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_SHARED = 1,
  -        VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_AUTOCREATE = 2,
  -};
   struct virLockSpaceProtocolAcquireResourceArgs {
           virLockSpaceProtocolNonNullString path;
           virLockSpaceProtocolNonNullString name;
  Makefile:10415: recipe for target 'lock_protocol-struct' failed
  make: *** [lock_protocol-struct] Error 1

That happens because without any specific options gcc doesn't keep enum
information in the resulting binary object.  I managed to isolate the
parameters of gcc that caused this issue to disappear, however I
remember that they influenced the resulting binaries quite a bit and
were definitely not something we would want to add as mandatory to the
build process.

So to deal with this cleanly, let's take that enum and separate it out
to its own header file.  Since it is only used in the lockd driver and
the protocol, lock_driver_lockd.h feels like a suitable name.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agorbd: Set r variable so it can be returned should an error occur
Wido den Hollander [Fri, 15 Jan 2016 12:52:16 +0000 (13:52 +0100)]
rbd: Set r variable so it can be returned should an error occur

This was reported in bug #1298024 where r would be filled with the
return code of rbd_open().

Should rbd_snap_unprotect() fail for any reason the virReportSystemError
call would return 'Success' since rbd_open() succeeded.

https://bugzilla.redhat.com/show_bug.cgi?id=1298024
Signed-off-by: Wido den Hollander <wido@widodh.nl>
9 years agoqemuTestDriverInit: fill driver with zeroes
Michal Privoznik [Mon, 18 Jan 2016 08:11:19 +0000 (09:11 +0100)]
qemuTestDriverInit: fill driver with zeroes

In the commit aea47e48c473a we have fixed a single pointer within
driver structure. Since all callers pass statically allocated
driver on stack other pointers within driver may contain random
values too. Before touching it lets overwrite it with zeroes and
thus fix all dangling pointers.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoPost-release version bump to 1.3.2
Michal Privoznik [Mon, 18 Jan 2016 12:07:35 +0000 (13:07 +0100)]
Post-release version bump to 1.3.2

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoNEWS: Don't prefix version numbers with 'v'
Andrea Bolognani [Mon, 18 Jan 2016 09:50:37 +0000 (10:50 +0100)]
NEWS: Don't prefix version numbers with 'v'

It was only used in two instances, so get rid of it for
consistency's sake.

9 years agoNEWS: Fix whitespace issues
Andrea Bolognani [Mon, 18 Jan 2016 09:49:05 +0000 (10:49 +0100)]
NEWS: Fix whitespace issues

9 years agoNEWS: Move 2015 entries to a separate file
Andrea Bolognani [Mon, 18 Jan 2016 09:47:12 +0000 (10:47 +0100)]
NEWS: Move 2015 entries to a separate file

Now that the first release made in 2016 is out, we can move all
entries for 2015 to their own file, just like we did for all previous
years.

9 years agoRelease of libvirt-1.3.1
Daniel Veillard [Sun, 17 Jan 2016 02:29:57 +0000 (10:29 +0800)]
Release of libvirt-1.3.1

* docs/news.html.in libvirt.spec.in: update for release
* po/*.po*: regenerated

9 years agosecurity: Do not restore labels on device tree binary
Jiri Denemark [Fri, 15 Jan 2016 15:34:37 +0000 (16:34 +0100)]
security: Do not restore labels on device tree binary

A device tree binary file specified by /domain/os/dtb element is a
read-only resource similar to kernel and initrd files. We shouldn't
restore its label when destroying a domain to avoid breaking other
domains configure with the same device tree.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agosecurity: Do not restore kernel and initrd labels
Jiri Denemark [Fri, 15 Jan 2016 09:55:58 +0000 (10:55 +0100)]
security: Do not restore kernel and initrd labels

Kernel/initrd files are essentially read-only shareable images and thus
should be handled in the same way. We already use the appropriate label
for kernel/initrd files when starting a domain, but when a domain gets
destroyed we would remove the labels which would make other running
domains using the same files very unhappy.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9 years agoqemu: Print better warning in qemuAgentNotifyEvent
Yaniv Kaul [Fri, 15 Jan 2016 07:33:49 +0000 (08:33 +0100)]
qemu: Print better warning in qemuAgentNotifyEvent

We have this function qemuAgentNotifyEvent() which is supposed to
be called from thread pool responsible for processing qemu
monitor events. The function then should wake up other thread
that is waiting for a guest to shutdown or reboot. However, if we
have received a different error a warning is printed out. This
warning lacks info on which event is expected.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agocgroup: Fix possible bug as a result of code motion for vcpu cgroup setup
John Ferlan [Tue, 22 Dec 2015 14:46:01 +0000 (09:46 -0500)]
cgroup: Fix possible bug as a result of code motion for vcpu cgroup setup

Commit id '90b721e43' moved where the virCgroupAddTask was made until
after the check for the vcpupin checks. However, in doing so it missed
an option where if the cpumap didn't exist, then the code would continue
back to the top of the current vcpu loop. The results was that the
virCgroupAddTask wouldn't be called.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoRevert "lxc_cgroup: Add check for NULL cgroup before AddTask call"
John Ferlan [Thu, 14 Jan 2016 16:01:50 +0000 (11:01 -0500)]
Revert "lxc_cgroup: Add check for NULL cgroup before AddTask call"

This reverts commit ae09988eb787df63d3bb298f713a3bbd77275901.

Since commit id '71ce4759' has been reverted, this one is no
longer necessary.

9 years agoRevert "util: cgroups do not implicitly add task to new machine cgroup"
John Ferlan [Thu, 14 Jan 2016 16:00:25 +0000 (11:00 -0500)]
Revert "util: cgroups do not implicitly add task to new machine cgroup"

This reverts commit 71ce475967b3523882b0e1a0f649fdbea5abf9d5.

Since commit id 'a41c00b47' has been reverted, this no longer is
necessary

9 years agoRevert "qemu: do not put a task into machine cgroup"
John Ferlan [Thu, 14 Jan 2016 15:56:53 +0000 (10:56 -0500)]
Revert "qemu: do not put a task into machine cgroup"

This reverts commit a41c00b472efaa192d2deae51ab732e65903238f.

After much testing and upstream discussion this has been deemed to be
the incorrect operation since it means we no longer have any guarantee
about which resource controllers the QEMU processes in general are in.

9 years agovirt-aa-helper: don't deny writes to readonly mounts
Cédric Bosdonnat [Tue, 17 Nov 2015 09:11:30 +0000 (10:11 +0100)]
virt-aa-helper: don't deny writes to readonly mounts

There is no need to deny writes on a readonly mount: write still
won't be accepted, even if the user remounts the folder as RW in
the guest as qemu sets the 9p mount as ro.

This deny rule was leading to problems for example with readonly /:
The qemu process had to write to a bunch of files in / like logs,
sockets, etc. This deny rule was also preventing auditing of these
denials, making it harder to debug.

9 years agoconf: Initialize 'deflate' for balloon parse XML
John Ferlan [Wed, 13 Jan 2016 22:01:04 +0000 (17:01 -0500)]
conf: Initialize 'deflate' for balloon parse XML

Commit id '7bf3198df' neglected to initialize deflate leading to a
possibility if model allocation/checks fail, then the VIR_FREE(deflate)
would be erroneous. Noted by Jan Tomko.

9 years agowireshark: Drop DESTDIR from install path
Michal Privoznik [Wed, 13 Jan 2016 15:10:15 +0000 (16:10 +0100)]
wireshark: Drop DESTDIR from install path

In 50078cfbcbf3c8 I've tried to fix distcheck but accidentally
broke rpm build. The problem is that rpm build not only sets
DESTDIR but also passes plugindir path. This results in double
DESTDIR being in the plugin path, Drop one.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirsh: Update description of lxc-enter-namespace
Guido Günther [Wed, 13 Jan 2016 07:47:26 +0000 (08:47 +0100)]
virsh: Update description of lxc-enter-namespace

Mention that we run a command in that namespace

9 years agobuild: fix distdir with wireshark disabled
Cole Robinson [Tue, 12 Jan 2016 20:56:42 +0000 (15:56 -0500)]
build: fix distdir with wireshark disabled

Even though the Makefile has WITH_WIRESHARK guards, the _SOURCES
variables are still processed when adding bits to the dist archive.

plugin.c is a generated file that is only built when wireshark is
enabled and it shouldn't be distributed, so use 'nodist'

9 years agoqemuProcessCleanupChardevDevice: Don't unlink NULL paths
Michal Privoznik [Wed, 13 Jan 2016 10:17:24 +0000 (11:17 +0100)]
qemuProcessCleanupChardevDevice: Don't unlink NULL paths

So, you try to start a domain, but before we even get to the part
where chardev part of qemu command line is generated (and
possibly missing path to unix sockets is made up) an error occurs
which results in calling qemuProcessStop. This will then try to
clean up the mess and possibly ends up calling unlink(NULL).

==8085== Thread 3:
==8085== Syscall param unlink(pathname) points to unaddressable byte(s)
==8085==    at 0xA85EA57: unlink (in /lib64/libc-2.21.so)
==8085==    by 0x213D3C24: qemuProcessCleanupChardevDevice (qemu_process.c:2866)
==8085==    by 0x558D6B1: virDomainChrDefForeach (domain_conf.c:22924)
==8085==    by 0x213DA9AE: qemuProcessStop (qemu_process.c:5326)
==8085==    by 0x213DA2F2: qemuProcessStart (qemu_process.c:5190)
==8085==    by 0x2142957F: qemuDomainObjStart (qemu_driver.c:7396)
==8085==    by 0x214297DB: qemuDomainCreateWithFlags (qemu_driver.c:7450)
==8085==    by 0x21429842: qemuDomainCreate (qemu_driver.c:7468)
==8085==    by 0x5611B95: virDomainCreate (libvirt-domain.c:6753)
==8085==    by 0x125D9A: remoteDispatchDomainCreate (remote_dispatch.h:3613)
==8085==    by 0x125CB7: remoteDispatchDomainCreateHelper (remote_dispatch.h:3589)
==8085==    by 0x568BF41: virNetServerProgramDispatchCall (virnetserverprogram.c:437)
==8085==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==8085==

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoxenconfig: check return value of regcomp
Jim Fehlig [Tue, 12 Jan 2016 18:34:06 +0000 (11:34 -0700)]
xenconfig: check return value of regcomp

Commit ec63000a missed checking the return value of regcomp(),
which coverity promptly identified.

9 years agowireshark: Install into DESTDIR
Michal Privoznik [Tue, 12 Jan 2016 16:20:08 +0000 (17:20 +0100)]
wireshark: Install into DESTDIR

Like everything we install, it should be prefixed with DESTDIR.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoXen: use correct domctl version in domaininfolist union
Jim Fehlig [Mon, 11 Jan 2016 22:17:53 +0000 (15:17 -0700)]
Xen: use correct domctl version in domaininfolist union

Commmit fd2e3c4c used the domctl version 8 structure for version 9
in the xen_getdomaininfolist union, resulting in insufficient buffer
size (and subsequent memory corruption) for the GETDOMAININFOLIST
ioctl.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
9 years agotestutils: Fix coverity warning with REGENERATE_OUTPUT
Cole Robinson [Tue, 12 Jan 2016 15:55:08 +0000 (10:55 -0500)]
testutils: Fix coverity warning with REGENERATE_OUTPUT

- Don't double check for expectName
- actual is always non-NULL by this point, so don't check it either

9 years agobuild: Kill tools/wireshark Makefiles
Cole Robinson [Sun, 10 Jan 2016 20:35:36 +0000 (15:35 -0500)]
build: Kill tools/wireshark Makefiles

Just handle it all in tools/Makefile.am. I verified the generated output
looks similar to the pre patch output, but I didn't test it.

9 years agoExpand $(wildcard) correctly
Michal Privoznik [Tue, 12 Jan 2016 15:22:24 +0000 (16:22 +0100)]
Expand $(wildcard) correctly

So after da176bf6b756 and friend we have switched to $(wildcard
some/path/*.xml) instead of enumerating the files explicitly.
This is nice, however it makes distcheck build from VPATH fail.
The reason is that it's is not obvious to what does the wildcard
refer to: srcdir or builddir?

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemu: add support of optional 'autodeflate' attribute
Dmitry Andreev [Fri, 8 Jan 2016 10:45:07 +0000 (13:45 +0300)]
qemu: add support of optional 'autodeflate' attribute

Autodeflate can be enabled/disabled for memballon device
of model 'virtio'.

xml:
<devices>
  <memballoon model='virtio' autodeflate='on'/>
</devices>

qemu:
qemu -device virtio-balloon-pci,...,deflate-on-oom=on

Autodeflate cannot be enabled/disabled for running domain.

9 years agoqemu: add capability check for memballoon 'deflate-on-oom' feature
Dmitry Andreev [Fri, 8 Jan 2016 10:45:06 +0000 (13:45 +0300)]
qemu: add capability check for memballoon 'deflate-on-oom' feature

Add appropriate capability check and new virQEMUCaps flag for the new
virtio balloon feature. QEMU commit with the complete feature description:
http://git.qemu.org/?p=qemu.git;a=commit;h=e3816255bf4b6377bb405331e2ee0dc14d841b80

9 years agoconf: introduce 'autodeflate' attribute for memballoon device
Dmitry Andreev [Fri, 8 Jan 2016 10:45:05 +0000 (13:45 +0300)]
conf: introduce 'autodeflate' attribute for memballoon device

Excessive memory balloon inflation can cause invocation of OOM-killer,
when Linux is under severe memory pressure. QEMU memballoon device
has a feature to release some memory at the last moment before some
process will be get killed by OOM-killer.

Introduce a new optional balloon device attribute 'autodeflate' to
enable or disable this feature.

9 years agorpc: socket: Don't repeatedly attempt to launch daemon
Cole Robinson [Tue, 12 Jan 2016 01:13:38 +0000 (20:13 -0500)]
rpc: socket: Don't repeatedly attempt to launch daemon

On every socket connect(2) attempt we were re-launching session
libvirtd, up to 100 times in 5 seconds.

This understandably caused some weird load races and intermittent
qemu:///session startup failures

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

9 years agorpc: socket: Explicitly error if we exceed retry count
Cole Robinson [Tue, 12 Jan 2016 01:08:45 +0000 (20:08 -0500)]
rpc: socket: Explicitly error if we exceed retry count

When we autolaunch libvirtd for session URIs, we spin in a retry
loop waiting for the daemon to start and the connect(2) to succeed.

However if we exceed the retry count, we don't explicitly raise an
error, which can yield a slew of different error messages elsewhere
in the code.

Explicitly raise the last connect(2) failure if we run out of retries.

9 years agorpc: socket: Minor cleanups
Cole Robinson [Tue, 12 Jan 2016 01:01:24 +0000 (20:01 -0500)]
rpc: socket: Minor cleanups

- Add some debugging
- Make the loop dependent only on retries
- Make it explicit that connect(2) success exits the loop
- Invert the error checking logic

9 years agoAdd missing virxdrdefs.h include to log_protocol
Roman Bogorodskiy [Tue, 12 Jan 2016 15:11:11 +0000 (18:11 +0300)]
Add missing virxdrdefs.h include to log_protocol

Commit 2b6f6ad introduced the virxdrdefs.h header with
common definitions to be included in the protocol files,
but logging/log_protocol.x was missed, so add it there as well.

Hopefully this fixes build on OS X.

9 years agovirsh: Fix alignment in VIRSH_COMMON_OPT_CONFIG definition
Andrea Bolognani [Tue, 12 Jan 2016 08:09:36 +0000 (09:09 +0100)]
virsh: Fix alignment in VIRSH_COMMON_OPT_CONFIG definition

9 years agorpc: Don't rewrite msg->fds on every read dispatch
Ben Gray [Thu, 26 Nov 2015 16:10:40 +0000 (16:10 +0000)]
rpc: Don't rewrite msg->fds on every read dispatch

When we are receiving data in smaller chunks it might happen that
virNetServerClientDispatchRead() will be called multiple times.  And as
that happens, if it is a message that also transfer headers, we decode
the number of them every single time and, unfortunately, also allocate
the memory for them.  That causes a leak, in the best scenario.

Best viewed with '-w'.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agovirsh: Create macro for common "interface" option
John Ferlan [Sat, 9 Jan 2016 13:36:35 +0000 (08:36 -0500)]
virsh: Create macro for common "interface" option

Rather than continually cut-n-paste the strings into each command,
create a common macro to be used generically.  Note that not all
'{.name = "interface",' entries are replaced, just those that have the
common .help string of "interface name or MAC address".

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agovirsh: Create macro for common "network" option
John Ferlan [Sat, 9 Jan 2016 13:36:34 +0000 (08:36 -0500)]
virsh: Create macro for common "network" option

Rather than continually cut-n-paste the strings into each command,
create a common macro to be used generically.  Note that not all
'{.name = "network",' entries are replaced, just those that have the
common .help string of "network name or uuid".

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agovirsh: Create macros for common "vol" options
John Ferlan [Sat, 9 Jan 2016 13:36:31 +0000 (08:36 -0500)]
virsh: Create macros for common "vol" options

Rather than continually cut-n-paste the strings into each command,
create common macros to be used generically.  Replace the more commonly
used "vol" option with a macro. This also adjusts 2 commands that
didn't have the correct helpstr - 'vol-create-from' and 'vol-clone'.
Both are described in the man page as taking vol, path, or key and
the code uses the virshCommandOptVol instead of virshCommandOptVolBy.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agovirsh: Create macro for common "file" option
John Ferlan [Sat, 9 Jan 2016 13:36:29 +0000 (08:36 -0500)]
virsh: Create macro for common "file" option

Rather than continually cut-n-paste the strings into each command,
create a common macro to be used generically. The macro will take a
single argument _helpstr for the less common help string for each
command option.  Note that only file options using "OT_DATA" and
"OFLAG_REQ" will be replace - others are left as is.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agovirsh: Create macro for common "current" option
John Ferlan [Sat, 9 Jan 2016 13:36:28 +0000 (08:36 -0500)]
virsh: Create macro for common "current" option

Rather than continually cut-n-paste the strings into each command,
create a common macro to be used generically. The macro will take a
single argument _helpstr which for many options in virsh-domain.c
is simply "affect current domain". So, create a second macro within that
file in order to define the more common use as a revector to the
common macro with the common _helpstr.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agovirsh: Create macro for common "live" option
John Ferlan [Sat, 9 Jan 2016 13:36:27 +0000 (08:36 -0500)]
virsh: Create macro for common "live" option

Rather than continually cut-n-paste the strings into each command,
create a common macro to be used generically. The macro will take a
single argument _helpstr which for many options in virsh-domain.c
is simply "affect running domain". So, create a second macro within that
file in order to define the more common use as a revector to the
common macro with the common _helpstr.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agovirsh: Create macro for common "config" option
John Ferlan [Sat, 9 Jan 2016 13:36:26 +0000 (08:36 -0500)]
virsh: Create macro for common "config" option

Rather than continually cut-n-paste the strings into each command,
create a common macro to be used generically. The macro will take a
single argument _helpstr which for many options in virsh-domain.c
is simply "affect next boot". So, create a second macro within that
file in order to define the more common use as a revector to the
common macro with the common _helpstr.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agovirsh: Create macro for common "persistent" option
John Ferlan [Sat, 9 Jan 2016 13:36:25 +0000 (08:36 -0500)]
virsh: Create macro for common "persistent" option

Rather than continually cut-n-paste the strings into each command,
create a common macro to be used generically.  Note that not all
'{.name = "persistent",' entries are replaced, just those that have the
common .help string of "make live change persistent".

Non replaced instances are unique to the command.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agovirsh: Create macro for common "domain" option
John Ferlan [Sat, 9 Jan 2016 13:36:24 +0000 (08:36 -0500)]
virsh: Create macro for common "domain" option

Rather than continually cut-n-paste the strings into each command,
create a common macro to be used generically. The macro will take a
single argument _helpstr which will be used to pass the translatable
helpstr since not all domain options can take the same string.

The majority of the options take 'N_("domain name, id or uuid")', so
create a separate macro with a _FULL suffix while those that do not
take the same string will use the VIRSH_COMMON_OPT_DOMAIN macro.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agovirsh: Adjustments for the VIRSH_COMMON_OPT_POOL
John Ferlan [Sat, 9 Jan 2016 13:36:23 +0000 (08:36 -0500)]
virsh: Adjustments for the VIRSH_COMMON_OPT_POOL

The macro is slightly adjusted to add an argument "_helpstr". This
will be passed as a translation macro string since other uses of the
option may not have the same exact help string (such as is the case
when the uuid is not suppliable for create commands).

In virsh-pool.c - we'll create a singular VIRSH_COMMON_OPT_POOL_FULL
in order to pass along the 'N_("pool name or uuid")'

In virsh-volume.c there will be a VIRSH_COMMON_OPT_POOL_FULL and a
VIRSH_COMMON_OPT_POOL_NAME, which passes 'N_("pool name")' for
the commands that can only pass a name. There will also be a
VIRSH_COMMON_OPT_POOL_OPTIONAL which is used for the command
options which use OT_STRING and don't require the --pool argument.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agovirsh: Convert VSH_POOL_ macro to VIRSH_COMMON_OPT_
John Ferlan [Sat, 9 Jan 2016 13:36:22 +0000 (08:36 -0500)]
virsh: Convert VSH_POOL_ macro to VIRSH_COMMON_OPT_

Commit id's 'cf793b00', 'e178688f', 'f9a6110f', '5372d49', and 'e193735'
added new VSH_POOL_ macros; however, it was pointed out after push that
commit id '834c5720' preferred use of VIRSH_ for the prefix over VSH_.

So this patch just changes the VSH_ to VIRSH_ and it changes the naming
format from VIRSH_<opt>_OPT_COMMON to VIRSH_COMMON_OPT_<opt>.

Signed-off-by: John Ferlan <jferlan@redhat.com>
9 years agoutil: eliminate bogus error log in virNetDevVPortProfileGetStatus
Laine Stump [Mon, 11 Jan 2016 22:08:43 +0000 (17:08 -0500)]
util: eliminate bogus error log in virNetDevVPortProfileGetStatus

 if instanceId is NULL

When virNetDevVPortProfileGetStatus() was called with instanceId =
NULL (which is the case for all DISASSOCIATE requests in 802.1Qbh) it
would log the following error:

   Could not find netlink response with expected parameters

even though the disassociate had been successfully completely. Then,
due to the fortunate coincidence of status having been initialized to
0 and then not changed when the "failure" was encountered, it would
still return a status of 0 (PORT_VDP_RESPONSE_SUCCESS), so the caller
would assume a successful operation.

This would result in a spurious log message though, and would fill in
LastErrorMessage, so that the API would return that error if it
happened during cleanup from some other error. That, in turn, would
lead to an incorrect supposition that the response to the port profile
disassociate was the cause of the failure.

During debugging, I noticed that the VF in question usually had *no
uuid* associated with it (big surprise)by the time the disassociate
completed, so the solution is *not* to send the previous instanceId
down.

This patch fixes virNetDevVPortProfileGetStatus() to only check the
VF's uuid in the status if it was given an instanceId to check against
when originally called. Otherwise it only checks that the particular
VF is present (it will be).

This does cause a slight difference in behavior - rather than
returning with status unchanged (and thus always 0) it will actually
get the IFLA_PORT_RESPONSE. This could lead to revelation of error
conditions we were previously ignoring. Or not. So far "not".

9 years agoqemu: use enum when setting PCI "multi" value, not 0 or 1
Laine Stump [Mon, 11 Jan 2016 20:12:08 +0000 (15:12 -0500)]
qemu: use enum when setting PCI "multi" value, not 0 or 1

Use the VIR_TRISTATE_SWITCH_* enums appropriately.

No functional change.

9 years agoqemu: auto-add a USB2 controller set for Q35 machines
Laine Stump [Tue, 20 Oct 2015 16:08:56 +0000 (12:08 -0400)]
qemu: auto-add a USB2 controller set for Q35 machines

Use virDomainDefAddUSBController() to add an EHCI1+UHCI1+UHCI2+UHCI3
controller set to newly defined Q35 domains that don't have any USB
controllers defined.

9 years agoqemu: define virDomainDevAddUSBController()
Laine Stump [Thu, 5 Nov 2015 20:16:50 +0000 (15:16 -0500)]
qemu: define virDomainDevAddUSBController()

This new function will add a single controller of the given model,
except the case of ich9-usb-ehci1 (the master controller for a USB2
controller set) in which case a set of related controllers will be
added (EHCI1, UHCI1, UHCI2, UHCI3). These controllers will not be
given PCI addresses, but should be otherwise ready to use.

"-1" is allowed for controller model, and means "default for this
machinetype". This matches the existing practice in
qemuDomainDefPostParse(), which always adds the default controller
with model = -1, and relies on the commandline builder to set a model
(that is wrong, but will be fixed later).

9 years agoconf: add virDomainDefAddController()
Laine Stump [Fri, 6 Nov 2015 18:01:29 +0000 (13:01 -0500)]
conf: add virDomainDefAddController()

We need a virDomainDefAddController() that doesn't check for an
existing controller at the same index (since USB2 controllers must be
added in sets of 4 that are all at the same index), so rather than
duplicating the code in virDomainDefMaybeAddController(), split it
into two functions, in the process eliminating existing duplicated
code that loops through the controller list by calling
virDomainControllerFind(), which does the same thing).

9 years agoqemu: prefer 00:1D.x and 00:1A.x for USB2 controllers on Q35
Laine Stump [Wed, 21 Oct 2015 19:08:49 +0000 (15:08 -0400)]
qemu: prefer 00:1D.x and 00:1A.x for USB2 controllers on Q35

The real Q35 machine puts the first USB controller set (EHCI+(UHCIx4))
on bus 0 slot 0x1D, and the 2nd USB controller set on bus 0 slot 0x1A,
so let's attempt to make the virtual machine match that for
controllers with auto-assigned addresses when possible.

Three test cases were added to assure that the proper addresses are
assigned - one with a single set of unaddressed USB controllers, one
with 3 (to grab both preferred slots plus one more), and one with the
order of the controller definitions reordered, to assure that the
auto-assignment isn't mixed up by order.

9 years agoqemu: don't assume slot 0 is unused/reserved.
Laine Stump [Wed, 21 Oct 2015 18:49:06 +0000 (14:49 -0400)]
qemu: don't assume slot 0 is unused/reserved.

When qemuAssignDevicePCISlots() is looking for companion controllers
for a USB controller that has no PCI address specified, it initializes
a virDevicePCIAddress to 0000:00:00.0, fills it in with the
companion's address if one is found, then checks whether or not there
was a find based on slot == 0. On a system with a single PCI bus, that
is a valid way to check, because slot 0 is reserved, but on most other
PCI buses, slot 0 is not reserved, and is open for use by any
device. This patch adds a separate bool that is set when a companion
is found rather than relying on the faulty information provided with
"slot == 0".

9 years agoUnify int types handling in protocol files
Jasper Lievisse Adriaanse [Sat, 9 Jan 2016 22:37:33 +0000 (01:37 +0300)]
Unify int types handling in protocol files

Some of the protocol files already include handing of the missing int
types such as xdr_uint64_t, some don't. To fix it everywhere, move out
of the appropriate defines to the utils/virxdrdefs.h file and include
it where needed.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
9 years agoUse struct sockpeercred when available
Jasper Lievisse Adriaanse [Thu, 7 Jan 2016 21:31:17 +0000 (00:31 +0300)]
Use struct sockpeercred when available

OpenBSD uses 'struct sockpeercred' instead of 'struct ucred'. Add a
configure check that detects its presence and use if in the code that
could be compiled on OpenBSD.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
9 years agocgroup: don't include sys/mount.h if not needed
Jasper Lievisse Adriaanse [Thu, 7 Jan 2016 18:41:52 +0000 (21:41 +0300)]
cgroup: don't include sys/mount.h if not needed

As cgroup implementation only works on Linux, it does not
make much sense to include sys/mount.h if other requirements are
not met, such as HAVE_MNTENT_H and HAVE_GETMNTENT_R.

Also, it fixes build on OpenBSD that requires to include sys/param.h
along with sys/mount.h.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
9 years agobuild: Kill docs/schemas/Makefile.am
Cole Robinson [Sun, 10 Jan 2016 20:14:33 +0000 (15:14 -0500)]
build: Kill docs/schemas/Makefile.am

Move the logic to docs/Makefile.am, and simplify it with a wildcard
expression.

9 years agobuild: Kill include/libvirt/Makefile.am
Cole Robinson [Sun, 10 Jan 2016 19:36:13 +0000 (14:36 -0500)]
build: Kill include/libvirt/Makefile.am

Move all the logic to include/Makefile.am, simplify it with a wildcard,
then kill include/libvirt/Makefile.am

9 years agowireshark: Fix header of get_message_len()
Michal Privoznik [Sun, 27 Dec 2015 10:00:22 +0000 (11:00 +0100)]
wireshark: Fix header of get_message_len()

In wireshark commit ceb8d954 (v1.99.2) they have changed the
signature of a function that determines how long a libvirt packet
is. Now it accepts a void pointer for passing data into the
function. Well, this is nice, but we don't need it right now.
Anyway, we have to change our code.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agowireshark: Replace WIRESHARK_COMPAT with actual version comparison
Michal Privoznik [Mon, 4 Jan 2016 10:26:03 +0000 (11:26 +0100)]
wireshark: Replace WIRESHARK_COMPAT with actual version comparison

In the upcoming patch we will need yet another #ifdef code block
depending on wireshark version. Instead of defining
WIRESHARK_COMPAT2 or something lets just compare the version
right at the place so that we can clearly see what version broke
API.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agowireshark: s/tvb_length/tvb_captured_length/
Michal Privoznik [Sun, 27 Dec 2015 09:55:29 +0000 (10:55 +0100)]
wireshark: s/tvb_length/tvb_captured_length/

In wireshak commit 22149c55 (v.1.11.3) the API was renamed.
Follow the change in our code too. Since the wireshark change was
made in the very same version that we require at least we are
good to go.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agowireshark: s/ep_alloc/wmem_alloc/
Michal Privoznik [Sun, 27 Dec 2015 09:49:10 +0000 (10:49 +0100)]
wireshark: s/ep_alloc/wmem_alloc/

In wireshark, they have introduced their own memory allocator
wmem. This means that we need to adapt our code to that change
too. Notably 0ad15f88ccf434e8210ca is the wireshark commit you
want to look at. It's the one where they dropped the old API. The
new allocator has been introduced in 84cc3daa (v1.10.0), however,
was not exposed until 5c05c9e0 (v1.10.0). Since we already are
requiring 1.11.3 or higher no other change is needed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agowireshark: s/proto_tree_add_text/proto_tree_add_item/
Michal Privoznik [Sun, 27 Dec 2015 09:43:37 +0000 (10:43 +0100)]
wireshark: s/proto_tree_add_text/proto_tree_add_item/

In the wireshark commit e2735ecfdd7a96c they dropped
proto_tree_add_text in favor of proto_tree_add_item. Adapt to
this change.

Moreover, the proto_tree_add_item API is around for ages and we
are already using it anyway. Therefore we don't need to change
required version of wireshark.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemu: Introduce QEMU_CAPS_VSERPORT_CHANGE
Michal Privoznik [Tue, 5 Jan 2016 13:05:15 +0000 (14:05 +0100)]
qemu: Introduce QEMU_CAPS_VSERPORT_CHANGE

This capability tells if qemu is capable of vserport_change
events.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemu: change qemuFindAgentConfig return type
Michal Privoznik [Fri, 8 Jan 2016 15:21:30 +0000 (16:21 +0100)]
qemu: change qemuFindAgentConfig return type

While this is no functional change, whole channel definition is
going to be needed very soon. Moreover, while touching this obey
const correctness rule in qemuAgentOpen() - so far it was passed
regular pointer to channel config even though the function is
expected to not change pointee at all. Pass const pointer
instead.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoqemu: Set virtio channel state sooner
Michal Privoznik [Tue, 5 Jan 2016 10:39:20 +0000 (11:39 +0100)]
qemu: Set virtio channel state sooner

In qemu driver we listen to virtio channel events like an agent
connected to or disconnected from the guest part of socket.
However, with a little exception - when we find out that the
socket in question is the guest agent one, we connect or
disconnect guest agent which is done prior setting new state in
internal structure. Due to a bug in our code it may happen that
we got the event but failed to set it in internal structure
representing the channel.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agoFix LSB requirements in service script and sync them
Martin Kletzander [Thu, 7 Jan 2016 08:50:26 +0000 (09:50 +0100)]
Fix LSB requirements in service script and sync them

Commit b22344f3285187ee1768d6e031bc0ff20e32552d mistakenly reordered
Default-* lines.  Thanks to that I noticed that we are very inconsistent
with our init scripts, so I took the liberty of synchronizing them,
updating them and making them all look shiny and new.  So apart from
fixing the LSB requirements, I also fixed the ordering, specified
runlevels and fix the link to the reference specification.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9 years agovirDomainGetTime: Deny on RO connections
Michal Privoznik [Mon, 11 Jan 2016 12:34:17 +0000 (13:34 +0100)]
virDomainGetTime: Deny on RO connections

We have a policy that if API may end up talking to a guest agent
it should require RW connection. We don't obey the rule in
virDomainGetTime().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirDomainInterfaceAddresses: Allow API on RO connection too
Michal Privoznik [Mon, 11 Jan 2016 11:48:30 +0000 (12:48 +0100)]
virDomainInterfaceAddresses: Allow API on RO connection too

This API does not change domain state. However, we have a policy
that an API talking to a guest agent requires RW access. But that
happens only if source == VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9 years agovirsh: Document the --timestamp option
Andrea Bolognani [Fri, 8 Jan 2016 11:04:08 +0000 (12:04 +0100)]
virsh: Document the --timestamp option

The event, net-event and qemu-monitor-event virsh commands all
support the --timestamp option now, but such option was not
referenced in the man page.

9 years agovirsh: Add timestamps to network events
Andrea Bolognani [Fri, 8 Jan 2016 10:50:55 +0000 (11:50 +0100)]
virsh: Add timestamps to network events

Implement a --timestamp option for 'virsh net-event', similar to the
one for 'virsh event'.

When the option is used, the human-readable timestamp will be printed
before the message.

9 years agovirsh: Add timestamps to QEMU monitor events
Andrea Bolognani [Mon, 21 Dec 2015 15:22:58 +0000 (16:22 +0100)]
virsh: Add timestamps to QEMU monitor events

Implement a --timestamp option for 'virsh qemu-monitor-event', similar
to the one for 'virsh event'.

When the option is used, the human-readable timestamp will be printed
before the message, and the timing information provided by QEMU will
not be displayed.