]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
6 years agoqemu: migration: Don't call qemuBlockJobSyncEndDisk when block job has terminated
Peter Krempa [Tue, 27 Nov 2018 16:57:53 +0000 (17:57 +0100)]
qemu: migration: Don't call qemuBlockJobSyncEndDisk when block job has terminated

Now that the data is per-job, we don't really need to bother with
finishing the synchronous job handling if the job is already terminated.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Allocate diskPriv->blockjob only when there's a blockjob
Peter Krempa [Wed, 17 Oct 2018 15:22:38 +0000 (17:22 +0200)]
qemu: Allocate diskPriv->blockjob only when there's a blockjob

Rather than storing the presence of the blockjob in a flag we can bind
together the lifecycle of the job with the lifecycle of the object which
is tracking the data for it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: blockjob: Pass job into qemuBlockJobUpdateDisk and rename it
Peter Krempa [Tue, 27 Nov 2018 12:55:28 +0000 (13:55 +0100)]
qemu: blockjob: Pass job into qemuBlockJobUpdateDisk and rename it

Instead of passing in the disk information, pass in the job and name the
function accordingly.

Few callers needed to be modified to have the job pointer handy.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: blockjob: Consume new block job state in the processing function
Peter Krempa [Mon, 26 Nov 2018 14:29:55 +0000 (15:29 +0100)]
qemu: blockjob: Consume new block job state in the processing function

The processing function modifies the job state so it should make sure
that the variable holding the new state is cleared properly and not the
caller. The caller should only deal with the job state and not the
transition that happened.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: blockjob: Remove error propagation from qemuBlockJobUpdateDisk
Peter Krempa [Tue, 4 Dec 2018 12:51:46 +0000 (13:51 +0100)]
qemu: blockjob: Remove error propagation from qemuBlockJobUpdateDisk

The job error can be safely accessed in the job structure, so we don't
need to propagate it through qemuBlockJobUpdateDisk.

Drop the propagation and refactor any caller that pased non-NULL error.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: migration: Extract reporting of disk migration error
Peter Krempa [Mon, 26 Nov 2018 13:19:57 +0000 (14:19 +0100)]
qemu: migration: Extract reporting of disk migration error

The same message is reported in 3 distinct places. Move it out into a
single function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: blockjob: Track current state of blockjob
Peter Krempa [Thu, 17 Jan 2019 15:34:11 +0000 (16:34 +0100)]
qemu: blockjob: Track current state of blockjob

Add a field tracking the current state of job so that it can be queried
later. Until now the job state e.g. that the job is _READY for
finalizing was tracked only for mirror jobs. Add tracking of state for
all jobs.

Similarly to 'qemuBlockJobType' this maps the existing states of the
blockjob from virConnectDomainEventBlockJobStatus to
'qemuBlockJobState' so that we can track some internal states as well.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: blockjob: Convert qemuBlockJobSyncBeginDisk to work with the job
Peter Krempa [Fri, 19 Oct 2018 07:14:54 +0000 (09:14 +0200)]
qemu: blockjob: Convert qemuBlockJobSyncBeginDisk to work with the job

Modify qemuBlockJobSyncBeginDisk to operate on qemuBlockt sJobDataPtr and
rename it accordingly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: blockjob: Pass in job to qemuBlockJobEventProcessLegacy
Peter Krempa [Fri, 23 Nov 2018 13:31:30 +0000 (14:31 +0100)]
qemu: blockjob: Pass in job to qemuBlockJobEventProcessLegacy

Don't split out individual fields, just pass in the job.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: blockjob: Record job type when starting the job
Peter Krempa [Fri, 23 Nov 2018 11:45:32 +0000 (12:45 +0100)]
qemu: blockjob: Record job type when starting the job

We can properly track the job type when starting the job so that we
don't have to infer it later.

This patch also adds an enum of block job types specific to qemu
(qemuBlockjobType) which mirrors the public block job types
(virDomainBlockJobType) but allows for other types to be added later
which will not be public.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: blockjob: Add reference to disk into struct qemuBlockJobData
Peter Krempa [Wed, 21 Nov 2018 14:36:47 +0000 (15:36 +0100)]
qemu: blockjob: Add reference to disk into struct qemuBlockJobData

Block jobs can also happen on objects which are not a disk at a given
point (e.g. the frontend was not hotplugged yet) and thus will be
eventually kept separately. Add a reference back to the disk for
blockjobs which do correspond to a disk.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: blockjob: Drop unnecessary calls to qemuBlockJobSyncEndDisk
Peter Krempa [Thu, 22 Nov 2018 17:34:42 +0000 (18:34 +0100)]
qemu: blockjob: Drop unnecessary calls to qemuBlockJobSyncEndDisk

If the job wasn't started, we don't need to end the synchronous job. Add
a note and drop the unnecessary calls.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: blockjob: Add functions for block job state control
Peter Krempa [Mon, 19 Nov 2018 15:48:09 +0000 (16:48 +0100)]
qemu: blockjob: Add functions for block job state control

Rather than directly modifying fields in the qemuBlockJobDataPtr
structure add a bunch of fields which allow to do the transitions.

This will help later when adding more complexity to the job handling.

APIs introduced in this patch are:

qemuBlockJobDiskNew - prepare for starting a new blockjob on a disk
qemuBlockJobDiskGetJob - get the block job data structure for a disk

For individual job state manipulation the following APIs are added:
qemuBlockJobStarted - Sets the job as started with qemu. Until that
                      the job can be cancelled without asking qemu.

