]> git.ipfire.org Git - thirdparty/libvirt.git/log
thirdparty/libvirt.git
7 years agoconfigure: Require GnuTLS
Michal Privoznik [Mon, 4 Jun 2018 04:51:50 +0000 (06:51 +0200)] 
configure: Require GnuTLS

We are building with GnuTLS everywhere because GnuTLS is widely
available. Also, it is desirable to prefer cryptographically
strong PRNG over "/dev/urandom" which is just a fallback.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agostorage: Add specific check for LUKS encryption support
John Ferlan [Tue, 29 May 2018 15:01:15 +0000 (11:01 -0400)] 
storage: Add specific check for LUKS encryption support

Modify virStorageBackendLogicalLVCreate to ensure if encryption
is requested that only type LUKS is supported; otherwise, error.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
7 years agovircrypto: Drop virCryptoGenerateRandom
Michal Privoznik [Tue, 29 May 2018 08:01:38 +0000 (10:01 +0200)] 
vircrypto: Drop virCryptoGenerateRandom

Now that virCryptoGenerateRandom() is plain wrapper over
virRandomBytes() we can drop it in favour of the latter.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agovirUUIDGenerate don't fall back to virRandomBits
Michal Privoznik [Tue, 29 May 2018 06:35:13 +0000 (08:35 +0200)] 
virUUIDGenerate don't fall back to virRandomBits

If virRandomBytes() fails there is no point calling
virRandomBits() because it uses virRandomBytes() internally
again.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agovirrandom: Make virRandomBits better
Michal Privoznik [Tue, 29 May 2018 06:26:18 +0000 (08:26 +0200)] 
virrandom: Make virRandomBits better

Now that we have strong PRNG generator implemented in
virRandomBytes() let's use that instead of gnulib's random_r.

Problem with the latter is in way we seed it: current UNIX time
and libvirtd's PID are not that random as one might think.
Imagine two hosts booting at the same time. There's a fair chance
that those hosts spawn libvirtds at the same time and with the
same PID. This will result in both daemons generating the same
sequence of say MAC addresses [1].

1: https://www.redhat.com/archives/libvirt-users/2018-May/msg00097.html

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agovirRandomBytes: Use gnutls_rnd whenever possible
Michal Privoznik [Tue, 29 May 2018 07:43:26 +0000 (09:43 +0200)] 
virRandomBytes: Use gnutls_rnd whenever possible

While /dev/urandom is not terrible source of random data
gnutls_rnd is better. Prefer that one.

Also, since nearly every platform we build on already has gnutls
(if not all of them) this is going to be used by default.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agovirRandomBytes: Report error
Michal Privoznik [Tue, 29 May 2018 06:58:46 +0000 (08:58 +0200)] 
virRandomBytes: Report error

Instead of having each caller report error move it into the
function. This way we can produce more accurate error messages
too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agovirRandomBytes: Prefer saferead over plain read
Michal Privoznik [Tue, 29 May 2018 06:55:28 +0000 (08:55 +0200)] 
virRandomBytes: Prefer saferead over plain read

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agovirCryptoGenerateRandom: Don't allocate return buffer
Michal Privoznik [Tue, 29 May 2018 05:46:32 +0000 (07:46 +0200)] 
virCryptoGenerateRandom: Don't allocate return buffer

To unify our vir*Random() functions we need to make
virCryptoGenerateRandom NOT allocate return buffer. It should
just fill given buffer with random data.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agovirCryptoGenerateRandom: Explain gnults error
Michal Privoznik [Tue, 29 May 2018 05:50:29 +0000 (07:50 +0200)] 
virCryptoGenerateRandom: Explain gnults error

When generating random stream using gnults fails an error is
reported. However, the error is not helpful as it contains only
an integer error code (a negative number). Use gnutls_strerror()
to turn the error code into a string explaining what went wrong.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agovirCryptoGenerateRandom: rename ret
Michal Privoznik [Tue, 29 May 2018 05:48:02 +0000 (07:48 +0200)] 
virCryptoGenerateRandom: rename ret

This function allocates a buffer, fills it in with random bytes
and then returns it. However, the buffer is held in @buf
variable, therefore having @ret variable which does not hold
return value of the function is misleading.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
7 years agovirRandomBytes: Fix return value
Michal Privoznik [Tue, 29 May 2018 07:02:57 +0000 (09:02 +0200)] 
virRandomBytes: Fix return value

