Commit Graph

31169 Commits

Author SHA1 Message Date
Simon Kobyda
c2b9cf6733 virsh: Implement vshTable API to nwfilter-list and nwfilterbinding-list
Signed-off-by: Simon Kobyda <skobyda@redhat.com>
2018-09-24 09:09:14 +02:00
Simon Kobyda
cf12efe088 virsh: Implement vshTable API to secret-list
Signed-off-by: Simon Kobyda <skobyda@redhat.com>
2018-09-24 09:09:14 +02:00
Simon Kobyda
71029ef588 virsh: Implement vshTable API to net-list and net-dhcp-leases
Signed-off-by: Simon Kobyda <skobyda@redhat.com>
2018-09-24 09:09:14 +02:00
Simon Kobyda
0396cf5336 virsh: Implement vsh-table to iface-list
Signed-off-by: Simon Kobyda <skobyda@redhat.com>
2018-09-24 09:09:14 +02:00
Wu Zongyong
2f754b26cb qemu: Update hostdevs device lists before connecting qemu monitor
In a following case:

    virsh start $domain
    service libvirtd stop
    <shutdown> the guest from within the $domain
    service libvirtd start

Notice that PCI devices which have been assigned to the $domain will
still be bound to stub drivers instead rebound to host drivers.
In that case the call stack is like below:

    libvirtd start
        qemuProcessReconnect
            qemuProcessStop (because $domain was shutdown without
                             libvirtd event to process that)
                qemuHostdevReAttachDomainDevices
                    qemuHostdevReAttachPCIDevices
                        virHostdevReAttachPCIDevices

However, because qemuHostdevUpdateActiveDomainDevices was called
after the qemuConnectMonitor, the setup of the tracking of each
host device in the $domain on either the activePCIHostdevs list
or inactivePCIHostdev list will not occur in an orderly manner.
Therefore, virHostdevReAttachPCIDevices just neglects these host PCI
devices which are bound to stub drivers and doesn't rebind them to
host drivers.

This patch fixs that by moving qemuHostdevUpdateActiveDomainDevices before
qemuConnectMonitor during libvirtd reconnection processing.

Signed-off-by: Wu Zongyong <cordius.wu@huawei.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-09-22 07:22:36 -04:00
Wang Yechao
fad65432ce qemu: Fix deadlock if create qemuProcessReconnect thread failed
Use the new qemuDomainRemoveInactiveJobLocked to remove the
@obj during the virDomainObjListForEach call which holds a
lock on the domain object list.

Signed-off-by: Wang Yechao <wang.yechao255@zte.com.cn>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-09-22 07:11:22 -04:00
Wang Yechao
a7b236345b qemu: Introduce qemuDomainRemoveInactiveJobLocked
Create a qemuDomainRemoveInactiveJobLocked which copies
qemuDomainRemoveInactiveJob except of course calling
another new helper qemuDomainRemoveInactiveLocked.

The qemuDomainRemoveInactiveLocked is a copy of
qemuDomainRemoveInactive except that instead of calling
virDomainObjListRemove it calls virDomainObjListRemoveLocked.

Signed-off-by: Wang Yechao <wang.yechao255@zte.com.cn>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-09-22 07:11:22 -04:00
Wang Yechao
6901a9321d qemu: Split up qemuDomainRemoveInactive
Introduce qemuDomainRemoveInactiveJobCommon to handle what will
be the common parts of the code with a new function that will
be used to call virDomainObjListRemoveLocked instead of the
unlocked variant.

Signed-off-by: Wang Yechao <wang.yechao255@zte.com.cn>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-09-22 07:11:22 -04:00
Andrea Bolognani
5095394e1e qemu: Drop QEMU_CAPS_DEVICE_SCSI_GENERIC
It was already available in 1.5.0, so we can assume it's
present and avoid checking for it at runtime.

This commit is best viewed with 'git show -w'.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2018-09-21 16:50:46 +02:00
Andrea Bolognani
e1fdffd374 tests: Fix duplicated capabilities
A bunch of SCSI test cases in qemuxml2argv used

  DO_TEST(...
          QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_SCSI,
          ...);

instead of the intended

  DO_TEST(...
          QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI,
          ...);

which is used correctly in qemuxml2xml. Fix them.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2018-09-21 16:50:39 +02:00
Andrea Bolognani
1a3de67001 qemu: Prefer qemu-system-* binaries
We already prefer them in capabilities, and domcapabilities
should be consistent with that.

This commit is best viewed with 'git show -w'.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2018-09-21 15:54:03 +02:00
Andrea Bolognani
7948ad4129 qemu: Refactor virQEMUCapsCacheLookupByArch()
The new implementation contains less duplicated code and
is easier to extend.

