]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
8 years agohyperv: update hypervObject struct.
Dawid Zamirski [Tue, 4 Apr 2017 22:26:07 +0000 (18:26 -0400)]
hyperv: update hypervObject struct.

Currently named as hypervObjecUnified to keep code
compilable/functional until all bits are in place.

This struct is a result of unserializing WMI request response.
Therefore, it needs to be able to deal with different "versions" of the
same WMI class. To accomplish this, the "data" member was turned in to
a union which:

* has a "common" member that contains only WMI class fields that are
  safe to access and are present in all "versions". This is ensured by
  the code generator that takes care of proper struct memory alignment
  between "common", "v1", "v2" etc members. This memeber is to be used
  by the driver code wherever the API implementation can be shared for
  all supported hyper-v versions.
* the "v1" and "v2" member can be used by the driver code to handle
  version specific cases.

Example:

Msvm_ComputerSystem *vm = NULL;
...
hypervGetVirtualMachineList(priv, wqlQuery, *vm);
...
/* safe for "v1" and "v2" */
char *vmName = vm->data.common->Name;

/* or if one really needs special handling for "v2" */
if (priv->wmiVersion == HYPERV_WMI_VERSION_V2) {
    char *foo = vm->data.v2->SomeV2OnlyField;
}

In other words, driver should not concern itself with existence of "v1"
or "v2" of WMI class unless absolutely necessary.

8 years agohyperv: introduce hypervWmiClassInfo struct.
Dawid Zamirski [Tue, 4 Apr 2017 22:26:06 +0000 (18:26 -0400)]
hyperv: introduce hypervWmiClassInfo struct.

This struct is to be used to carry all the information necessary to
issue wsman requests for given WMI class. Those will be defined by the
generator code (as lists) so that they are handy for the driver code to
"extract" needed info depending on which hyper-v we're connected to.
For example:

hypervWmiClassInfoListPtr Msvm_ComputerSystem_WmiInfo = {
    .count = 2
    {
        {
            .name = "Msvm_ComputerSystem",
            .version = "v1",
            .rootUri = "http://asdf.com",
            ...
        },
        {
            .name = "Msvm_ComputerSystem",
            .version = "v2",
            .rootUri = "http://asdf.com/v2",
            ...
        },
    }
};

Then the driver code will grab either "v1" or "v2" to pass info wsman
API, depending on hypervPrivate->wmiVersion value.

8 years agohyperv: store WMI version in hypervPrivate.
Dawid Zamirski [Tue, 4 Apr 2017 22:26:05 +0000 (18:26 -0400)]
hyperv: store WMI version in hypervPrivate.

Hyper-V 2012+ uses a new "v2" version of Msvm_* WMI classes so we will
store that info in hypervPrivate so that it is easily accessbile in the
driver API callbacks and handled accordingly.

8 years agodisk: Force usage of parted when checking disk format for "bsd"
John Ferlan [Fri, 7 Apr 2017 13:38:44 +0000 (09:38 -0400)]
disk: Force usage of parted when checking disk format for "bsd"

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

Add "bsd" to the list of format types to not checked during blkid
processing even though it supposedly knows the format - for some
(now unknown) reason it's returning partition table not found. So
let's just let PARTED handle "bsd" too.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agodisk: Resolve issues with disk partition build/start checks
John Ferlan [Fri, 7 Apr 2017 11:02:40 +0000 (07:02 -0400)]
disk: Resolve issues with disk partition build/start checks

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

Commit id 'a48c674fb' added a check for format types "dvh" and "pc98"
to use the parted print processing instead of using blkid processing
in order to validate the label on the disk was what is expected for
disk pool startup. However, commit id 'a4cb4a74f' really messed things
up by missing an else condition causing PARTEDFindLabel to always
return DIFFERENT.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoconf: create new RemovalFailed event using correct class
Pavel Hrdina [Fri, 7 Apr 2017 12:00:22 +0000 (14:00 +0200)]
conf: create new RemovalFailed event using correct class

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu: fix memory leak and check mdevPath
Pavel Hrdina [Fri, 7 Apr 2017 11:43:25 +0000 (13:43 +0200)]
qemu: fix memory leak and check mdevPath

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
8 years agoqemu: Don't overwrite existing error in qemuMigrationReset
Jiri Denemark [Thu, 6 Apr 2017 07:23:18 +0000 (09:23 +0200)]
qemu: Don't overwrite existing error in qemuMigrationReset

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Properly reset all migration capabilities
Jiri Denemark [Wed, 5 Apr 2017 11:05:25 +0000 (13:05 +0200)]
qemu: Properly reset all migration capabilities