In libvirt when a function wants to return an error code it
should be a negative value. Returning a positive value (or zero)
means success. But virRandomBytes() does not follow this rule.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
7 years agotravis: Install and use ccache on macOS
Andrea Bolognani [Wed, 30 May 2018 12:27:10 +0000 (14:27 +0200)] 
travis: Install and use ccache on macOS

As documented in [1], ccache needs to be installed and
configured explicitly on macOS.

[1] https://docs.travis-ci.com/user/caching/#ccache-cache

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agotravis: Move PATH to macOS-specific environment
Andrea Bolognani [Wed, 30 May 2018 12:24:41 +0000 (14:24 +0200)] 
travis: Move PATH to macOS-specific environment

Now that we have separate sections for each build
configuration, there's no reason to set PATH in the global
environment.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
7 years agobuild: Don't install sysconfig files as scripts
Jiri Denemark [Mon, 4 Jun 2018 21:07:16 +0000 (23:07 +0200)] 
build: Don't install sysconfig files as scripts

The files are not scripts and should not be executable.

Broken by v4.0.0-294-g5f998681df.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoqemu: Fix domain resume after failed migration
Jiri Denemark [Tue, 17 Apr 2018 12:46:29 +0000 (14:46 +0200)] 
qemu: Fix domain resume after failed migration

Libvirt relies on being able to kill the destination domain and resume
the source one during migration until we called "cont" on the
destination. Unfortunately, QEMU automatically activates block devices
at the end of migration even when it's called with -S. This wasn't a big
issue in the past since the guest is not running and thus no data are
written to the block devices. However, when QEMU introduced its internal
block device locks, we can no longer resume the source domain once the
destination domain already activated the block devices (and thus
acquired all locks) unless the destination domain is killed first.

Since it's impossible to synchronize the destination and the source
libvirt daemons after a failed migration, QEMU introduced a new
migration capability called "late-block-activate" which ensures QEMU
won't activate block devices until it gets "cont". The only thing we
need to do is to enable this capability whenever QEMU supports it.

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

QEMU commit implementing the capability: v2.12.0-952-g0f073f44df

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agovirDomainDefCopy: Skip ostype checks
Michal Privoznik [Sat, 2 Jun 2018 09:15:55 +0000 (11:15 +0200)] 
virDomainDefCopy: Skip ostype checks

When parsing domain XML the virCapsDomainData lookup is performed
in order to fill in missing def->os.arch and def->os.machine
strings. Well, when doing copy of already existing virDomainDef
we don't want any automagic fill in of defaults (and those two
strings are going to be provided at this point anyway by first
parse of the domain XML).

What is even worse is that we do not look up capabilities for
parsed emulator path rather some generic capabilities for parsed
arch. Therefore, if emulator points to qemu under non-default
path (say $HOME/qemu-system-arm) but there's no such qemu under
the default path (say /usr/bin/qemu-system-arm) the capabilities
lookup fails and creating the copy is denied.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agovirFileAccessibleAs: Remove redundant forkRet
Radostin Stoyanov [Tue, 5 Jun 2018 07:11:33 +0000 (08:11 +0100)] 
virFileAccessibleAs: Remove redundant forkRet

The variable forkRet is not used after commit 25f8781

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
7 years agodocs: news: Explain iommu_support improvement
Filip Alac [Fri, 1 Jun 2018 08:16:00 +0000 (10:16 +0200)] 
docs: news: Explain iommu_support improvement

Signed-off-by: Filip Alac <filipalac@gmail.com>
7 years agocapabilities: Extend capabilities with iommu_support
Filip Alac [Fri, 1 Jun 2018 08:15:59 +0000 (10:15 +0200)] 
capabilities: Extend capabilities with iommu_support

Signed-off-by: Filip Alac <filipalac@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoqemu: hostdev: Move parts of qemuHostdevHostSupportsPassthroughVFIO() into separate...
Filip Alac [Fri, 1 Jun 2018 08:15:58 +0000 (10:15 +0200)] 
qemu: hostdev: Move parts of qemuHostdevHostSupportsPassthroughVFIO() into separate function

Signed-off-by: Filip Alac <filipalac@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoqemu: command: Refactor disk commandline formatting
Peter Krempa [Fri, 1 Jun 2018 14:57:44 +0000 (16:57 +0200)] 
qemu: command: Refactor disk commandline formatting

Now that we have one place that sets up all disk-related objects to
qemuBlockStorageSourceAttachDataPtr we can easily reuse the data in the
command-line formatter by implementing a worker which will convert the
data.

