]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
8 years agoqemu: Remove redundant capabilities
Andrea Bolognani [Thu, 30 Mar 2017 12:33:54 +0000 (14:33 +0200)]
qemu: Remove redundant capabilities

Now that the NO_ACPI and NO_HPET capabilities are set
automatically by virQEMUCapsInitQMPBasicArch() if
appropriate for the architecture, they shouldn't be
used manually to avoid masking bugs.

8 years agotests: Initialize basic capabilities properly
Andrea Bolognani [Thu, 2 Mar 2017 18:24:22 +0000 (19:24 +0100)]
tests: Initialize basic capabilities properly

The capabilities used in test cases should match those used
during normal operation for the tests to make any sense.

This results in the generated command line for a few test
cases (most notably non-x86 test cases that were wrongly
assuming they could use -no-acpi) changing.

8 years agoqemu: Split virQEMUCapsInitArchQMPBasic()
Andrea Bolognani [Mon, 27 Mar 2017 14:42:17 +0000 (16:42 +0200)]
qemu: Split virQEMUCapsInitArchQMPBasic()

Instead of having a single function that probes the
architecture from the monitor and then sets a bunch of
basic capabilities based on it, have a separate function
for each part: virQEMUCapsInitQMPArch() only sets the
architecture, and virQEMUCapsInitQMPBasicArch() only sets
the capabilities.

This split will be useful later on, when we will want to
set basic capabilities from the test suite without having
to go through the pain of mocking the monitor.

8 years agonews: Allow empty <section> elements
Andrea Bolognani [Tue, 28 Mar 2017 15:13:39 +0000 (17:13 +0200)]
news: Allow empty <section> elements

Creating dummy <change> elements was a workaround for the
HTML DTD not allowing empty <ul> elements, but we can do
better by tweaking the the XSLT stylesheet.

8 years agonews: Remove handling of random HTML tags
Andrea Bolognani [Tue, 28 Mar 2017 14:25:21 +0000 (16:25 +0200)]
news: Remove handling of random HTML tags

Now that the source file is validated against a schema that
only allows the <code> HTML tag to be used, we can rely on
that assumption to simplify our XSLT stylesheet.

8 years agostorage: driver: Remove unavailable transient pools after restart
Peter Krempa [Thu, 30 Mar 2017 11:47:45 +0000 (13:47 +0200)]
storage: driver: Remove unavailable transient pools after restart

If a transient storage pool is deemed inactive after libvirtd restart it
would not be deleted from the list. Reuse virStoragePoolUpdateInactive
along with a refactor necessary to properly update the state.

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

8 years agostorage: driver: Split out code fixing pool state after deactivation
Peter Krempa [Thu, 30 Mar 2017 11:45:45 +0000 (13:45 +0200)]
storage: driver: Split out code fixing pool state after deactivation

After a pool is made inactive the definition objects need to be updated
(if a new definition is prepared) and transient pools need to be
completely removed. Split out the code doing these steps into a separate
function for later reuse.

8 years agostorage: backend: Use correct stringifier for pool type
Peter Krempa [Thu, 30 Mar 2017 08:13:36 +0000 (10:13 +0200)]
storage: backend: Use correct stringifier for pool type

When registering a storage poll backend, the code would use
virStorageTypeToString instead of virStoragePoolTypeToString. The
following message would be logged:

virDriverLoadModuleFunc:71 : Lookup function 'virStorageBackendSCSIRegister'
virStorageBackendRegister:174 : Registering storage backend '(null)'

8 years agoschema: Introduce schema for the news.xml file
Peter Krempa [Tue, 28 Mar 2017 11:35:05 +0000 (13:35 +0200)]
schema: Introduce schema for the news.xml file

Since this file gets changed (and broken) rather often, introduce a
schema file so that the test suite can validate it.

8 years agonews: Introduce rules for the schema file and fix offending lines
Peter Krempa [Fri, 31 Mar 2017 07:52:26 +0000 (09:52 +0200)]
news: Introduce rules for the schema file and fix offending lines

Add stricter rules for the news file and fix offending entries.

8 years agotests: schema: Add possibility to validate individual files
Peter Krempa [Tue, 28 Mar 2017 11:28:02 +0000 (13:28 +0200)]
tests: schema: Add possibility to validate individual files

Sometimes it may be desired to validate individual files against a
schema. Refactor the data structures to unify them and introduce a new
macro DO_TEST_FILE(schema, xmlfile) which will test the XML file against
the given schema file.

