Commit Graph

32528 Commits

Author SHA1 Message Date
Daniel P. Berrangé
81c5e75e57 rpm: add dep on xfsprogs-devel for reflink support
Support for XFS reflink clone was added in:

  commit 8ed874b39b
  Author: Julio Faracco <jcfaracco@gmail.com>
  Date:   Fri Jul 6 10:43:01 2018 -0300

    storage: Rename btrfsCloneFile to support other filesystems.

  commit 2e11298f93
  Author: Julio Faracco <jcfaracco@gmail.com>
  Date:   Fri Jul 6 10:43:00 2018 -0300

    configure: Adding XFS library/headers check.

But these patches missed that the xfs/xfs.h header is not installed
unless you have xfsprogs-devel present.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-03-07 11:46:16 +00:00
Pavel Hrdina
8c0fe9c649 tests: use VIR_AUTOUNREF in storagepoolcapstest
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-03-07 12:12:11 +01:00
Pavel Hrdina
9dadc73029 caps: drop requiredSourceElements from storage pool capabilities
Capabilities should not duplicate data that are obvious from our
documentation and will not change with different QEMU binaries
or the way how we compile libvirt.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-03-07 12:01:09 +01:00
Pavel Hrdina
0b5b221300 tests: invert the return logic in storagepoolcapstest
This way if the first test "full" fails we will run the second test as
well.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-03-07 12:01:09 +01:00
Pavel Hrdina
a59590c7eb tests: use virTestCompareToFile in storagepoolcapstest
This will allow to use VIR_TEST_REGENERATE_OUTPUT.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-03-07 12:01:09 +01:00
Andrea Bolognani
094f29df07 Use virStringHasSuffix() where possible
When dealing with internal paths we don't need to worry about
whether or not suffixes are lowercase since we have full control
over them, which means we can avoid performing case-insensitive
string comparisons.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
ACKed-by: Peter Krempa <pkrempa@redhat.com>
2019-03-07 10:10:49 +01:00
Andrea Bolognani
d93b9e8829 util: Add virStringHasSuffix()
This is the case-sensitive counterpart of the existing
virStringHasCaseSuffix() function.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
ACKed-by: Peter Krempa <pkrempa@redhat.com>
2019-03-07 10:10:47 +01:00
Andrea Bolognani
b5cc0a7f29 util: Rename virFileMatchesNameSuffix() to virStringMatchesNameSuffix()
Despite its name, this is really just a general-purpose string
manipulation function, so it should be moved to the virstring
module and renamed accordingly.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
ACKed-by: Peter Krempa <pkrempa@redhat.com>
2019-03-07 10:10:45 +01:00
Andrea Bolognani
9c5fa79fd7 util: Rename virFileStripSuffix() to virStringStripSuffix()
Despite its name, this is really just a general-purpose string
manipulation function, so it should be moved to the virstring
module and renamed accordingly.

A few trivial whitespace changes are squashed in.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
ACKed-by: Peter Krempa <pkrempa@redhat.com>
2019-03-07 10:10:43 +01:00
Andrea Bolognani
2de7dcba7e util: Rename virFileHasSuffix() to virStringHasCaseSuffix()
Despite its name, this is really just a general-purpose string
manipulation function, so it should be moved to the virstring
module and renamed accordingly.

In addition to the obvious s/File/String/, also tweak the name
to make it clear that the presence of the suffix is verified
using case-insensitive comparison.

A few trivial whitespace changes are squashed in.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
ACKed-by: Peter Krempa <pkrempa@redhat.com>
2019-03-07 10:08:47 +01:00
Michal Privoznik
ab2e90006d Drop some useless comparisons and checks
In these cases the check that is removed has been done a few
lines above already (as can even be seen in the context). Drop
them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-03-07 09:22:47 +01:00
Jim Fehlig
4ec3cf9a0f apparmor: Add ptrace and signal rules for named profile
Commit a3ab6d42 changed the libvirtd profile to a named profile
but neglected to accommodate the change in the qemu profile
ptrace and signal rules. As a result, libvirtd is unable to
signal confined qemu processes and hence unable to shutdown
or destroy VMs.

Add ptrace and signal rules that reference the libvirtd profile
by name in addition to full binary path.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Acked-by: Jamie Strandboge <jamie@canonical.com>
2019-03-06 09:51:01 -07:00
John Ferlan
3fd1a15968 docs: Add news article
Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2019-03-06 11:12:48 -05:00
John Ferlan
d9a4115892 virsh: Expose virConnectGetStoragePoolCapabilities
https://bugzilla.redhat.com/show_bug.cgi?id=1581670

