]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
7 years agoutil: mdev: Introduce virMediatedDeviceTypeReadAttrs getter
Erik Skultety [Tue, 23 Jan 2018 08:55:52 +0000 (09:55 +0100)]
util: mdev: Introduce virMediatedDeviceTypeReadAttrs getter

This should serve as a replacement for the existing udevFillMdevType
which is responsible for fetching the device type's attributes from the
sysfs interface. The problem with the existing solution is that it's
tied to the udev backend.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agoutil: mdev: Introduce virMediatedDeviceType structure
Erik Skultety [Tue, 23 Jan 2018 08:47:43 +0000 (09:47 +0100)]
util: mdev: Introduce virMediatedDeviceType structure

This is later going to replace the existing virNodeDevCapMdevType, since:
1) it's going to couple related stuff in a single module
2) util is supposed to contain helpers that are widely accessible across
the whole repository.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agoutil: mdev: Drop some unused symbols/includes from the header
Erik Skultety [Tue, 23 Jan 2018 08:52:21 +0000 (09:52 +0100)]
util: mdev: Drop some unused symbols/includes from the header

There were some leftovers from early development which never got used.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agoconf: nodedev: Refresh capabilities before touching them
Erik Skultety [Thu, 18 Jan 2018 14:25:49 +0000 (15:25 +0100)]
conf: nodedev: Refresh capabilities before touching them

Most of them are static, however in case of PCI and SCSI_HOST devices,
the nested capabilities can change dynamically, e.g. due to a driver
change (from host_pci_driver -> vfio_pci).

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Suggested-by: Wu Zongyong <cordius.wu@huawei.com>
7 years agonodedev: Introduce virNodeDeviceCapsListExport
Erik Skultety [Fri, 19 Jan 2018 09:57:03 +0000 (10:57 +0100)]
nodedev: Introduce virNodeDeviceCapsListExport

Whether asking for a number of capabilities supported by a device or
listing them, it's handled essentially by a copy-paste code, so extract
the common stuff into this new helper which also updates all
capabilities just before touching them.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agonodedev: Export nodeDeviceUpdateCaps from node_device_conf.c
Erik Skultety [Thu, 18 Jan 2018 10:07:25 +0000 (11:07 +0100)]
nodedev: Export nodeDeviceUpdateCaps from node_device_conf.c

Since we moved the helpers from nodedev driver to src/conf, the actual
'update' function using those helpers should be moved as well so that we
don't need to call back into the driver.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agonodedev: Move the sysfs-related cap handling to node_device_conf.c
Erik Skultety [Fri, 12 Jan 2018 12:14:26 +0000 (13:14 +0100)]
nodedev: Move the sysfs-related cap handling to node_device_conf.c

The capabilities are defined/parsed/formatted/queried from this module,
no reason for 'update' not being part of the module as well. This also
involves some module-specific prefix changes.
This patch also drops the node_device_linux_sysfs module from the repo
since:
a) it only contained the capability handlers we just moved
b) it's only linked with the driver (by design) and thus unreachable to
other modules
c) we touch sysfs across all the src/util modules so the module being
deleted hasn't been serving its original intention for some time already.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agonodedev: Drop the nodeDeviceSysfsGetSCSIHostCaps wrapper
Erik Skultety [Fri, 12 Jan 2018 15:23:30 +0000 (16:23 +0100)]
nodedev: Drop the nodeDeviceSysfsGetSCSIHostCaps wrapper

We can call directly the virNodeDeviceGetSCSIHostCaps helper instead.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agoconf: nodedev: Convert virNodeDevObjHasCapStr to a simple wrapper
Erik Skultety [Tue, 23 Jan 2018 11:38:26 +0000 (12:38 +0100)]
conf: nodedev: Convert virNodeDevObjHasCapStr to a simple wrapper

This patch drops the capability matching redundancy by simply converting
the string input to our internal types which are then in turn used for
the actual capability matching.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agoconf: nodedev: Rename virNodeDeviceCapMatch to virNodeDevObjHasCap
Erik Skultety [Thu, 11 Jan 2018 12:43:29 +0000 (13:43 +0100)]
conf: nodedev: Rename virNodeDeviceCapMatch to virNodeDevObjHasCap

We currently have 2 methods that do the capability matching. This should
be condensed to a single function and all the derivates should just call
into that using a proper type conversion.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agoconf: nodedev: Rename virNodeDevObjHasCap to virNodeDevObjHasCapStr
Erik Skultety [Thu, 11 Jan 2018 12:43:29 +0000 (13:43 +0100)]
conf: nodedev: Rename virNodeDevObjHasCap to virNodeDevObjHasCapStr

We currently have 2 methods that do the capability matching. This should
be condensed to a single function and all the derivates should just call
into that using a proper type conversion.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agotest: Implementing testDomainRename().
Julio Faracco [Mon, 15 Jan 2018 19:18:08 +0000 (17:18 -0200)]
test: Implementing testDomainRename().

There is no method to rename inactive domains for test driver.
After this patch, we can rename the domains using 'domrename'.

    virsh# domrename test anothertest
    Domain successfully renamed

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agotests: Clean up GIC test cases
Andrea Bolognani [Thu, 25 Jan 2018 14:12:39 +0000 (15:12 +0100)]
tests: Clean up GIC test cases

These test cases are supposed to verify GIC support works as
expected, and shouldn't concern themselves with other features;
we can trim them down significantly, and make them less likely
to need updating after unrelated changes.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agovhost-user: add support reconnect for vhost-user ports
ZhiPeng Lu [Wed, 17 Jan 2018 16:14:06 +0000 (00:14 +0800)]
vhost-user: add support reconnect for vhost-user ports

For vhost-user ports, Open vSwitch acts as the server and QEMU the client.
When OVS crashes or restarts, the QEMU process should be reconnected to
OVS.