8 years agoIntroduce and use virDomainDiskEmptySource
Michal Privoznik [Fri, 31 Mar 2017 13:59:54 +0000 (15:59 +0200)]
Introduce and use virDomainDiskEmptySource

Currently, if we want to zero out disk source (e,g, due to
startupPolicy when starting up a domain) we use
virDomainDiskSetSource(disk, NULL). This works well for file
based storage (storage type file, dir, or block). But it doesn't
work at all for other types like volume and network.

So imagine that you have a domain that has a CDROM configured
which source is a volume from an inactive pool. Because it is
startupPolicy='optional', the CDROM is empty when the domain
starts. However, the source element is not cleared out in the
status XML and thus when the daemon restarts and tries to
reconnect to the domain it refreshes the disks (which fails - the
storage pool is still not running) and thus the domain is killed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirDomainDiskDefForeachPath: Prefer virStorageSourceIsLocalStorage
Michal Privoznik [Thu, 30 Mar 2017 15:02:39 +0000 (17:02 +0200)]
virDomainDiskDefForeachPath: Prefer virStorageSourceIsLocalStorage

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agonetworkUpdateState: Create virMacMap module more frequently
Michal Privoznik [Wed, 22 Mar 2017 10:07:56 +0000 (11:07 +0100)]
networkUpdateState: Create virMacMap module more frequently

The virMacMap module is there for dumping [domain, <list of is
MACs>] pairs into a file so that libvirt_guest NSS module can use
it. Whenever a interface is allocated from network (e.g. on
domain<F2> startup or NIC hotplug), network is notified and so is
virMacMap module subsequently. The module update functions
networkMacMgrAdd() and networkMacMgrDel() gracefully handle the
case when there's no module. The problem is, the module is
created if and only if network is freshly started, or if the
daemon restarts and network previously had the module.

This is not very user friendly - if users want to use the NSS
module they need to destroy their network and bring it up again
(and subsequently all the domains using it).

One disadvantage of this approach implemented here is that one
may get just partial results: any already running network does
not record mac maps, thus only newly plugged domains will be
stored in the module. The network restart scenario is not touched
by this of course. But one can argue that older libvirts had
never recorded the mac maps anyway.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirGetDomain: Set domain ID too
Michal Privoznik [Tue, 28 Mar 2017 15:08:03 +0000 (17:08 +0200)]
virGetDomain: Set domain ID too

So far our code is full of the following pattern:

  dom = virGetDomain(conn, name, uuid)
  if (dom)
      dom->id = 42;

There is no reasong why it couldn't be just:

  dom = virGetDomain(conn, name, uuid, id);

After all, client domain representation consists of tuple (name,
uuid, id).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoPost-release version bump to 3.3.0
Martin Kletzander [Mon, 3 Apr 2017 06:17:14 +0000 (08:17 +0200)]
Post-release version bump to 3.3.0

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoRelease of libvirt-3.2.0
Daniel Veillard [Sun, 2 Apr 2017 14:59:37 +0000 (16:59 +0200)]
Release of libvirt-3.2.0

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

8 years agodocs: bhyve: fix typo
Roman Bogorodskiy [Sat, 1 Apr 2017 14:27:29 +0000 (18:27 +0400)]
docs: bhyve: fix typo

USB tables -> USB tablet.

8 years agohyperv: fixed typo in function name
Dawid Zamirski [Thu, 30 Mar 2017 16:47:18 +0000 (12:47 -0400)]
hyperv: fixed typo in function name

that is: s/hyperyVerifyResponse/hypervVerifyResponse/

8 years agoDocument virDomainAbortJob behavior for post-copy migration
Jiri Denemark [Fri, 31 Mar 2017 18:41:39 +0000 (20:41 +0200)]
Document virDomainAbortJob behavior for post-copy migration

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoadmin: Throw a system error when 'open' fails on user-provided output
Erik Skultety [Fri, 31 Mar 2017 08:05:08 +0000 (10:05 +0200)]
admin: Throw a system error when 'open' fails on user-provided output

There was an unhandled 'open' call which resulted in:

"error: Library function returned error but did not set virError"

Even if this happens during the daemon's start when we still don't have
any set of outputs defined yet, we can safely report an error, since we
automatically fallback to stderr which is fine even for both
running as a daemonized process, since this happens before the daemon
forks into the background, and running as a systemd service, since
systemd re-directs std outputs to journald by default.

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

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agonews: Add template for a <release> section
Peter Krempa [Fri, 31 Mar 2017 07:48:42 +0000 (09:48 +0200)]
news: Add template for a <release> section

