]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
5 years agovirfile: Add Quobyte as a shared fs
Silvan Kaiser [Tue, 28 May 2019 12:55:29 +0000 (14:55 +0200)]
virfile: Add Quobyte as a shared fs

This adds detection of a Quobyte as a shared file system for live
migration.

Signed-off-by: Silvan Kaiser <silvan@quobyte.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agovirpci: Drop duplicate function
Michal Privoznik [Thu, 18 Jul 2019 18:28:15 +0000 (20:28 +0200)]
virpci: Drop duplicate function

We have two functions: virPCIDeviceAddressIsEqual() defined only
on Linux and virPCIDeviceAddressEqual() defined everywhere. And
both of them do the same. Drop the former in favour of the
latter.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
5 years agoqemu: blockjob: Adjust ATTRIBUTE_NONNULL statements for qemuBlockJobDiskNew
Peter Krempa [Fri, 19 Jul 2019 06:47:39 +0000 (08:47 +0200)]
qemu: blockjob: Adjust ATTRIBUTE_NONNULL statements for qemuBlockJobDiskNew

Commit 5ff46aaa7f added a new parameter but neglected to fix the NONNULL
declarations.

Reported-by: Julio Faracco <jcfaracco@gmail.com>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
5 years agoutil: Fix broken MinGW builds caused by commit 9bc01ad8
Erik Skultety [Fri, 19 Jul 2019 06:10:12 +0000 (08:10 +0200)]
util: Fix broken MinGW builds caused by commit 9bc01ad8

virPCIGetSysfsFile is conditionally compiled only on Linux platforms.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
5 years agoqemu: hotplug: Transfer ownership of backing chain to block job on disk unplug
Peter Krempa [Mon, 25 Mar 2019 15:30:28 +0000 (16:30 +0100)]
qemu: hotplug: Transfer ownership of backing chain to block job on disk unplug

When removing the disk fronted while any block job is still active we
need to transfer the ownership of the backing chain to the job itself as
the job still holds the reference to the chain members and thus attempts
to remove them would fail.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: blockjob: Unplug inherited storage chains when concluding blockjob
Peter Krempa [Fri, 29 Mar 2019 07:47:38 +0000 (08:47 +0100)]
qemu: blockjob: Unplug inherited storage chains when concluding blockjob

In cases when the disk frontend was unplugged while a blockjob was
running the blockjob inherits the backing chain. When the blockjob is
then terminated we need to unplug the chain as it will not be used any
more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Detect managed persistent reservations in block job orphan chains
Peter Krempa [Thu, 21 Mar 2019 12:54:20 +0000 (13:54 +0100)]
qemu: Detect managed persistent reservations in block job orphan chains

The PR manager is a property of the format layer in qemu so we need to
be able to track it also in the chains of orphaned block jobs.

Add a helper for qemu to look also into the blockjob state.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: blockjob: Track orphaned backing chains in blockjob status XML
Peter Krempa [Tue, 19 Mar 2019 06:54:12 +0000 (07:54 +0100)]
qemu: blockjob: Track orphaned backing chains in blockjob status XML

When the guest unplugs the disk frontend libvirt is responsible for
deleting the backend. Since a blockjob may still have a reference to the
backing chain when it is running we'll have to store the metadata for
the unplugged disk for future reference.

This patch adds 'chain' and 'mirrorChain' fields to 'qemuBlockJobData'
to keep them around with the job along with status XML machinery and
tests. Later patches will then add code to change the ownership of the
chain when unplugging the disk backend.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoconf: export virDomainDiskBackingStoreFormat
Peter Krempa [Thu, 21 Mar 2019 09:29:53 +0000 (10:29 +0100)]
conf: export virDomainDiskBackingStoreFormat

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoconf: export virDomainDiskBackingStoreParse
Peter Krempa [Thu, 21 Mar 2019 09:16:36 +0000 (10:16 +0100)]
conf: export virDomainDiskBackingStoreParse

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: process: Refresh -blockdev based blockjobs on reconnect to qemu
Peter Krempa [Tue, 11 Dec 2018 17:13:35 +0000 (18:13 +0100)]
qemu: process: Refresh -blockdev based blockjobs on reconnect to qemu

Refresh the state of the jobs and process any events that might have
happened while libvirt was not running.

The job state processing requires some care to figure out if a job
needs to be bumped.

For any invalid job try doing our best to cancel it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: blockjob: Add modern block job event handler
Peter Krempa [Fri, 7 Dec 2018 09:21:22 +0000 (10:21 +0100)]
qemu: blockjob: Add modern block job event handler

Add the infrastructure to handle block job events in the -blockdev era.

Some complexity is required as qemu does not bother to notify whether
the job was concluded successfully or failed. Thus it's necessary to
re-query the monitor.