Add a new storage pool command "pool-capabilities" to output
the storage pool capabilities.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2019-03-06 11:12:48 -05:00
John Ferlan
d9bf6cef32 storage: Introduce storageConnectGetStoragePoolCapabilities
https://bugzilla.redhat.com/show_bug.cgi?id=1581670

Create the storage driver code to generate the output for the
storage pool capabilities XML.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2019-03-06 11:12:48 -05:00
John Ferlan
6696155ae6 libvirt: Introduce virConnectGetStoragePoolCapabilities
Introduce the API to expose the storage pool capabilities along
with all the remote munglement required to hook up the client.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2019-03-06 11:12:48 -05:00
John Ferlan
784cd46fb8 docs: Add description for Storage Pool Capabilities
Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2019-03-06 11:12:48 -05:00
John Ferlan
73426c55b7 tests: Introduce storage pool capabilites test
Add a new test for the storage pool capabilities. There will be
one test mocked with every backend available (full) and one where
only the file system pool is available.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2019-03-06 11:12:48 -05:00
John Ferlan
3b1988f3e3 conf: Add storage pool capability formatting
Add support to format the storage pool capabilities using
the virStoragePoolTypeInfoPtr to determine what capabilities
exist for the various pools and the driver capabilities to
determine whether the pool is compiled in and supported.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2019-03-06 11:12:48 -05:00
John Ferlan
5dded8c806 docs: Add schema for storage pool capabilities
Define a schema for the storage pool capabilities along with
a test to show the general format.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2019-03-06 11:12:48 -05:00
John Ferlan
642c06fd63 storage: Process storage pool capabilities
https://bugzilla.redhat.com/show_bug.cgi?id=1581670

During storage driver backend initialization, let's save
which backends are available in the storage pool capabilities.

In order to format those, we need add a connectGetCapabilities
processor to the storageHypervisorDriver. This allows a storage
connection, such as "storage:///system" to find the API and
format the results, such as:

  virsh -c storage:///system capabilities

  <capabilities>

    <pool>
      <enum name='type'>
        <value>dir</value>
        <value>fs</value>
        <value>netfs</value>
        <value>logical</value>
        <value>iscsi</value>
        <value>iscsi-direct</value>
        <value>scsi</value>
        <value>mpath</value>
        <value>disk</value>
        <value>rbd</value>
        <value>sheepdog</value>
        <value>gluster</value>
        <value>zfs</value>
      </enum>
    </pool>

  </capabilities>

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2019-03-06 11:12:48 -05:00
John Ferlan
05fe03505a conf: Introduce storage pool functions into capabilities
Introduce the bare bones functions to processing capability
data for the storage driver.

Since there will be no need for the <host> output, we need
to filter that data.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2019-03-06 11:12:48 -05:00
John Ferlan
05fade52fe docs: Fix a few storage.html.in typos
Fix the ZFS Valid Volume Format Types label and add the
Valid pool format types for Vstorage pools.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2019-03-06 11:12:48 -05:00
John Ferlan
538b83ae68 conf: Remove defaultFormat from VIR_STORAGE_POOL_ZFS
The ZFS pool is documented as not using pool format types, so remove
the defaultFormat value.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2019-03-06 11:12:48 -05:00
John Ferlan
08af6ca362 conf: Remove volOptions for VIR_STORAGE_POOL_MPATH
The multipath pool is documented as not using the volume type,
so let's just remove it.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2019-03-06 11:12:48 -05:00
John Ferlan
85f574600a conf: Remove volOptions for VIR_STORAGE_POOL_ISCSI[_DIRECT]
The iscsi and iscsi-direct pools are documented as not using
the volume type, so let's just remove it. Besides it would
have produced bad output since formatting uses the Disk types.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2019-03-06 11:12:48 -05:00
John Ferlan
d893ce1574 conf: Remove volOptions for VIR_STORAGE_POOL_SCSI
The scsi pool is documented as not using the volume type,
so let's just remove it.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2019-03-06 11:12:48 -05:00
John Ferlan
035db37394 conf: Remove volOptions for VIR_STORAGE_POOL_RBD
The rbd pool is documented as not using the volume type,
so let's just remove it.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2019-03-06 11:12:48 -05:00
John Ferlan
4ad00278f6 conf: Remove volOptions for VIR_STORAGE_POOL_SHEEPDOG
The sheepdog pool is documented as not using the volume type,
so let's just remove it.  Besides it would have produced bad
results since the defaultType is FILE but the formatting used
the Disk types.

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
2019-03-06 11:12:48 -05:00
Peter Krempa
66a508d2cc conf: domain: Use VIR_XPATH_NODE_AUTORESTORE where appropriate
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-03-06 15:53:53 +01:00
Peter Krempa
933f136844 conf: Move XPath context node in descendants of virSysinfoParseXML
Rather than moving the XPath root node in the caller and then still
passing it down, make sure that the callees move the node themselves.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-03-06 15:53:53 +01:00
Peter Krempa
8f6ac3b740 conf: domain: Use VIR_AUTOCLEAN(virBuffer) where appropriate
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-03-06 15:53:53 +01:00
Peter Krempa
dc87a715ee conf: Use virXMLFormatElement in virDomainDefFormatFeatures
Remove logic necessary to figure out whether to format the 'features'
element by using virXMLFormatElement.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-03-06 15:53:53 +01:00
Peter Krempa
4653ae65af conf: Refactor formating of 'capabilities' features
Use virXMLFormatElement for the formatting which allows us to avoid
looking through the array to see if any feature is enabled.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-03-06 15:53:53 +01:00
Peter Krempa
89dda12b8d conf: Avoid formatting empty <capabilities> element
If none of the 'capabilities' features are enabled we'd still format the
opening and closing tag for the <capabilities element.

