Commit Graph

25913 Commits

Author SHA1 Message Date
Ján Tomko
e9f9690958 conf: do not steal pointers from the pool source
Since commit fcbbb28 we steal the pointer to the storage pool
source name if there was no pool name specified.

Properly duplicate the string to avoid freeing it twice.

https://bugzilla.redhat.com/show_bug.cgi?id=1436400
2017-03-29 10:36:55 +02:00
Ján Tomko
8ef12b96fa schema: do not require name for certain pool types
Pool types that have the VIR_STORAGE_POOL_SOURCE_NAME flag set
allow omitting the <name> element and instead fill out the pool name
from the <source><name> element.

Relax the schema to make <name> optional for these pools.
Expressing that at least one of these is required is out of scope
of the schema.
2017-03-29 10:36:55 +02:00
Michal Privoznik
ca8c36a9e3 qemuDomainGetStats: Copy domain ID too
One of the problems with our virGetDomain function is that it
copies just domain name and domain UUID. Therefore it's very
easy to forget aboud domain ID. This can cause some bugs, like
virConnectGetAllDomainStats not reporting proper domain IDs.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-03-29 09:29:45 +02:00
Michal Privoznik
2fe93123bf network: Don't crash on domain destroy
https://bugzilla.redhat.com/show_bug.cgi?id=1434882

Imagine the following scenario:

1) virsh net-start default
2) virsh start myFavouriteDomain
3) virsh net-destroy default
4) virsh destroy myFavouriteDomain

(assuming myFavouriteDomain has an interface from default
network)

Regardless of how unlikely this scenario looks like, we should
not crash. The problem is, on net-destroy in
networkShutdownNetworkVirtual() the virMacMap module is unrefed,
but the stale pointer is kept around. Thus when the domain
destroy procedure comes in, networkReleaseActualDevice() and
subsequently networkMacMgrDel() is called. This function sees the
stale pointer and starts calling the virMacMap module APIs which
work over freed memory.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-03-29 09:29:35 +02:00
Peter Krempa
d63d54e558 news: Update after recent commits
Mention the hyperv notifier and the new API to set block thresholds.
2017-03-28 14:07:44 +02:00
John Ferlan
0b7ec61bcc storage: Better describe logical pool creation/definition parameters
https://bugzilla.redhat.com/show_bug.cgi?id=1398087

Clean up the virsh man page description for --pool-create-as in order
to better describe how the various arguments are used when creating
(or defining) a logical pool.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2017-03-28 13:19:47 +02:00
Ján Tomko
fcb90d72ab Revert "storage: Better describe logical pool creation/definition parameters"
This reverts commit ca4515d263
which also included a functional change that broke logical storage pools
not named after their volume groups.
2017-03-28 13:19:47 +02:00
Jiri Denemark
efb446e1b0 storage: Fix build on i686
off_t is signed and it's size is the same as long only on 64b archs.
Thus it cannot be formatted as %lu.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-28 12:53:56 +02:00
Andrea Bolognani
0b483ddcb3 docs: Improve documentation related to memory locking 2017-03-28 10:54:50 +02:00
Andrea Bolognani
8cfe7d977a tests: Introduce QEMU memory locking limit tests
These tests cover a number of scenarios where we care about
the memory locking limit being set correctly for the guest
to work properly.
2017-03-28 10:54:50 +02:00
Andrea Bolognani
94918e2035 tests: Introduce virTestCompareToULL()
This will be used later on in the test suite.
2017-03-28 10:54:50 +02:00
Andrea Bolognani
868d043a09 process: Translate "unlimited" correctly
The value we use internally to represent the lack of a memory
locking limit, VIR_DOMAIN_MEMORY_PARAM_UNLIMITED, doesn't
match the value setrlimit() and prlimit() use for the same
purpose, RLIM_INFINITY, so we have to handle the translation
ourselves.

Partially-resolves: https://bugzilla.redhat.com/1431793
2017-03-28 10:54:49 +02:00
Andrea Bolognani
7e667664d2 qemu: Fix memory locking limit calculation
For guests that use <memoryBacking><locked>, our only option
is to remove the memory locking limit altogether.

Partially-resolves: https://bugzilla.redhat.com/1431793
2017-03-28 10:54:49 +02:00
Andrea Bolognani
1f7661af8c qemu: Remove qemuDomainRequiresMemLock()
Instead of having a separate function, we can simply return
zero from the existing qemuDomainGetMemLockLimitBytes() to
signal the caller that the memory locking limit doesn't need
to be set for the guest.

Having a single function instead of two makes it less likely
that we will use the wrong value, which is exactly what
happened when we started applying the limit that was meant
for VFIO-using guests to <memoryBacking><locked>-using
guests.
2017-03-28 10:54:47 +02:00
Andrea Bolognani
4b67e7a377 Revert "qemu: Forbid <memoryBacking><locked> without <memtune><hard_limit>"
This reverts commit c2e60ad0e5.

Turns out this check is excessively strict: there are ways
other than <memtune><hard_limit> to raise the memory locking
limit for QEMU processes, one prominent example being
tweaking /etc/security/limits.conf.