qemuBlockJobStartupFinalize - finalize job startup. If the job was
                              started in qemu already, just releases
                              reference to the job object. Otherwise
                              clears everything as if the job was never
                              started.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: migration: Separate startup of disk mirror from migration logic
Peter Krempa [Thu, 22 Nov 2018 15:16:24 +0000 (16:16 +0100)]
qemu: migration: Separate startup of disk mirror from migration logic

Extract the disk mirroring startup code from the loop into a separate
function to allow cleaner cleanup paths.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: blockjob: Clarify that job 'status' field contains new state
Peter Krempa [Thu, 22 Nov 2018 14:05:50 +0000 (15:05 +0100)]
qemu: blockjob: Clarify that job 'status' field contains new state

The field is used to note the state the job has transitioned to while
handling the blockjob state change event. Rename the field so that it's
obvious that this is the new state and not the general state of the
blockjob.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: blockjob: Turn struct qemuBlockJobData into a virObject
Peter Krempa [Wed, 14 Nov 2018 15:47:50 +0000 (16:47 +0100)]
qemu: blockjob: Turn struct qemuBlockJobData into a virObject

Reference counting will simplify semantics of the lifecycle of the
object.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: migration: Simplify cancellation of migration blockjobs
Peter Krempa [Thu, 18 Oct 2018 11:13:21 +0000 (13:13 +0200)]
qemu: migration: Simplify cancellation of migration blockjobs

When cancelling job after a reconnect we can now use the disk block job
state rather than having to re-detect it in the migration code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: driver: Remove block job status reprobing from qemuDomainBlockPivot
Peter Krempa [Mon, 12 Nov 2018 06:46:49 +0000 (07:46 +0100)]
qemu: driver: Remove block job status reprobing from qemuDomainBlockPivot

Now that we reprobe the status of blockjobs when reconnecting in
addition to handling job status events, the status reprobing can be
removed as we always track the correct status internally.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: process: refresh block jobs on reconnect
Peter Krempa [Thu, 18 Oct 2018 10:34:49 +0000 (12:34 +0200)]
qemu: process: refresh block jobs on reconnect

Block job state was widely untracked by libvirt across restarts which
was allowed by a stateless block job finishing handler which discarded
disk state and redetected it. This is undesirable since we'll need to
track more information for individual blockjobs due to -blockdev
integration requirements.

In case of legacy blockjobs we can recover whether the job is present at
reconnect time by querying qemu. Adding tracking whether a job is
present will allow simplification of the non-shared-storage cancellation
code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: migration: Properly note that non-shared-storage migration uses a blockjob
Peter Krempa [Thu, 18 Oct 2018 11:11:08 +0000 (13:11 +0200)]
qemu: migration: Properly note that non-shared-storage migration uses a blockjob

Internally we do a 'block-copy' to accomodate non-shared storage
migration but the code did not fill in that the block job was active on
the disk when starting the copy job. Since we handle block jobs finishes
regardless of having it registered it's not a problem but soon will
become one.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: blockjob: Split out handling of completed jobs
Peter Krempa [Wed, 17 Oct 2018 12:51:56 +0000 (14:51 +0200)]
qemu: blockjob: Split out handling of completed jobs

qemuBlockJobEventProcessLegacy was getting too big. Remove handling of
completed jobs in a separate function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: blockjob: Rename qemuBlockJobEventProcess to qemuBlockJobEventProcessLegacy
Peter Krempa [Wed, 17 Oct 2018 12:43:01 +0000 (14:43 +0200)]
qemu: blockjob: Rename qemuBlockJobEventProcess to qemuBlockJobEventProcessLegacy

This will handle blockjob finalizing for the old approach so rename it
accordingly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: process: Consolidate error paths in qemuProcessHandleBlockJob
Peter Krempa [Wed, 17 Oct 2018 12:22:23 +0000 (14:22 +0200)]
qemu: process: Consolidate error paths in qemuProcessHandleBlockJob

'cleanup' label was accessed only from a jump to 'error'. Consolidate
everyting into 'cleanup'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Consolidate disk blockjob variables into a structure
Peter Krempa [Wed, 17 Oct 2018 06:57:08 +0000 (08:57 +0200)]
qemu: Consolidate disk blockjob variables into a structure

Struct qemuDomainDiskPrivate was holding multiple variables connected to
a disk block job. Consolidate them into a new struct qemuBlockJobData.

This will also allow simpler extensions to the block job mechanisms.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: blockjob: Remove header dependency on qemu_domain.h
Peter Krempa [Tue, 16 Oct 2018 14:43:49 +0000 (16:43 +0200)]
qemu: blockjob: Remove header dependency on qemu_domain.h

The blockjob module uses 'qemuDomainAsyncJob' in it's public headers.
As I plan adding a new structure containing job data which will need to
be included in "qemu_domain.h" it's necessary to break the circular
dependency.

Convert 'qemuDomainAsyncJob' type to 'int' as it's an enum.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: blockjob: Rename public APIs
Peter Krempa [Tue, 16 Oct 2018 14:36:18 +0000 (16:36 +0200)]
qemu: blockjob: Rename public APIs

All the public APIs of the qemu_blockjob module operate on a 'disk'.
Since I'll be adding APIs which operate on a job later let's rename the
existing ones.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: blockjob: Unexport qemuBlockJobEventProcess
Peter Krempa [Tue, 16 Oct 2018 09:54:02 +0000 (11:54 +0200)]
qemu: blockjob: Unexport qemuBlockJobEventProcess