A huge advantage is that it will be way easier to integrate this with
-blockdev later on.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: command: Extract setup of one disk's command line
Peter Krempa [Fri, 1 Jun 2018 14:25:18 +0000 (16:25 +0200)] 
qemu: command: Extract setup of one disk's command line

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: command: Rename qemuBuildDiskDriveCommandLine
Peter Krempa [Fri, 1 Jun 2018 14:14:19 +0000 (16:14 +0200)] 
qemu: command: Rename qemuBuildDiskDriveCommandLine

It prepares all disk so use the plural form.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: hotplug: Extract hotplug of TLS into qemuBlockStorageSourceAttachApply
Peter Krempa [Fri, 1 Jun 2018 10:11:06 +0000 (12:11 +0200)] 
qemu: hotplug: Extract hotplug of TLS into qemuBlockStorageSourceAttachApply

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: hotplug: Extract hotplug of secrets into qemuBlockStorageSourceAttachApply
Peter Krempa [Thu, 17 May 2018 08:32:32 +0000 (10:32 +0200)] 
qemu: hotplug: Extract hotplug of secrets into qemuBlockStorageSourceAttachApply

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: hotplug: Extract hotplug of PR into qemuBlockStorageSourceAttachApply
Peter Krempa [Fri, 1 Jun 2018 13:56:47 +0000 (15:56 +0200)] 
qemu: hotplug: Extract hotplug of PR into qemuBlockStorageSourceAttachApply

Introduce a new setup function for all the related configuration and
move the setup and attachment of the PR code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: Reuse qemuBlockStorageSourceAttachApply in disk hotplug
Peter Krempa [Wed, 16 May 2018 11:39:22 +0000 (13:39 +0200)] 
qemu: Reuse qemuBlockStorageSourceAttachApply in disk hotplug

Create a new "Prepare" function and move the drive add code into the new
helpers. This will eventually allow to simplify and unify the attaching
code for use with blockdev at the same time as providing compatibility
with older qemus.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: alias: Rename qemuAliasFromDisk to qemuAliasDiskDriveFromDisk
Peter Krempa [Thu, 31 May 2018 09:55:24 +0000 (11:55 +0200)] 
qemu: alias: Rename qemuAliasFromDisk to qemuAliasDiskDriveFromDisk

Emphasize that it's for the 'drive' part of the disk.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: hotplug: Remove qemuDomainDelDiskSrcTLSObject
Peter Krempa [Mon, 14 May 2018 10:12:41 +0000 (12:12 +0200)] 
qemu: hotplug: Remove qemuDomainDelDiskSrcTLSObject

Replace access via wrapper by direct call to monitor API.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: Split handling of managed and unmanaged persistent reservations
Peter Krempa [Thu, 31 May 2018 11:56:35 +0000 (13:56 +0200)] 
qemu: Split handling of managed and unmanaged persistent reservations

Add code that will handle the managed persistent reservations object
separately from the unmanaged one. There is only one managed object so
handling it with disks is awkward and does not scale well when backing
chains come into view.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: command: Return props as return value in qemuBuildPRManagerInfoProps
Peter Krempa [Thu, 31 May 2018 11:29:45 +0000 (13:29 +0200)] 
qemu: command: Return props as return value in qemuBuildPRManagerInfoProps

Also since we don't do any conditional formatting, fix the comment for
the function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: command: Pass in 'src' rather than 'disk' to qemuBuildPRManagerInfoProps
Peter Krempa [Thu, 31 May 2018 11:20:52 +0000 (13:20 +0200)] 
qemu: command: Pass in 'src' rather than 'disk' to qemuBuildPRManagerInfoProps

Everything is contained in the virStorageSourceStructure.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoutil: storage: Add helper for determining whether a backing chain requires PR
Peter Krempa [Thu, 17 May 2018 10:52:02 +0000 (12:52 +0200)] 
util: storage: Add helper for determining whether a backing chain requires PR

With blockdev support we will need to introspect whether any of the
backing chain members requires PR rather just one of them. Add a helper
and reuse it in virDomainDefHasManagedPR.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agotests: qemublock: Test NBD with TLS in the JSON generator
Peter Krempa [Wed, 30 May 2018 13:28:24 +0000 (15:28 +0200)] 
tests: qemublock: Test NBD with TLS in the JSON generator

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: domain: Add support for TLS for NBD
Peter Krempa [Tue, 29 May 2018 11:57:17 +0000 (13:57 +0200)] 
qemu: domain: Add support for TLS for NBD

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: conf: Add qemu.conf knobs for setting up TLS for NBD
Peter Krempa [Thu, 31 May 2018 18:21:48 +0000 (20:21 +0200)] 
qemu: conf: Add qemu.conf knobs for setting up TLS for NBD

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: Remove code for setting up disk passphrases
Peter Krempa [Tue, 22 May 2018 13:50:42 +0000 (15:50 +0200)] 
qemu: Remove code for setting up disk passphrases