So far only QEMU_MONITOR_MIGRATION_CAPS_POSTCOPY was reset, but only in
a single code path leaving post-copy enabled in quite a few cases.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Simplify qemuMigrationResetTLS
Jiri Denemark [Wed, 5 Apr 2017 11:04:04 +0000 (13:04 +0200)]
qemu: Simplify qemuMigrationResetTLS

It's only called from qemuMigrationReset now so it doesn't need to be
exported and {tls,sec}Alias are always NULL.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Introduce qemuMigrationReset
Jiri Denemark [Wed, 5 Apr 2017 12:48:43 +0000 (14:48 +0200)]
qemu: Introduce qemuMigrationReset

This new API is supposed to reset all migration parameters to make sure
future migrations won't accidentally use them. This patch makes the
first step and moves qemuMigrationResetTLS call inside
qemuMigrationReset.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Don't reset TLS in qemuMigrationCancel
Jiri Denemark [Wed, 5 Apr 2017 12:44:26 +0000 (14:44 +0200)]
qemu: Don't reset TLS in qemuMigrationCancel

Migration parameters are either reset by the main migration code path or
from qemuProcessRecoverMigration* in case libvirtd is restarted during
migration.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Don't reset TLS in qemuMigrationRun
Jiri Denemark [Wed, 5 Apr 2017 08:24:47 +0000 (10:24 +0200)]
qemu: Don't reset TLS in qemuMigrationRun

Finished qemuMigrationRun does not mean the migration itself finished
(it might have just switched to post-copy mode). While resetting TLS
parameters is probably OK at this point even if migration is still
running, we want to consolidate the code which resets various migration
parameters. Thus qemuMigrationResetTLS will be called from the Confirm
phase (or at the end of the Perform phase in case of v2 protocol), when
migration is either canceled or finished.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Always reset TLS in qemuProcessRecoverMigrationOut
Jiri Denemark [Wed, 5 Apr 2017 10:04:09 +0000 (12:04 +0200)]
qemu: Always reset TLS in qemuProcessRecoverMigrationOut

qemuProcessRecoverMigrationOut doesn't explicitly call
qemuMigrationResetTLS relying on two things:

    - qemuMigrationCancel resets TLS parameters
    - our migration code resets TLS before entering
      QEMU_MIGRATION_PHASE_PERFORM3_DONE phase

But this is not obvious and the assumptions will be broken soon. Let's
explicitly reset TLS parameters on all paths which do not kill the
domain.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Drop resume label in qemuProcessRecoverMigrationOut
Jiri Denemark [Tue, 4 Apr 2017 18:54:57 +0000 (20:54 +0200)]
qemu: Drop resume label in qemuProcessRecoverMigrationOut

Let's use a bool variable to create a single shared path returning 0.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Properly reset TLS in qemuProcessRecoverMigrationIn
Jiri Denemark [Tue, 4 Apr 2017 17:43:13 +0000 (19:43 +0200)]
qemu: Properly reset TLS in qemuProcessRecoverMigrationIn

There is no async job running when a freshly started libvirtd is trying
to recover from an interrupted incoming migration. While at it, let's
call qemuMigrationResetTLS every time we don't kill the domain. This is
not strictly necessary since TLS is not supported when v2 migration
protocol is used, but doing so makes more sense.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoRevert "qemu: Move qemuCaps->{kvm,tcg}CPUModel into a struct"
Jiri Denemark [Fri, 7 Apr 2017 11:19:11 +0000 (13:19 +0200)]
Revert "qemu: Move qemuCaps->{kvm,tcg}CPUModel into a struct"