The function is now only called locally. Some code movement was
necessary to avoid forward declarations.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: processBlockJobEvent: Use qemuBlockJobUpdate to process block job events
Peter Krempa [Tue, 16 Oct 2018 09:47:32 +0000 (11:47 +0200)]
qemu: processBlockJobEvent: Use qemuBlockJobUpdate to process block job events

Replace use of qemuBlockJobEventProcess with the general helper. A small
tweak is required to pass in the 'type' and 'status' of the job via the
appropriate private data variables.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: blockjob: Emit VIR_DOMAIN_EVENT_ID_BLOCK_JOB only for local disks
Peter Krempa [Thu, 17 Jan 2019 12:52:09 +0000 (13:52 +0100)]
qemu: blockjob: Emit VIR_DOMAIN_EVENT_ID_BLOCK_JOB only for local disks

The event reports the disk path to identify the disk which makes sense
only for local disks. Additionally network backed disks like NBD don't
need to have a path so the callback would return NULL.

Report VIR_DOMAIN_EVENT_ID_BLOCK_JOB only for non-empty local disks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: blockjob: Extract emitting of libvirt events
Peter Krempa [Wed, 12 Sep 2018 15:13:16 +0000 (17:13 +0200)]
qemu: blockjob: Extract emitting of libvirt events

Put the emitting of VIR_DOMAIN_EVENT_ID_BLOCK_JOB and
VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2 into a separate function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: fill out usage-specific TLS settings after parsing
Ján Tomko [Mon, 14 Jan 2019 22:06:06 +0000 (23:06 +0100)]
qemu: fill out usage-specific TLS settings after parsing

Instead of copying the default default values upfront
and then wondering whether the user has given us a new default,
leave the per-usage TLS certdirs and secrets empty during
parsing and only fill them afterwards if they weren't provided
by the user.

This means that instead of looking whether the specific certdir
paths match the default default, the Validate function (which
is called in between parsing and setting the defaults) can error
out for missing directories if the value is present, because
it must've come from the user.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu.conf: fill out TLS verify attributes after parsing
Ján Tomko [Mon, 14 Jan 2019 21:51:00 +0000 (22:51 +0100)]
qemu.conf: fill out TLS verify attributes after parsing

Introduce a set of bool variables with the 'present' suffix
to track whether the value was actually specified.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: group swtpm entry in augeas file
Ján Tomko [Mon, 14 Jan 2019 20:18:26 +0000 (21:18 +0100)]
qemu: group swtpm entry in augeas file

They are meant to be together.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: fix double space in augeas file
Ján Tomko [Mon, 14 Jan 2019 20:18:18 +0000 (21:18 +0100)]
qemu: fix double space in augeas file

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agosrc: Don't use double-colon rules
Andrea Bolognani [Fri, 11 Jan 2019 10:03:53 +0000 (11:03 +0100)]
src: Don't use double-colon rules

According to the GNU Make manual, "double-colon rules are
somewhat obscure and not often very useful". Looking at
the few instances we have in libvirt, that certainly seems
to be the case, so just drop them.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoqemu: remove comments for qemuDomainSecret.*Destroy functions
Ján Tomko [Tue, 15 Jan 2019 13:19:07 +0000 (14:19 +0100)]
qemu: remove comments for qemuDomainSecret.*Destroy functions

These all contain the same copy and pasted '@disk' error,
and only repeat the list of arguments.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agomaint: Post-release version bump to 5.1.0
Ján Tomko [Wed, 16 Jan 2019 07:28:49 +0000 (08:28 +0100)]
maint: Post-release version bump to 5.1.0

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agoRelease of libvirt-5.0.0
Daniel Veillard [Tue, 15 Jan 2019 19:29:40 +0000 (20:29 +0100)]
Release of libvirt-5.0.0

* docs/news.xml: updated for release

Signed-off-by: Daniel Veillard <veillard@redhat.com>
6 years agovirnetdevip: Avoid cast align warning
Ján Tomko [Tue, 15 Jan 2019 12:00:52 +0000 (13:00 +0100)]
virnetdevip: Avoid cast align warning

Commit 7282f455a got rid of the VIR_WARNINGS_NO_CAST_ALIGN macro
when refactoring the code and broke the build with clang.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agonews: Update for 5.0.0 release
Andrea Bolognani [Mon, 14 Jan 2019 16:49:18 +0000 (17:49 +0100)]
news: Update for 5.0.0 release

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoqemu: Temporary disable owner remembering
Michal Privoznik [Mon, 14 Jan 2019 16:53:43 +0000 (17:53 +0100)]
qemu: Temporary disable owner remembering

Turns out, that there are few bugs that are not that trivial to
fix (e.g. around block jobs). Instead of rushing in not
thoroughly tested fixes disable the feature temporarily for the
release.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
ACKed-by: Peter Krempa <pkrempa@redhat.com>
6 years agopo: refresh translations from zanata
Daniel P. Berrangé [Mon, 14 Jan 2019 16:58:34 +0000 (16:58 +0000)]
po: refresh translations from zanata

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoutil: make forgotten changes suggested during review of commit d40b820c
Laine Stump [Sat, 12 Jan 2019 21:14:50 +0000 (16:14 -0500)]
util: make forgotten changes suggested during review of commit d40b820c

I had intended to make these changes to commit d40b820c before
pushing, but forgot about it during the day between the initial review
and ACK.