After the release it's necessary to add a new <release> section for the
upcoming release. Add a template so that it does not have to be
compiled over and over again.

8 years agoqemuDomainSnapshotPrepare: Don't always assume vm->def->os.loader
Michal Privoznik [Thu, 30 Mar 2017 12:03:45 +0000 (14:03 +0200)]
qemuDomainSnapshotPrepare: Don't always assume vm->def->os.loader

In 9e2465834 a check that denies internal snapshots when pflash
based loader is configured for the domain. However, if there's
none and an user tries to do an internal snapshot they will
witness daemon crash as in that case vm->def->os.loader is NULL
and we dereference it unconditionally.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu: Check non-migratable host CPU features
Jiri Denemark [Wed, 29 Mar 2017 09:00:32 +0000 (11:00 +0200)]
qemu: Check non-migratable host CPU features

CPU features which change their value from disabled to enabled between
two calls to query-cpu-model-expansion (the first with no extra
properties set and the second with 'migratable' property set to false)
can be marked as enabled and non-migratable in qemuMonitorCPUModelInfo.

Since the code consuming qemuMonitorCPUModelInfo currently ignores the
migratable flag, this change is effectively changing the CPU model
advertised in domain capabilities to contain all features (even those
which block migration). And this matches what we do for QEMU older than
2.9.0, when we detect all CPUID bits ourselves without asking QEMU.

As a result of this change

    <cpu mode='host-model'>
      <feature name='invtsc' policy='require'/>
    </cpu>

will work with all QEMU versions. Such CPU definition would be forbidden
with QEMU >= 2.9.0 without this patch.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Check migratable host CPU features
Jiri Denemark [Wed, 29 Mar 2017 08:58:41 +0000 (10:58 +0200)]
qemu: Check migratable host CPU features

If calling query-cpu-model-expansion on the 'host'/'max' CPU model with
'migratable' property set to false succeeds, we know QEMU is able to
tell us which features would disable migration. Thus we can mark all
enabled features as migratable.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemuMonitorCPUModelInfo: Add support for non-migratable features
Jiri Denemark [Wed, 29 Mar 2017 08:33:08 +0000 (10:33 +0200)]
qemuMonitorCPUModelInfo: Add support for non-migratable features

QEMU is able to tell us whether a CPU feature would block migration or
not. This patch adds support for storing such features in
qemuMonitorCPUModelInfo.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agodocs: document bhyve UEFI support
Roman Bogorodskiy [Mon, 20 Mar 2017 13:53:18 +0000 (17:53 +0400)]
docs: document bhyve UEFI support

 - Add a news entry
 - Update the driver page with documentation of the new options
   and some examples

8 years agoqemu: domain: Properly lookup top of chain in qemuDomainGetStorageSourceByDevstr
Peter Krempa [Wed, 29 Mar 2017 14:56:05 +0000 (16:56 +0200)]
qemu: domain: Properly lookup top of chain in qemuDomainGetStorageSourceByDevstr

When idx is 0 virStorageFileChainLookup returns the base (bottom) of the
backing chain rather than the top. This is expected by the callers of
qemuDomainGetStorageSourceByDevstr.

Add a special case for idx == 0

8 years agoconf: do not steal pointers from the pool source
Ján Tomko [Tue, 28 Mar 2017 13:11:52 +0000 (15:11 +0200)]
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

8 years agoschema: do not require name for certain pool types
Ján Tomko [Tue, 28 Mar 2017 13:07:50 +0000 (15:07 +0200)]
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.

8 years agoqemuDomainGetStats: Copy domain ID too
Michal Privoznik [Tue, 28 Mar 2017 13:47:42 +0000 (15:47 +0200)]
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>
8 years agonetwork: Don't crash on domain destroy
Michal Privoznik [Wed, 22 Mar 2017 12:07:14 +0000 (13:07 +0100)]
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>
8 years agonews: Update after recent commits
Peter Krempa [Mon, 27 Mar 2017 15:35:34 +0000 (17:35 +0200)]
news: Update after recent commits

Mention the hyperv notifier and the new API to set block thresholds.