This reverts commit 68507d77d38c0f7b05f260177091e0ce1452758e which was
pushed accidentally.

8 years agoRevert "qemu: Store migratable host CPU model in qemuCaps"
Jiri Denemark [Fri, 7 Apr 2017 11:18:41 +0000 (13:18 +0200)]
Revert "qemu: Store migratable host CPU model in qemuCaps"

This reverts commit dfc711dc8cf08e942b01e6ead3de117e6522e5cd which was
pushed accidentally.

8 years agoRevert "qemu: Pass migratable host model to virCPUUpdate"
Jiri Denemark [Fri, 7 Apr 2017 11:17:57 +0000 (13:17 +0200)]
Revert "qemu: Pass migratable host model to virCPUUpdate"

This reverts commit 959e72d323d06d67a5c3a759869af6da49da0e0e which was
pushed accidentally.

8 years agoRevert "cpu: Drop feature filtering from virCPUUpdate"
Jiri Denemark [Fri, 7 Apr 2017 11:17:02 +0000 (13:17 +0200)]
Revert "cpu: Drop feature filtering from virCPUUpdate"

This reverts commit 5f96b3feb6b345d3c3bfb68b05b16194ad3fea9d which was
pushed accidentally.

8 years agoqemu: Fix formatting in qemu_migration.h
Jiri Denemark [Fri, 7 Apr 2017 10:12:30 +0000 (12:12 +0200)]
qemu: Fix formatting in qemu_migration.h

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu: Drop feature filtering from virCPUUpdate
Jiri Denemark [Wed, 29 Mar 2017 13:00:21 +0000 (15:00 +0200)]
cpu: Drop feature filtering from virCPUUpdate

Because of the changes done in the previous commit, @host is already a
migratable CPU and there's no need to do any additional filtering.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Pass migratable host model to virCPUUpdate
Jiri Denemark [Thu, 30 Mar 2017 14:46:55 +0000 (16:46 +0200)]
qemu: Pass migratable host model to virCPUUpdate

This will allow us to drop feature filtering from virCPUUpdate where it
was just a hack.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Store migratable host CPU model in qemuCaps
Jiri Denemark [Wed, 29 Mar 2017 13:31:17 +0000 (15:31 +0200)]
qemu: Store migratable host CPU model in qemuCaps

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Move qemuCaps->{kvm,tcg}CPUModel into a struct
Jiri Denemark [Thu, 30 Mar 2017 14:13:57 +0000 (16:13 +0200)]
qemu: Move qemuCaps->{kvm,tcg}CPUModel into a struct

We will need to store two more host CPU models and nested structs look
better than separate items with long complicated names.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Add migratable parameter to virQEMUCapsInitCPUModel
Jiri Denemark [Wed, 29 Mar 2017 11:33:50 +0000 (13:33 +0200)]
qemu: Add migratable parameter to virQEMUCapsInitCPUModel

The caller can ask for a migratable CPU model by passing true for the
new parameter.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: Move common code in virQEMUCapsInitCPUModel one layer up
Jiri Denemark [Thu, 30 Mar 2017 11:50:44 +0000 (13:50 +0200)]
qemu: Move common code in virQEMUCapsInitCPUModel one layer up

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agocpu: Introduce virCPUCopyMigratable
Jiri Denemark [Wed, 29 Mar 2017 12:45:44 +0000 (14:45 +0200)]
cpu: Introduce virCPUCopyMigratable

This new internal API makes a copy of virCPUDef while removing all
features which would block migration. It uses cpu_map.xml as a database
of such features, which should only be used as a fallback when we cannot
get the data from a hypervisor. The main goal of this API is to decouple
this filtering from virCPUUpdate so that the hypervisor driver can
filter the features according to the hypervisor.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoProperly ignore files in build-aux directory
Jiri Denemark [Fri, 7 Apr 2017 06:50:21 +0000 (08:50 +0200)]
Properly ignore files in build-aux directory