Signed-off-by: ZhiPeng Lu <lu.zhipeng@zte.com.cn>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agodocs: Add missing element encryption description term entry
John Ferlan [Thu, 25 Jan 2018 18:40:00 +0000 (13:40 -0500)]
docs: Add missing element encryption description term entry

Missed adding the "encryption" description term entry to the list
of possible sub-elements for disk source. The description details
were there, just not the tag.

7 years agoresctl: stub out functions with Linux-only APIs used
Daniel P. Berrangé [Thu, 25 Jan 2018 17:42:36 +0000 (17:42 +0000)]
resctl: stub out functions with Linux-only APIs used

The flock() function and d_type field in struct dirent are not portable
to the mingw platform.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agorpc: fix race sending and encoding sasl data
Daniel P. Berrange [Mon, 18 Dec 2017 17:41:12 +0000 (17:41 +0000)]
rpc: fix race sending and encoding sasl data

The virNetSocketWriteSASL method has to encode the buffer it is given and then
write it to the underlying socket. This write is not guaranteed to send the
full amount of data that was encoded by SASL. We cache the SASL encoded data so
that on the next invocation of virNetSocketWriteSASL we carry on sending it.

The subtle problem is that the 'len' value passed into virNetSocketWriteSASL on
the 2nd call may be larger than the original value. So when we've completed
sending the SASL encoded data we previously cached, we must return the original
length we encoded, not the new length.

This flaw means we could potentially have been discarded queued data without
sending it. This would have exhibited itself as a libvirt client never receiving
the reply to a method it invokes, async events silently going missing, or worse
stream data silently getting dropped.

For this to be a problem libvirtd would have to be queued data to send to the
client, while at the same time the TCP socket send buffer is full (due to a very
slow client). This is quite unlikely so if this bug was ever triggered by a real
world user it would be almost impossible to reproduce or diagnose, if indeed it
was ever noticed at all.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
7 years agolibxl: resume lock process after failed migration
Jim Fehlig [Wed, 24 Jan 2018 21:23:04 +0000 (14:23 -0700)]
libxl: resume lock process after failed migration

During migration, the lock process is paused in the perform phase
but not resumed if there is a subsequent failure, leaving the locked
resource unprotected.

The perform phase itself can fail, in which case the lock process
should be resumed before returning from perform. The finish phase
could also fail on the destination host, in which case the migration
is canceled in the confirm phase and the VM is resumed. The lock
process needs to be resumed there as well.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
7 years agotests: Clean up and modify some vircaps2xmldata
Martin Kletzander [Tue, 23 Jan 2018 13:53:38 +0000 (14:53 +0100)]
tests: Clean up and modify some vircaps2xmldata

Basically the `cpus` and `tasks` files are not needed, and I've witnessed on a
real system that the schemata file may have spaces prepended to a line, so let's
adjust at least one test so that it reflects what can happen.  Also `000`
allocation is invalid and a full mask means it's all free.  So adjust for that
too.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
7 years agodocs: Add CAT (resctrl) support into news.xml
Martin Kletzander [Sun, 12 Nov 2017 22:16:36 +0000 (23:16 +0100)]
docs: Add CAT (resctrl) support into news.xml

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
7 years agoqemu: Add support for resctrl
Martin Kletzander [Fri, 10 Nov 2017 12:21:51 +0000 (13:21 +0100)]
qemu: Add support for resctrl

We've been building up to this.  This adds support for cputune/cachetune
settings for domains in the QEMU driver.  The addition into
qemuProcessSetupVcpu() automatically adds support for hotplug.  For hot-unplug
we need to remove the allocation only if all the vCPUs were unplugged.  But
since the threads are left running, we can't really do much about it now.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
7 years agotests: Add virresctrltest
Martin Kletzander [Sat, 11 Nov 2017 08:13:08 +0000 (09:13 +0100)]
tests: Add virresctrltest

This test initializes capabilities from vircaps2xmldata (since it exists there
already) and then requests list of free bitmaps (all unallocated space) from
virresctrl.c

Desirable outputs are saved in virresctrldata.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
7 years agoconf: Add support for cputune/cachetune
Martin Kletzander [Fri, 10 Nov 2017 13:47:05 +0000 (14:47 +0100)]
conf: Add support for cputune/cachetune

More info in the documentation, this is basically the XML parsing/formatting
support, schemas, tests and documentation for the new cputune/cachetune element
that will get used by following patches.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
7 years agoresctrl: Add functions to work with resctrl allocations
Martin Kletzander [Mon, 16 Oct 2017 15:17:32 +0000 (17:17 +0200)]
resctrl: Add functions to work with resctrl allocations

With this commit we finally have a way to read and manipulate basic resctrl
settings.  Locking is done only on exposed functions that read/write from/to
resctrlfs.  Not in functions that are exposed in virresctrlpriv.h as those are
only supposed to be used from tests.

More information about how resctrl works:

  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/x86/intel_rdt_ui.txt

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
7 years agofixup_resctrlinfo
Martin Kletzander [Wed, 24 Jan 2018 14:47:31 +0000 (15:47 +0100)]
fixup_resctrlinfo

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
7 years agoutil: Remove now-unneeded resctrl functions
Martin Kletzander [Mon, 20 Nov 2017 13:01:59 +0000 (14:01 +0100)]
util: Remove now-unneeded resctrl functions

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
7 years agoconf: Use virResctrlInfo in capabilities
Martin Kletzander [Mon, 20 Nov 2017 12:43:30 +0000 (13:43 +0100)]
conf: Use virResctrlInfo in capabilities

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
7 years agoutil: Add virResctrlInfo
Martin Kletzander [Mon, 20 Nov 2017 10:12:06 +0000 (11:12 +0100)]
util: Add virResctrlInfo