8 years agostorage: Better describe logical pool creation/definition parameters
John Ferlan [Sat, 25 Mar 2017 12:07:36 +0000 (08:07 -0400)]
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>
8 years agoRevert "storage: Better describe logical pool creation/definition parameters"
Ján Tomko [Tue, 28 Mar 2017 07:45:10 +0000 (09:45 +0200)]
Revert "storage: Better describe logical pool creation/definition parameters"

This reverts commit ca4515d2639057020c749470f390fe1f5981e91e
which also included a functional change that broke logical storage pools
not named after their volume groups.

8 years agostorage: Fix build on i686
Jiri Denemark [Tue, 28 Mar 2017 10:48:31 +0000 (12:48 +0200)]
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>
8 years agodocs: Improve documentation related to memory locking
Andrea Bolognani [Thu, 23 Mar 2017 17:22:15 +0000 (18:22 +0100)]
docs: Improve documentation related to memory locking

8 years agotests: Introduce QEMU memory locking limit tests
Andrea Bolognani [Thu, 23 Mar 2017 13:06:57 +0000 (14:06 +0100)]
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.

8 years agotests: Introduce virTestCompareToULL()
Andrea Bolognani [Thu, 23 Mar 2017 13:29:43 +0000 (14:29 +0100)]
tests: Introduce virTestCompareToULL()

This will be used later on in the test suite.

8 years agoprocess: Translate "unlimited" correctly
Andrea Bolognani [Wed, 22 Mar 2017 12:44:45 +0000 (13:44 +0100)]
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

8 years agoqemu: Fix memory locking limit calculation
Andrea Bolognani [Wed, 22 Mar 2017 12:44:13 +0000 (13:44 +0100)]
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

8 years agoqemu: Remove qemuDomainRequiresMemLock()
Andrea Bolognani [Tue, 21 Mar 2017 18:52:50 +0000 (19:52 +0100)]
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.

8 years agoRevert "qemu: Forbid <memoryBacking><locked> without <memtune><hard_limit>"
Andrea Bolognani [Thu, 16 Mar 2017 17:23:56 +0000 (18:23 +0100)]
Revert "qemu: Forbid <memoryBacking><locked> without <memtune><hard_limit>"

This reverts commit c2e60ad0e5124482942164e5fec088157f5e716a.

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

8 years agonews: Fix typo in element name
Jiri Denemark [Tue, 28 Mar 2017 08:12:22 +0000 (10:12 +0200)]
news: Fix typo in element name

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agonews: Move recent bug fixes into 3.2.0 release
Jiri Denemark [Mon, 27 Mar 2017 20:50:30 +0000 (22:50 +0200)]
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>
8 years agonews: Make changes understandable for users
Martin Kletzander [Mon, 27 Mar 2017 20:25:39 +0000 (22:25 +0200)]
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>
8 years agoBuild vircaps2xmltest and requirements only on Linux
Martin Kletzander [Mon, 27 Mar 2017 20:08:45 +0000 (22:08 +0200)]
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>
8 years agoUse stub for virNetDevGetName on mingw
Martin Kletzander [Mon, 27 Mar 2017 19:49:06 +0000 (21:49 +0200)]
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 5dd607059d8a98e04024305ae4afbd038aadbdcd

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoqemu: Free persistent def inside qemuMigrationCookieFree
Jiri Denemark [Tue, 21 Mar 2017 10:04:16 +0000 (11:04 +0100)]
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>
8 years agoqemu: Typedef migration cookie enums
Jiri Denemark [Tue, 21 Mar 2017 09:36:53 +0000 (10:36 +0100)]
qemu: Typedef migration cookie enums

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Fix formatting in qemu_migration_cookie.c
Jiri Denemark [Tue, 21 Mar 2017 11:47:19 +0000 (12:47 +0100)]
qemu: Fix formatting in qemu_migration_cookie.c

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Move migration cookies to a separate file
Jiri Denemark [Mon, 27 Mar 2017 18:50:44 +0000 (20:50 +0200)]
qemu: Move migration cookies to a separate file

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agonews: Add support for setting TSC frequency
Jiri Denemark [Mon, 27 Mar 2017 18:31:10 +0000 (20:31 +0200)]
news: Add support for setting TSC frequency

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agodocs: Add news article for logical pool-create-as
John Ferlan [Mon, 27 Mar 2017 17:18:49 +0000 (13:18 -0400)]
docs: Add news article for logical pool-create-as

8 years agostorage: Better describe logical pool creation/definition parameters
John Ferlan [Sat, 25 Mar 2017 12:07:36 +0000 (08:07 -0400)]
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".