We want to ignore all files except *.pl in build-aux directory, however
the unignore pattern "!/build-aux/*.pl" doesn't have any effect because
a previous "/build-aux/" pattern ignores the directory itself rather
than individual files in it.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoutil: Add virStringTrimOptionalNewline
Martin Kletzander [Wed, 29 Mar 2017 11:48:22 +0000 (13:48 +0200)]
util: Add virStringTrimOptionalNewline

And use it in virFileRead*

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoutil: Fix virDirRead() description
Martin Kletzander [Wed, 29 Mar 2017 11:41:20 +0000 (13:41 +0200)]
util: Fix virDirRead() description

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoconf: Fix possible memleak in capabilities
Martin Kletzander [Wed, 29 Mar 2017 11:36:15 +0000 (13:36 +0200)]
conf: Fix possible memleak in capabilities

If formatting NUMA topology fails, the function returns immediatelly,
but the buffer structure allocated on the stack references lot of
heap-allocated memory and that would get lost in such case.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
8 years agoqemu: Fix regression when hyperv/vendor_id feature is used
Jiri Denemark [Thu, 6 Apr 2017 11:52:30 +0000 (13:52 +0200)]
qemu: Fix regression when hyperv/vendor_id feature is used

qemuProcessVerifyHypervFeatures is supposed to check whether all
requested hyperv features were actually honored by QEMU/KVM. This is
done by checking the corresponding CPUID bits reported by the virtual
CPU. In other words, it doesn't work for string properties, such as
VIR_DOMAIN_HYPERV_VENDOR_ID (there is no CPUID bit we could check). We
could theoretically check all 96 bits corresponding to the vendor
string, but luckily we don't have to check the feature at all. If QEMU
is too old to support hyperv features, the domain won't even start.
Otherwise, it is always supported.

Without this patch, libvirt refuses to start a domain which contains

  <features>
    <hyperv>
      <vendor_id state='on' value='...'/>
    </hyperv>
  </features>

reporting internal error: "unknown CPU feature __kvm_hv_vendor_id.

This regression was introduced by commit v3.1.0-186-ge9dbe7011, which
(by fixing the virCPUDataCheckFeature condition in
qemuProcessVerifyHypervFeatures) revealed an old bug in the feature
verification code. It's been there ever since the verification was
implemented by commit v1.3.3-rc1-5-g95bbe4bf5, which effectively did not
check VIR_DOMAIN_HYPERV_VENDOR_ID at all.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoSplit out -Wframe-larger-than warning from WARN_CLFAGS
Ján Tomko [Wed, 29 Jun 2016 13:19:18 +0000 (15:19 +0200)]
Split out -Wframe-larger-than warning from WARN_CLFAGS

Introduce STRICT_FRAME_LIMIT_CFLAGS that will be used for
production code and RELAXED_FRAME_LIMIT_CFLAGS for tests.

Raising the limit for tests allows building them with clang
with optimizations disabled.

8 years agoqemu: Move some functions to qemu_capspriv.h
Andrea Bolognani [Wed, 5 Apr 2017 13:38:37 +0000 (15:38 +0200)]
qemu: Move some functions to qemu_capspriv.h

This header file has been created so that we can expose
internal functions to the test suite without making them
public: those in qemu_capabilities.h bearing the comment

  /* Only for use by test suite */

are obvious candidates for being moved over.

8 years agostorage: Avoid leak in virStorageUtilGlusterExtractPoolSources()
Andrea Bolognani [Wed, 5 Apr 2017 16:24:33 +0000 (18:24 +0200)]
storage: Avoid leak in virStorageUtilGlusterExtractPoolSources()

The contents of volname would be leaked if the function were
to be passed an invalid pooltype by the caller.

Make sure the memory is released instead.

8 years agoqemu: Fix VPATH syntax-check for qemuSecurity wrappers enforcment
Boris Fiuczynski [Tue, 4 Apr 2017 15:25:26 +0000 (17:25 +0200)]
qemu: Fix VPATH syntax-check for qemuSecurity wrappers enforcment

Fixing make syntax-check broken by commit 4da534c0b9.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
8 years agovirISCSIGetSession: Don't leak memory
Michal Privoznik [Wed, 5 Apr 2017 08:48:10 +0000 (10:48 +0200)]
virISCSIGetSession: Don't leak memory