Partially-resolves: https://bugzilla.redhat.com/1431793
2017-03-28 10:44:25 +02:00
Jiri Denemark
c2568133bb news: Fix typo in element name
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-28 10:12:22 +02:00
Jiri Denemark
ecc3a63bf2 news: Move recent bug fixes into 3.2.0 release
Commits 29f7b5ea6a and 5edf9aaf54 pushed them incorrectly at the end of
the file in the bug fixes section for libvirt 2.5.0.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-27 22:51:07 +02:00
Martin Kletzander
ea4769a1b5 news: Make changes understandable for users
When reading release notes, patch summary is not always the best
description of what users can expect in new version.  I propose
changing it slightly so that it describes what exactly happens and
when.

However, we do not have to add every single code change to the news
file, that would be ridiculous and unreadable for users.  If the patch
subject needs changes like this one, I'm rather tempted to say that
such changes should not be in the news file at all.  So that would be
the other way how to fix this.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2017-03-27 22:46:48 +02:00
Martin Kletzander
452f014abf Build vircaps2xmltest and requirements only on Linux
The mock, as well as the test, is only available on Linux.  So skip
building it everywhere else, especially when it fails on mingw.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2017-03-27 22:38:40 +02:00
Martin Kletzander
0fc454cec0 Use stub for virNetDevGetName on mingw
If if_indextoname is not defined, the whole function using it should
not be defined either.  Add stub to fix build on mingw.

Caused by 5dd607059d

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2017-03-27 22:26:21 +02:00
Jiri Denemark
5498aa29a7 qemu: Free persistent def inside qemuMigrationCookieFree
Creating a copy of the definition we want to add in a migration cookie
makes the code cleaner and less prone to memory leaks or double free
errors.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-27 20:55:18 +02:00
Jiri Denemark
6052f75de5 qemu: Typedef migration cookie enums
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-27 20:55:18 +02:00
Jiri Denemark
7c6b609ac4 qemu: Fix formatting in qemu_migration_cookie.c
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-27 20:55:18 +02:00
Jiri Denemark
e50fb329a9 qemu: Move migration cookies to a separate file
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-27 20:55:14 +02:00
Jiri Denemark
3c666cde0c news: Add support for setting TSC frequency
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-27 20:41:02 +02:00
John Ferlan
5edf9aaf54 docs: Add news article for logical pool-create-as 2017-03-27 14:31:42 -04:00
John Ferlan
ca4515d263 storage: Better describe logical pool creation/definition parameters
https://bugzilla.redhat.com/show_bug.cgi?id=1398087

Clean up the virsh man page description for --pool-create-as in order
to better describe how the various arguments are used when creating
(or defining) a logical pool.

Also modify the storage pool XML parsing algorithm to check for the
mismatched "name" and "source-name".
2017-03-27 14:31:42 -04:00
John Ferlan
5d5380cf66 virsh.pod: Move the positional --print-xml for pool-{define|create}-as
Move the --print-xml to the end of the qualifiers since it's not
properly positionally situated for both --pool-create-as and --pool-define-as
and could be miscontrued as being the 3rd positional argument.
2017-03-27 14:31:42 -04:00
John Ferlan
4572843d4a conf: Set defaultFormat if no storage source XML present
While parsing if the storage source is not present, then a defaultFormat
was not set. This could lead to oddities such as seeing "unknown" format
in output for the "logical" pool even though the only format the pool could
support would be "lvm2".

This does "put a label" on other pool defaults as follows:

   File System: FS_AUTO
   Network File System: NETFS_AUTO
   Disk: UNKNOWN

Each of which is the "0" value for their respective pools and thus
would be no "real" change.
2017-03-27 14:31:42 -04:00
Jiri Denemark
03eeb84fed qemu: Allow migration with invtsc if tsc frequency is set
Migration with invtsc is allowed by QEMU as long as TSC frequency is
explicitly specified.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-27 20:16:32 +02:00
Jiri Denemark
6cb8bf6ab9 qemu: Use virCPUCheckFeature in qemuMigrationIsAllowed
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-27 20:16:32 +02:00
Jiri Denemark
7373c4e48f qemu: Add support for setting TSC frequency
QEMU allows for TSC frequency to be explicitly set to enable migration
with invtsc (migration fails if the destination QEMU cannot set the
exact same frequency used when starting the domain on the source host).

Libvirt already supports setting the TSC frequency in the XML using

    <clock>
      <timer name='tsc' frequency='1234567890'/>
    </clock>

which will be transformed into

    -cpu Model,tsc-frequency=1234567890

QEMU command line.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-27 20:16:32 +02:00
Jiri Denemark
5a506cce38 conf: Fix XML parser for timer frequency
The frequency is documented and formatted as an attribute of the <timer>
element rather than a nested <frequency> element expected by the parser.
Luckily enough, timer frequency has not been used by any driver so far.
And users were not able to set it in the XML either.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-27 20:16:32 +02:00
Roman Bogorodskiy
8ffffae97f virmdev: fix build on non-Linux
- Make virMediatedDeviceNew() stub args match its prototype
 - Fix typo: virRerportError -> virReportError
 - Move MDEV_SYSFS_DEVICES definition out of the #ifdef __linux__ block
   so we don't have to stub virMediatedDeviceGetSysfsPath()