Now that the old qcow2 encryption is removed we can safely delete all
this code since it's not needed any more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: domain: Forbid storage with old QCOW2 encryption
Peter Krempa [Tue, 22 May 2018 12:53:06 +0000 (14:53 +0200)] 
qemu: domain: Forbid storage with old QCOW2 encryption

The encryption was buggy and qemu actually dropped it upstream. Forbid
it for all versions since it would cause other problems too.

Problems with the old encryption include weak crypto, corruption of
images with blockjobs and a lot of usability problems.

This requires changing of the encryption type for the encrypted disk
tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: hotplug: Fix TLS setup on disk hotplug
Peter Krempa [Fri, 1 Jun 2018 15:21:02 +0000 (17:21 +0200)] 
qemu: hotplug: Fix TLS setup on disk hotplug

We need to check if TLS is enabled as the variable is a tristate.
Currently we'd setup TLS even if it was explicitly turned off.
Thankfully TLS for disks was only used with the vxhs protocol so hardly
anybody would ever be able to hit the problem.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoutil: storage: remove virStorageSource->tlsVerify
Peter Krempa [Thu, 31 May 2018 12:10:47 +0000 (14:10 +0200)] 
util: storage: remove virStorageSource->tlsVerify

Disks are client-only so we don't need to have this variable. We also
always pass false for 'isListen' to qemuBuildTLSx509BackendProps for all
disk-related code-paths so the 'tlsVerify' is ignored anyways.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: block: Add support for 'pr-manager' in qemuBlockStorageSourceGetFileProps
Peter Krempa [Wed, 30 May 2018 13:47:13 +0000 (15:47 +0200)] 
qemu: block: Add support for 'pr-manager' in qemuBlockStorageSourceGetFileProps

To keep feature parity, we need to be able to format the PR manager
alias when using blockdev.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: Delete old unused code for adding objects to qemu
Peter Krempa [Wed, 30 May 2018 16:28:05 +0000 (18:28 +0200)] 
qemu: Delete old unused code for adding objects to qemu

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: Convert iothread hotplug to qemuMonitorCreateObjectProps
Peter Krempa [Wed, 30 May 2018 16:24:26 +0000 (18:24 +0200)] 
qemu: Convert iothread hotplug to qemuMonitorCreateObjectProps

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: hotplug: Refactor 'secret' props formatting to qemuMonitorCreateObjectProps
Peter Krempa [Tue, 22 May 2018 05:38:22 +0000 (07:38 +0200)] 
qemu: hotplug: Refactor 'secret' props formatting to qemuMonitorCreateObjectProps

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: hotplug: Refactor tls-credential props formatting to qemuMonitorCreateObjectProps
Peter Krempa [Tue, 22 May 2018 05:38:22 +0000 (07:38 +0200)] 
qemu: hotplug: Refactor tls-credential props formatting to qemuMonitorCreateObjectProps

Note that it's okay to pass NULL to qemuDomainDelTLSObjects in
qemuDomainAddTLSObjects as the tls-creds-x509 object was either not
created or qemu crashed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: hotplug: Refactor shmem props formatting to qemuMonitorCreateObjectProps
Peter Krempa [Fri, 18 May 2018 12:48:22 +0000 (14:48 +0200)] 
qemu: hotplug: Refactor shmem props formatting to qemuMonitorCreateObjectProps

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: hotplug: Refactor memory props formatting to qemuMonitorCreateObjectProps
Peter Krempa [Fri, 18 May 2018 12:48:22 +0000 (14:48 +0200)] 
qemu: hotplug: Refactor memory props formatting to qemuMonitorCreateObjectProps

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: hotplug: Refactor RNG props formatting to use qemuMonitorCreateObjectProps
Peter Krempa [Fri, 18 May 2018 12:48:22 +0000 (14:48 +0200)] 
qemu: hotplug: Refactor RNG props formatting to use qemuMonitorCreateObjectProps

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: hotplug: Refactor PR props formatting to use qemuMonitorCreateObjectProps
Peter Krempa [Fri, 18 May 2018 12:48:22 +0000 (14:48 +0200)] 
qemu: hotplug: Refactor PR props formatting to use qemuMonitorCreateObjectProps

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoutil: qemu: Introduce helper for formatting command line from new object props
Peter Krempa [Fri, 18 May 2018 12:04:21 +0000 (14:04 +0200)] 
util: qemu: Introduce helper for formatting command line from new object props

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: monitor: Add better APIs for adding of objects to qemu
Peter Krempa [Thu, 17 May 2018 14:43:58 +0000 (16:43 +0200)] 
qemu: monitor: Add better APIs for adding of objects to qemu