This function runs an iscsi command and parses its output.
However, due to the nature of things, virISCSIExtractSession()
callback can be called multiple times. In each run it would
allocate new memory and overwrite the variable where we keep
pointer to it and thus leaking old allocations.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirNetworkObjDispose: Don't leak virMacMap object
Michal Privoznik [Wed, 5 Apr 2017 08:25:50 +0000 (10:25 +0200)]
virNetworkObjDispose: Don't leak virMacMap object

Even though the virMacMap object is not necessarily created at
the same time as the network object, the former makes no sense
without the latter and thus should be unref'd in the network
object dispose function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agovirStorageSourceClear: Don't leave dangling pointers behind
Michal Privoznik [Wed, 5 Apr 2017 07:59:25 +0000 (09:59 +0200)]
virStorageSourceClear: Don't leave dangling pointers behind

Imagine that this function is called twice over the same disk
source. While in the first run all allocated memory is freed, not
all pointers are set to NULL (e.g. def->srcpool). So when called
again, these poitners are freed again resulting in double free.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
8 years agoqemu: Break endless loop if qemuMigrationResetTLS fails
Jiri Denemark [Tue, 4 Apr 2017 10:46:37 +0000 (12:46 +0200)]
qemu: Break endless loop if qemuMigrationResetTLS fails

Jumping to "endjob" label from a code after this label is not a very
good idea.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
8 years agoqemu: monitor: No need to debug-log the 'mon' pointer
Peter Krempa [Wed, 5 Apr 2017 12:01:46 +0000 (14:01 +0200)]
qemu: monitor: No need to debug-log the 'mon' pointer

QEMU_CHECK_MONITOR_* already logs the object and vm name

8 years agodocs: Add news.rng to EXTRA_DIST
Peter Krempa [Wed, 5 Apr 2017 11:17:53 +0000 (13:17 +0200)]
docs: Add news.rng to EXTRA_DIST

8 years agostorage: gluster: Implement 'checkPool' method so that state is restored
Peter Krempa [Thu, 30 Mar 2017 11:18:43 +0000 (13:18 +0200)]
storage: gluster: Implement 'checkPool' method so that state is restored

After restart of libvirtd the 'checkPool' method is supposed to validate
that the pool is online. Since libvirt then refreshes the pool contents
anyways just return whether the pool was supposed to be online so that
the code can be reached. This is necessary since if a pool does not
implement the method it's automatically considered as inactive.

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

8 years agodocs: Move news.rng out of docs/schemas
Peter Krempa [Wed, 5 Apr 2017 07:51:51 +0000 (09:51 +0200)]
docs: Move news.rng out of docs/schemas

docs/schemas directory is meant for schemas which are installed on the
system. The schema for the news file does not need to be installed.
Store it along with the file it describes for simplicity.

8 years agodocs: Document limitation of maximum vcpu count used with <topology>
Peter Krempa [Tue, 4 Apr 2017 14:02:21 +0000 (16:02 +0200)]
docs: Document limitation of maximum vcpu count used with <topology>

qemu requires that the topology equals to the maximum vcpu count.
Document this along with the API to set maximum vcpu count and the XML
element.

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

8 years agoqemu: Fix resource leak in qemuDomainAddChardevTLSObjects error path
John Ferlan [Mon, 3 Apr 2017 16:53:33 +0000 (12:53 -0400)]
qemu: Fix resource leak in qemuDomainAddChardevTLSObjects error path

On any failure, call virJSONValueFree for the *Props.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agoqemu: Initialize 'data' argument
John Ferlan [Mon, 3 Apr 2017 16:53:32 +0000 (12:53 -0400)]
qemu: Initialize 'data' argument

Initialize stack variable to {0}

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agotests: Pass BlockIOThrottle arguments by reference not value
John Ferlan [Mon, 3 Apr 2017 16:53:31 +0000 (12:53 -0400)]
tests: Pass BlockIOThrottle arguments by reference not value

Pass the data by reference rather than everything on the stack.