2017-03-27 21:59:39 +04:00
Roman Bogorodskiy
5efdc1a6e2 netdev: fix build on non-Linux
Fix typo: virNetDevVLanPtr -> virNetDevVlanPtr.
2017-03-27 21:59:20 +04:00
Jiri Denemark
9bca66530b util: Fix build on FreeBSD
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-27 19:43:31 +02:00
John Ferlan
29f7b5ea6a news: Add logical overwrite 2017-03-27 12:52:32 -04:00
John Ferlan
6760cc4bfd logical: Need to overwrite/clear more than just first 512 bytes
https://bugzilla.redhat.com/show_bug.cgi?id=1430679

As it turns out some file headers (e.g. ext4) may be larger/longer than
the 512 bytes of zeros being written prior to a pvcreate, so let's write
out 2048 bytes similar to how the pvcreate sources would peek at the first
4 sectors of the device.

Make sure there is at enough bytes on the device to clear before doing
doing the clear - just to be sure.
2017-03-27 12:48:05 -04:00
John Ferlan
2902771fa0 util: Remove NONNULL from virHostdevReAttachMediatedDevices
Causes build failure when enabling static analysis
2017-03-27 12:41:24 -04:00
John Ferlan
69577aeaf9 news: Add <change> lost in merge
Ensure to insert </change> <change> between items - lost during merge
resolution.
2017-03-27 12:40:52 -04:00
Laine Stump
5c8d622f5d network: better validation of devices in hostdev network pool
This adds a few validations to the devices listed for a hostdev network:

* devices must be listed by PCI address, not by netdev name

* listing a device by PCI address is valid only for hostdev networks, not
  for other types of network (e.g. macvtap passthrough).

* each device in a hostdev pool must be an SR-IOV VF

Resolves: https://bugzilla.redhat.com/1004676
2017-03-27 12:15:39 -04:00
Martin Kletzander
76107bf1d9 Expose Linux symbols only on Linux
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2017-03-27 17:36:13 +02:00
Martin Kletzander
71732f0f54 virhostcpu: Make only defined symbols available
That way you get the error from the compiler before the linker.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2017-03-27 17:34:59 +02:00
Martin Kletzander
9c5ac84d76 virhostcpu: Expose virHostCPUGetOnline on non-Linux
Previously, this function must've been called only on Linux in order
to fail gracefully.  That lead to #ifdef mess in callers, so the
function was redesigned so it failed gracefully on non-existing
files.  However that commit forgot to define the function outside the
__linux__ ifdef, it broke non-Linux builds.

Caused by c67e04e25f.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2017-03-27 17:34:59 +02:00
Martin Kletzander
75f30a60e6 tests: Properly dereference cpus pointer in virnumamock.c
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2017-03-27 17:34:59 +02:00
Ján Tomko
df6551feb4 virsh: reject more negative numbers
Be more positive and reject negative numbers where we don't
allow them by using the virStrToLong variants with 'p'.

https://bugzilla.redhat.com/show_bug.cgi?id=1436119
2017-03-27 17:20:03 +02:00
Ján Tomko
2da7f545a3 storage: reject negative capacity
https://bugzilla.redhat.com/show_bug.cgi?id=1436119
2017-03-27 17:20:03 +02:00
Jiri Denemark
eeeaaa0b73 build: Fix syntax check in VPATH
Matching the beginning of a path in syntax check does not work because
each path is enriched with a prefix of the source tree.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-27 16:53:18 +02:00
Jiri Denemark
88a185960d build: Fix sc_prohibit_exit_in_tests syntax check
This check makes sense only in *.c files.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-27 16:52:29 +02:00
Jiri Denemark
84cc51ea74 cputest: Add tests for virCPUUpdateLive API
The test takes

  x86-cpuid-Something-guest.xml CPU (the CPU libvirt would use for
    host-model on a CPU described by x86_64-cpuid-Something.xml without
    talking to QEMU about what it supports on the host)

and updates it according to CPUID data from QEMU:

  x86_64-cpuid-Something-enabled.xml (reported as "feature-words"
    property of the CPU device)

and

  x86_64-cpuid-Something-disabled.xml (reported as "filtered-features"
    property of the CPU device).

The result is compared to

  x86_64-cpuid-Something-json.xml (the CPU libvirt would use as
    host-model based on the reply from query-cpu-model-expansion).

The comparison is a bit tricky because the *-json.xml CPU contains fewer
disabled features. Only the features which are included in the base CPU
model, but listed as disabled in *.json will be disabled in *-json.xml.
The CPU computed by virCPUUpdateLive from the test data will list all
features present in the host's CPUID data and not enabled in *.json as
disabled. The cpuTestUpdateLiveCompare function checks that the computed
and expected sets of enabled features match.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-27 16:29:27 +02:00