Use the new monitor command internal API to allow wrapping of the object
name and alias into the JSON props so that they don't have to be passed
out of band.

The new API also takes a double pointer so that it can be cleared when
the value is consumed so that it does not need to happen in every single
caller.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: Rename virQEMUBuildObjectCommandlineFromJSON
Peter Krempa [Thu, 17 May 2018 14:26:09 +0000 (16:26 +0200)] 
qemu: Rename virQEMUBuildObjectCommandlineFromJSON

s/virQEMUBuildObjectCommandlineFromJSON/virQEMUBuildObjectCommandlineFromJSONType/

The function adds the object of a certain type. Change the name so that
we make room for the generic function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: monitor: Rename qemuMonitorAddObject to qemuMonitorAddObjectType
Peter Krempa [Thu, 17 May 2018 14:26:09 +0000 (16:26 +0200)] 
qemu: monitor: Rename qemuMonitorAddObject to qemuMonitorAddObjectType

The function adds the object of a certain type. Change the name so that
we make room for the generic function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: command: Fix name of qemuBuildMemoryBackendStr
Peter Krempa [Fri, 18 May 2018 13:51:36 +0000 (15:51 +0200)] 
qemu: command: Fix name of qemuBuildMemoryBackendStr

The function generates JSON properties rather than a string so rename
it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agotests: qemu: Rename disk-drive-network-tlsx509-vxhs test
Peter Krempa [Wed, 30 May 2018 11:44:23 +0000 (13:44 +0200)] 
tests: qemu: Rename disk-drive-network-tlsx509-vxhs test

Drop the 'vxhs' suffix so other network protocols using TLS can be
put into the same test.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: hotplug: Remove TLS alias generation from qemuDomainGetTLSObjects
Peter Krempa [Wed, 30 May 2018 07:24:35 +0000 (09:24 +0200)] 
qemu: hotplug: Remove TLS alias generation from qemuDomainGetTLSObjects

Callers should generate the alias separately.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: hotplug: Drop 'secAlias' output parameter from qemuDomainGetTLSObjects
Peter Krempa [Tue, 29 May 2018 18:17:04 +0000 (20:17 +0200)] 
qemu: hotplug: Drop 'secAlias' output parameter from qemuDomainGetTLSObjects

No callers are using it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: hotplug: Remove misleading comment in qemuDomainGetTLSObjects
Peter Krempa [Tue, 29 May 2018 18:08:57 +0000 (20:08 +0200)] 
qemu: hotplug: Remove misleading comment in qemuDomainGetTLSObjects

'secinfo' is present also for migrations. Delete the misleading comment.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: hotplug: Pass around existing secret object alias from qemuDomainAddChardevTLSO...
Peter Krempa [Tue, 29 May 2018 18:03:07 +0000 (20:03 +0200)] 
qemu: hotplug: Pass around existing secret object alias from qemuDomainAddChardevTLSObjects

Setting up the 'secinfo' for the TLS private key password also generates
the given alias, so we don't need to generate another one.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: migration: Don't pass around secAlias
Peter Krempa [Tue, 29 May 2018 17:56:05 +0000 (19:56 +0200)] 
qemu: migration: Don't pass around secAlias

The alias of the secret for decrypting the TLS passphrase is useless
besides for TLS setup. Stop passing it around.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: command: Always setup TLS environment if src->haveTLS is on
Peter Krempa [Tue, 29 May 2018 12:57:37 +0000 (14:57 +0200)] 
qemu: command: Always setup TLS environment if src->haveTLS is on

We make sure that the disk supports TLS when preparing the environment
so there's no need to duplicate checks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: command: Pass in alias for TLS object to qemuBuildTLSx509CommandLine
Peter Krempa [Tue, 29 May 2018 16:04:42 +0000 (18:04 +0200)] 
qemu: command: Pass in alias for TLS object to qemuBuildTLSx509CommandLine

Callers need to know the alias anyways so it does not make much sense to
generate it inside of this function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: command: Don't generate alias for TLS private key password secret
Peter Krempa [Tue, 29 May 2018 16:04:42 +0000 (18:04 +0200)] 
qemu: command: Don't generate alias for TLS private key password secret