8 years agovirsh.pod: Move the positional --print-xml for pool-{define|create}-as
John Ferlan [Mon, 27 Mar 2017 17:14:55 +0000 (13:14 -0400)]
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.

8 years agoconf: Set defaultFormat if no storage source XML present
John Ferlan [Mon, 27 Mar 2017 17:01:56 +0000 (13:01 -0400)]
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.

8 years agoqemu: Allow migration with invtsc if tsc frequency is set
Jiri Denemark [Fri, 24 Mar 2017 08:27:26 +0000 (09:27 +0100)]
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>
8 years agoqemu: Use virCPUCheckFeature in qemuMigrationIsAllowed
Jiri Denemark [Fri, 24 Mar 2017 08:27:16 +0000 (09:27 +0100)]
qemu: Use virCPUCheckFeature in qemuMigrationIsAllowed

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Add support for setting TSC frequency
Jiri Denemark [Thu, 23 Mar 2017 14:54:38 +0000 (15:54 +0100)]
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>
8 years agoconf: Fix XML parser for timer frequency
Jiri Denemark [Thu, 23 Mar 2017 14:53:50 +0000 (15:53 +0100)]
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>
8 years agovirmdev: fix build on non-Linux
Roman Bogorodskiy [Mon, 27 Mar 2017 15:38:33 +0000 (19:38 +0400)]
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()

8 years agonetdev: fix build on non-Linux
Roman Bogorodskiy [Mon, 27 Mar 2017 15:25:16 +0000 (19:25 +0400)]
netdev: fix build on non-Linux

Fix typo: virNetDevVLanPtr -> virNetDevVlanPtr.

8 years agoutil: Fix build on FreeBSD
Jiri Denemark [Mon, 27 Mar 2017 17:43:31 +0000 (19:43 +0200)]
util: Fix build on FreeBSD

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agonews: Add logical overwrite
John Ferlan [Mon, 27 Mar 2017 16:52:32 +0000 (12:52 -0400)]
news: Add logical overwrite

8 years agological: Need to overwrite/clear more than just first 512 bytes
John Ferlan [Fri, 24 Mar 2017 16:25:27 +0000 (12:25 -0400)]
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.

8 years agoutil: Remove NONNULL from virHostdevReAttachMediatedDevices
John Ferlan [Mon, 27 Mar 2017 15:25:20 +0000 (11:25 -0400)]
util: Remove NONNULL from virHostdevReAttachMediatedDevices

Causes build failure when enabling static analysis

8 years agonews: Add <change> lost in merge
John Ferlan [Mon, 27 Mar 2017 15:20:58 +0000 (11:20 -0400)]
news: Add <change> lost in merge

Ensure to insert </change> <change> between items - lost during merge
resolution.

8 years agonetwork: better validation of devices in hostdev network pool
Laine Stump [Sat, 25 Mar 2017 18:00:13 +0000 (14:00 -0400)]
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

8 years agoExpose Linux symbols only on Linux
Martin Kletzander [Mon, 27 Mar 2017 15:11:49 +0000 (17:11 +0200)]
Expose Linux symbols only on Linux

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agovirhostcpu: Make only defined symbols available
Martin Kletzander [Mon, 27 Mar 2017 14:15:45 +0000 (16:15 +0200)]
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>
8 years agovirhostcpu: Expose virHostCPUGetOnline on non-Linux
Martin Kletzander [Mon, 27 Mar 2017 14:16:43 +0000 (16:16 +0200)]
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 c67e04e25fa58104e0fae41f5b874a8067557073.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agotests: Properly dereference cpus pointer in virnumamock.c
Martin Kletzander [Mon, 27 Mar 2017 13:47:58 +0000 (15:47 +0200)]
tests: Properly dereference cpus pointer in virnumamock.c

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agovirsh: reject more negative numbers
Ján Tomko [Mon, 27 Mar 2017 12:17:42 +0000 (14:17 +0200)]
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

8 years agostorage: reject negative capacity
Ján Tomko [Mon, 27 Mar 2017 12:33:16 +0000 (14:33 +0200)]
storage: reject negative capacity

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

