Commit Graph

23414 Commits

Author SHA1 Message Date
Daniel P. Berrange
8764c99a40 mingw-libvirt.spec.in: add perl + perl(Getopt::Long) BRs
The default Fedora build roots for f25 and newer no longer
include perl. We must thus explicitly ask for it as the
RPC gendispatch.pl program needs it, and the Getopt::Long
module. Do this unconditionally since it isn't harmful for
older Fedora

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-07-01 14:11:15 +01:00
Daniel P. Berrange
8050f60450 mingw-libvirt.spec.in: fix packaging of admin API and other bugs
When the admin API was enabled no entries were added to the
file list.

The virt-host-validate binary is also no longer built on
win32

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-07-01 12:41:32 +01:00
Cole Robinson
5684680fd0 events: Rename argument uuid->key
Since it's not strictly a uuid anymore
2016-07-01 07:15:38 -04:00
Cole Robinson
37d1c246e5 events: Add explicit lookup 'key' value
This allows event implementations to match on something other
than an object's uuid, like nodedev or interface objects which
don't have a uuid.
2016-07-01 07:15:38 -04:00
Cole Robinson
d7c96a7245 events: Pass in UUID as a string
This should not have any functional difference, it's just a step
towards matching on non-uuid string keys
2016-07-01 07:15:38 -04:00
Cole Robinson
7926c5a5be events: Cleanup callback variable name
In every other instance virObjectEventCallbackPtr is named 'cb',
and in other code 'event' usually means a virObjectEventPtr
2016-07-01 07:15:38 -04:00
Cole Robinson
593269a2a5 events: Add virObjectEventCallbackFree 2016-07-01 07:15:38 -04:00
Cole Robinson
d3a492a883 events: Privatize virObjectEventCallback
It's only used in object_event.c, so remove it from the header. We
need to move the _virObjectEventCallback definition earlier as a
result.
2016-07-01 07:15:38 -04:00
Ján Tomko
492b3bfda1 Introduce virDomainUSBDeviceDefForeach
A helper that will execute a callback on every USB device
in the domain definition.