qemuBuildTLSx509CommandLine has no business guessing which alias should
be used. The alias needs to be passed in.

Note that there's a lingering bad design of this, since the secret
object alias is based on the device name and not on the fact that the
secret is used for decrypting of the TLS private key. If we ever add
authentication for chardevs this will bite us.

Thankfully disk code does not support encrypted private keys for TLS so
it can be happily refactored there.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: domain: Set up disk TLS alias when preparing TLS setup
Peter Krempa [Tue, 29 May 2018 15:42:23 +0000 (17:42 +0200)] 
qemu: domain: Set up disk TLS alias when preparing TLS setup

Move the TLS object alias setup earlier. Also make sure that the alias
is not overwritten on hotplug.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: hotplug: Allow passing in NULL 'tlsAlias' to qemuDomainGetTLSObjects
Peter Krempa [Tue, 29 May 2018 16:30:10 +0000 (18:30 +0200)] 
qemu: hotplug: Allow passing in NULL 'tlsAlias' to qemuDomainGetTLSObjects

Some callers will not need to generate the alias again.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: hotplug: Don't mandate passing of 'secAlias' in qemuDomainGetTLSObjects
Peter Krempa [Tue, 29 May 2018 18:06:35 +0000 (20:06 +0200)] 
qemu: hotplug: Don't mandate passing of 'secAlias' in qemuDomainGetTLSObjects

For some reason the function returned an error if secAlias was not
passed in. It's not an error, in fact it's desired.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoconf: Don't encode matrix of storage protocols supporting TLS in the parser
Peter Krempa [Wed, 30 May 2018 09:03:28 +0000 (11:03 +0200)] 
conf: Don't encode matrix of storage protocols supporting TLS in the parser

Always parse the 'tls' source field and let the drivers decide whether
they support it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: domain: Forbid TLS setup for disk protocols not supporting it
Peter Krempa [Wed, 30 May 2018 10:50:44 +0000 (12:50 +0200)] 
qemu: domain: Forbid TLS setup for disk protocols not supporting it

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: domain: Use switch statement in qemuDomainPrepareDiskSourceTLS
Peter Krempa [Tue, 29 May 2018 11:45:18 +0000 (13:45 +0200)] 
qemu: domain: Use switch statement in qemuDomainPrepareDiskSourceTLS

Select protocol using a switch with all cases enumerated. This will
simplify checking unsupported protocols and adding new support.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: domain: Process only one object in qemuDomainPrepareDiskSourceTLS
Peter Krempa [Wed, 30 May 2018 10:48:34 +0000 (12:48 +0200)] 
qemu: domain: Process only one object in qemuDomainPrepareDiskSourceTLS

Remove the loop from qemuDomainPrepareDiskSourceTLS and rename it to
qemuDomainPrepareStorageSourceTLS. Currently there is no backing chain
to prepare so fixing one device is equivalent. In the future it will be
reused in a function which will do the looping.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: domain: Separate setup of TLS for VXHS disks from qemuDomainPrepareDiskSourceTLS
Peter Krempa [Tue, 29 May 2018 11:40:16 +0000 (13:40 +0200)] 
qemu: domain: Separate setup of TLS for VXHS disks from qemuDomainPrepareDiskSourceTLS

Split out the code into a separate function so that all steps for a
storage protocol are contained and the original function is easily
extendable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: domain: aggregate setup of disk drive options for -drive
Peter Krempa [Tue, 29 May 2018 14:38:50 +0000 (16:38 +0200)] 
qemu: domain: aggregate setup of disk drive options for -drive

When using blockdev the approach to base aliases will change. Add a
helper function that will aggregate all code which needs to be called
with the disk alias for the -drive to setup internal data.

qemuDomainSecretDiskPrepare wrapper is no longer necessary as the
contents were moved to a function which is designed to use the old
aliases.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: domain: Split validation and setup of the virStorageSource
Peter Krempa [Tue, 29 May 2018 15:28:11 +0000 (17:28 +0200)] 
qemu: domain: Split validation and setup of the virStorageSource

Remove the call to the validating function from the function which sets
stuff up.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: domain: don't loop through images in qemuDomainPrepareDiskSourceChain
Peter Krempa [Tue, 29 May 2018 15:05:05 +0000 (17:05 +0200)] 
qemu: domain: don't loop through images in qemuDomainPrepareDiskSourceChain

Convert the function to just prepare data for the disk. Callers need to
do the looping since there's more to do than just copy the data around.