The implementation is suboptimal but will be refactored for a better
approach. This is done prior to the refactor to show that tests are not
impacted.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-03-06 15:53:53 +01:00
Peter Krempa
c7637521d6 conf: Avoid extra scope when formatting 'smm' feature
Use an early break and remove the temporary variable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-03-06 15:53:53 +01:00
Peter Krempa
d1164bfdca conf: Avoid extra set of temp buffers in virDomainDefFormatFeatures
Use the top level set of temp buffers to do the job.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-03-06 15:53:53 +01:00
Peter Krempa
dc29a46777 conf: Simplify lifecycle of temp buffers in virDomainDefFormatFeatures
Use VIR_AUTOCLEAN to avoid leaking the buffer on error path and get rid
of resetting mid loop since virXMLFormatElement does the reset
internally.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-03-06 15:53:53 +01:00
Peter Krempa
e0b3e4e11c conf: Remove impossible error in virDomainDefFormatFeatures
'i' is always in range of the enum, thus the name is always populated by
virDomainFeatureTypeToString.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-03-06 15:53:52 +01:00
Peter Krempa
21dd762de8 conf: Rename temp buffers in virDomainDefFormatFeatures
These buffers are used temporarily for some of the partial formatters
but not globally. Prefix the name with 'tmp' to be explicit.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-03-06 15:53:52 +01:00
Peter Krempa
4c85929a73 conf: Refactor control flow in virDomainDefFormatFeatures
Use an early return to avoid one level of nesting scopes.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-03-06 15:53:52 +01:00
Peter Krempa
c3878c94f4 conf: Split out domain features formatting from virDomainDefFormatInternal
Pure code motion of code for formatting domain features to a function
called virDomainDefFormatFeatures. Best viewed with the '--patience'
option for git show.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-03-06 15:53:52 +01:00
Peter Krempa
a0585301cd conf: refactor formatting of 'blkiotune' from virDomainDefFormatInternal
Split out the code into a separate function named
virDomainDefFormatBlkiotune and use virXMLFormatElement.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-03-06 15:53:52 +01:00
Peter Krempa
b6f32c9ec2 conf: Refactor virDomainHubDefFormat
Use virXMLFormatElement to format the internals along with simplifying
cleanup code paths.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-03-06 15:53:52 +01:00
Peter Krempa
1fb4c01a8e conf: Refactor virDomainInputDefFormat
Use virXMLFormatElement to format the internals along with simplifying
cleanup code paths.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-03-06 15:53:52 +01:00
Peter Krempa
af993b172c conf: Refactor formatting of 'driver' in virDomainRNGDefFormat
Use virXMLFormatElement to format the internals along with simplifying
cleanup code paths.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-03-06 15:53:52 +01:00
Peter Krempa
bc817ddfdd conf: Refactor virDomainPanicDefFormat
Use virXMLFormatElement to format the internals along with simplifying
cleanup code paths.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-03-06 15:53:52 +01:00
Peter Krempa
4a08acd77e conf: Refactor virDomainWatchdogDefFormat
Use virXMLFormatElement to format the internals along with simplifying
cleanup code paths.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-03-06 15:53:51 +01:00
Peter Krempa
afc47b7785 conf: Refactor virDomainMemballoonDefFormat
Use virXMLFormatElement to format the internals along with simplifying
cleanup code paths.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-03-06 15:53:51 +01:00
Peter Krempa
6b8a31e26c conf: Use virXMLFormatElement in virDomainControllerDefFormat
Refactor the function to use the XML formatting aid and use automatic
cleaning to simplify the control flow.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-03-06 15:53:51 +01:00