This will make the current functions obsolete and it will provide more
information to the virresctrl module so that it can be used later.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
7 years agoRename virResctrlInfo to virResctrlInfoPerCache
Martin Kletzander [Mon, 20 Nov 2017 09:23:04 +0000 (10:23 +0100)]
Rename virResctrlInfo to virResctrlInfoPerCache

Just to ease the review of following patches.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
7 years agovsh: Cmd aliases lookups should return results for the aliased command
Erik Skultety [Thu, 25 Jan 2018 15:13:37 +0000 (16:13 +0100)]
vsh: Cmd aliases lookups should return results for the aliased command

Unfortunately, we have a number of aliases in virsh and even though
these are not visible any more, we have to support them. The problem is
that when trying to print help for the alias, we get SIGSEGV because
there isn't any @def structure anymore and we need to query the command
being aliased instead.

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

Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agovsh: Drop redundant definition searches from vshCmd{def,Grp}Help
Erik Skultety [Thu, 25 Jan 2018 15:08:46 +0000 (16:08 +0100)]
vsh: Drop redundant definition searches from vshCmd{def,Grp}Help

These helpers are called from a single place only - cmdHelp wrapper and
just before the wrapper invokes the helpers, it performs the search,
either for command group or for the command itself, except the result is
discarded and the helper therefore needs to do it again. Drop this
inefficient handling and pass the @def structure rather than a name,
thus preventing the helper from needing to perform the search again.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agoqemu: add support for generating SMBIOS OEM strings command line
Daniel P. Berrange [Wed, 17 Jan 2018 17:35:13 +0000 (17:35 +0000)]
qemu: add support for generating SMBIOS OEM strings command line

This wires up the previously added OEM strings XML schema to be able to
generate comamnd line args for QEMU. This requires QEMU >= 2.12 release
containing this patch:

  commit 2d6dcbf93fb01b4a7f45a93d276d4d74b16392dd
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Sat Oct 28 21:51:36 2017 +0100

    smbios: support setting OEM strings table

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
7 years agoconf: add support for setting OEM strings SMBIOS data fields
Daniel P. Berrange [Sat, 28 Oct 2017 13:56:51 +0000 (14:56 +0100)]
conf: add support for setting OEM strings SMBIOS data fields

The OEM strings table in SMBIOS allows the vendor to pass arbitrary
strings into the guest OS. This can be used as a way to pass data to an
application like cloud-init, or potentially as an alternative to the
kernel command line for OS installers where you can't modify the install
ISO image to change the kernel args.

As an example, consider if cloud-init and anaconda supported OEM strings
you could use something like

    <oemStrings>
      <entry>cloud-init:ds=nocloud-net;s=http://10.10.0.1:8000/</entry>
      <entry>anaconda:method=http://dl.fedoraproject.org/pub/fedora/linux/releases/25/x86_64/os</entry>
    </oemStrings>

use of a application specific prefix as illustrated above is
recommended, but not mandated, so that an app can reliably identify
which of the many OEM strings are targetted at it.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
7 years agocpu: Add support for al57 Intel features
Shaohe Feng [Sun, 17 Dec 2017 23:02:44 +0000 (18:02 -0500)]
cpu: Add support for al57 Intel features

We can start qemu with a "cpu,+la57" to set 57-bit vitrual address
space. So VM can be aware that it need to enable 5-level paging.

Corresponding QEMU commits:
        al57 6c7c3c21f95dd9af8a0691c0dd29b07247984122

7 years agomailmap: set preferred spelling for my name
Daniel P. Berrangé [Thu, 25 Jan 2018 09:42:14 +0000 (09:42 +0000)]
mailmap: set preferred spelling for my name

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agolibxl: add explicit linkage to xenstore library
Daniel P. Berrange [Tue, 23 Jan 2018 18:17:13 +0000 (18:17 +0000)]
libxl: add explicit linkage to xenstore library

Since

  commit eee7bd4ecb5a3e83ed47cc89bf0dc4866b4858af
  Author: Joao Martins <joao.m.martins@oracle.com>
  Date:   Tue Jul 26 00:45:14 2016 +0100

    libxl: implement virDomainBlockStats

    Introduce initial support for domainBlockStats API

the libxl driver calls a couple of xenstore APIs, so it must explicitly
link to this library rather than rely on indirect linkage via libxl or
other xen libraries.

Reviewed-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
7 years agodocs: Mention just implemented completers
Michal Privoznik [Fri, 12 Jan 2018 15:27:39 +0000 (16:27 +0100)]
docs: Mention just implemented completers

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agovirsh: Introduce virshSnapshotNameCompleter
Michal Privoznik [Fri, 12 Jan 2018 14:28:30 +0000 (15:28 +0100)]
virsh: Introduce virshSnapshotNameCompleter

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agovirsh: Introduce virshSecretUUIDCompleter
Michal Privoznik [Fri, 12 Jan 2018 14:00:40 +0000 (15:00 +0100)]
virsh: Introduce virshSecretUUIDCompleter

This is a slight change from previous patches since virSecret
does not have a name only UUID strings.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agovirsh: Introduce virshNWFilterNameCompleter
Michal Privoznik [Fri, 12 Jan 2018 13:51:34 +0000 (14:51 +0100)]
virsh: Introduce virshNWFilterNameCompleter

The virConnectListAllNWFilters() has no extra flags yet, which
simplifies things a bit.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agovirsh: Introduce virshNodeDeviceNameCompleter
Michal Privoznik [Fri, 12 Jan 2018 13:44:37 +0000 (14:44 +0100)]
virsh: Introduce virshNodeDeviceNameCompleter