The code path in qemuDomainPrepareDiskSource doesn't need to loop over
the chain yet, since there currently is no chain at this point. This
will be addressed later in the blockdev series where we will setup much
more stuff.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: domain: Properly setup data relevant for top disk image
Peter Krempa [Tue, 29 May 2018 14:52:17 +0000 (16:52 +0200)] 
qemu: domain: Properly setup data relevant for top disk image

qemuDomainPrepareDiskSourceChain should set up the disk zero detection
mode only for the top level image. Since it's invoked also for the
middle of the chain we need to check that it's really only the top level
image.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: domain: Regenerate alias for the TLS x509 credential object
Peter Krempa [Wed, 30 May 2018 10:18:37 +0000 (12:18 +0200)] 
qemu: domain: Regenerate alias for the TLS x509 credential object

When restarting libvirt would previously lose the alias of the x509
certificate object. Upon unplug we would then not delete the
corresponding objects.

Restore the alias if we know it should be there.

Luckily for disks we don't support encrypted TLS environment, so there's
no need to regenerate the 'secret' alias for decryption.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: domain: Store and restore TLS object alias of a disk
Peter Krempa [Wed, 30 May 2018 10:03:41 +0000 (12:03 +0200)] 
qemu: domain: Store and restore TLS object alias of a disk

Libvirt uses the stored alias to detach the TLS x509 object on disk
unplug. As the alias was not stored, the object would not be detached
if unplugging disks after libvirtd restart.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: hotplug: Use 'tlsAlias' to see whether to detach the disk
Peter Krempa [Wed, 30 May 2018 09:33:13 +0000 (11:33 +0200)] 
qemu: hotplug: Use 'tlsAlias' to see whether to detach the disk

Using 'haveTLS' to do this is pointless if the alias is not set.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: hotplug: Don't try to infer secret object alias/presence
Peter Krempa [Mon, 28 May 2018 13:15:16 +0000 (15:15 +0200)] 
qemu: hotplug: Don't try to infer secret object alias/presence

Now that we remember the alias we've used to attach the secret objects
we should reuse them rather than trying to infer them from the disk
configuration.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: domain: Regenerate auth/enc secret aliases when restoring status XML
Peter Krempa [Thu, 24 May 2018 16:24:13 +0000 (18:24 +0200)] 
qemu: domain: Regenerate auth/enc secret aliases when restoring status XML

Previously we did not store the aliases but rather re-generated them
when unplug was necessary. This is very cumbersome since the knowledge
when and which alias to use needs to be stored in the hotplug code as
well.

While this patch will not strictly improve this situation since there
still will be two places containing this code it at least will allow to
remove the mess from the disk-unplug code and will prevent introducing
more mess when adding blockdev support.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agotests: qemustatusxml2xml: Add test data for re-generating LUKS/auth aliases
Peter Krempa [Mon, 28 May 2018 08:02:54 +0000 (10:02 +0200)] 
tests: qemustatusxml2xml: Add test data for re-generating LUKS/auth aliases

Add tests for upcoming re-generation of aliases for the secret objects
used by qemu when upgrading libvirt.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: Store and parse disk authentication and encryption secret alias
Peter Krempa [Thu, 24 May 2018 11:55:16 +0000 (13:55 +0200)] 
qemu: Store and parse disk authentication and encryption secret alias

Rather than trying to figure out which alias was used, store it in the
status XML.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: domain: Don't delete aliases of secret objects associated with disks
Peter Krempa [Mon, 28 May 2018 13:31:42 +0000 (15:31 +0200)] 
qemu: domain: Don't delete aliases of secret objects associated with disks

We need to reference the secret objects by name when hot-unplugging
disks. Don't remove the alias so that it does not need to be
recalculated.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: domain: Add helpers for partially clearing qemuDomainSecretInfoPtr
Peter Krempa [Mon, 28 May 2018 13:17:01 +0000 (15:17 +0200)] 
qemu: domain: Add helpers for partially clearing qemuDomainSecretInfoPtr

It's desired to keep the alias around to allow referencing of the secret
object used with qemu. Add set of APIs which will destroy all data
except the alias.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: domain: Use qemuDomainSecretInfoNewPlain only for unencrypted secrets
Peter Krempa [Tue, 22 May 2018 15:34:11 +0000 (17:34 +0200)] 
qemu: domain: Use qemuDomainSecretInfoNewPlain only for unencrypted secrets

Move the logic that determines which secret shall be used into the
caller and make this function work only for plain secrets.