This commit is best viewed with 'git show -w'.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2018-09-21 15:54:01 +02:00
Andrea Bolognani
e9e3a3c0fe qemu: Rename qemubinCaps => qemuCaps
The latter is used throughout libvirt, so use it here as
well for consistency.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2018-09-21 15:53:59 +02:00
Andrea Bolognani
3df264080e qemu: Simplify QEMU binary search
Now that we have reduced the number of sensible options down
to either the native QEMU binary or RHEL's qemu-kvm, we can
make virQEMUCapsInitGuest() a bit simpler.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2018-09-21 15:53:57 +02:00
Andrea Bolognani
ed5efee914 qemu: Don't look for "qemu-kvm" and "kvm" binaries
Both Fedora's qemu-kvm and Debian's/Ubuntu's kvm are nothing
more than paper-thin wrappers around the native QEMU binary,
so we gain nothing by looking for them.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2018-09-21 15:53:55 +02:00
Andrea Bolognani
9f01f9b4e4 qemu: Remove unnecessary variables
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2018-09-21 15:53:53 +02:00
Andrea Bolognani
943f2d53c6 qemu: Expect a single binary in virQEMUCapsInitGuest()
We're only ever passing a single binary when calling this
function, so we can remove all code dealing with the
possibility of a second binary being specified.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2018-09-21 15:53:50 +02:00
Andrea Bolognani
83d86e348e qemu: Stop looking after finding the first binary
When the guest is native, we are currently looking at
potential KVM binaries regardless of whether or not we have
already located a QEMU binary suitable to run the guest.

This made sense back when KVM support was not part of QEMU
proper, but these days the KVM binaries are in most cases
just trivial wrapper scripts around the native QEMU binary
so it doesn't make sense to poke at them unless they're
the only binaries on the system, such as when running on
RHEL.

This will allow us to simplify both virQEMUCapsInitGuest()
and virQEMUCapsInitGuestFromBinary().

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2018-09-21 15:53:48 +02:00
Andrea Bolognani
0d131d3893 qemu: Move armv7l-on-aarch64 special case
When running an armv7l guest on an aarch64 hosts, the
qemu-system-aarch64 binary should be our first choice instead
of qemu-system-arm since the former can take advantage of KVM
acceleration.

Move the special case to virQEMUCapsFindBinaryForArch() so
that it's handled along with all other cases rather than on
its own later on.

Doing so will also make further refactoring easier.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2018-09-21 15:53:45 +02:00
Andrea Bolognani
b37b41f868 qemu: Don't duplicate binary name in capabilities
virCapabilitiesAddGuestDomain() takes an optional binary
name: this is intended for cases where a certain domain
type can't use the default one registered for the guest
architecture, but has to use a special binary instead.

The current code, however, will pass 'binary' again when
'kvmbin' is not defined, which is unnecessary as 'binary'
has been registered as default earlier, and will result
in capabilities output such as

  <emulator>/usr/bin/qemu-system-x86_64</emulator>
  <domain type='qemu'/>
  <domain type='kvm'>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
  </domain>

with the second <emulator> element providing no additional
information.

Change it so that, when 'kvmbin' is not defined, NULL is
passed and so the default emulator will be used instead.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2018-09-21 15:53:42 +02:00
Andrea Bolognani
99d5a516d0 qemu: Move comments to virQEMUCapsGuestIsNative()
The function performing the checks, rather than its callers,
should contain comments explaining the rationale behind said
checks.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2018-09-21 15:53:35 +02:00
Michal Privoznik
c846767bfa virsh: Display vhostuser socket path in domiflist
https://bugzilla.redhat.com/show_bug.cgi?id=1630164

The domiflist command is designed to show a brief information on
domain interfaces. One piece of information that is shows is
"Source" - source network, device, name, bridge. However, it's
ignoring vhostuser for which we can show the unix socket it's
associated with.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-09-21 15:01:29 +02:00
Michal Privoznik
c88ef717c8 qemu_hotplug: Fetch vhostuser ifname on hotplug
https://bugzilla.redhat.com/show_bug.cgi?id=1630164