Yet again, we don't need listing by device capabilities, so flags
are unused.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agovirsh: Introduce virshNetworkNameCompleter
Michal Privoznik [Fri, 12 Jan 2018 13:35:40 +0000 (14:35 +0100)]
virsh: Introduce virshNetworkNameCompleter

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agovirsh: Introduce virshInterfaceNameCompleter
Michal Privoznik [Fri, 12 Jan 2018 13:26:35 +0000 (14:26 +0100)]
virsh: Introduce virshInterfaceNameCompleter

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agovirsh: Introduce virshStorageVolNameCompleter
Michal Privoznik [Fri, 12 Jan 2018 13:15:11 +0000 (14:15 +0100)]
virsh: Introduce virshStorageVolNameCompleter

This one is a bit simpler since virStoragePoolListAllVolumes()
has no flags yet.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agovirsh: Introduce virshStoragePoolNameCompleter
Michal Privoznik [Fri, 12 Jan 2018 13:01:33 +0000 (14:01 +0100)]
virsh: Introduce virshStoragePoolNameCompleter

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agolibvirtd: clarify the TLS conf default value setting
Chen Hanxiao [Sun, 21 Jan 2018 14:39:34 +0000 (22:39 +0800)]
libvirtd: clarify the TLS conf default value setting

Provide more details related to the requirement that setting one
of the values requires setting all of them.

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agolibvirtd: Explicit dependency on systemd-machined
Michal Koutný [Wed, 10 Jan 2018 22:06:41 +0000 (23:06 +0100)]
libvirtd: Explicit dependency on systemd-machined

The libvirtd daemon uses systemd-machined D-Bus API when manipulating
domains. The systemd-machined is D-Bus activated on demand.

However, during system shutdown systemd-machined is stopped concurrently
with libvirtd and virsh users also doing their final cleanup may
transitively fail due to unavailability of systemd-machined. Example
error message

> libvirtd[1390]: 2017-12-20 18:55:56.182+0000: 32700: error : virSystemdTerminateMachine:503 : Refusing activation, D-Bus is shutting down.

To circumvent this we need to explicitly specify both ordering and
requirement dependency (to avoid late D-Bus activation) on
systemd-machined. See [1] for the dependency debate.

[1] https://lists.freedesktop.org/archives/systemd-devel/2018-January/040095.html

7 years agoqemu: auto-add generic xhci rather than NEC xhci to Q35 domains
Laine Stump [Wed, 17 Jan 2018 21:47:06 +0000 (16:47 -0500)]
qemu: auto-add generic xhci rather than NEC xhci to Q35 domains

We recently added a generic XHCI USB3 controller to QEMU, and libvirt
supports adding that controller rather than the NEC XHCI USB3
controller, but when auto-adding a USB controller to Q35 domains we
were still adding the vendor-specific NEC controller. This patch
changes to add the generic controller instead, if it's available in
the QEMU binary that will be used.

Signed-off-by: Laine Stump <laine@laine.org>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoqemu: Don't initialize struct utsname
Jiri Denemark [Mon, 22 Jan 2018 13:51:11 +0000 (14:51 +0100)]
qemu: Don't initialize struct utsname

It breaks the build and it is not really useful for anything.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu: Refresh caps cache after booting a different kernel
Jiri Denemark [Mon, 22 Jan 2018 10:37:04 +0000 (11:37 +0100)]
qemu: Refresh caps cache after booting a different kernel

Whenever a different kernel is booted, some capabilities related to KVM
(such as CPUID bits) may change. We need to refresh the cache to see the
changes.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
7 years agoqemu: move qemuDomainDefValidateVideo into qemuDomainDeviceDefValidateVideo
Laine Stump [Mon, 18 Dec 2017 15:19:40 +0000 (10:19 -0500)]
qemu: move qemuDomainDefValidateVideo into qemuDomainDeviceDefValidateVideo

qemuDomainDefValidateVideo() (called from qemuDomainDefValidate()) is
just a loop performing various checks on each video device. Rather
than maintaining this separate function, just fold the validations
into qemuDomainDeviceDefValidateVideo(), which is called once for each
video device.

7 years agoqemu: assign correct type of PCI address for vhost-scsi when using pcie-root
Laine Stump [Fri, 15 Dec 2017 16:42:35 +0000 (11:42 -0500)]
qemu: assign correct type of PCI address for vhost-scsi when using pcie-root

Commit 10c73bf1 fixed a bug that I had introduced back in commit
70249927 - if a vhost-scsi device had no manually assigned PCI
address, one wouldn't be assigned automatically. There was a slight
problem with the logic of the fix though - in the case of domains with
pcie-root (e.g. those with a q35 machinetype),
qemuDomainDeviceCalculatePCIConnectFlags() will attempt to determine
if the host-side PCI device is Express or legacy by examining sysfs
based on the host-side PCI address stored in
hostdev->source.subsys.u.pci.addr, but that part of the union is only
valid for PCI hostdevs, *not* for SCSI hostdevs. So we end up trying
to read sysfs for some probably-non-existent device, which fails, and
the function virPCIDeviceIsPCIExpress() returns failure (-1).

By coincidence, the return value is being examined as a boolean, and
since -1 is true, we still end up assigning the vhost-scsi device to
an Express slot, but that is just by chance (and could fail in the
case that the gibberish in the "hostside PCI address" was the address
of a real device that happened to be legacy PCI).

Since (according to Paolo Bonzini) vhost-scsi devices appear just like
virtio-scsi devices in the guest, they should follow the same rules as
virtio devices when deciding whether they should be placed in an
Express or a legacy slot. That's accomplished in this patch by
returning early with virtioFlags, rather than erroneously using
hostdev->source.subsys.u.pci.addr. It also adds a test case for PCIe
to assure it doesn't get broken in the future.

7 years agonodedev: Fix failing to parse PCI address for non-PCI network devices
Jim Fehlig [Sat, 6 Jan 2018 00:10:47 +0000 (17:10 -0700)]
nodedev: Fix failing to parse PCI address for non-PCI network devices