Neither change is significant - just returning immediately when
virNetDevGetName() fails (instead of logging a debug message first)
and eliminating a comment that adds to confusion rather than
eliminating it. Still, the changes should be made to be more
consistent with nearly identical code just a few lines up (added in
commit 7282f455)

Signed-off-by: Laine Stump <laine@laine.org>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agonews: Move entry for libvirt picking DRI devices
Andrea Bolognani [Mon, 14 Jan 2019 13:32:31 +0000 (14:32 +0100)]
news: Move entry for libvirt picking DRI devices

The entry, introduced by commit 3934beb8579c, ended up
inside a comment instead of the XML document proper, and
as such didn't show up in the generated files.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agoutil: check accept_ra for all nexthop interfaces of multipath routes
Laine Stump [Tue, 8 Jan 2019 22:07:12 +0000 (17:07 -0500)]
util: check accept_ra for all nexthop interfaces of multipath routes

When checking the setting of accept_ra, we have assumed that all
routes have a single nexthop, so the interface of the route would be
in the RTA_OIF attribute of the netlink RTM_NEWROUTE message. But
multipath routes don't have an RTA_OIF; instead, they have an
RTA_MULTIPATH attribute, which is an array of rtnexthop, with each
rtnexthop having an interface. This patch adds a loop to look at the
setting of accept_ra of the interface for every rtnexthop in the
array.

Signed-off-by: Laine Stump <laine@laine.org>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoqemu: Filter non SCSI hostdevs in qemuHostdevPrepareSCSIDevices
John Ferlan [Thu, 10 Jan 2019 23:05:12 +0000 (18:05 -0500)]
qemu: Filter non SCSI hostdevs in qemuHostdevPrepareSCSIDevices

When commit 1d94b3e7 added code to walk the [n]hostdevs list looking
to add shared hostdevs, it should've filtered any hostdevs that were
not SCSI hostdev's.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoutil: use nlmsg_find_attr() instead of an open-coded loop
Laine Stump [Tue, 8 Jan 2019 19:13:00 +0000 (14:13 -0500)]
util: use nlmsg_find_attr() instead of an open-coded loop

This is about the same number of code lines, but is simpler, and more
consistent with what will be added to check another attribute in a
coming patch.

As a side effect, it

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

Signed-off-by: Laine Stump <laine@laine.org>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: add a function to insert new interfaces to IPv6CheckForwarding list
Laine Stump [Mon, 7 Jan 2019 20:55:31 +0000 (15:55 -0500)]
util: add a function to insert new interfaces to IPv6CheckForwarding list

This same operation needs to be done in multiple places, so move the
inline code into a separate function.

Signed-off-by: Laine Stump <laine@laine.org>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoutil: remove const specifier from nlmsghdr arg to virNetlinkDumpCallback()
Laine Stump [Sun, 6 Jan 2019 22:35:47 +0000 (17:35 -0500)]
util: remove const specifier from nlmsghdr arg to virNetlinkDumpCallback()

This is problematic if a callback function wants to send the nlmsghdr
to a library function that has no "const" in its prototype
(e.g. nlmsg_find_attr())

Signed-off-by: Laine Stump <laine@laine.org>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoapparmor: Move static data out of examples/
Andrea Bolognani [Wed, 9 Jan 2019 15:51:43 +0000 (16:51 +0100)]
apparmor: Move static data out of examples/

These files need to be installed on the system for apparmor
support to work, so they don't belong with examples.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agosrc: Simplify installing/uninstalling data
Andrea Bolognani [Wed, 9 Jan 2019 16:11:12 +0000 (17:11 +0100)]
src: Simplify installing/uninstalling data

Instead of defining targets conditionally and depending on
them unconditionally, define a couple of variables and
conditionally add targets to them.

In addition to removing a bunch of useless code, this has
the nice effect of no longer requiring the main Makefile.am
to have any knowledge about the contents of the various
snippets it includes.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agosrc: Only install SysV init scripts when libvirtd is built
Andrea Bolognani [Thu, 10 Jan 2019 13:05:31 +0000 (14:05 +0100)]
src: Only install SysV init scripts when libvirtd is built

This is consistent with the way we already handle
configuration for other init systems such as upstart and
systemd.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agosrc: Define initdir
Andrea Bolognani [Thu, 10 Jan 2019 14:06:36 +0000 (15:06 +0100)]
src: Define initdir

Avoid building the same path several times.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agocpu_map: Add support for arch-capabilities feature
Jiri Denemark [Thu, 10 Jan 2019 13:35:07 +0000 (14:35 +0100)]
cpu_map: Add support for arch-capabilities feature

The feature was added to QEMU in 3.1.0 and it is currently blocking
migration, which is expected to change in the future. Luckily 3.1.0 is
new enough to give us migratability hints on each feature via
query-cpu-model-expension, which means we don't need to use the
"migratable" attribute on the CPU map XML.

The kernel calls this feature arch_capabilities and RHEL/CentOS 7.* use
arch-facilities. Apparently some CPU test files were gathered with the
RHEL version of QEMU. Let's update the test files to avoid possible
confusion about the correct naming.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Don't enable seclabel remembering for session mode
Michal Privoznik [Thu, 10 Jan 2019 12:53:33 +0000 (13:53 +0100)]
qemu: Don't enable seclabel remembering for session mode