With an ability to skip USB hubs, since we will want to treat
them differently in some cases.
2016-07-01 12:25:18 +02:00
Ján Tomko
3681e0a9fe Add USB addresses to qemuhotplug test cases
This test assumes the XML will be the same after formatting.
Add USB addresses to it to keep it working when we autoassign them.
2016-07-01 12:25:18 +02:00
Jiri Denemark
60f35e263f qemu: Avoid needless copies of static strings
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-07-01 12:20:54 +02:00
Jiri Denemark
77437410d7 qemu: Drop emitBootindex parameter
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-07-01 12:20:54 +02:00
Jiri Denemark
0dd67acfa7 qemu: Use bootindex whenever possible
I'm not sure why our code claimed "-boot menu=on" cannot be used in
combination with per-device bootindex, but it was proved wrong about
four years ago by commit 8c952908. Let's always use bootindex when QEMU
supports it.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-07-01 12:20:54 +02:00
Jiri Denemark
5343dd4a31 qemu: Remove redundant parameter in virQEMUCapsFillDomainCaps
virttype is already included in domCaps, no need to pass it separately.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-07-01 12:20:54 +02:00
Jiri Denemark
324d2cdda4 domaincapstest: Don't read data from host
virQEMUCapsFillDomainCaps would use virHostCPUGetKVMMaxVCPUs for KVM
domains.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-07-01 12:20:54 +02:00
Jiri Denemark
6ec4e28ecd cpu: Drop NR_DRIVERS macro
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-07-01 12:20:54 +02:00
Jiri Denemark
3e5197ac13 cpu: Drop generic driver
Pretending (partial) support for something we don't understand is risky.
Reporting a failure is much better.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-07-01 12:20:54 +02:00
Jiri Denemark
e4c2c2facf Post-release version bump to 2.1.0 2016-07-01 12:20:43 +02:00
Daniel Veillard
7a2d92f693 Libvirt 2.0.0 release
* docs/news.html.in: update documentation
* po/*.po*: regenerate
2016-07-01 10:59:30 +02:00
Martin Kletzander
e8a5939c46 dist: Speed up distribution compression
This almost reverts b7200d7236.  The size is increased from 11M to 13M
and the compression is sped up from 2 minutes to 17 seconds.  The
compression level is removed because -9 doesn't allow multiple threads
to be spawned.  Effectively speeds up distcheck as well.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-06-30 16:05:24 +02:00
Peter Krempa
cbe4c049d8 conf: Don't free the constructed string in virDomainGetBlkioParametersAssignFromDef
virTypedParameterAssign steals the string rather than copying it into
the typed parameter and thus freeing it leads to a crash when attempting
to serialize the results.

This was introduced in commit 9f50f6e2 and later made an universal
helper in 32e6339c.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1351473
2016-06-30 15:07:55 +02:00
Peter Krempa
d7c40d50d7 conf: def: Avoid unnecessary allocation of 'perf' events definition
Some code paths already assume that it is allocated since it was always
allocated by virDomainPerfDefParseXML. Make it member of virDomainDef
directly so that we don't have to allocate it all the time.

This fixes crash when attempting to connect to an existing process via
virDomainQemuAttach since we would not allocate it in that code path.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1350688
2016-06-30 15:07:44 +02:00
Jiri Denemark
60a545fa68 docs: Warn against locked memory limit too high
https://bugzilla.redhat.com/show_bug.cgi?id=1046833

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-30 12:54:42 +02:00
Marc Hartmayer
cdf4ae6ae3 tests: Add test cases for SCSI disk hot-plug with QEMU
Verify that SCSI controllers get created automatically when a SCSI disk
is hot-plugged to a domain that doesn't have a matching SCSI controller
defined already.

Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
2016-06-30 12:48:51 +02:00
Marc Hartmayer
12ec22b68b qemu: SCSI hostdev hot-plug: Fix automatic creation of SCSI controllers
Ensure that the given controller and all controllers with a smaller
index exist; there must not be any missing index in between.

Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
2016-06-30 12:48:51 +02:00
Marc Hartmayer
58d07db9b0 qemu: hot-plug: Fix broken SCSI disk hot-plug
The commit "qemu: hot-plug: Assume support for -device in
qemuDomainAttachSCSIDisk" dropped the code for the automatic SCSI
controller creation used in SCSI disk hot-plugging. If we are
hot-plugging a SCSI disk to a domain and there is no proper SCSI
controller defined, it results in an "error: internal error: Could not
find scsi controller with index X required for device" error.

For that reason reverting a hunk of the commit
d4d32005d6.

This patch also adds an extra comment to the code to clarify the
loop.

Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
2016-06-30 12:48:51 +02:00
Jiri Denemark
bb848feec0 qemu: Let empty default VNC password work as documented
CVE-2016-5008

Setting an empty graphics password is documented as a way to disable
VNC/SPICE access, but QEMU does not always behaves like that. VNC would
happily accept the empty password. Let's enforce the behavior by setting
password expiration to "now".

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-30 10:20:44 +02:00
Jiri Denemark
7371ca5c26 qemu: Use proper async job to refresh virtio channels
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-30 09:41:39 +02:00
Jean-Marc Liger
e893d3ca8e libvirt.spec.in: Use libnl-devel for RHEL-6
RHEL-6 still needs to use libnl instead of libnl3, so re-add
the spec conditional mistakenly removed in

  commit 3694e038fd
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Wed May 4 15:43:08 2016 +0100

    libvirt.spec.in: drop Fedora < 20 and RHEL < 6
2016-06-29 17:38:15 +01:00
Erik Skultety
c924965b24 admin: fix virt-admin startup crash by calling virAdmInitialize
Similarly to what virsh virt-login-shell do, call virAdmInitialize prior to
initializing an event loop and initializing the error handler. Commit 97973ebb7
described and fixed an identical issue for libvirt_lxc.
Since virAdmInitialize becomes a public API after applying this patch,
the symbol is also added to public syms and the doc string of the method is
slightly enhanced analogically to virInitialize.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2016-06-29 16:33:08 +02:00
Ján Tomko
a3f565b339 Fix possible invalid read in adminClientGetInfo
virNetServerClientGetInfo returns the client's remote address
as a string, which is a part of the client object.

Use VIR_STRDUP to make a copy which can be freely accessed
even after the virNetServerClient object is unlocked.

To reproduce, put a sleep between virObjectUnlock in
virNetServerClientGetInfo and virTypedParamsAddString in
adminClientGetInfo, then close the queried connection during
that sleep.
2016-06-29 16:13:12 +02:00
Michal Privoznik
ca5d51df27 virStorageTranslateDiskSourcePool: Avoid double free
https://bugzilla.redhat.com/show_bug.cgi?id=1316370

Consider the following disk for a domain:

    <disk type='volume' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <auth username='libvirt'>
        <secret type='iscsi' usage='libvirtiscsi'/>
      </auth>
      <source pool='iscsi-secret-pool' volume='unit:0:0:0' mode='direct' startupPolicy='optional'/>
      <target dev='sda' bus='scsi'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

Now, startupPolicy is currently not allowed for iscsi disks, so
one would expect an error message to be thrown. But what a
surprise is waiting for users if they try to start up such
domain:

==15724== Invalid free() / delete / delete[] / realloc()
==15724==    at 0x4C2B1F0: free (vg_replace_malloc.c:473)
==15724==    by 0x54B7A69: virFree (viralloc.c:582)
==15724==    by 0x552DC90: virStorageAuthDefFree (virstoragefile.c:1549)
==15724==    by 0x552F023: virStorageSourceClear (virstoragefile.c:2055)
==15724==    by 0x552F054: virStorageSourceFree (virstoragefile.c:2067)
==15724==    by 0x55556AA: virDomainDiskDefFree (domain_conf.c:1562)
==15724==    by 0x5557ABE: virDomainDefFree (domain_conf.c:2547)
==15724==    by 0x1B43CC42: qemuProcessStop (qemu_process.c:5918)
==15724==    by 0x1B43BA2E: qemuProcessStart (qemu_process.c:5511)
==15724==    by 0x1B48993E: qemuDomainObjStart (qemu_driver.c:7050)
==15724==    by 0x1B489B9A: qemuDomainCreateWithFlags (qemu_driver.c:7104)
==15724==    by 0x1B489C01: qemuDomainCreate (qemu_driver.c:7122)
==15724==  Address 0x21cfbb90 is 0 bytes inside a block of size 48 free'd
==15724==    at 0x4C2B1F0: free (vg_replace_malloc.c:473)
==15724==    by 0x54B7A69: virFree (viralloc.c:582)
==15724==    by 0x552DC90: virStorageAuthDefFree (virstoragefile.c:1549)
==15724==    by 0x12D1C8D4: virStorageTranslateDiskSourcePool (storage_driver.c:3475)
==15724==    by 0x1B4396E4: qemuProcessPrepareDomain (qemu_process.c:4896)
==15724==    by 0x1B43B880: qemuProcessStart (qemu_process.c:5466)
==15724==    by 0x1B48993E: qemuDomainObjStart (qemu_driver.c:7050)
==15724==    by 0x1B489B9A: qemuDomainCreateWithFlags (qemu_driver.c:7104)
==15724==    by 0x1B489C01: qemuDomainCreate (qemu_driver.c:7122)
==15724==    by 0x561CA97: virDomainCreate (libvirt-domain.c:6787)
==15724==    by 0x12B6FD: remoteDispatchDomainCreate (remote_dispatch.h:4116)
==15724==    by 0x12B61A: remoteDispatchDomainCreateHelper (remote_dispatch.h:4092)

The problem is, in virStorageTranslateDiskSourcePool disk
def->src->auth is freed, but the pointer is not set to NULL. So
later, when qemuProcessStop starts to free the domain definition,
virStorageAuthDefFree() tries to free the memory again, instead
of jumping out immediately.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-06-28 15:02:16 +02:00
Jaroslav Suchanek
c59b9e1483 logging: fixing log level initialization from cmdline
Reorder code for setting default log level from cmdline prior
initialization of log outputs. Thus the --verbose option is reflected.

This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1325072
2016-06-28 13:52:34 +02:00
Jiri Denemark
fa3c558596 qemuDomainDeviceDefValidate: Drop unused qemuCaps
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-28 13:33:05 +02:00
Andrea Bolognani
a9a2abd478 vz: Fix indentation in prlsdkGetNetAddresses() 2016-06-28 10:09:52 +02:00
Olga Krishtal
a2adcc1b93 vz: fix build for virNetDev* changes
Patch fixes vz build after changes in IP-related netdev functions(cf0568b0, fbc1843d).

Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
2016-06-27 16:31:11 -04:00
Ján Tomko
05eab47559 Revert "util: new function virNetDevIPInfoAddToDev"
This reverts commit f1e0d0da11.

This feature was accidentally pushed in the feature freeze.
2016-06-27 12:54:55 +02:00
Ján Tomko
f6acf039f0 Revert "conf: allow setting peer address in <ip> element of <interface>"
This reverts commit 93135abf14.

This feature was accidentally pushed in the feature freeze.
2016-06-27 12:54:55 +02:00
Ján Tomko
d658456530 Revert "conf: support host-side IP/route information in <interface>"
This reverts commit fe6a77898a.

This feature was accidentally pushed in the feature freeze.
2016-06-27 12:54:55 +02:00
Ján Tomko
cba06aea8d Revert "util: support setting peer for virNetDevIPInfo addresses"
This reverts commit cb20f989df.

This feature was accidentally pushed in the feature freeze.
2016-06-27 12:54:55 +02:00
Ján Tomko
1549f16832 Revert "lxc: support setting host-side IP addresses/routes"
This reverts commit cd5c9f21de.

This feature was accidentally pushed in the feature freeze.
2016-06-27 12:54:55 +02:00
Ján Tomko
84d47a3cce Revert "qemu: support setting host-side IP addresses/routes"
This reverts commit 0b4645a7e0.

This feature was accidentally pushed in the feature freeze.
2016-06-27 12:54:55 +02:00
Andrea Bolognani
7970436ec4 Clean up after virNetDevIP creation
Commit cf0568b0af moved a bunch of functions from virNetDev
to the more specific virNetDevIP; however, not all of the
existing uses were moved properly, causing build failures on
FreeBSD.

Complete the transition to the new names and drop the
obsolete declarations from the header file while at it.
2016-06-27 12:42:48 +02:00
Andrea Bolognani
014dd11291 util: netdevip: Include vircommand.h
Not including the header causes

  util/virnetdevip.c:520:5: error:
  unknown type name 'virCommandPtr'; did you mean 'virCondPtr'?
    virCommandPtr cmd = NULL;
    ^~~~~~~~~~~~~

and plenty more similar failures when compiling on FreeBSD.
2016-06-27 12:42:48 +02:00
Michal Privoznik
60f1f1082a libvirtd.conf: Fix invalid default of max_anonymous_clients
https://bugzilla.redhat.com/show_bug.cgi?id=1343442

When a client connects, it is placed into a queue. As soon as it
authenticate, it is taken out of that queue and placed into a
different one. Now, we have a setting in the daemon config file
that allows users to control the length of the queue of yet not
authenticated clients. By default, it has a value 20 but in the
description to the config knob we clam it's zero.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-06-27 08:54:03 +02:00
Laine Stump
0b4645a7e0 qemu: support setting host-side IP addresses/routes
For type='ethernet' interfaces only.
2016-06-26 19:33:10 -04:00
Laine Stump
cd5c9f21de lxc: support setting host-side IP addresses/routes 2016-06-26 19:33:10 -04:00
Laine Stump
cb20f989df util: support setting peer for virNetDevIPInfo addresses
This will apply to any IP address setting that uses
virNetDevIPInfoAddToDev() (which so far is only the guest-side of LXC
type='ethernet' interfaces).
2016-06-26 19:33:10 -04:00
Laine Stump
fe6a77898a conf: support host-side IP/route information in <interface>
This is place as a sub-element of <source>, where other aspects of the
host-side connection to the network device are located (network or
bridge name, udp listen port, etc). It's a bit odd that the interface
we're configuring with this info is itself named in <target dev='x'/>,
but that ship sailed long ago:

    <interface type='ethernet'>
      <mac address='00:16:3e:0f:ef:8a'/>
      <source>
        <ip address='192.168.122.12' family='ipv4'
            prefix='24' peer='192.168.122.1'/>
        <ip address='192.168.122.13' family='ipv4' prefix='24'/>
        <route family='ipv4' address='0.0.0.0'
               gateway='192.168.122.1'/>
        <route family='ipv4' address='192.168.124.0' prefix='24'
               gateway='192.168.124.1'/>
      </source>
    </interface>

In practice, this will likely only be useful for type='ethernet', so
its presence in any other type of interface is currently forbidden in
the generic device Validate function (but it's been put into the
general population of virDomainNetDef rather than the
ethernet-specific union member so that 1) we can more easily add the
capability to other types, and 2) we can retain the info when set to
an invalid interface type all the way through to validation and report
a proper error, rather than just ignoring it (which is currently what
happens for many other type-specific settings).

(NB: The already-existing configuration of IP info for the guest-side
of interfaces is in subelements directly under <interface>, and the
name of the guest-side interface (when configurable) is in <guest
dev='x'/>).
2016-06-26 19:33:10 -04:00
Vasiliy Tolstov
93135abf14 conf: allow setting peer address in <ip> element of <interface>
The peer attribute is used to set the property of the same name in the
interface IP info:

  <interface type='ethernet'>
    ...
    <ip family='ipv4' address='192.168.122.5'
        prefix='32' peer='192.168.122.6'/>
    ...
  </interface>

Note that this element is used to set the IP information on the
*guest* side interface, not the host side interface - that will be
supported in an upcoming patch.

(This is an updated *re*-commit of commit 690969af, which was
subsequently reverted in commit 1d14b13f).

Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
Signed-off-by: Laine Stump <laine@laine.org>
2016-06-26 19:33:10 -04:00