To minimize the possibility of stuck jobs save the state into the XML
prior to handling everything so that the reconnect code can potentially
continue with the cleanup.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Add handler for job state change event
Peter Krempa [Wed, 5 Dec 2018 09:40:45 +0000 (10:40 +0100)]
qemu: Add handler for job state change event

Add support for handling the event either synchronously or
asynchronously using the event thread.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: blockjob: Add helper to convert monitor job status to internal state
Peter Krempa [Mon, 10 Dec 2018 15:56:53 +0000 (16:56 +0100)]
qemu: blockjob: Add helper to convert monitor job status to internal state

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: process: Don't trigger BLOCK_JOB* events with -blockdev
Peter Krempa [Wed, 5 Sep 2018 14:16:17 +0000 (16:16 +0200)]
qemu: process: Don't trigger BLOCK_JOB* events with -blockdev

With blockdev we'll need to use the JOB_STATUS_CHANGE so gate the old
events by the blockdev capability.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: blockjob: Add 'concluded' state for a block job
Peter Krempa [Fri, 7 Dec 2018 16:40:30 +0000 (17:40 +0100)]
qemu: blockjob: Add 'concluded' state for a block job

This new state is entered when qemu finished the job but libvirt does
not know whether it was successful or not.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agotests: qemustatusxml2xml: Add test case for block job tracking
Peter Krempa [Fri, 30 Nov 2018 16:40:40 +0000 (17:40 +0100)]
tests: qemustatusxml2xml: Add test case for block job tracking

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: driver: Remove unnecessary saving of status XML
Peter Krempa [Wed, 15 May 2019 09:07:53 +0000 (11:07 +0200)]
qemu: driver: Remove unnecessary saving of status XML

Now that the blockjob handling code deals with the status XML we don't
need to save it explicitly when starting blockjobs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: blockjob: Save status XML when modifying job state
Peter Krempa [Wed, 15 May 2019 08:58:42 +0000 (10:58 +0200)]
qemu: blockjob: Save status XML when modifying job state

Now that block job data is stored in the status XML portion we need to
make sure that everything which changes the state also saves the status
XML. The job registering function is used while parsing the status XML
so in that case we need to skip the XML saving.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: domain: Store blockjob data in the status XML
Peter Krempa [Fri, 30 Nov 2018 09:36:22 +0000 (10:36 +0100)]
qemu: domain: Store blockjob data in the status XML

We need to store the block job state in the status XML so that we can
properly recover any data when reconnecting after startup and also in
the end to be able to do any transition of the backing chain that
happened while libvirt was not connected to the monitor.

First step is to note the name, type, state and corresponding disk into
the status XML.

We also need to make sure that a broken blockjob does not make libvirt
lose the VM, thus many of the errors just mark the job as invalid.
Later on we'll cancel all invalid jobs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: blockjob: Add flag for invalid block job data
Peter Krempa [Fri, 5 Jul 2019 07:02:21 +0000 (09:02 +0200)]
qemu: blockjob: Add flag for invalid block job data

The job data saved in the XML may be partially invalid e.g. if something
is missing. To prevent losing a domain with such a job add a flag to the
job data so that job APIs can ignore such a job and we can just cancel
it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: blockjob: Export functions for allocating and registering job data
Peter Krempa [Mon, 1 Jul 2019 15:36:38 +0000 (17:36 +0200)]
qemu: blockjob: Export functions for allocating and registering job data

When parsing the status XML we need to register all existing jobs.
Export the functions so that they are usable in other modules.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: blockjob: Add string convertors for blockjob type and state enums
Peter Krempa [Fri, 30 Nov 2018 15:55:08 +0000 (16:55 +0100)]
qemu: blockjob: Add string convertors for blockjob type and state enums

Later on we'll format these values into the status XML so the from/to
string functions will come handy. The implementation also notes that
these will be used in the status XML to avoid somebody changing the
values.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: blockjob: Register new and running blockjobs in the global table
Peter Krempa [Thu, 29 Nov 2018 16:35:52 +0000 (17:35 +0100)]
qemu: blockjob: Register new and running blockjobs in the global table

Add the job structure to the table when instantiating a new job and
remove it when it terminates/fails.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: domain: Add global table of blockjobs
Peter Krempa [Thu, 29 Nov 2018 11:50:09 +0000 (12:50 +0100)]
qemu: domain: Add global table of blockjobs

Block jobs currently belong to disks only so we can look up the block
job data for them in the corresponding disks. This won't be the case
when using blockdev as certain jobs don't even correspond to a disk and
most of them can run on a part of the backing chain.

Add a global table of blockjobs which can be used to look up the data
for the blockjobs when the job events need to be processed.

The table is a hash table organized by job name and has a reference to
the job. New and running jobs will later be added to this table.
Reference counting will allow to reap job state for synchronous callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: blockjob: Update new job state earlier in qemuBlockJobEventProcessLegacy
Peter Krempa [Wed, 17 Jul 2019 14:00:32 +0000 (16:00 +0200)]
qemu: blockjob: Update new job state earlier in qemuBlockJobEventProcessLegacy