The session daemon is unable to set XATTRs in 'trusted'
namespace because it doesn't run as privileged process.
Therefore, when creating the default qemu config enable
rememberOwner only when running as privileged process.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoremote: Define sasldir
Andrea Bolognani [Wed, 9 Jan 2019 17:22:39 +0000 (18:22 +0100)]
remote: Define sasldir

Avoid building the same path several times.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoremote: Define sysctldir
Andrea Bolognani [Wed, 9 Jan 2019 17:11:33 +0000 (18:11 +0100)]
remote: Define sysctldir

Avoid building the same path several times.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoremote: Define polkit{actions,rules}dir
Andrea Bolognani [Wed, 9 Jan 2019 17:14:34 +0000 (18:14 +0100)]
remote: Define polkit{actions,rules}dir

Avoid building the same path several times.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoremote: Move polkitdir definition
Andrea Bolognani [Wed, 9 Jan 2019 17:08:57 +0000 (18:08 +0100)]
remote: Move polkitdir definition

No need to have two conditional blocks.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoqemu: require reply from guest agent in qemuAgentGetInterfaces
Ján Tomko [Fri, 4 Jan 2019 09:17:46 +0000 (10:17 +0100)]
qemu: require reply from guest agent in qemuAgentGetInterfaces

Since its introduction in commit 0977b8aa071 (released in v1.2.14)
qemuAgentGetInterfaces calls qemuAgentCommand with needReply=false,
which allows qemuAgentCommand to return 0 even when it did not get
any reply from the agent.

Set needReply to true, since we dereference it right after.

This can be hit if libvirt is waiting for an event from the agent
(e.g. shutdown) and the agent cannot reply in time (e.g. due to
the guest being shut down), as reported in:
https://bugzilla.redhat.com/show_bug.cgi?id=1663051

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
6 years agosrc/qemu: Fix indentation in Makefile.inc.am
Michal Privoznik [Wed, 9 Jan 2019 16:18:58 +0000 (17:18 +0100)]
src/qemu: Fix indentation in Makefile.inc.am

Three lines are a bit off there.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agolxc: allow empty path in URI for historical compatibility
Daniel P. Berrangé [Mon, 24 Dec 2018 15:09:25 +0000 (15:09 +0000)]
lxc: allow empty path in URI for historical compatibility

The use of 'lxc://' was mistakenly broken in:

  commit 4c8574c85c554e68de0d8bf9b85727954a5bea91
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Wed Mar 28 12:49:29 2018 +0100

    driver: ensure NULL URI isn't passed to drivers with whitelisted URIs

Allow it again for historical compatibility.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agoqemu: Use ULL instead of uint64_t for RDMA GID event
Michal Privoznik [Wed, 9 Jan 2019 10:27:15 +0000 (11:27 +0100)]
qemu: Use ULL instead of uint64_t for RDMA GID event

In the previous commit we are using uint64_t for storing subnet
prefix and interface id that qemu reports in
RDMA_GID_STATUS_CHANGED event. We also report them in some debug
messages. This poses a problem because uint64_t can be UL or ULL
depending on the host architecture and hence we wouldn't know
which format to use. Switch to ULL which is big enough and
doesn't suffer from the issue.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoqemu: Process RDMA GID state change event
Yuval Shaia [Mon, 24 Dec 2018 10:15:12 +0000 (12:15 +0200)]
qemu: Process RDMA GID state change event

This event is emitted on the monitor when a GID table in pvrdma device
is modified and the change needs to be propagate to the backend RDMA
device's GID table.

The control over the RDMA device's GID table is done by updating the
device's Ethernet function addresses.
Usually the first GID entry is determine by the MAC address, the second
by the first IPv6 address and the third by the IPv4 address. Other
entries can be added by adding more IP addresses. The opposite is the
same, i.e. whenever an address is removed, the corresponding GID entry
is removed.

The process is done by the network and RDMA stacks. Whenever an address
is added the ib_core driver is notified and calls the device driver's
add_gid function which in turn update the device.

To support this in pvrdma device we need to hook into the create_bind
and destroy_bind HW commands triggered by pvrdma driver in guest.
Whenever a changed is made to the pvrdma device's GID table a special
QMP messages is sent to be processed by libvirt to update the address of
the backend Ethernet device.

Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoexamples: Work around lack of mingw localtime_r()
Eric Blake [Tue, 8 Jan 2019 19:41:28 +0000 (13:41 -0600)]
examples: Work around lack of mingw localtime_r()

mingw lacks localtime_r(); we were getting it from gnulib. But since
commit acf522e8 stopped linking examples against gnulib, we are
getting a build failure. Keep the examples standalone, and work
around mingw by using the non-reentrant localtime() (safe since our
examples are single-threaded), and add a necessary exemption to our
syntax check.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoexamples: Work around lack of mingw sigaction()
Eric Blake [Tue, 8 Jan 2019 19:46:48 +0000 (13:46 -0600)]
examples: Work around lack of mingw sigaction()

mingw lacks sigaction(); we were getting it from gnulib. But since
commit acf522e8 stopped linking examples against gnulib, we are
getting a build failure. Keep the examples standalone, and work
around mingw by using signal() instead.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoexamples: Work around mingw printf() weakness
Eric Blake [Tue, 8 Jan 2019 19:46:48 +0000 (13:46 -0600)]
examples: Work around mingw printf() weakness