8 years agobuild: Fix syntax check in VPATH
Jiri Denemark [Mon, 27 Mar 2017 14:48:19 +0000 (16:48 +0200)]
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>
8 years agobuild: Fix sc_prohibit_exit_in_tests syntax check
Jiri Denemark [Mon, 27 Mar 2017 14:46:12 +0000 (16:46 +0200)]
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>
8 years agocputest: Add tests for virCPUUpdateLive API
Jiri Denemark [Thu, 16 Mar 2017 11:26:30 +0000 (12:26 +0100)]
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>
8 years agocputest: Disable "cmt" feature unknown to QEMU
Jiri Denemark [Fri, 17 Mar 2017 10:46:19 +0000 (11:46 +0100)]
cputest: Disable "cmt" feature unknown to QEMU

All CPU features which QEMU does not know about but libvirt knows them
(currently "cmt" is the only one) are implicitly disabled by QEMU and
should be present in x86_64-cpuid-*-disabled.xml.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocputest: Disable TSX on broken models
Jiri Denemark [Fri, 17 Mar 2017 10:29:02 +0000 (11:29 +0100)]
cputest: Disable TSX on broken models

Commit v3.1.0-26-gd60012b4e started filtering hle and rtm features from
broken Intel Haswell CPUs. QEMU implemented similar functionality and
thus it doesn't report rtm and hle features as enabled for Core i5-4670T
CPU anymore.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocputest: Generate data for virCPUUpdateLive
Jiri Denemark [Thu, 16 Mar 2017 11:26:05 +0000 (12:26 +0100)]
cputest: Generate data for virCPUUpdateLive

Generated with

    (cd tests/cputestdata; ./cpu-cpuid.py diff x86_64-cpuid-*.json)

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocputest: Add "diff" command to cpu-cpuid.py
Jiri Denemark [Thu, 16 Mar 2017 11:25:30 +0000 (12:25 +0100)]
cputest: Add "diff" command to cpu-cpuid.py

The new command can be used to generate test data for virCPUUpdateLive.

When "cpu-cpuid.py diff x86-cpuid-Something.json" is run, it reads raw
CPUID data stored in x86-cpuid-Something.xml and CPUID data from QEMU
stored in x86-cpuid-Something.json to produce two more CPUID files:
x86-cpuid-Something-enabled.xml and x86-cpuid-Something-disabled.xml.

- x86-cpuid-Something-enabled.xml will contain CPUID bits present in
    x86-cpuid-Something.json (i.e., enabled by QEMU for the "host" CPU)

- x86-cpuid-Something-disabled.xml will contain all CPUID bits from
    x86-cpuid-Something.xml which are not present in
    x86-cpuid-Something.json (i.e., CPUID bits which the host CPU
    supports, but QEMU does not enable them for the "host" CPU)

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocputest: Add cpuidLeaf helper to cpu-cpuid.py
Jiri Denemark [Wed, 15 Mar 2017 13:29:30 +0000 (14:29 +0100)]
cputest: Add cpuidLeaf helper to cpu-cpuid.py

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocputest: Add cpuidIsSet helper to cpu-cpuid.py
Jiri Denemark [Wed, 15 Mar 2017 13:21:48 +0000 (14:21 +0100)]
cputest: Add cpuidIsSet helper to cpu-cpuid.py

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocputest: Rename cpu-convert.py script as cpu-cpuid.py
Jiri Denemark [Wed, 15 Mar 2017 12:16:37 +0000 (13:16 +0100)]
cputest: Rename cpu-convert.py script as cpu-cpuid.py

The new script is going to be more general and the original
functionality can be requested by "cpu-cpuid.py convert".

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocputest: Move instantiation of JSONDecoder in cpu-convert.py
Jiri Denemark [Wed, 15 Mar 2017 12:09:21 +0000 (13:09 +0100)]
cputest: Move instantiation of JSONDecoder in cpu-convert.py

Let's make the object local to the parseFeatureWords function which uses
it.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu: Do not pass virConnectBaselineCPUFlags to cpuBaseline
Jiri Denemark [Fri, 17 Mar 2017 14:58:07 +0000 (15:58 +0100)]
cpu: Do not pass virConnectBaselineCPUFlags to cpuBaseline

The public API flags are handled by the cpuBaselineXML wrapper. The
internal cpuBaseline API only needs to know whether it is supposed to
drop non-migratable features.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu: Move feature expansion out of cpuBaseline
Jiri Denemark [Fri, 17 Mar 2017 14:57:47 +0000 (15:57 +0100)]
cpu: Move feature expansion out of cpuBaseline

cpuBaseline is responsible for computing a baseline CPU while feature
expansion is done by virCPUExpandFeatures. The cpuBaselineXML wrapper
(used by hypervisor drivers to implement virConnectBaselineCPU API)
calls cpuBaseline followed by virCPUExpandFeatures if requested by
VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES flag.