Commit 8708ca01c added virNetDevSwitchdevFeature() to check if a network
device has Switchdev capabilities. virNetDevSwitchdevFeature() attempts
to retrieve the PCI device associated with the network device, ignoring
non-PCI devices. It does so via the following call chain

  virNetDevSwitchdevFeature()->virNetDevGetPCIDevice()->
  virPCIGetDeviceAddressFromSysfsLink()

For non-PCI network devices (qeth, Xen vif, etc),
virPCIGetDeviceAddressFromSysfsLink() will report an error when
virPCIDeviceAddressParse() fails. virPCIDeviceAddressParse() also
logs an error. After commit 8708ca01c there are now two errors reported
for each non-PCI network device even though the errors are harmless.

To avoid the errors, introduce virNetDevIsPCIDevice() and use it in
virNetDevGetPCIDevice() before attempting to retrieve the associated
PCI device. virNetDevIsPCIDevice() uses the 'subsystem' property of the
device to determine if it is PCI. See the sysfs rules in kernel
documentation for more details

https://www.kernel.org/doc/html/latest/admin-guide/sysfs-rules.html

7 years agoRevert "qemu: monitor: do not report error on shutdown"
Michal Privoznik [Fri, 19 Jan 2018 12:53:57 +0000 (13:53 +0100)]
Revert "qemu: monitor: do not report error on shutdown"

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

This reverts commit aeda1b8c56dc58b0a413acc61bbea938b40499e1.

Problem is that we need mon->lastError to be set because it's
used all over the place. Also, there's nothing wrong with
reporting error if one occurred. I mean, if there's a thread
executing an API and which currently is talking on monitor it
definitely wants the error reported.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoPost-release version bump to 4.1.0
Michal Privoznik [Fri, 19 Jan 2018 13:26:53 +0000 (14:26 +0100)]
Post-release version bump to 4.1.0

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoRelease of libvirt-4.0.0
Daniel Veillard [Fri, 19 Jan 2018 10:43:00 +0000 (11:43 +0100)]
Release of libvirt-4.0.0