This untangles the control flow by only checking relevant data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: domain: Setup disk encryption password secret via new helper
Peter Krempa [Tue, 22 May 2018 15:18:06 +0000 (17:18 +0200)] 
qemu: domain: Setup disk encryption password secret via new helper

The encryption secret is setup only for LUKS and thus requires the new
approach. Use qemuDomainSecretInfoNew for initializing it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: domain: Add new function to set up encrypted secrets only
Peter Krempa [Tue, 22 May 2018 15:14:10 +0000 (17:14 +0200)] 
qemu: domain: Add new function to set up encrypted secrets only

Some code paths can't use the unencrypted secret. Add a helper which
checks and sets up an encrypted secret only and reuse it when setting up
the secret to decrypt the TLS private key in qemuDomainSecretInfoTLSNew.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: domain: Rename and fix docs for qemuDomainSecretInfoNew
Peter Krempa [Tue, 22 May 2018 11:08:19 +0000 (13:08 +0200)] 
qemu: domain: Rename and fix docs for qemuDomainSecretInfoNew

Rename it to qemuDomainSecretInfoNewPlain and annotate that it also may
set up a 'plain' secret in some cases. This will eventually be
refactored further.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: domain: Rename qemuDomainSecretDiskCapable
Peter Krempa [Tue, 22 May 2018 07:18:34 +0000 (09:18 +0200)] 
qemu: domain: Rename qemuDomainSecretDiskCapable

The function checks whether the storage source requires authentication
secret setup. Rename it accordingly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: domain: Reuse code when preparing hostdev auth secrets
Peter Krempa [Tue, 22 May 2018 07:03:02 +0000 (09:03 +0200)] 
qemu: domain: Reuse code when preparing hostdev auth secrets

Use qemuDomainSecretStorageSourcePrepare in
qemuDomainSecretHostdevPrepare as it uses a virStorageSource to prepare
the authentication secret object data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: domain: Add helper to check if encrypted secrets can be used with a VM
Peter Krempa [Tue, 22 May 2018 14:36:20 +0000 (16:36 +0200)] 
qemu: domain: Add helper to check if encrypted secrets can be used with a VM

This helper checks that the vm has the master key setup and libvirt
supports the given encryption algorithm.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agotests: qemublock: Switch to qcow2+luks in test files
Peter Krempa [Tue, 22 May 2018 13:03:02 +0000 (15:03 +0200)] 
tests: qemublock: Switch to qcow2+luks in test files

The next patch will forbid the old qcow2 encryption completely. Remove
it from the tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agotests: qemuxml2argv: Verify that disk secret alias is correct with user-aliases
Peter Krempa [Wed, 23 May 2018 14:00:33 +0000 (16:00 +0200)] 
tests: qemuxml2argv: Verify that disk secret alias is correct with user-aliases

Change the disk encryption type to qcow2+luks so that the appropriate
secret objects are generated. This tests that the proper alias is used
for the passphrase secret object.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agotests: qemuxml2argv: Drop disk encryption from 'interface-server' test
Peter Krempa [Wed, 23 May 2018 13:57:39 +0000 (15:57 +0200)] 
tests: qemuxml2argv: Drop disk encryption from 'interface-server' test

The disk encryption part is no way relevant to the rest of the test so
drop it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
7 years agoqemu: implement vsock coldplug/coldunplug
Ján Tomko [Wed, 30 May 2018 14:49:06 +0000 (16:49 +0200)] 
qemu: implement vsock coldplug/coldunplug

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemu: implement vsock hotunplug
Ján Tomko [Wed, 30 May 2018 10:49:04 +0000 (12:49 +0200)] 
qemu: implement vsock hotunplug

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoconf: introduce virDomainVsockDefEquals
Ján Tomko [Wed, 30 May 2018 13:52:28 +0000 (15:52 +0200)] 
conf: introduce virDomainVsockDefEquals

Introduce a function for comparing two vsock definitions.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemu: implement vsock hotplug
Ján Tomko [Wed, 30 May 2018 11:53:52 +0000 (13:53 +0200)] 
qemu: implement vsock hotplug

Allow hotplugging the vsock device.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemu: Add prefix for vsock vhostfd
Ján Tomko [Wed, 30 May 2018 10:52:51 +0000 (12:52 +0200)] 
qemu: Add prefix for vsock vhostfd

Alter qemuBuildVsockDevStr to allow passing a prefix for
the vhostfd file descriptor name. Domain startup uses
the numeric value of fd without a prefix, but hotplug
will need to use a prefix because passed file descriptor
names cannot start with a number.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>