mingw lacks %lld and %zu support in printf(); we were getting it
from gnulib. But since commit acf522e8 stopped linking examples
against gnulib, we are getting a build failure due to -Wformat
flagging these strings. Keep the examples standalone, and work
around mingw by using manual casts to types we can portably print.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agosyntax-check: Simplify and fix unmarked_diagnostics
Andrea Bolognani [Tue, 8 Jan 2019 14:24:36 +0000 (15:24 +0100)]
syntax-check: Simplify and fix unmarked_diagnostics

The check was concerning itself with whitespace where it
didn't need to, and used some confusing escaping for one
of its regular expressions - which GNU sed was fine with,
but FreeBSD's sed didn't like one bit.

Switch to extended regular expressions (which, incidentally,
were already in use in the same rule when calling grep) and
remove all whitespace handling.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agosrc: Fix a few unmarked_diagnostics issues
Andrea Bolognani [Tue, 8 Jan 2019 14:24:07 +0000 (15:24 +0100)]
src: Fix a few unmarked_diagnostics issues

These were not caught by our current regular expressions
but will be caught by the improved ones we're about to
introduce, so fix them ahead of time.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoexamples: Avoid gnulib, have standalone examples
Eric Blake [Tue, 8 Jan 2019 04:15:48 +0000 (22:15 -0600)]
examples: Avoid gnulib, have standalone examples

Commit 0c6ad476 updated gnulib, which rearranged some of the
conditions in gnulib wrapper headers such that compilation
started failing on BSD systems when the normal system <unistd.h>
tried to include another system header but instead got a
gnulib wrapper header in an incomplete state; this is because
gnulib headers only work if <config.h> is included first.

Commit b6f78259 papered over the symptoms of that by including
<config.h> in all the examples.  But this logic is backwards -
if our examples are truly meant to be stand-alone, they should
NOT depend on how libvirt was configured, and should NOT
depend on the gnulib fixes for system quirks.  In particular,
if an example does not need to link against libgnulib.la,
then it also does not need to use -Ignulib in its compile
flags, and likewise does not need to include <config.h> since
none of the gnulib wrapper headers should be interfering.

So, revert (most of) b6f78259 (except for the bogus pre-patch
use of "config.h" in admin/logging.c: if config.h is included,
it should be via <> rather than "", and must be before any
system headers); then additionally nuke all mention of
<config.h>, -Ignulib, and -llibgnu.la, making all of the
examples truly standalone.

Signed-off-by: Eric Blake <eblake@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoexamples: Drop event-test.c dependency on gnulib <verify.h>
Eric Blake [Tue, 8 Jan 2019 05:23:52 +0000 (23:23 -0600)]
examples: Drop event-test.c dependency on gnulib <verify.h>

Pulling in gnulib just for the <verify.h> header is rather
expensive, especially since that header does not require us
to link against gnulib.  It's better to make the event-test
example be standalone by just open-coding a more limited form
of a verify() macro that depends on modern gcc (we have enough
CI coverage that even though the verify is now a no-op in
older setups, we will still notice if we fail to add an event
- as a quick test, I was still able to provoke a compile
failure on Fedora 29 when deleting a line from domainEvents).

Signed-off-by: Eric Blake <eblake@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoutil: Fix the default log output to 'journald' when running under systemd
Erik Skultety [Thu, 3 Jan 2019 13:32:36 +0000 (14:32 +0100)]
util: Fix the default log output to 'journald' when running under systemd

Essentially, bring back the old behaviour as of commit eba36a38 which
was later changed by commit ae06048bf5d. Even though all the stderr
messages will eventually end up in the journal, we're not making use of
the fields journald provides.

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

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
6 years agomaint: Fix VPATH build
Eric Blake [Tue, 8 Jan 2019 03:50:08 +0000 (21:50 -0600)]
maint: Fix VPATH build

In a VPATH build, <config.h> is in the builddir (which automake
includes automatically), but it includes <config-post.h> from the
top source directory (which is not automatic); hence, we need to
keep the -I(top_srcdir) directive that was accidentally removed
from commit 7a879323 (the problem is not visible in an in-tree
build).

Signed-off-by: Eric Blake <eblake@redhat.com>
6 years agomaint: Prefer AM_CPPFLAGS over INCLUDES
Eric Blake [Fri, 4 Jan 2019 19:47:44 +0000 (13:47 -0600)]
maint: Prefer AM_CPPFLAGS over INCLUDES

Our use of INCLUDES in Makefile.am hearkens back to when we had to
cater to automake 1.9.6 (thanks, RHEL 5) which lacked AM_CPPFLAGS.
Modern Automake flags a warning that INCLUDES is deprecated, and
now that we mandate RHEL 7 or better (see commit c1bc9c66), we no
longer have to cater to the old spelling.  This change will also
make it easier to do per-binary CPPFLAGS.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agomaint: Drop unused GETTEXT_CPPFLAGS variable
Eric Blake [Fri, 4 Jan 2019 19:42:52 +0000 (13:42 -0600)]
maint: Drop unused GETTEXT_CPPFLAGS variable

Commit c0a8ea45 removed the use of gettextize, and the setting of
GETTEXT_CPPFLAGS, but did not scrub the now-unused variable from
Makefile.am snippets.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agomaint: split long lines for BSD syntax-check
Eric Blake [Thu, 3 Jan 2019 19:30:39 +0000 (13:30 -0600)]
maint: split long lines for BSD syntax-check

Similar to the gnulib changes we just incorporated into maint.mk,
it's time to use '$(VC_LIST) | xargs program' instead of
'program $$($(VC_LIST))', in order to bypass the problem of hitting
argv limits due to our large set of files.