The features in the three changed test files had to be sorted using
"sort -k 3" because virCPUExpandFeatures returns a sorted list of
features.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu: Drop unused flags from cpuArchDecode
Jiri Denemark [Thu, 16 Mar 2017 13:03:09 +0000 (14:03 +0100)]
cpu: Drop unused flags from cpuArchDecode

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu: Introduce virCPUExpandFeatures
Jiri Denemark [Thu, 16 Mar 2017 11:23:50 +0000 (12:23 +0100)]
cpu: Introduce virCPUExpandFeatures

Having to use cpuBaseline with VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES
flag to expand CPU features is strange. Not to mention that cpuBaseline
can only expand host CPU definitions (i.e., it completely ignores
feature policies). The new virCPUExpandFeatures API is designed to work
with both host and guest CPU definitions.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu_conf: Introduce virCPUDefFreeFeatures
Jiri Denemark [Thu, 16 Mar 2017 11:21:58 +0000 (12:21 +0100)]
cpu_conf: Introduce virCPUDefFreeFeatures

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agodocs: make interface start mode element optional
Laine Stump [Mon, 27 Mar 2017 04:40:18 +0000 (00:40 -0400)]
docs: make interface start mode element optional

This brings the libvirt version of this RNG file in line with the same
file in netcf (as soon as the corresponding patch there is ACKed and
pushed).

There's no reason to require it when defining an interface (the config
option it corresponds to is optional), and it isn't even output in the
status of an interface.

Resolves: https://bugzilla.redhat.com/1414404

8 years agoconf: validate that PCI controller index is < 256
Laine Stump [Mon, 27 Mar 2017 00:47:17 +0000 (20:47 -0400)]
conf: validate that PCI controller index is < 256

This is the maximum for many reasons, for starters because index ==
bus number, and a controller's bus number is 8 bits.

This incidentally resolves: https://bugzilla.redhat.com/1329090

8 years agoutil: rename virHostdevNetConfigRestore() to virHostdevRestoreNetConfig()
Laine Stump [Mon, 13 Mar 2017 23:07:02 +0000 (19:07 -0400)]
util: rename virHostdevNetConfigRestore() to virHostdevRestoreNetConfig()

8 years agoutil: log all setting of MAC addresses and vlan tags
Laine Stump [Sat, 11 Mar 2017 15:29:29 +0000 (10:29 -0500)]
util: log all setting of MAC addresses and vlan tags

Having this information available will make it easier to determine the
culprit when MAC or vlan tag appear to not be set, eg.:

  https://bugzilla.redhat.com/1364073