* docs/news.xml: update for release
* po/*.po*: regenerated

7 years agoqemu: Fix crash in offline migration
Jiri Denemark [Fri, 19 Jan 2018 09:32:44 +0000 (10:32 +0100)]
qemu: Fix crash in offline migration

When migrating a shutoff domain (i.e., offline migration), we have no
statistics to report and thus jobInfo will be NULL in
qemuMigrationFinish.

Broken by me in v3.10.0-183-ge8784e7868.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agocpu: Add EPYC-IBPB CPU model
Jiri Denemark [Mon, 8 Jan 2018 19:53:25 +0000 (20:53 +0100)]
cpu: Add EPYC-IBPB CPU model

This is a variant of EPYC with indirect branch prediction protection.
The only difference between EPYC and EPYC-IBPB is the added "ibpb"
feature.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoRaise the frame limit for tests
Ján Tomko [Thu, 18 Jan 2018 09:14:41 +0000 (10:14 +0100)]
Raise the frame limit for tests

After the latest CPU additions, the build fails with clang:
cputest.c:905:1: error: stack frame size of 26136 bytes
  in function 'mymain' [-Werror,-Wframe-larger-than=]

Raise the relaxed limit which is used for tests.

7 years agoqemu: avoid denial of service reading from QEMU monitor (CVE-2018-5748)
Daniel P. Berrange [Tue, 16 Jan 2018 17:00:11 +0000 (17:00 +0000)]
qemu: avoid denial of service reading from QEMU monitor (CVE-2018-5748)

We read from QEMU until seeing a \r\n pair to indicate a completed reply
or event. To avoid memory denial-of-service though, we must have a size
limit on amount of data we buffer. 10 MB is large enough that it ought
to cope with normal QEMU replies, and small enough that we're not
consuming unreasonable mem.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
7 years agonews: Update for 4.0.0
Andrea Bolognani [Wed, 17 Jan 2018 15:57:49 +0000 (16:57 +0100)]
news: Update for 4.0.0

As usual, a bunch of changes slipped through the cracks during the
development cycle. Update the release notes to include at least the
most notable ones.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agoqemu: qemuDomainNamespaceUnlinkPaths: Return 0 in case of success
Marc Hartmayer [Wed, 17 Jan 2018 15:47:16 +0000 (16:47 +0100)]
qemu: qemuDomainNamespaceUnlinkPaths: Return 0 in case of success

Commit 7a931a4204af refactored the code and probably forgot to add
this line.

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
7 years agocpu: Add Skylake-Server-IBRS CPU model
Jiri Denemark [Tue, 9 Jan 2018 20:47:29 +0000 (21:47 +0100)]
cpu: Add Skylake-Server-IBRS CPU model

This is a variant of Skylake-Server with indirect branch prediction
protection. The only difference between Skylake-Server and
Skylake-Server-IBRS is the added "spec-ctrl" feature.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agocpu: Add Skylake-Client-IBRS CPU model
Jiri Denemark [Tue, 9 Jan 2018 20:41:31 +0000 (21:41 +0100)]
cpu: Add Skylake-Client-IBRS CPU model

This is a variant of Skylake-Client with indirect branch prediction
protection. The only difference between Skylake-Client and
Skylake-Client-IBRS is the added "spec-ctrl" feature.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agocpu: Add Broadwell-IBRS CPU model
Jiri Denemark [Tue, 9 Jan 2018 20:36:28 +0000 (21:36 +0100)]
cpu: Add Broadwell-IBRS CPU model

This is a variant of Broadwell with indirect branch prediction
protection. The only difference between Broadwell and Broadwell-IBRS is
the added "spec-ctrl" feature.

The Broadwell-IBRS model in QEMU is a bit different since Broadwell got
several additional features since we added it in cpu_map.xml:
    abm, arat, f16c, rdrand, vme, xsaveopt

Adding them only to the -IBRS variant would confuse our CPU detection
code.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agocpu: Add Broadwell-noTSX-IBRS CPU model
Jiri Denemark [Mon, 8 Jan 2018 19:53:25 +0000 (20:53 +0100)]
cpu: Add Broadwell-noTSX-IBRS CPU model

This is a variant of Broadwell-noTSX with indirect branch prediction
protection. The only difference between Broadwell-noTSX and
Broadwell-noTSX-IBRS is the added "spec-ctrl" feature.

The Broadwell-noTSX-IBRS model in QEMU is a bit different since
Broadwell-noTSX got several additional features since we added it in
cpu_map.xml:
    abm, arat, f16c, rdrand, vme, xsaveopt

Adding them only to the -IBRS variant would confuse our CPU detection
code.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agocpu: Add Haswell-IBRS CPU model
Jiri Denemark [Mon, 8 Jan 2018 19:53:25 +0000 (20:53 +0100)]
cpu: Add Haswell-IBRS CPU model

This is a variant of Haswell with indirect branch prediction protection.
The only difference between Haswell and Haswell-IBRS is the added
"spec-ctrl" feature.

The Haswell-IBRS model in QEMU is a bit different since Haswell got
several additional features since we added it in cpu_map.xml:
    arat, abm, f16c, rdrand, vme, xsaveopt

Adding them only to the -IBRS variant would confuse our CPU detection
code.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agocpu: Add Haswell-noTSX-IBRS CPU model
Jiri Denemark [Tue, 9 Jan 2018 19:40:03 +0000 (20:40 +0100)]
cpu: Add Haswell-noTSX-IBRS CPU model

This is a variant of Haswell-noTSX with indirect branch prediction
protection. The only difference between Haswell-noTSX and
Haswell-noTSX-IBRS is the added "spec-ctrl" feature.

The Haswell-noTSX-IBRS model in QEMU is a bit different since
Haswell-noTSX got several additional features since we added it in
cpu_map.xml:
    arat, abm, f16c, rdrand, vme, xsaveopt

Adding them only to the -IBRS variant would confuse our CPU detection
code.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agocpu: Add IvyBridge-IBRS CPU model
Jiri Denemark [Mon, 8 Jan 2018 19:53:25 +0000 (20:53 +0100)]
cpu: Add IvyBridge-IBRS CPU model

This is a variant of IvyBridge with indirect branch prediction
protection. The only difference between IvyBridge and IvyBridge-IBRS is
the added "spec-ctrl" feature.

The IvyBridge-IBRS model in QEMU is a bit different since IvyBridge got
several additional features since we added it in cpu_map.xml:
    arat, vme, xsaveopt

Adding them only to the -IBRS variant would confuse our CPU detection
code.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agocpu: Add SandyBridge-IBRS CPU model
Jiri Denemark [Mon, 8 Jan 2018 19:53:25 +0000 (20:53 +0100)]
cpu: Add SandyBridge-IBRS CPU model

This is a variant of SandyBridge with indirect branch prediction
protection. The only difference between SandyBridge and SandyBridge-IBRS
is the added "spec-ctrl" feature.

The SandyBridge-IBRS model in QEMU is a bit different since SandyBridge
got several additional features since we added it in cpu_map.xml:
    arat, vme, xsaveopt

Adding them only to the -IBRS variant would confuse our CPU detection
code.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agocpu: Add Westmere-IBRS CPU model
Jiri Denemark [Mon, 8 Jan 2018 19:53:25 +0000 (20:53 +0100)]
cpu: Add Westmere-IBRS CPU model

This is a variant of Westmere with indirect branch prediction
protection. The only difference between Westmere and Westmere-IBRS is
the added "spec-ctrl" feature.

The Westmere-IBRS model in QEMU is a bit different since Westmere got
several additional features since we added it in cpu_map.xml:
    arat, pclmuldq, vme

Adding them only to the -IBRS variant would confuse our CPU detection
code.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agocpu: Add Nehalem-IBRS CPU model
Jiri Denemark [Mon, 8 Jan 2018 19:53:25 +0000 (20:53 +0100)]
cpu: Add Nehalem-IBRS CPU model

This is a variant of Nehalem with indirect branch prediction protection.
The only difference between Nehalem and Nehalem-IBRS is the added
"spec-ctrl" feature.

Thus the diff matches QEMU, but the new CPU model itself is different.
The QEMU's versions of both models contain "vme" feature, while this
feature is missing in libvirt's models. While we can't change the
existing Nehalem CPU model, we could add "vme" to Nehalem-IBRS to make
it similar to QEMU, but doing so would fool our CPU detecting code so
that any Nehalem CPU with "vme" feature would be detected as
Nehalem-IBRS CPU without spec-ctrl. Not adding "vme" to Nehalem-IBRS is
safe as QEMU will just provide the feature anyway, which matches what
happens with Nehalem (and new enough machine types).

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agocputest: Add data for updated Intel(R) Core(TM) i7-5600U CPU
Jiri Denemark [Mon, 8 Jan 2018 23:02:44 +0000 (00:02 +0100)]
cputest: Add data for updated Intel(R) Core(TM) i7-5600U CPU

The CPU contains the updated microcode for CVE-2017-5715.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agocputest: Add data for updated AMD EPYC 7601 32-Core Processor
Jiri Denemark [Fri, 5 Jan 2018 14:58:07 +0000 (15:58 +0100)]
cputest: Add data for updated AMD EPYC 7601 32-Core Processor

The CPU contains the updated microcode for CVE-2017-5715.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agocputest: Add data for Intel(R) Xeon(R) Gold 5115 CPU
Jiri Denemark [Fri, 5 Jan 2018 14:43:16 +0000 (15:43 +0100)]
cputest: Add data for Intel(R) Xeon(R) Gold 5115 CPU

The CPU contains the updated microcode for CVE-2017-5715.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agocputest: Add data for Intel(R) Xeon(R) CPU E5-2623 v4
Jiri Denemark [Fri, 5 Jan 2018 14:03:12 +0000 (15:03 +0100)]
cputest: Add data for Intel(R) Xeon(R) CPU E5-2623 v4

The CPU contains the updated microcode for CVE-2017-5715.

The *-guest.xml and *-json.xml CPU definitions use Skylake-Client CPU
model rather than Broadwell. This is similar to Xeon-E5-2650-v4 and it
is caused by our CPU model selection code when no model matches the CPU
signature (family + model). We'd need to maintain a complete list of CPU
signatures for our CPU models to fix this.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agocputest: Add data for Intel(R) Xeon(R) CPU E5-2609 v3
Jiri Denemark [Fri, 5 Jan 2018 13:52:45 +0000 (14:52 +0100)]
cputest: Add data for Intel(R) Xeon(R) CPU E5-2609 v3

The CPU contains the updated microcode for CVE-2017-5715.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agocpu: add CPU features for indirect branch prediction protection
Paolo Bonzini [Tue, 12 Dec 2017 15:23:42 +0000 (16:23 +0100)]
cpu: add CPU features for indirect branch prediction protection

Added in QEMU commits TBD and TBD.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoOn startup libvirtd runs a number of QEMU processes unconfined such as:
intrigeri [Wed, 17 Jan 2018 15:28:15 +0000 (16:28 +0100)]
On startup libvirtd runs a number of QEMU processes unconfined such as:

  /usr/bin/qemu-system-x86_64 -S -no-user-config -nodefaults -nographic -machine none,accel=kvm:tcg -qmp unix:/var/lib/libvirt/qemu/capabilities.monitor.sock,server,nowait -pidfile /var/lib/libvirt/qemu/capabilities.pidfile -daemonize

libvirtd needs to be allowed to kill these processes, otherwise they
remain running.

7 years agoqemu: Fix segmentation fault when attaching a non iSCSI host device
Marc Hartmayer [Wed, 17 Jan 2018 12:26:08 +0000 (13:26 +0100)]
qemu: Fix segmentation fault when attaching a non iSCSI host device

Add a check if it's a iSCSI hostdev and if it's not then don't use the
union member 'iscsi'. The segmentation fault occured when accessing
secinfo->type, but this can vary from case to case.

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
7 years agorpm: updates wrt min required fedora version
Daniel P. Berrange [Thu, 11 Jan 2018 16:30:03 +0000 (16:30 +0000)]
rpm: updates wrt min required fedora version

Update the min fedora to 26. Use a macro to record the min versions so that the
later error message is always in sync with the earlier version check. Clarify
the comment that refers to guessing of dist which does not actually happen.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
7 years agospec: enable bash completion only on new enough distros
Pavel Hrdina [Wed, 17 Jan 2018 09:21:31 +0000 (10:21 +0100)]
spec: enable bash completion only on new enough distros

RHEL-6 doesn't have bash-completion package by default, it has to be
installed from EPEL.

Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
7 years agonodedev: Add the missing PCI dev checks for 'mdev_types' capability
Dan Zheng [Tue, 16 Jan 2018 04:21:21 +0000 (12:21 +0800)]
nodedev: Add the missing PCI dev checks for 'mdev_types' capability

Similar to commit @f44ec9c1, commit @500cbc06 introduced a new nested
'mdev_types' capability, however the mentioned commit didn't adjust
virNodeDeviceNumOfCaps and virNodeDeviceListCaps functions accordingly
to provide proper support for this capability.

After applying this patch the following python snippet returns the
expected results:
    import libvirt
    conn = libvirt.openReadOnly('qemu:///system')
    devs = conn.listAllDevices()
    for dev in devs:
        if 'mdev_types' in dev.listCaps():
            print dev.name(),dev.numOfCaps(),dev.listCaps()

Signed-off-by: Dan Zheng <dzheng@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
7 years agom4: Check for rl_completion_quote_character
Michal Privoznik [Sun, 14 Jan 2018 13:29:32 +0000 (14:29 +0100)]
m4: Check for rl_completion_quote_character

Apparently we can't assume that people run readline recent enough
to have rl_completion_quote_character (added in readline-5.0
released in 2011). However, we can't compile without it. So if
not present, disable readline.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
7 years agotools: Always compile {virsh,virt-admin}-completer.c
Michal Privoznik [Sun, 14 Jan 2018 10:51:44 +0000 (11:51 +0100)]
tools: Always compile {virsh,virt-admin}-completer.c

The functions defined in these sources are referenced all over
the place, however, compiler only when building with readline.
Thus when building without it linker gets sad as it can't find
them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
7 years agovsh: Provide cmdComplete stub for readline disabled builds
Michal Privoznik [Sun, 14 Jan 2018 10:43:51 +0000 (11:43 +0100)]
vsh: Provide cmdComplete stub for readline disabled builds

When building without readline, this function does nothing but
return false. Without touching any of its arguments which
triggers a build error. Therefore, provide a stub that has
arguments marked as unused.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
7 years agovshReadlineOptionsGenerator: Don't add already specified options to the list
Michal Privoznik [Fri, 12 Jan 2018 16:05:33 +0000 (17:05 +0100)]
vshReadlineOptionsGenerator: Don't add already specified options to the list

The current state of art is as follows:

 1) vshReadlineOptionsGenerator() generate all possible --options
 for given command, and then
 2) vshReadlineOptionsPrune() clears out already provided ones
 from the list.

Not only this brings needless memory complexity it is also not
trivial to get right. We can switch to easier approach: just
don't add already specified --options in the first step.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
7 years agotests: sysinfotest: add new test case for S390
Bjoern Walk [Fri, 12 Jan 2018 11:38:02 +0000 (12:38 +0100)]
tests: sysinfotest: add new test case for S390

Let's add a test case for S390 with CPU frequency information available.
Test data is sampled from an IBM z13 system running kernel 4.14 on LPAR.

Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Signed-off-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
7 years agoutil: virsysinfo: parse frequency information on S390
Bjoern Walk [Fri, 12 Jan 2018 11:38:01 +0000 (12:38 +0100)]
util: virsysinfo: parse frequency information on S390

Let's also parse the available processor frequency information on S390
so that it can be utilized by virsh sysinfo:

    # virsh sysinfo

    <sysinfo type='smbios'>
      ...
      <processor>
<entry name='family'>2964</entry>
<entry name='manufacturer'>IBM/S390</entry>
<entry name='version'>00</entry>
<entry name='max_speed'>5000</entry>
<entry name='serial_number'>145F07</entry>
      </processor>
      ...
    </sysinfo>

Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Signed-off-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
7 years agotravis: Skip nfs-common installation
Andrea Bolognani [Fri, 12 Jan 2018 10:41:06 +0000 (11:41 +0100)]
travis: Skip nfs-common installation

Installing nfs-common is broken on trusty since build #807

  https://travis-ci.org/libvirt/libvirt/builds/326705054

It's probably a transient error on Travis' side, so just comment
it out for the time being to allow builds to proceed.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
7 years agotravis: Sync packages with libvirt-jenkins-ci
Andrea Bolognani [Fri, 12 Jan 2018 10:02:38 +0000 (11:02 +0100)]
travis: Sync packages with libvirt-jenkins-ci

Make sure we install the same packages lcitool would install on
the CentOS CI so that we have consistent results. The package
list is current as of libvirt-jenkins-ci commit 3a559ae7bc08.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
7 years agodomcaps: Treat host models as case-insensitive strings
Scott Garfinkle [Tue, 26 Dec 2017 19:55:08 +0000 (13:55 -0600)]
domcaps: Treat host models as case-insensitive strings

Qemu 2.11 allows case-insensitive specification of CPU models.
This patch fixes the resulting problems on (at least) POWER
arch machines so that Power8 and POWER8 are not different.

Signed-off-by: Scott Garfinkle <scottgar@linux.vnet.ibm.com>
7 years agoqemu: Fix type of a completed job
Jiri Denemark [Thu, 11 Jan 2018 19:47:50 +0000 (20:47 +0100)]
qemu: Fix type of a completed job

Libvirt 3.7.0 and earlier libvirt reported a migration job as completed
immediately after QEMU finished sending migration data at which point
migration was not really complete yet. Commit v3.7.0-29-g3f2d6d829e
fixed this, but caused a regression in reporting statistics for
completed jobs which started reporting the job as still running. This
happened because the completed job statistics including the job status
are copied from the running job before we finally mark it as completed.

Let's make sure QEMU_DOMAIN_JOB_STATUS_COMPLETED is always set in the
completed job info even when the job has not finished yet.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agoqemu: Ignore fallback CPU attribute on reconnect
Jiri Denemark [Wed, 10 Jan 2018 14:56:21 +0000 (15:56 +0100)]
qemu: Ignore fallback CPU attribute on reconnect

When reconnecting to a running domain with host-model CPU started by old
libvirt which did not store the actual CPU in the status XML, we need to
ignore the fallback attribute to make sure we can translate the detected
host CPU model to a model which is supported by the running QEMU.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agom4: Don't enable bash-completion by default
Michal Privoznik [Thu, 11 Jan 2018 21:11:15 +0000 (22:11 +0100)]
m4: Don't enable bash-completion by default

Due to the way that check logic was written we basically enabled
bash completion whenever readline was enabled. This is not right
because it made bash-completion pkg-config module required.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agovirt-admin: Introduce vshAdmServerCompleter
Michal Privoznik [Tue, 7 Nov 2017 08:33:06 +0000 (09:33 +0100)]
virt-admin: Introduce vshAdmServerCompleter

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agovirsh: Introduce virshDomainInterfaceCompleter
Michal Privoznik [Mon, 6 Nov 2017 14:48:01 +0000 (15:48 +0100)]
virsh: Introduce virshDomainInterfaceCompleter

For given domain fetch list of defined interfaces. This can be
used for commands like domif-getlink and others. If available,
the interface name is returned (e.g. "vnet0", usually available
only for running domains), if not the MAC address is returned.
Moreover, the detach-interface command requires only MAC address
and therefore we have new flag that forces the completer to
return just the MAC address.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agovirsh: Introduce virshDomainNameCompleter
Michal Privoznik [Tue, 31 Oct 2017 08:24:21 +0000 (09:24 +0100)]
virsh: Introduce virshDomainNameCompleter

Now that we have everything prepared let the fun begin. This
completer is very simple and returns domain names. Moreover,
depending on the command it can return just a subset of domains
(e.g. only running/paused/transient/.. ones).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agotools: Provide bash autompletion file
Michal Privoznik [Thu, 2 Nov 2017 13:41:53 +0000 (14:41 +0100)]
tools: Provide bash autompletion file

The only purpose of this file is to be sourced. After that one
can use completion even for their bash:

  # virsh list --<TAB><TAB>
  --all                   --inactive ...

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agovsh: Introduce complete command
Michal Privoznik [Wed, 1 Nov 2017 14:34:14 +0000 (15:34 +0100)]
vsh: Introduce complete command

This command is going to be called from bash completion script in
the following form:

  virsh complete -- start --domain

Its only purpose is to return list of possible strings for
completion. Note that this is a 'hidden', unlisted command and
therefore there's no documentation to it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>