The legacy job handler does not look at the old job state so we can
update it earlier.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: blockjob: Save config only in qemuBlockJobEventProcessLegacyCompleted
Peter Krempa [Wed, 17 Jul 2019 13:39:57 +0000 (15:39 +0200)]
qemu: blockjob: Save config only in qemuBlockJobEventProcessLegacyCompleted

There's no need to do it if the job is not completed. The new helper
allows to do this with much less hassle in the correct place.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: blockjob: Separate and unify block job (un)registration
Peter Krempa [Thu, 27 Jun 2019 15:54:24 +0000 (17:54 +0200)]
qemu: blockjob: Separate and unify block job (un)registration

Rename and move qemuBlockJobTerminate to qemuBlockJobUnregister and
separate bits from qemuBlockJobDiskNew which register the job with the
disk. This creates an unified interface for other APIs to use.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: blockjob: Use VIR_AUTOUNREF in qemuBlockJobDataNew
Peter Krempa [Wed, 26 Jun 2019 12:50:25 +0000 (14:50 +0200)]
qemu: blockjob: Use VIR_AUTOUNREF in qemuBlockJobDataNew

Simplify error paths.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: domain: Add helper for saving config XML
Peter Krempa [Thu, 4 Jul 2019 16:51:36 +0000 (18:51 +0200)]
qemu: domain: Add helper for saving config XML

Similarly to qemuDomainSaveStatus add a helper to save the config XML
named qemuDomainSaveConfig.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: domain: Repurpose and export helper for saving domain status XML
Peter Krempa [Thu, 27 Jun 2019 13:40:39 +0000 (15:40 +0200)]
qemu: domain: Repurpose and export helper for saving domain status XML

Rename qemuDomainObjSaveJob and create a wrapper for it which does not
require 'driver' to be passed and export it so that other palces can
easily save the status XML without having to invoke virDomainSaveStatus
which has unpleasing parameters.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agotests: qemublock: Add testing of 'blockdev-create' generators
Peter Krempa [Tue, 4 Sep 2018 11:40:01 +0000 (13:40 +0200)]
tests: qemublock: Add testing of 'blockdev-create' generators

Test the output against the schema and also against what we expect.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoconf: snapshot: Provide a function to free virDomainSnapshotDiskDefPtr
Peter Krempa [Tue, 4 Sep 2018 14:02:43 +0000 (16:02 +0200)]
conf: snapshot: Provide a function to free virDomainSnapshotDiskDefPtr

Tests will need to parse such a definition so it also needs to be freed.
Provide a function for it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoconf: snapshot: Export virDomainSnapshotDiskDefParseXML
Peter Krempa [Tue, 4 Sep 2018 13:42:42 +0000 (15:42 +0200)]
conf: snapshot: Export virDomainSnapshotDiskDefParseXML

Allow using it from the tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: domain: Export qemuDomainPrepareStorageSourceBlockdev
Peter Krempa [Tue, 9 Oct 2018 09:06:39 +0000 (11:06 +0200)]
qemu: domain: Export qemuDomainPrepareStorageSourceBlockdev

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: block: Add generator for creating storage with blockdev-create
Peter Krempa [Thu, 6 Sep 2018 07:09:55 +0000 (09:09 +0200)]
qemu: block: Add generator for creating storage with blockdev-create

QEMU allows us to create storage on certain network protocols which
allow image creation through their API. Wire up the generator for using
it with libvirt as well as for local files.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: block: Add generator for image format creation properties
Peter Krempa [Mon, 3 Sep 2018 18:08:07 +0000 (20:08 +0200)]
qemu: block: Add generator for image format creation properties

'blockdev-add' allows us to use qemu to format images to our desired
format. This patch implements helpers which convert a
virStorageSourcePtr into JSON objects describing the required
configuration.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: block: Use 'auto-read-only' instead of 'read-only' for backing chain
Peter Krempa [Tue, 4 Sep 2018 17:29:10 +0000 (19:29 +0200)]
qemu: block: Use 'auto-read-only' instead of 'read-only' for backing chain

To allow using -blockdev with blockjobs QEMU needs to reopen files in
read-write mode when modifying the backing chain. To achieve this we
need to use 'auto-read-only' for the backing files rather than the
normal 'read-only' property. That way qemu knows that the files need to
be reopened.

Note that the format drivers (e.g. qcow2) are still opened with the
read-only property enabled when being a member of the backing chain
since they are supposed to be immutable unless a block job is started.

QEMU v4.0 (since commit 23dece19da4) allows also dynamic behaviour for
auto-read-only which allows us to use sVirt as we only grant write
permissions to files when doing a blockjob.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: block: Extract formatting of 'driver' attribute from child formatters
Peter Krempa [Tue, 5 Feb 2019 15:03:39 +0000 (16:03 +0100)]
qemu: block: Extract formatting of 'driver' attribute from child formatters