Signed-off-by: John Ferlan <jferlan@redhat.com>
8 years agotests: Rename VIRT_TEST_* macros to VIR_TEST_*
Andrea Bolognani [Wed, 29 Mar 2017 14:45:42 +0000 (16:45 +0200)]
tests: Rename VIRT_TEST_* macros to VIR_TEST_*

We use the "vir" prefix pretty consistently in our
APIs, both external and internal, which made these
macros stood out.

8 years agostorage: gluster: Use volume name as "<name>" field in the XML
Peter Krempa [Tue, 4 Apr 2017 12:04:39 +0000 (14:04 +0200)]
storage: gluster: Use volume name as "<name>" field in the XML

For native gluster pools the <dir> field denotes a directory inside the
pool. For the actual pool name the <name> field has to be used.

8 years agostorage: Fix XPath for looking up gluster volume name
Peter Krempa [Thu, 30 Mar 2017 14:14:13 +0000 (16:14 +0200)]
storage: Fix XPath for looking up gluster volume name

Use the relative lookup specifier rather than the global one. Otherwise
only the first name would be looked up. Add a test case to cover the
scenario.

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

8 years agotest: Introduce testing of virStorageUtilGlusterExtractPoolSources
Peter Krempa [Tue, 28 Mar 2017 15:23:37 +0000 (17:23 +0200)]
test: Introduce testing of virStorageUtilGlusterExtractPoolSources

Add a test program called virstorageutiltest and test the gluster pool
detection code.

8 years agostorage: util: Split out the gluster volume extraction code into new function
Peter Krempa [Tue, 4 Apr 2017 11:39:37 +0000 (13:39 +0200)]
storage: util: Split out the gluster volume extraction code into new function

To allow testing of the algorithm, split out the extractor into a
separate helper.

8 years agostorage: util: Pass pool type to virStorageBackendFindGlusterPoolSources
Peter Krempa [Thu, 30 Mar 2017 13:08:06 +0000 (15:08 +0200)]
storage: util: Pass pool type to virStorageBackendFindGlusterPoolSources

The native gluster pool source list data differs from the data used for
attaching gluster volumes as netfs pools. Currently the only difference
was the format. Since native pools don't use it and later there will be
more differences add a more deterministic way to switch between the
types instead.

8 years agovz: fix typo that breaks build
Nikolay Shirokovskiy [Tue, 4 Apr 2017 10:02:21 +0000 (13:02 +0300)]
vz: fix typo that breaks build

8 years agoutil: ignore -Wcast-align in virNetlinkDumpCommand
Ján Tomko [Tue, 4 Apr 2017 10:51:47 +0000 (12:51 +0200)]
util: ignore -Wcast-align in virNetlinkDumpCommand

Similar to commit b202c39 ignore the warning that breaks the build
with clang:
util/virnetlink.c:365:52: error: cast from 'char *' to 'struct nlmsghdr *'
 increases required alignment from 1 to 4 [-Werror,-Wcast-align]
        for (msg = resp; NLMSG_OK(msg, len); msg = NLMSG_NEXT(msg, len)) {
                                                   ^~~~~~~~~~~~~~~~~~~~
/usr/include/linux/netlink.h:87:7: note: expanded from macro 'NLMSG_NEXT'
         (struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len)))
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

8 years agoqemu: hotplug: Validate that vcpu-hotplug does not break config
Peter Krempa [Fri, 31 Mar 2017 11:34:16 +0000 (13:34 +0200)]
qemu: hotplug: Validate that vcpu-hotplug does not break config

Make sure that non-hotpluggable vcpus stay clustered at the beginning
after modifying persistent definition.

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

8 years agoqemu: hotplug: Add validation for coldplug of individual vcpus
Peter Krempa [Fri, 31 Mar 2017 11:13:14 +0000 (13:13 +0200)]
qemu: hotplug: Add validation for coldplug of individual vcpus

Validate that users don't try to disable vcpu 0.

8 years agoqemu: hotplug: Clear vcpu ordering for coldplug of vcpus
Peter Krempa [Fri, 31 Mar 2017 11:05:47 +0000 (13:05 +0200)]
qemu: hotplug: Clear vcpu ordering for coldplug of vcpus