(This patch doesn't fix that bug, just makes it easier to diagnose)

8 years agoutil: try *really* hard to set the MAC address of an SRIOV VF
Laine Stump [Tue, 7 Mar 2017 19:24:37 +0000 (14:24 -0500)]
util: try *really* hard to set the MAC address of an SRIOV VF

If an SRIOV VF has previously been used for VFIO device assignment,
the "admin MAC" that is stored in the PF driver's table of VF info
will have been set to the MAC address that the virtual machine wanted
the device to have. Setting the admin MAC for a VF also sets a flag in
the PF that is loosely called the "administratively set" flag. Once
that flag is set, it is no longer possible for the net driver of the
VF (either on the host or in a virtual machine) to directly set the
VF's MAC again; this flag isn't reset until the *PF* driver is
restarted, and that requires taking *all* VFs offline, so it's not
really feasible to do.

If the same SRIOV VF is later used for macvtap passthrough mode, the
VF's MAC address must be set, but normally we don't unbind the VF from
its host net driver (since we actually need the host net driver in
this case). Since setting the VF MAC directly will fail, in the past
"we" ("I") had tried to fix the problem by simply setting the admin MAC
(via the PF) instead. This *appeared* to work (and might have at one
time, due to promiscuous mode being turned on somewhere or something),
but it currently creates a non-working interface because only the
value for admin MAC is set to the desired value, *not* the actual MAC
that the VF is using.

Earlier patches in this series reverted that behavior, so that we once
again set the MAC of the VF itself for macvtap passthrough operation,
not the admin MAC. But that brings back the original bug - if the
interface has been used for VFIO device assignment, you can no longer
use it for macvtap passthrough.

This patch solves that problem by noticing when virNetDevSetMAC()
fails for a VF, and in that case it sets the desired MAC to the admin
MAC via the PF, then "bounces" the VF driver (by unbinding and the
immediately rebinding it to the VF). This causes the VF's MAC to be
reinitialized from the admin MAC, and everybody is happy (until the
*next* time someone wants to set the VF's MAC address, since the
"administratively set" bit is still turned on).

8 years agoutil: if setting admin MAC to 00:00:00:00:00:00 fails, try 02:00:00:00:00:00
Laine Stump [Mon, 6 Mar 2017 18:59:29 +0000 (13:59 -0500)]
util: if setting admin MAC to 00:00:00:00:00:00 fails, try 02:00:00:00:00:00

Some PF drivers allow setting the admin MAC (that is the MAC address
that the VF will be initialized to the next time the VF's driver is
loaded) to 00:00:00:00:00:00, and some don't. Multiple drivers
initialize the admin MACs to all 0, but don't allow setting it to that
very same value. It has been an uphill battle convincing the driver
people that it's reasonable to expect The argument that's used is
that an all 0 device MAC address on a device is invalid; however, from
an outsider's point of view, when the admin MAC is set to 0 at the
time the VF driver is loaded, the VF's MAC is *not* set to 0, but to a
random non-0 value. But that's beside the point - even if I could
convince one or two SRIOV driver maintainers to permit setting the
admin MAC to 0, there are still several other drivers.

So rather than fighting that losing battle, this patch checks for a
failure to set the admin MAC due to an all 0 value, and retries it
with 02:00:00:00:00:00. That won't result in a random value being set
in the VF MAC at next VF driver init, but that's okay, because we
always want to set a specific value anyway. Rather, the "almost 0"
setting makes it easy to visually detect from the output of "ip link
show" which VFs are currently in use and which are free.

8 years agoutil: remove unused functions from virnetdev.c
Laine Stump [Mon, 6 Mar 2017 15:01:02 +0000 (10:01 -0500)]
util: remove unused functions from virnetdev.c

The global functions virNetDevReplaceMacAddress(),
virNetDevReplaceNetConfig(), virNetDevRestoreMacAddress(), and
virNetDevRestoreNetConfig() are no longer used, as their functionality
has been replaced by virNetDev(Save|Read|Set)NetConfig().

The static functions virNetDevReplaceVfConfig() and
virNetDevRestoreVfConfig() were only used by the above-named global
functions that were removed.

8 years agoutil: after hostdev assignment, restore VF MAC address via setting admin MAC
Laine Stump [Mon, 6 Mar 2017 14:36:40 +0000 (09:36 -0500)]
util: after hostdev assignment, restore VF MAC address via setting admin MAC

It takes longer to explain this than to fix it...

In the past we weren't able to save the VF's own MAC address *at all*
when using it for hostdev assignment, because we had already unbound
the VF from the host net driver prior to saving its config. With the
previous patch, that problem has been solved, so we now have the VF's
MAC address saved and can move on to the *next* problem, which is twofold:

1) during teardown we restore the config before we've re-bound, so the
   VF doesn't have a net driver, and thus we can't set its MAC address
   directly.

2) even if we delay restoring the config until the VF is bound to a
   net driver, the request to set its MAC address would fail, since
   (during device setup) we had set the "admin MAC" for the VF via an
   RTM_SETLINK to the PF - once you've set the admin MAC for a VF, the
   VF driver (either on host or on guest) is not allowed to change the
   VF's MAC address "forever" (well, until you reload the PF driver,
   but that requires destroying and recreating every single VF, which
   isn't something you can require).

The solution is to keep the restoration of config at the same place,
but to set the *admin MAC* to the address you want the VF to have -
when the VF net driver is later initialized (as a part of re-binding
to the VF net driver) its MAC will be initialized to the current value
of the admin MAC.

8 years agoutil: save hostdev network device config before unbinding from host driver
Laine Stump [Tue, 28 Feb 2017 21:44:26 +0000 (16:44 -0500)]
util: save hostdev network device config before unbinding from host driver

In order to properly restore the original state of an SRIOV VF when
we're finished with it, we need to save the MAC address of the VF
itself (not just the admin MAC address for the VF that is stored in
the PF). But that can only be done when the VF is still bound to the
host's netdev driver, and we have always done the saving of device
config after the VF is already bound to vfio-pci. This patch prepares
us for adding a save of the VF's MAC by calling the function that
saves netconfig earlier in the device preparation, before we've
unbound it from the host netdev driver.