Since 2a13a0a103 we are querying the vhostuser's interface name
when building qemu command line. However, we forgot to do so on
hotplug.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2018-09-21 14:59:35 +02:00
Fabiano Fidêncio
6efa07e7b9 xen_common: Change xenParseCharDev to use virConfGetValueStringList
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-09-20 16:39:22 -04:00
Fabiano Fidêncio
1bb379ad8e xen_common: Change xenParseVfbs to use virConfGetValueStringList
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-09-20 16:39:16 -04:00
Fabiano Fidêncio
5f0c1c1e25 xen_common: Change xenParsePCIList to use virConfGetValueStringList
The `if(!list || list->type != VIR_CONF_LIST)` check couldn't be
written in a 100% similar way. Instead, we're just checking whether
`virConfGetValueStringList() <= 0` and creating a new function to:
- return -1 in case virConfGetValueStringList fails either due to some
  allocation failure or when traversing the list;
- resetting the last error and return 0 otherwise;

Taking this approach we can have the behaviour with the new code as
close as possible to the old one.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-09-20 16:39:09 -04:00
Fabiano Fidêncio
b98d936c19 xen_common: Change xenConfigGetString to use virConfGetValueString
This change actually changes the behaviour of xenConfigGetString() as
now it returns a newly-allocated string.

Unfortunately, there's not much that can be done in order to avoid that
and all the callers have to be changed in order to avoid leaking the
return value.

Also, as a side-effect of the change above, the function now takes a
"char **" argument instead of a "const char **" one.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-09-20 16:39:01 -04:00
Fabiano Fidêncio
93c6239f21 xen_common: Change xenConfigGetUUID to use virConfGetValueString
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-09-20 16:39:01 -04:00
Fabiano Fidêncio
db343ca830 xen_common: Change xenConfigCopyStringInternal to use virConfGetValueString
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-09-20 16:39:01 -04:00
Boris Fiuczynski
efc29ab2e5 tests: domaincaps: Add QEMU 3.0 for s390x
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
2018-09-20 16:24:58 -04:00
Boris Fiuczynski
d7434ae800 tests: Add capabilities data for QEMU 3.0.0 on s390x
The QEMU binary is compiled from the v3.0.0 tag.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
2018-09-20 16:24:58 -04:00
John Ferlan
2c476dbc07 util: Fix travis build error
Commit 12093f1f used %ld instead of %zd for a size_t.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2018-09-20 14:57:22 -04:00
John Ferlan
e3a42028af Remove ignore_value or void from unlink calls
There seems to be no need to add the ignore_value wrapper or
caste with (void) to the unlink() calls, so let's just remove
them. I assume at one point in time Coverity complained. So,
let's just be consistent - those that care to check the return
status can and those that don't can just have the naked unlink.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2018-09-20 13:45:56 -04:00
Wang Huaqiang
6af8417415 conf: Introduce RDT monitor host capability
This patch is introducing cache monitor(CMT) to cache and
memory bandwidth monitor(MBM) for monitoring CPU memory
bandwidth.

The host capability of the two monitors is also introduced
in this patch.

For CMT, the host capability is shown like:
  <host>
  ...
    <cache>
      <bank id='0' level='3' type='both' size='15' unit='MiB' cpus='0-5'>
        <control granularity='768' min='1536' unit='KiB' type='both' maxAllocs='4'/>
      </bank>
      <monitor level='3' 'reuseThreshold'='270336' maxMonitors='176'>
        <feature name='llc_occupancy'/>
      </monitor>
    </cache>
    ...
  </host>

For MBM, the capability is shown like this:
  <host>
    ...
    <memory_bandwidth>
      <node id='1' cpus='6-11'>
        <control granularity='10' min ='10' maxAllocs='4'/>
      </node>
      <monitor maxMonitors='176'>
        <feature name='mbm_total_bytes'/>
        <feature name='mbm_local_bytes'/>
      </monitor>
    </memory_bandwidth>
    ...
  </host>

Signed-off-by: Wang Huaqiang <huaqiang.wang@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-09-20 13:06:02 -04:00
Wang Huaqiang
8f6887998b conf: Refactor memory bandwidth capability structure
Move memory bandwidth capability nodes into one data structure,
this allows us to add a monitor for memory bandwidth.

Signed-off-by: Wang Huaqiang <huaqiang.wang@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-09-20 13:06:02 -04:00
Wang Huaqiang
58fcee6f3a conf: Refactor cache bank capability structure
Move all cache banks into one data structure, this allows
us to add other cache component, such as cache monitor.

Signed-off-by: Wang Huaqiang <huaqiang.wang@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-09-20 13:06:02 -04:00
Wang Huaqiang
12093f1fea util: Introduce monitor capability interface
This patch introduces the resource monitor and creates the interface
for getting host capability of resource monitor from the system resource
control file system.

The resource monitor takes the role of RDT monitoring group and could be
used to monitor the resource consumption information, such as the last
level cache occupancy and the utilization of memory bandwidth.