Vcpu order is required to stay sequential. Clear the order on cpu
coldplug to avoid issues with removing vcpus out of sequence.

8 years agoqemu: hotplug: Fix formatting strings in qemuDomainFilterHotplugVcpuEntities
Peter Krempa [Fri, 31 Mar 2017 11:28:19 +0000 (13:28 +0200)]
qemu: hotplug: Fix formatting strings in qemuDomainFilterHotplugVcpuEntities

'next' is declared as 'ssize_t' so use '%zd'

8 years agoqemu: hotplug: Iterate over vcpu 0 in individual vcpu hotplug code
Peter Krempa [Fri, 31 Mar 2017 11:02:14 +0000 (13:02 +0200)]
qemu: hotplug: Iterate over vcpu 0 in individual vcpu hotplug code

Buggy condition meant that vcpu0 would not be iterated in the checks.
Since it's not hotpluggable anyways we would not be able to break the
configuration of a live VM.

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

8 years agonews.rng: work around a bug in old libxml2
Ján Tomko [Tue, 4 Apr 2017 06:56:26 +0000 (08:56 +0200)]
news.rng: work around a bug in old libxml2

Similar to commit c3c2cc6, use a literal newsline instead of \n
inside the brackets.

8 years agoqemu: Add device id for mediated devices on qemu command line
Erik Skultety [Mon, 3 Apr 2017 14:10:00 +0000 (16:10 +0200)]
qemu: Add device id for mediated devices on qemu command line

Like all devices, add the 'id' option for mdevs as well. Patch also
adjusts the test accordingly.

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

Signed-off-by: Erik Skultety <eskultet@redhat.com>
8 years agostorage: Fix capacity value for LUKS encrypted volumes
John Ferlan [Fri, 24 Mar 2017 13:26:17 +0000 (09:26 -0400)]
storage: Fix capacity value for LUKS encrypted volumes

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

The 'capacity' value (e.g. guest logical size) for a LUKS volume is
smaller than the 'physical' value of the file in the file system, so
we need to account for that.

When peeking at the encryption information about the volume add a fetch
of the payload_offset which is described as the offset to the start of
the volume data (in 512 byte sectors) in QEMU's QCryptoBlockLUKSHeader.

Then adjust the ->capacity appropriately when we determine that the
volume target encryption has a payload_offset value.

8 years agovirNetDevIPCheckIPv6ForwardingCallback fixes
Cédric Bosdonnat [Tue, 28 Mar 2017 14:00:24 +0000 (16:00 +0200)]
virNetDevIPCheckIPv6ForwardingCallback fixes

Add check for more than one RTA_OIF, even though this is rather
unlikely.

Get rid of the buggy switch / break as this code won't need to
handle more attributes.

Use VIR_WARNINGS_NO_CAST_ALIGN to fix impossible to fix
util/virnetdevip.c:560:17: error: cast increases required alignment of target type [-Werror=cast-align]

8 years agotests: Test ACPI, UEFI requirements
Andrea Bolognani [Thu, 9 Mar 2017 15:38:56 +0000 (16:38 +0100)]
tests: Test ACPI, UEFI requirements

Make sure every combination of ACPI and UEFI works, or fails to
work, as expected.

8 years agoqemu: Enforce ACPI, UEFI requirements
Andrea Bolognani [Thu, 9 Mar 2017 15:38:26 +0000 (16:38 +0100)]
qemu: Enforce ACPI, UEFI requirements

Depending on the architecture, requirements for ACPI and UEFI can
be different; more specifically, while on x86 UEFI requires ACPI,
on aarch64 it's the other way around.

Enforce these requirements when validating the domain, and make
the error message more accurate by mentioning that they're not
necessarily applicable to all architectures.

Several aarch64 test cases had to be tweaked because they would
have failed the validation step otherwise.

8 years agoqemu: Advertise ACPI support for aarch64 guests
Andrea Bolognani [Thu, 2 Mar 2017 17:57:51 +0000 (18:57 +0100)]
qemu: Advertise ACPI support for aarch64 guests

So far, libvirt has assumed that only x86 supports ACPI,
but that's inaccurate since aarch64 supports it too.

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

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>