To allow reusing the formatters in the code for creating JSON properties
for 'blockdev-create' we need to create everything except the 'driver'
attribute.

Use the new helper virJSONValueObjectPrependString to put the driver at
the same place so that we don't change any output.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: json: Introduce helper to prepend string into a virJSONValueObject
Peter Krempa [Tue, 5 Feb 2019 17:45:05 +0000 (18:45 +0100)]
util: json: Introduce helper to prepend string into a virJSONValueObject

Libvirt treats the JSON objects as lists thus the values appear in the
order they were added. To avoid too much changes introduce a helper
which allows to prepend a string which will allow to keep certain
outputs in order.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agotests: qemublock: Add testing of pure disk source specification JSON generator
Peter Krempa [Mon, 17 Dec 2018 15:29:05 +0000 (16:29 +0100)]
tests: qemublock: Add testing of pure disk source specification JSON generator

Add testing of the host specification part so that we can be sure that
no image/host specific data will be present.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: block: Allow skipping non-target related data when formating disk JSON
Peter Krempa [Tue, 4 Sep 2018 16:52:02 +0000 (18:52 +0200)]
qemu: block: Allow skipping non-target related data when formating disk JSON

When formatting new qcow2 images we need to provide the backing store
string which should not contain any authentication or irrelevant data.

Add a flag for qemuBlockStorageSourceGetBackendProps which allows to
skip the irrelevant data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: monitor: Add APIs for 'blockdev-create'
Peter Krempa [Mon, 3 Sep 2018 12:45:16 +0000 (14:45 +0200)]
qemu: monitor: Add APIs for 'blockdev-create'

The 'blockdev-create' starts a job which creates a storage volume using
the given protocol or formats an existing (added) volume with one of the
supported storage formats.

This patch adds the monitor interaction bits.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: monitor: Implement support for 'JOB_STATUS_CHANGE' event
Peter Krempa [Tue, 4 Dec 2018 16:57:23 +0000 (17:57 +0100)]
qemu: monitor: Implement support for 'JOB_STATUS_CHANGE' event

This new event is a superset of the BLOCK_JOB* events and also covers
jobs which don't bind to a VM disk.

In this patch the monitor part is implemented.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: monitor: Add infrastructure for 'query-jobs'
Peter Krempa [Tue, 4 Dec 2018 16:58:38 +0000 (17:58 +0100)]
qemu: monitor: Add infrastructure for 'query-jobs'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: monitor: Add support for 'job-complete' command
Peter Krempa [Thu, 16 Aug 2018 09:48:41 +0000 (11:48 +0200)]
qemu: monitor: Add support for 'job-complete' command

This belongs to the new job management API which can manage also
non-block based jobs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: monitor: Add support for 'job-cancel' command
Peter Krempa [Thu, 16 Aug 2018 09:48:41 +0000 (11:48 +0200)]
qemu: monitor: Add support for 'job-cancel' command

This belongs to the new job management API which can manage also
non-block based jobs. Since we'll need to be able to attempt to cancel
jobs which potentially were not started (during reconnect) the 'quiet'
flag allows to suppress errors reported.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: monitor: Add support for 'job-dismiss' command
Peter Krempa [Thu, 16 Aug 2018 09:48:41 +0000 (11:48 +0200)]
qemu: monitor: Add support for 'job-dismiss' command

This belongs to the new job management API for generic jobs.

The dismiss command is meant to remove a concluded job after we were
able to get the final status.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: monitor: Add new fields for 'blockdev-mirror' command
Peter Krempa [Thu, 16 Aug 2018 16:47:20 +0000 (18:47 +0200)]
qemu: monitor: Add new fields for 'blockdev-mirror' command

Allow using the delayed dismiss of the job so that we can reap the state
even if libvirtd was not running when qemu emitted the job completion
event.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: monitor: Add new fields for 'block-commit' command
Peter Krempa [Thu, 16 Aug 2018 16:20:25 +0000 (18:20 +0200)]
qemu: monitor: Add new fields for 'block-commit' command

Allow using the node name to specify the base and top of the 'commit'
operation, allow specifying explicit job name and add support for
delayed dismiss of the job so that we can reap the state even if
libvirtd was not running when qemu emitted the job completion event.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: monitor: Add new fields for 'block-stream' command
Peter Krempa [Wed, 15 Aug 2018 11:13:53 +0000 (13:13 +0200)]
qemu: monitor: Add new fields for 'block-stream' command

Allow using the node name to specify the base of the 'stream' operation,
allow specifying explicit job name and add support for delayed dismiss
of the job so that we can reap the state even if libvirtd was not
running when qemu emitted the job completion event.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: storage: Don't leak metadata on repeated calls of virStorageFileGetMetadata
Peter Krempa [Thu, 18 Jul 2019 14:32:44 +0000 (16:32 +0200)]
util: storage: Don't leak metadata on repeated calls of virStorageFileGetMetadata