Signed-off-by: Wang Huaqiang <huaqiang.wang@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2018-09-20 13:06:02 -04:00
Jim Fehlig
dc3d2c9f8c libxl: fallback to lib probe if pkgconfig file not found
With the assumption that all Xen >= 4.6 contains a pkgconfig file for
libxenlight, commit 5bdcef13 dropped the fallback check to probe
libxenlight with LIBVIRT_CHECK_LIB. At the time it was not known that
the various Xen pkgconfig files are in the -runtime package in Fedora,
instead of the traditional -devel package. This bug [1] was fixed in
Fedora > 28, but until Fedora 28 reaches EOL we'll need to re-introduce
the fallback check.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1629643

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2018-09-20 07:59:26 -06:00
Jim Fehlig
e44840c441 build: remove unused variables from virt-driver-libxl.m4
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2018-09-20 07:59:26 -06:00
John Ferlan
5309b6cb64 storage: Save error during refresh failure processing
https://bugzilla.redhat.com/show_bug.cgi?id=1614283

Save the error from the refresh failure because the stopPool
processing may overwrite the error or even worse clear it
due to calling an external libvirt API that resets the last
error such as is the case with the SCSI pool which may call
virGetConnectNodeDev (see commit decaeb288) in order to
process deleting an NPIV vport.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2018-09-20 07:49:49 -04:00
John Ferlan
5745f08cea storage: Introduce storagePoolRefreshFailCleanup
Create a common pool refresh failure handling method as the
same code is repeated multiple times.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2018-09-20 07:49:43 -04:00
John Ferlan
1ff45609d6 storage: Create error label path for storagePoolCreateXML
Rather than duplicate the error code, let's create an error
label to keep code common.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2018-09-20 07:49:38 -04:00
John Ferlan
4a7abc67d5 storage: Clean up storagePoolUpdateStateCallback processing
Alter the code path to remove the need to to go cleanup and thus
remove the label completely.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2018-09-20 07:49:33 -04:00
John Ferlan
49c322145b storage: Clean up stateFile if refreshPool fails
If the virStoragePoolRefresh fails and we call stopPool, the
code neglected to clean up the state file leading to the next
libvirtd restart attempting to start the pool. For a transient
pool this could make it unexpectedly reappear.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2018-09-20 07:49:19 -04:00
John Ferlan
9e52c64966 qemu: Ignore nwfilter binding instantiation issues during reconnect
https://bugzilla.redhat.com/show_bug.cgi?id=1607202

It's essentially stated in the nwfilterBindingDelete that we
will allow the admin to shoot themselves in the foot by deleting
the nwfilter binding which then allows them to undefine the
nwfilter that is in use for the running guest...

However, by allowing this we cause a problem for libvirtd
restart reconnect processing which would then try to recreate
the missing binding attempting to use the deleted filter
resulting in an error and thus shutting the guest down.

So rather than keep adding virDomainConfNWFilterInstantiate
flags to "ignore" specific error conditions, modify the logic
to ignore, but VIR_WARN errors other than ignoreExists. This
will at least allow the guest to not shutdown for only nwfilter
binding errors that we can now perhaps recover from since we
have the binding create/delete capability.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2018-09-20 07:31:55 -04:00
Erik Skultety
5165ff0971 src: More cleanup of some system headers already contained in internal.h
All of the ones being removed are pulled in by internal.h. The only
exception is sanlock which expects the application to include <stdint.h>
before sanlock's headers, because sanlock prototypes use fixed width
int, but they don't include stdint.h themselves, so we have to leave
that one in place.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
2018-09-20 10:16:39 +02:00
Erik Skultety
9403b63102 internal: Move <stdio.h> include to internal.h
It doesn't really make sense for us to have stdlib.h and string.h but
not stdio.h in the internal.h header.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
2018-09-20 10:16:38 +02:00
Jim Fehlig
212df3f957 libxl: remove configure check for libxl_domain_config_from_json
The libxl_domain_config_from_json API appeared in Xen 4.5, hence
there is no need to check for its existence after changing the
minimum supported Xen version to 4.6. Remove the check and its
use in the tests.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-09-19 09:41:09 -06:00
Erik Skultety
322d2e58d0 secret: Makefile: Fix an EXTRA_DIST typo
So, when trying to add some secret util sources, we referenced them with
a non-existent symbol.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2018-09-19 15:37:26 +02:00
Jiri Denemark
993d85ae5e cpu_map: Add Icelake CPU models
Introduced in QEMU by commit v3.0.0-156-g8a11c62da9.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2018-09-19 14:05:59 +02:00