Drop several uses of $$files as a temporary variable when we can
instead directly use xargs. While at it, fix a typo in the
prohibit_windows_special_chars error message.

Note that 'grep $pattern $(generate list)' has be be rewritten
as 'generate list | xargs grep $pattern /dev/null' - this is
because for a list that is just long enough, and without /dev/null,
xargs could make a worst-case split of 'grep $pattern all but one;
grep $pattern last' which has different output (grep includes the
filename when there was more than one file, but omits it for a
single file), while our conversion gives 'grep $pattern /dev/null
all but one; grep $pattern /dev/null last'. We are less concerned
about the empty list case (why would we run the syntax check if we
didn't have at least one file?), but grepping /dev/null happens to
produce no output and thus nicely also solves that problem without
relying on the GNU extension of 'xargs -r'.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agomaint: prefer $(GREP) in cfg.mk
Eric Blake [Thu, 3 Jan 2019 15:31:37 +0000 (09:31 -0600)]
maint: prefer $(GREP) in cfg.mk

We already used $(GREP) in some places, but might as well use it
everywhere during syntax check, in line with similar recent gnulib
changes.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agomaint: update gnulib for syntax-check on BSD
Eric Blake [Thu, 3 Jan 2019 13:42:41 +0000 (07:42 -0600)]
maint: update gnulib for syntax-check on BSD

In particular, this incorporates Roman's patches to allow
'make syntax-check' to work on BSD with its exec argv
limitations that previously failed when trying to grep the
large number of files present in libvirt.

cfg.mk needs similar changes, but that will be tackled separately.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agonews: Add support for postcopy-requests migration statistics
Han Han [Mon, 7 Jan 2019 08:08:39 +0000 (16:08 +0800)]
news: Add support for postcopy-requests migration statistics

This feature is introduced by 3f4914e0.

Signed-off-by: Han Han <hhan@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agonews: Add support for "stibp" x86_64 feature
Han Han [Mon, 7 Jan 2019 08:08:38 +0000 (16:08 +0800)]
news: Add support for "stibp" x86_64 feature

This feature is in since eb1b551d.

Signed-off-by: Han Han <hhan@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoexamples: include config.h
Ján Tomko [Fri, 4 Jan 2019 15:16:13 +0000 (16:16 +0100)]
examples: include config.h

Since gnulib commit 6954995d unistd.h is included via stdlib.h
on BSD systems, which requires config.h to be included first.

Add config.h to the files that use it.

Part of this commit reverts commit 6ee918de7462a20947241ec817c4571d6b84a716

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoexamples: add spaces after #include
Ján Tomko [Fri, 4 Jan 2019 15:12:51 +0000 (16:12 +0100)]
examples: add spaces after #include

Lead by example in examples/

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agomaint: cfg.mk typo fix
Eric Blake [Fri, 4 Jan 2019 15:44:32 +0000 (09:44 -0600)]
maint: cfg.mk typo fix

Signed-off-by: Eric Blake <eblake@redhat.com>
6 years agodocs: schemas: Decouple the virtio options from each other
Erik Skultety [Fri, 4 Jan 2019 09:40:48 +0000 (10:40 +0100)]
docs: schemas: Decouple the virtio options from each other

Currently, all of the VirtioOptions are under a single <optional>
element, however, neither our parser/formatter or QEMU driver requires
the presence of all the options if only a single one from the set has
been specified, so fix it and silence the schema validator.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoRemove even more Author(s): lines from source files
Michal Privoznik [Sun, 30 Dec 2018 04:49:26 +0000 (05:49 +0100)]
Remove even more Author(s): lines from source files

In 600462834f4ec1955a9a4 we've tried to remove Author(s): lines
from comments at the beginning of our source files. Well, in some
files while we removed the "Author" line we did not remove the
actual list of authors.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agodocs: Add news for new nvdimm options
Luyao Zhong [Thu, 20 Dec 2018 09:14:50 +0000 (17:14 +0800)]
docs: Add news for new nvdimm options

Add more configure options for NVDIMM

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: Add qemu command-line to generate the nvdimm unarmed property
Luyao Zhong [Thu, 20 Dec 2018 09:14:49 +0000 (17:14 +0800)]
qemu: Add qemu command-line to generate the nvdimm unarmed property

According to the result parsing from xml, add the unarmed property
into QEMU command line:

-device nvdimm,...[,unarmed=on]

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: Add command-line to generate the nvdimm pmem property
Luyao Zhong [Thu, 20 Dec 2018 09:14:48 +0000 (17:14 +0800)]
qemu: Add command-line to generate the nvdimm pmem property

According to the result parsing from xml, add pmem property
into QEMU command line:

-object memory-backend-file,...[,pmem=on]

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: Add command-line to generate the nvdimm align property
Luyao Zhong [Thu, 20 Dec 2018 09:14:47 +0000 (17:14 +0800)]
qemu: Add command-line to generate the nvdimm align property

According to the result parsing from xml, add align property
into QEMU command line:

-object memory-backend-file,...[,align=xxx]

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agotests: Use DO_TEST_CAPS_LATEST for nvdimm qemuxml2argv
Luyao Zhong [Thu, 20 Dec 2018 09:14:46 +0000 (17:14 +0800)]
tests: Use DO_TEST_CAPS_LATEST for nvdimm qemuxml2argv

Deprecate DO_TEST to do nvdimm qemuxml2argvdata tests, because
DO_TEST_CAPS_LATEST is a better choice. The DO_TEST needs
to specify all qemu capabilities and is not easy for scaling.

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: Introduce QEMU_CAPS_DEVICE_NVDIMM_UNARMED capability
Luyao Zhong [Thu, 20 Dec 2018 09:14:45 +0000 (17:14 +0800)]
qemu: Introduce QEMU_CAPS_DEVICE_NVDIMM_UNARMED capability

This capability tracks if nvdimm has the unarmed attribute or not
for the nvdimm readonly xml attribute.

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: Introduce QEMU_CAPS_OBJECT_MEMORY_FILE_PMEM capability
Luyao Zhong [Thu, 20 Dec 2018 09:14:44 +0000 (17:14 +0800)]
qemu: Introduce QEMU_CAPS_OBJECT_MEMORY_FILE_PMEM capability

This capability tracks if memory-backend-file has the pmem
attribute or not.

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: Introduce QEMU_CAPS_OBJECT_MEMORY_FILE_ALIGN capability
Luyao Zhong [Thu, 20 Dec 2018 09:14:43 +0000 (17:14 +0800)]
qemu: Introduce QEMU_CAPS_OBJECT_MEMORY_FILE_ALIGN capability

This capability tracks if memory-backend-file has the align
attribute or not.

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoconf: Introduce 'readonly' element into xml for NVDIMM memory
Luyao Zhong [Thu, 20 Dec 2018 09:14:42 +0000 (17:14 +0800)]
conf: Introduce 'readonly' element into xml for NVDIMM memory

The 'readonly' option allows users to mark vNVDIMM read-only:

<devices>
  ...
  <memory model='nvdimm' access='shared'>
      <source>
          <path>/dev/dax0.0</path>
      </source>
      <target>
          <size unit='MiB'>4094</size>
          <node>0</node>
          <label>
              <size unit='MiB'>2</size>
          </label>
          <readonly/>
      </target>
  </memory>
  ...
</devices>

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoconf: Introduce 'pmem' element into xml for NVDIMM memory
Luyao Zhong [Thu, 20 Dec 2018 09:14:41 +0000 (17:14 +0800)]
conf: Introduce 'pmem' element into xml for NVDIMM memory

The 'pmem' option allows users to specify whether the backend
storage of memory-backend-file is a real persistent memory:

<devices>
  ...
  <memory model='nvdimm' access='shared'>
      <source>
          <path>/dev/dax0.0</path>
          <pmem/>
      </source>
      <target>
          <size unit='MiB'>4094</size>
          <node>0</node>
          <label>
              <size unit='MiB'>2</size>
          </label>
      </target>
  </memory>
  ...
</devices>

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoconf: Introduce 'alignsize' element into xml for NVDIMM memory
Luyao Zhong [Thu, 20 Dec 2018 09:14:40 +0000 (17:14 +0800)]
conf: Introduce 'alignsize' element into xml for NVDIMM memory

NVDIMM emulation will mmap the backend file, it uses host pagesize
as the alignment of mapping address before, but some backends may
require alignments different from the pagesize. So the 'alignsize'
option is introduced to allow specification of the proper alignment:

<devices>
  ...
  <memory model='nvdimm' access='shared'>
      <source>
          <path>/dev/dax0.0</path>
          <alignsize unit='MiB'>2</alignsize>
      </source>
      <target>
          <size unit='MiB'>4094</size>
          <node>0</node>
          <label>
              <size unit='MiB'>2</size>
          </label>
      </target>
  </memory>
  ...
</devices>

Signed-off-by: Luyao Zhong <luyao.zhong@intel.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: process: SEV: Relabel guest owner's SEV files created before start
Erik Skultety [Thu, 6 Dec 2018 13:59:15 +0000 (14:59 +0100)]
qemu: process: SEV: Relabel guest owner's SEV files created before start

Before launching a SEV guest we take the base64-encoded guest owner's
data specified in launchSecurity and create files with the same content
under /var/lib/libvirt/qemu/<domain>. The reason for this is that we
need to pass these files on to QEMU which then uses them to communicate
with the SEV firmware, except when it doesn't have permissions to open
those files since we don't relabel them.

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

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoqemu: process: SEV: Assume libDir to be the directory to create files in
Erik Skultety [Thu, 6 Dec 2018 13:50:19 +0000 (14:50 +0100)]
qemu: process: SEV: Assume libDir to be the directory to create files in

Since SEV operates on a per domain basis, it's very likely that all
SEV launch-related data will be created under
/var/lib/libvirt/qemu/<domain_name>. Therefore, when calling into
qemuProcessSEVCreateFile we can assume @libDir as the directory prefix
rather than passing it explicitly.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
6 years agomaint: update to latest gnulib
Ján Tomko [Tue, 1 Jan 2019 21:57:29 +0000 (22:57 +0100)]
maint: update to latest gnulib

Includes:
  maint: Run 'make update-copyright'

Signed-off-by: Ján Tomko <jtomko@redhat.com>
6 years agosecurity: Fix comparison for virSecuritySELinuxRecallLabel
John Ferlan [Thu, 20 Dec 2018 21:30:24 +0000 (16:30 -0500)]
security: Fix comparison for virSecuritySELinuxRecallLabel

The @con type security_context_t is actually a "char *", so the
correct check should be to dereference one more level; otherwise,
we could return/use the NULL pointer later in a subsequent
virSecuritySELinuxSetFileconImpl call (using @fcon).

Suggested-by: Michal Prívozník <mprivozn@redhat.com>
Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>