When querying storage metadata after a block job we re-run
virStorageFileGetMetadata on the top level storage file. This means that
the workers (virStorageFileGetMetadataInternal) must not overwrite any
pointers without freeing them.

This was not considered for src->compat and src->features. Fix it and
add a comment mentioning that.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoutil: storage: Clean up label use in virStorageFileGetMetadataInternal
Peter Krempa [Thu, 18 Jul 2019 14:30:18 +0000 (16:30 +0200)]
util: storage: Clean up label use in virStorageFileGetMetadataInternal

The function does not do any cleanup, so replace the 'cleanup' label
with return of -1 and the 'done' label with return of 0.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agonetwork: Link with libxml2
Michal Privoznik [Thu, 18 Jul 2019 14:00:54 +0000 (16:00 +0200)]
network: Link with libxml2

Since fb9f6ce6253 we are including a libxml header file in the
network driver but never link with it. This hasn't caused an
immediate problem because in the end the network driver links
with libvirt.la. But apparently, it's causing a build issue on
old Ubuntu.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
5 years agotools: Introduce virshNodedevCapabilityNameCompleter
Michal Privoznik [Fri, 14 Jun 2019 12:27:13 +0000 (14:27 +0200)]
tools: Introduce virshNodedevCapabilityNameCompleter

This is a very simple completer for completing --cap argument of
nodedev-list command.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
5 years agovirsh-completer: Separate comma list construction into a function
Michal Privoznik [Tue, 18 Jun 2019 10:16:17 +0000 (12:16 +0200)]
virsh-completer: Separate comma list construction into a function

There are more arguments than 'shutdown --mode' that accept a
list of strings separated by commas. 'nodedev-list --cap' is one
of them. To avoid duplicating code, let's separate interesting
bits of virshDomainShutdownModeCompleter() into a function that
can then be reused.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
5 years agoutil: command: Ignore bitmap errors when enumerating file descriptors to close
Peter Krempa [Thu, 18 Jul 2019 13:05:35 +0000 (15:05 +0200)]
util: command: Ignore bitmap errors when enumerating file descriptors to close

virCommandMassCloseGetFDsLinux fails when running libvird on valgrind
with the following message:

libvirt:  error : internal error: unable to set FD as open: 1024

This is because valgrind opens few file descriptors beyond the limit:

65701125 lr-x------. 1 root root 64 Jul 18 14:48 1024 -> /home/pipo/build/libvirt/gcc/src/.libs/libvirtd
65701126 lrwx------. 1 root root 64 Jul 18 14:48 1025 -> '/tmp/valgrind_proc_3849_cmdline_186612e3 (deleted)'
65701127 lrwx------. 1 root root 64 Jul 18 14:48 1026 -> '/tmp/valgrind_proc_3849_auxv_186612e3 (deleted)'
65701128 lrwx------. 1 root root 64 Jul 18 14:48 1027 -> /dev/pts/11
65701129 lr-x------. 1 root root 64 Jul 18 14:48 1028 -> 'pipe:[65689522]'
65701130 l-wx------. 1 root root 64 Jul 18 14:48 1029 -> 'pipe:[65689522]'
65701131 lr-x------. 1 root root 64 Jul 18 14:48 1030 -> /tmp/vgdb-pipe-from-vgdb-to-3849-by-root-on-angien

Ignore bitmap errors in this case since we'd leak those FD's anyways in
the previous scenario.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agolibvirt_private.syms: Properly expose virPCI* function from virpci.h
Michal Privoznik [Thu, 18 Jul 2019 13:18:09 +0000 (15:18 +0200)]
libvirt_private.syms: Properly expose virPCI* function from virpci.h

There are couple of functions that are meant to be exposed but
are missing syms file adjustment.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
5 years agovirSecurityManagerMetadataLock: Skip over duplicate paths
Michal Privoznik [Thu, 18 Jul 2019 08:59:08 +0000 (10:59 +0200)]
virSecurityManagerMetadataLock: Skip over duplicate paths

If there are two paths on the list that are the same we need to
lock it only once. Because when we try to lock it the second time
then open() fails. And if it didn't, locking it the second time
would fail for sure. After all, it is sufficient to lock all
paths just once satisfy the caller.

Reported-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Tested-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agovirSecurityManagerMetadataLock: Expand the comment on deadlocks
Michal Privoznik [Thu, 18 Jul 2019 08:58:19 +0000 (10:58 +0200)]
virSecurityManagerMetadataLock: Expand the comment on deadlocks

Document why we need to sort paths while it's still fresh in my
memory.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Tested-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoutil: Fix uninitalized variable to avoid garbage value.
Julio Faracco [Thu, 18 Jul 2019 03:44:56 +0000 (00:44 -0300)]
util: Fix uninitalized variable to avoid garbage value.

This commit is similar with 596aa144. It fixes an uninitialized
variable to avoid garbage value. This case, it uses time 't' 0 if
an error occurs with virTimeMillisNowRaw.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agodocs: formatnetwork: Document xmlns:dnsmasq
Cole Robinson [Sun, 14 Jul 2019 23:46:15 +0000 (19:46 -0400)]
docs: formatnetwork: Document xmlns:dnsmasq

Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agonetwork: wire up dnsmasq option xmlns
Cole Robinson [Sun, 14 Jul 2019 22:25:12 +0000 (18:25 -0400)]
network: wire up dnsmasq option xmlns

This maps to XML like:

  <network xmlns:dnsmasq='http://libvirt.org/schemas/network/dnsmasq/1.0'>
    ...
    <dnsmasq:options>
      <dnsmasq:option value="foo=bar"/>
      <dnsmasq:option value="cname=*.foo.example.com,master.example.com"/>
    </dnsmasq:options>
  </network>

To dnsmasq config options

  ...
  foo=bar
  cname=*.foo.example.com,master.example.com

Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agoconf: Add virNetworkXMLNamespace
Cole Robinson [Sun, 14 Jul 2019 11:36:44 +0000 (07:36 -0400)]
conf: Add virNetworkXMLNamespace

Just the plumbing, no real implementation yet

Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agoconf: Add network xmlopt argument
Cole Robinson [Sun, 14 Jul 2019 16:15:12 +0000 (12:15 -0400)]
conf: Add network xmlopt argument

Pass an xmlopt argument through all the needed network conf
functions, like is done for domain XML handling. No functional
change for now

Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agoconf: Add virNetworkXMLOption
Cole Robinson [Sun, 14 Jul 2019 16:11:06 +0000 (12:11 -0400)]
conf: Add virNetworkXMLOption

Just a stub for now that is unused. Add init+cleanup plumbing and
demostrate it in bridge_driver.c

Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agodocs: news: add per-release links
Ján Tomko [Wed, 17 Jul 2019 14:29:09 +0000 (16:29 +0200)]
docs: news: add per-release links

Wrap each release headline in an <a> element with the id set
to the release value and page.xsl will take care of the rest.

Reported-by: Kashyap Chamarthy <kchamart@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agodocs: news: remove sed sorcery
Ján Tomko [Wed, 17 Jul 2019 14:28:54 +0000 (16:28 +0200)]
docs: news: remove sed sorcery

Set a default namespace in the stylesheet instead.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agodocs: formatdomain: tsc is supported by QEMU
Ján Tomko [Wed, 17 Jul 2019 13:01:37 +0000 (15:01 +0200)]
docs: formatdomain: tsc is supported by QEMU

As of commit 7373c4e48 the QEMU driver also supports TSC.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
5 years agodocs: formatdomain: remove stray nbsp
Ján Tomko [Wed, 17 Jul 2019 13:01:08 +0000 (15:01 +0200)]
docs: formatdomain: remove stray nbsp

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
5 years agodocs: drvqemu: remove relative time reference
Ján Tomko [Wed, 17 Jul 2019 11:56:13 +0000 (13:56 +0200)]
docs: drvqemu: remove relative time reference

It has not aged well.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
5 years agodocs: drvqemu: fix a typo
Ján Tomko [Wed, 17 Jul 2019 11:46:37 +0000 (13:46 +0200)]
docs: drvqemu: fix a typo

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
5 years agodocs: link to networkportformat.html in format.html
Ján Tomko [Tue, 16 Jul 2019 15:39:30 +0000 (17:39 +0200)]
docs: link to networkportformat.html in format.html

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
5 years agoqemu: command: remove qemuDomainFSDriver
Ján Tomko [Tue, 16 Jul 2019 10:31:03 +0000 (12:31 +0200)]
qemu: command: remove qemuDomainFSDriver

Having a translation enum full of empty strings seems excessive.
Now that the validiation is performed in qemuDomainDeviceDefValidateFS,
remove it completely and open-code the two allowed cases.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
5 years agoqemu: command: use VIR_AUTOCLEAN in qemuBuildFS*
Ján Tomko [Tue, 16 Jul 2019 10:25:31 +0000 (12:25 +0200)]
qemu: command: use VIR_AUTOCLEAN in qemuBuildFS*

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
5 years agoqemu: introduce qemuDomainDeviceDefValidateFS
Ján Tomko [Tue, 16 Jul 2019 10:05:19 +0000 (12:05 +0200)]
qemu: introduce qemuDomainDeviceDefValidateFS

Move validation of the filesystem device out of qemu_command.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
5 years agoqemu: command: use VIR_AUTOFREE in qemuBuildFSDevCommandLine
Ján Tomko [Tue, 16 Jul 2019 08:37:03 +0000 (10:37 +0200)]
qemu: command: use VIR_AUTOFREE in qemuBuildFSDevCommandLine

Introduce two separate variables instead of reusing the same one
for clarity.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
5 years agoqemu: command: re-introduce qemuBuildFSDevCommandLine
Ján Tomko [Tue, 16 Jul 2019 08:35:44 +0000 (10:35 +0200)]
qemu: command: re-introduce qemuBuildFSDevCommandLine

This time it only builds one device.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
5 years agoqemu: command: rename qemuBuildFSDevCommandLine
Ján Tomko [Tue, 16 Jul 2019 08:30:51 +0000 (10:30 +0200)]
qemu: command: rename qemuBuildFSDevCommandLine

This function iterates over all filesystems, not just -fsdevs.

Rename it to free the name for a function that actually builds fsdevs.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
5 years agoqemu: address: remove useless comment
Ján Tomko [Tue, 16 Jul 2019 06:30:31 +0000 (08:30 +0200)]
qemu: address: remove useless comment

Commit b27375a9b86f010a9a9fc0323be3f204b62195f4 omitted one zero.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
5 years agoqemu: add CAPS_LATEST tests for 9pfs
Ján Tomko [Tue, 16 Jul 2019 10:49:32 +0000 (12:49 +0200)]
qemu: add CAPS_LATEST tests for 9pfs

Use the existing fs9p.xml and fs9p-ccw.xml to run the tests
with latest caps on x86_64 and s390x.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
5 years agotests: qemu: minimize fs9p.xml
Ján Tomko [Tue, 16 Jul 2019 10:50:44 +0000 (12:50 +0200)]
tests: qemu: minimize fs9p.xml

Remove the hard drive, USB controller and memballoon.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
5 years agovirCommand: use procfs to learn opened FDs
Michal Privoznik [Tue, 2 Jul 2019 17:49:51 +0000 (19:49 +0200)]
virCommand: use procfs to learn opened FDs

When spawning a child process, between fork() and exec() we close
all file descriptors and keep only those the caller wants us to
pass onto the child. The problem is how we do that. Currently, we
get the limit of opened files and then iterate through each one
of them and either close() it or make it survive exec(). This
approach is suboptimal (although, not that much in default
configurations where the limit is pretty low - 1024). We have
/proc where we can learn what FDs we hold open and thus we can
selectively close only those.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agovircommand: Separate mass FD closing into a function
Michal Privoznik [Tue, 2 Jul 2019 06:27:25 +0000 (08:27 +0200)]
vircommand: Separate mass FD closing into a function

I will optimize this code a bit in the next commit. But for that
it is better if the code lives in a separate function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agotest: Introduce virnetdevopenvswitchtest
Michal Privoznik [Tue, 16 Jul 2019 07:33:38 +0000 (09:33 +0200)]
test: Introduce virnetdevopenvswitchtest

Test if our parsing of interface stats as returned by ovs-vsctl
works as expected. To achieve this without having to mock
virCommand* I'm separating parsing of stats into a separate
function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agovirNetDevOpenvswitchInterfaceStats: Optimize for speed
Michal Privoznik [Fri, 28 Jun 2019 08:33:09 +0000 (10:33 +0200)]
virNetDevOpenvswitchInterfaceStats: Optimize for speed

We run 'ovs-vsctl' nine times (first to find if interface is
there and then eight times = for each stats member separately).
This is very inefficient. I've found a way to run it once and
with a bit of help from virJSON module we can parse out stats
we need.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agotests: don't assume "localhost" only resolves to 1/2 IPs
Daniel P. Berrangé [Mon, 15 Jul 2019 15:58:02 +0000 (16:58 +0100)]
tests: don't assume "localhost" only resolves to 1/2 IPs

On Debian derived distros "localhost" can resolve to the normal
"127.0.0.1" and "::1", but it can also resolve to "127.0.1.1"

Rewrite the code so that it doesn't assume a fixed number of IPs.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agotest_driver: implement virDomainSetMemoryParameters
Ilias Stamatis [Thu, 4 Jul 2019 21:36:35 +0000 (23:36 +0200)]
test_driver: implement virDomainSetMemoryParameters

Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
5 years agointerface: fix driver name in state directory path
Daniel P. Berrangé [Thu, 11 Jul 2019 15:22:03 +0000 (16:22 +0100)]
interface: fix driver name in state directory path

Typo meant we use 'nodedev' instead of 'interface'. This doesn't hurt
libvirtd because if a process tries to acquire a lock it already holds
it will succeed. It fails when nodedev & interface drivers are in
separate daemons though.

Reviewed-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoall: don't wait for driver lock during startup
Daniel P. Berrangé [Thu, 11 Jul 2019 14:57:34 +0000 (15:57 +0100)]
all: don't wait for driver lock during startup

When the drivers acquire their pidfile lock we don't want to wait if the
lock is already held. We need the driver to immediately report error,
causing the daemon to exit.

Reviewed-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agotest_driver: implement virDomainSetUserPassword
Ilias Stamatis [Tue, 9 Jul 2019 16:13:44 +0000 (18:13 +0200)]
test_driver: implement virDomainSetUserPassword

Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
5 years agolibvirt_nss: Report newer addresses first
Michal Privoznik [Wed, 10 Jul 2019 12:30:11 +0000 (14:30 +0200)]
libvirt_nss: Report newer addresses first

Ideally, a software that's translating domain names would iterate
over all addresses the NSS returned, but some software does not
bother (e.g. ping). What happens is that for instance when
installing a guest, it's assigned one IP address but once it's
installed and rebooted it gets a different IP address (because
client ID used for the first DHCP traffic when installing the
guest was generated dynamically and never saved so after reboot
the guest generated new ID which resulted in different IP address
to be assigned). This results in 'ping $domain' not working
properly as it still pings the old IP address. Well, it might -
NSS plugin does not guarantee any order of addresses.

To resolve this problem, we can sort the array just before
returning it to the caller (ping) so that the newer IP addresses
come before older ones.

Reported-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
5 years agolibvirt_nss: Pass @name to appendAddr()
Michal Privoznik [Wed, 10 Jul 2019 08:34:53 +0000 (10:34 +0200)]
libvirt_nss: Pass @name to appendAddr()

In the nss plugin we have ERROR() macro which by default does
nothing. However, at compile time it can be made to report errors
(this is useful for debugging because by nature of NSS debugging
is hard). Anyway, the appendAddr() function uses @name (which
contains name the caller wants us to resolve) for error
reporting. But the caller findLeaseInJSON() is not passing it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
5 years agolibvirt_nss: Drop some needless cleanup labels
Michal Privoznik [Wed, 10 Jul 2019 08:09:46 +0000 (10:09 +0200)]
libvirt_nss: Drop some needless cleanup labels

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
5 years agolibvirt_nss: Use VIR_AUTOPTR and VIR_AUTOFREE
Michal Privoznik [Wed, 10 Jul 2019 08:03:49 +0000 (10:03 +0200)]
libvirt_nss: Use VIR_AUTOPTR and VIR_AUTOFREE

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
5 years agolibvirt_nss: Use VIR_STEAL_PTR() in findLease()
Michal Privoznik [Wed, 10 Jul 2019 08:01:56 +0000 (10:01 +0200)]
libvirt_nss: Use VIR_STEAL_PTR() in findLease()

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
5 years agosecurity: aa-helper: allow virt-aa-helper to read .vhd images
Christian Ehrhardt [Wed, 3 Jul 2019 10:44:31 +0000 (12:44 +0200)]
security: aa-helper: allow virt-aa-helper to read .vhd images

VHD images can be used as any other, so we should add them to the list
of types that virt-aa-helper can read when creating the per-guest rules
for backing files.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Acked-by: Jamie Strandboge <jamie@canonical.com>
5 years agoqemu: Relax os.loader->type check when validating domain
Michal Privoznik [Sat, 13 Jul 2019 07:17:06 +0000 (09:17 +0200)]
qemu: Relax os.loader->type check when validating domain

When validating a domain among all the checks there are two that
concern VIR_DOMAIN_LOADER_TYPE_PFLASH specifically. The first
check ensures that on x86 ACPI is enabled when UEFI is requested,
the second ensures that UEFI is used when ACPI is requested on
aarch64. However, check for UEFI is done by plain comparison of
def->os.loader->type which is insufficient because we have
def->os.firmware too.

NB, this wouldn't be a problem for active domain, because on
startup process def->os.loader->type gets filled by
qemuFirmwareEnableFeatures(), but that's not the case for
inactive domains.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1729604
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
5 years agoqemu: block: Split up qemuBlockStorageSourceAttachApply
Peter Krempa [Mon, 27 May 2019 15:30:12 +0000 (17:30 +0200)]
qemu: block: Split up qemuBlockStorageSourceAttachApply

Split up the addition of a storage source into the following sub-steps:
1) storage access dependencies (TLS transport, persistent reservation)
2) storage acccess node (file/gluster/nbd...)
3) format driver dependencies (encryption secret)
4) format driver node (qcow2, raw, ...)

The functions split out will be later reused when implementing support
for 'blockdev-create' as we'll need the dependencies plugged in first,
then blockdev-create will be called and after that successfully finishes
blockdev-add will be added.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Refactor variables for extracting flags in qemuDomainBlockCopyCommon
Peter Krempa [Tue, 21 May 2019 11:51:27 +0000 (13:51 +0200)]
qemu: Refactor variables for extracting flags in qemuDomainBlockCopyCommon

Add separate booleans for extracting VIR_DOMAIN_BLOCK_COPY_REUSE_EXT and
VIR_DOMAIN_BLOCK_COPY_SHALLOW from '@flags' and also change 'reuse' into
'existing'.

qemuMonitorDriveMirror requires the unmodified state of the flags to
pass to qemu and also we use the value a few times internally. Extract
it separately now.

The 'reuse' flag did not indicate reusing of the file as much as the
fact that the storage is existing and thus should not be created, so
modify the name to reflect this.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>