]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
7 years agovbox: Generate disk address element in dumpxml
Dawid Zamirski [Tue, 7 Nov 2017 18:49:28 +0000 (13:49 -0500)]
vbox: Generate disk address element in dumpxml

This patch adds <address> element to each <disk> device since device
names alone won't adequately reflect the storage device layout in the
VM. With this patch, the ouput produced by dumpxml will faithfully
reproduce the storage layout of the VM if used with define.

7 years agovbox: Process empty removable disks in dumpxml
Dawid Zamirski [Tue, 7 Nov 2017 18:49:27 +0000 (13:49 -0500)]
vbox: Process empty removable disks in dumpxml

Previously any removable storage device without media attached was
omitted from domain XML dump. They're still (rightfully) omitted in
snapshot XML dump but need to be accounted properly to for the device
names to stay in 'sync' between domain and snapshot XML dumps.

7 years agovbox: Cleanup vboxDumpDisks implementation
Dawid Zamirski [Tue, 7 Nov 2017 18:49:26 +0000 (13:49 -0500)]
vbox: Cleanup vboxDumpDisks implementation

Primer the code for further changes:

* move variable declarations to the top of the function
* group together free/release statements
* error check and report VBOX API calls used

7 years agovbox: Correctly generate drive name in dumpxml
Dawid Zamirski [Tue, 7 Nov 2017 18:49:25 +0000 (13:49 -0500)]
vbox: Correctly generate drive name in dumpxml

If a VBOX VM has e.g. a SATA and SCSI disk attached, the XML generated
by dumpxml used to produce "sda" for both of those disks. This is an
invalid domain XML as libvirt does not allow duplicate device names. To
address this, keep the running total of disks that will use "sd" prefix
for device name and pass it to the vboxGenerateMediumName which no
longer tries to "compute" the value based only on current and max
port and slot values. After this the vboxGetMaxPortSlotValues is not
needed and was deleted.

7 years agovbox: Swap vboxSnapshotGetReadOnlyDisks arguments
Dawid Zamirski [Tue, 7 Nov 2017 18:49:24 +0000 (13:49 -0500)]
vbox: Swap vboxSnapshotGetReadOnlyDisks arguments

So that the function signature matches vboxSnapshotGetReadWriteDisks

7 years agovbox: Do not free disk definitions on cleanup
Dawid Zamirski [Tue, 7 Nov 2017 18:49:23 +0000 (13:49 -0500)]
vbox: Do not free disk definitions on cleanup

Both vboxSnapshotGetReadWriteDisks and vboxSnapshotGetReadWriteDisks do
not need to free the def->disks on cleanup because it's being done by
the caller via virDomainSnaphotDefFree

7 years agovbox: Cleanup/prepare snasphot dumpxml functions
Dawid Zamirski [Tue, 7 Nov 2017 18:49:22 +0000 (13:49 -0500)]
vbox: Cleanup/prepare snasphot dumpxml functions

This patch prepares the vboxSnapshotGetReadOnlyDisks and
vboxSnapshotGetReadWriteDisks functions for further changes so that
the code movement does not obstruct the gist of those future changes.
This is done primarily because we'll need to know the type of vbox
storage controller as early as possible and make decisions based on
that info.

7 years agovbox: Rename vboxDumpIDEHDDs to vboxDumpDisks
Dawid Zamirski [Tue, 7 Nov 2017 18:49:21 +0000 (13:49 -0500)]
vbox: Rename vboxDumpIDEHDDs to vboxDumpDisks

Because it deals with other disk types as well not just IDE. Also this
function now returns -1 on error

7 years agovbox: Add vboxDumpStorageControllers
Dawid Zamirski [Tue, 7 Nov 2017 18:49:20 +0000 (13:49 -0500)]
vbox: Add vboxDumpStorageControllers

7 years agovbox: Process <controller> element in domain XML
Dawid Zamirski [Tue, 7 Nov 2017 18:49:19 +0000 (13:49 -0500)]
vbox: Process <controller> element in domain XML

With this patch, the vbox driver will no longer attach all supported
storage controllers by default even if no disk devices are associated
with them. Instead, it will attach only those that are implicitly added
by virDomainDefAddImplicitController based on <disk> element or if
explicitly specified via the <controller> element.

7 years agovbox: Cleanup partially-defined VM on failure
Dawid Zamirski [Tue, 7 Nov 2017 18:49:18 +0000 (13:49 -0500)]
vbox: Cleanup partially-defined VM on failure

Since the VBOX API requires to register an initial VM before proceeding
to attach any remaining devices to it, any failure to attach such
devices should result in automatic cleanup of the initially registered
VM so that the state of VBOX registry remains clean without any leftover
"aborted" VMs in it. Failure to cleanup of such partial VMs results in a
warning log so that actual define error stays on the top of the error
stack.

7 years agostorage: Privatize virStoragePoolObj and virStorageVolDefList
John Ferlan [Wed, 26 Jul 2017 19:13:28 +0000 (15:13 -0400)]
storage: Privatize virStoragePoolObj and virStorageVolDefList

Move the structures into virstorageobj so that both are known
within virstorageobj.c.

7 years agostorage: Use virStoragePoolObjGetDef accessor for new driver events
John Ferlan [Fri, 6 Oct 2017 14:31:34 +0000 (10:31 -0400)]
storage: Use virStoragePoolObjGetDef accessor for new driver events

Missed from merge from commit id 'b0652192' into commit id 'bfcd8fc92'
were a couple of obj->def-> references.

7 years agostorage: Use virStoragePoolObjGetDef accessor for ZFS backend
John Ferlan [Wed, 26 Jul 2017 18:39:54 +0000 (14:39 -0400)]
storage: Use virStoragePoolObjGetDef accessor for ZFS backend

In preparation for privatizing the object, use the accessor.

7 years agostorage: Use virStoragePoolObjGetDef accessor for VSTORAGE backend
John Ferlan [Wed, 26 Jul 2017 18:36:46 +0000 (14:36 -0400)]
storage: Use virStoragePoolObjGetDef accessor for VSTORAGE backend

In preparation for privatizing the object, use the accessor.

7 years agostorage: Use virStoragePoolObjGetDef accessor for SCSI backend
John Ferlan [Wed, 26 Jul 2017 18:34:57 +0000 (14:34 -0400)]
storage: Use virStoragePoolObjGetDef accessor for SCSI backend

In preparation for privatizing the object, use the accessor.

7 years agostorage: Use virStoragePoolObjGetDef accessor for RBD backend
John Ferlan [Wed, 26 Jul 2017 18:32:09 +0000 (14:32 -0400)]
storage: Use virStoragePoolObjGetDef accessor for RBD backend

In preparation for privatizing the object, use the accessor.

7 years agostorage: Use virStoragePoolObjGetDef accessor for MPATH backend
John Ferlan [Wed, 26 Jul 2017 18:28:16 +0000 (14:28 -0400)]
storage: Use virStoragePoolObjGetDef accessor for MPATH backend

In preparation for privatizing the object, use the accessor.

7 years agostorage: Use virStoragePoolObjGetDef accessor for iSCSI backend
John Ferlan [Wed, 26 Jul 2017 18:26:27 +0000 (14:26 -0400)]
storage: Use virStoragePoolObjGetDef accessor for iSCSI backend

In preparation for privatizing the object, use the accessor.

7 years agoapparmor, virt-aa-helper: allow ipv6
Christian Ehrhardt [Fri, 3 Nov 2017 08:46:59 +0000 (09:46 +0100)]
apparmor, virt-aa-helper: allow ipv6

In case ipv6 is used the network inet6 permission is required for
virt-aa-helper.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
7 years agoapparmor: allow qemu to read max_segments
Christian Ehrhardt [Fri, 3 Nov 2017 08:46:58 +0000 (09:46 +0100)]
apparmor: allow qemu to read max_segments

Since qemu 2.9 via 9103f1ce "file-posix: Consider max_segments for
BlockLimits.max_transfer" this is a new access that is denied by the
qemu profile.

It is non fatal, but prevents the fix mentioned to actually work.
It should be safe to allow reading from that path.

Since qemu opens a symlink path we need to translate that for apparmor from
"/sys/dev/block/*/queue/max_segments" to
"/sys/devices/**/block/*/queue/max_segments"

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
7 years agotests: Add testing of storage backend JSON props formatter
Peter Krempa [Fri, 3 Nov 2017 14:20:55 +0000 (15:20 +0100)]
tests: Add testing of storage backend JSON props formatter

Add a new test program called 'qemublocktest' to test the block layer
related stuff and test storage source to JSON generator by comparing it
to the JSON parser.

7 years agoqemu: block: Add node-names to JSON backing storage strings
Peter Krempa [Mon, 9 Oct 2017 06:55:15 +0000 (08:55 +0200)]
qemu: block: Add node-names to JSON backing storage strings

Format out the node-name if it was assigned for JSON-based storage
specification.

7 years agoqemu: block: Add JSON props generator for ssh storage backing
Peter Krempa [Mon, 23 Oct 2017 16:54:12 +0000 (18:54 +0200)]
qemu: block: Add JSON props generator for ssh storage backing

7 years agoqemu: block: Add JSON props generator for sheepdog storage backing
Peter Krempa [Mon, 23 Oct 2017 16:44:35 +0000 (18:44 +0200)]
qemu: block: Add JSON props generator for sheepdog storage backing

7 years agoqemu: block: Add JSON props generator for RBD storage backing
Peter Krempa [Mon, 23 Oct 2017 16:16:53 +0000 (18:16 +0200)]
qemu: block: Add JSON props generator for RBD storage backing

7 years agoqemu: block: Add JSON props generator for NBD storage backing
Peter Krempa [Thu, 13 Jul 2017 13:48:06 +0000 (15:48 +0200)]
qemu: block: Add JSON props generator for NBD storage backing

7 years agoqemu: block: Add JSON props generator for iSCSI protocol
John Ferlan [Thu, 19 Oct 2017 15:44:57 +0000 (17:44 +0200)]
qemu: block: Add JSON props generator for iSCSI protocol

7 years agoqemu: block: Add JSON props generator for 'curl' based storage backends
Peter Krempa [Thu, 13 Jul 2017 13:48:06 +0000 (15:48 +0200)]
qemu: block: Add JSON props generator for 'curl' based storage backends

QEMU uses curl for accessing files using http(s) and ftp(s). They share
common options so let's generate them in one helper.

7 years agostorage: Store RBD image name as pool and image name
Peter Krempa [Mon, 23 Oct 2017 14:23:45 +0000 (16:23 +0200)]
storage: Store RBD image name as pool and image name

Similarly to how we store gluster names, split the name into a pool and
image portions when paring the XML and store them separately.

7 years agostorage: Don't store leading '/' in image name when splitting out volume
Peter Krempa [Mon, 23 Oct 2017 14:39:49 +0000 (16:39 +0200)]
storage: Don't store leading '/' in image name when splitting out volume

Libvirt historically stores storage source path including the volume as
one string in the XML, but that is not really flexible enough when
dealing with the fields in the code. Previously we'd store the slash
separating the two as part of the image name. This was fine for gluster
but it's not necessary and does not scale well when converting other
protocols.

Don't store the slash as part of the path. The resulting change from
absolute to relative path within the gluster driver should be okay,
as the root directory is the default when accessing gluster.

7 years agoqemu: process: Split out useful parts from qemuBuildNetworkDriveURI
Peter Krempa [Thu, 13 Jul 2017 13:38:50 +0000 (15:38 +0200)]
qemu: process: Split out useful parts from qemuBuildNetworkDriveURI

Extract the part formatting the basic URI part so that it can be reused
to format JSON backing definitions. Parts specific to the command line
format will remain in qemuBuildNetworkDriveURI. The new function is
called qemuBlockStorageSourceGetURI.

7 years agoqemu: block: Use proper type for servers for VxHS disks
Peter Krempa [Mon, 23 Oct 2017 16:02:28 +0000 (18:02 +0200)]
qemu: block: Use proper type for servers for VxHS disks

Original implementation used 'SocketAddress' equivalent from qemu for
the disk server field, while qemu documentation specifies
'InetSocketAddress'. The backing store parser uses the correct parsing
function but the formatter used the incorrect one (and also with the
legacy mode enabled which was wrong).

7 years agoqemu: command: Move disk serial validation to qemuCheckDiskConfig
Peter Krempa [Wed, 1 Nov 2017 15:05:55 +0000 (16:05 +0100)]
qemu: command: Move disk serial validation to qemuCheckDiskConfig

7 years agoqemu: command: Move blkiotune checks to qemuCheckDiskConfig
Peter Krempa [Wed, 1 Nov 2017 10:47:19 +0000 (11:47 +0100)]
qemu: command: Move blkiotune checks to qemuCheckDiskConfig

7 years agoqemu: command: Refactor blkiotune checks to tolerate NULL qemuCaps
Peter Krempa [Wed, 1 Nov 2017 10:42:06 +0000 (11:42 +0100)]
qemu: command: Refactor blkiotune checks to tolerate NULL qemuCaps

To allow aggregating the checks, refactor the code to check capabilities
only if they were provided.

7 years agoqemu: command: Merge checks from qemuBuildDriveStrValidate to qemuCheckDiskConfig
Peter Krempa [Tue, 7 Nov 2017 13:32:02 +0000 (14:32 +0100)]
qemu: command: Merge checks from qemuBuildDriveStrValidate to qemuCheckDiskConfig

Stash all the disk definition and capability checks into one function.

7 years agoqemu: command: Refactor qemuBuildDriveStrValidate to make qemuCaps optional
Peter Krempa [Wed, 1 Nov 2017 10:17:20 +0000 (11:17 +0100)]
qemu: command: Refactor qemuBuildDriveStrValidate to make qemuCaps optional

To allow merging this with other disk type checks we need to check
qemuCaps only when available, since some of the checks are executed on
disk cold-plug and thus capabilities should not be checked.

Make the checks optional by making them conditional on qemuCaps not
being NULL.

7 years agoqemu: command: Directly report bus type in qemuBuildDriveStrValidate
Peter Krempa [Wed, 1 Nov 2017 10:02:41 +0000 (11:02 +0100)]
qemu: command: Directly report bus type in qemuBuildDriveStrValidate

All of the error message are already in a conditional block with known
bus type. Inline the bus type rather than formatting it from a separate
variable.

7 years agoqemu: command: Move disk index validation closer to usage
Peter Krempa [Wed, 1 Nov 2017 09:41:55 +0000 (10:41 +0100)]
qemu: command: Move disk index validation closer to usage

The disk index validation is used only in very specific cases and does
not need to be performed otherwise. Move it out of the global check into
the usage place.

7 years agoqemu: command: Remove dead code when formatting -drive
Peter Krempa [Wed, 1 Nov 2017 09:33:24 +0000 (10:33 +0100)]
qemu: command: Remove dead code when formatting -drive

busid and unitid are ever used only if the device is an SD card due to
the check in qemuDiskBusNeedsDeviceArg. Since the SD card does not have
an bus or unit number, most of the code and command line formatter can
be removed since it will never be used.

7 years agoutil: Fix condition check in virDiskNameToIndex
Peter Krempa [Wed, 1 Nov 2017 09:30:04 +0000 (10:30 +0100)]
util: Fix condition check in virDiskNameToIndex

Use the more common '< 0' rather than the non-zero check.

7 years agoqemu: Move memPath generation from memoryBackingDir to a separate function
Michal Privoznik [Mon, 23 Oct 2017 09:33:06 +0000 (11:33 +0200)]
qemu: Move memPath generation from memoryBackingDir to a separate function

In near future we will need more than just a plain VIR_STRDUP().
Better implement that in a separate function and in
qemuBuildMemoryBackendStr() which is complicated enough already.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoconf: s/virDomainObjGetShortName/virDomainDefGetShortName/
Michal Privoznik [Mon, 23 Oct 2017 13:13:09 +0000 (15:13 +0200)]
conf: s/virDomainObjGetShortName/virDomainDefGetShortName/

This function works over domain definition and not domain object.
Its name is thus misleading.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agorpc,lockd: Add missing netserver refcount increment on reload
Nikolay Shirokovskiy [Tue, 24 Oct 2017 10:47:36 +0000 (13:47 +0300)]
rpc,lockd: Add missing netserver refcount increment on reload

After the virNetDaemonAddServerPostExec call in virtlogd we should have
netserver refcount set to 2. One goes to netdaemon servers hashtable
and one goes to virt{logd,lock} own reference to netserver. Let's add
the missing increment in virNetDaemonAddServerPostExec itself while
holding the daemon lock.

Since lockd defers management of the @srv object by the presence
in the hash table, virLockDaemonNewPostExecRestart must Unref the
alloc'd Ref on the @srv object done as part of virNetDaemonAddServerPostExec
and virNetServerNewPostExecRestart processing. The virNetDaemonGetServer
in lock_daemon main will also take a reference which is Unref'd during
main cleanup.

7 years agolockd: Need to Unref @srv when done with it.
John Ferlan [Sat, 28 Oct 2017 21:03:20 +0000 (17:03 -0400)]
lockd: Need to Unref @srv when done with it.

Commit id '252610f7d' used a hash table to store the @srv, but
didn't handle the virObjectUnref if virNetDaemonNew failed nor
did it use virObjectUnref once successfully placed into the table
which will now be managing it's lifetime (and would cause the
virObjectRef if successfully inserted into the table).

7 years agoconf: Don't inline virDomainNetTypeSharesHostView
Jiri Denemark [Thu, 2 Nov 2017 18:58:00 +0000 (19:58 +0100)]
conf: Don't inline virDomainNetTypeSharesHostView

When coverage build is enabled, gcc complains about it:

In file included from qemu/qemu_agent.h:29:0,
                 from qemu/qemu_driver.c:47:
qemu/qemu_driver.c: In function 'qemuDomainSetInterfaceParameters':
./conf/domain_conf.h:3397:1: error: inlining failed in call to
'virDomainNetTypeSharesHostView': call is unlikely and code size would
grow [-Werror=inline]
 virDomainNetTypeSharesHostView(const virDomainNetDef *net)
 ^

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agovirsh: Define multi line macros properly
Michal Privoznik [Tue, 31 Oct 2017 10:47:36 +0000 (11:47 +0100)]
virsh: Define multi line macros properly

In some cases there's dangling backward slash at the end of multi
line macros. While technically the code works, it will stop if
some empty lines are removed.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agodomain: Allow 'model' attribute for ide controller
Dawid Zamirski [Tue, 24 Oct 2017 19:35:32 +0000 (15:35 -0400)]
domain: Allow 'model' attribute for ide controller

The optional values are 'piix3', 'piix4' or 'ich6'. Those will be
needed to allow setting IDE controller model in VirtualBox driver.

7 years agovbox: Add more IStorageController API mappings
Dawid Zamirski [Tue, 24 Oct 2017 19:35:31 +0000 (15:35 -0400)]
vbox: Add more IStorageController API mappings

This patch exposes additional methods of the native VBOX API to the
libvirt 'unified' vbox API to deal with IStorageController. The exposed
methods are:

* IStorageController->GetStorageControllerType()
* IStorageController->SetStorageControllerType()
* IMachine->GetStorageControllers()

7 years agovbox: Support empty removable drives.
Dawid Zamirski [Tue, 24 Oct 2017 19:35:30 +0000 (15:35 -0400)]
vbox: Support empty removable drives.

Original code was checking for non empty disk source before proceeding
to actually attach disk device to VM. This prevented from creating
empty removable devices like DVD or floppy. Therefore, this patch
re-organizes the loop work-flow to allow such configurations as well as
makes the code follow better libvirt practices. Additionally, adjusted
debug logs to be more helpful - removed old ones and added new which
give more valuable info for troubleshooting.

7 years agovbox: Errors in vboxAttachDrives are now critical
Dawid Zamirski [Tue, 24 Oct 2017 19:35:29 +0000 (15:35 -0400)]
vbox: Errors in vboxAttachDrives are now critical

Previously, if one tried to define a VBOX VM and the API failed to
perform the requested actions for some reason, it would just log the
error and move on to process remaining disk definitions. This is not
desired as it could result in incorrectly defined VM without the caller
even knowing about it. So now all the code paths that call
virReportError are now treated as hard failures as they should have
been.

7 years agovbox: Remove unused mediumEmpty
Dawid Zamirski [Fri, 3 Nov 2017 11:49:32 +0000 (07:49 -0400)]
vbox: Remove unused mediumEmpty

Remove the setting since it's unused as of commit 34364df3 which should
have never copied it in from the old code which ended up getting removed
as part of commit c7c286c6.

7 years agovbox: Cleanup vboxAttachDrives implementation
Dawid Zamirski [Tue, 24 Oct 2017 19:35:28 +0000 (15:35 -0400)]
vbox: Cleanup vboxAttachDrives implementation

This commit primes vboxAttachDrives for further changes so when they
are made, the diff is less noisy:

* move variable declarations to the top of the function
* add disk variable to replace all the def->disks[i] instances
* add cleanup at the end of the loop body, so it's all in one place
  rather than scattered through the loop body. It's purposefully
  called 'cleanup' rather than 'skip' or 'continue' because future
  commit will treat errors as hard-failures.

7 years agovbox: vboxAttachDrives now relies on address info
Dawid Zamirski [Tue, 24 Oct 2017 19:35:27 +0000 (15:35 -0400)]
vbox: vboxAttachDrives now relies on address info

Previously, the driver was computing VBOX's devicePort/deviceSlot values
based on device name and max port/slot values. While this worked, it
completely ignored <address> values. Additionally, libvirt's built-in
virDomainDiskDefAssignAddress already does a good job  setting default
values on virDomainDeviceDriveAddress struct which we can use to set
devicePort and deviceSlot and accomplish the same result while allowing
the customizing those via XML. Also, this allows to remove some code
which will make further patches smaller.

7 years agovbox: Close media when undefining domains
Dawid Zamirski [Tue, 24 Oct 2017 19:35:25 +0000 (15:35 -0400)]
vbox: Close media when undefining domains

When registering a VM we call OpenMedium on each disk image which adds it
to vbox's global media registry. Therefore, we should make sure to call
Close when unregistering VM so we cleanup the media registry entries
after ourselves - this does not remove disk image files. This follows
the behaviour of the VBoxManage unregistervm command.

7 years agovbox: Update ATTRIBUTE_UNUSED usage
Dawid Zamirski [Tue, 24 Oct 2017 19:35:24 +0000 (15:35 -0400)]
vbox: Update ATTRIBUTE_UNUSED usage

Since the removal of VBOX <= 3x, the function arguments are actually
used so they should not be marked with ATTRIBUTE_UNUSED anymore.

7 years agocfg.mk: Prohibit backspace alignment attempts
Andrea Bolognani [Tue, 31 Oct 2017 13:12:52 +0000 (14:12 +0100)]
cfg.mk: Prohibit backspace alignment attempts

Now that our codebase is clean, we can add a syntax-check rule
to ensure it will remain so.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agoRemove backslash alignment attempts
Andrea Bolognani [Fri, 3 Nov 2017 12:09:47 +0000 (13:09 +0100)]
Remove backslash alignment attempts

Right-aligning backslashes when defining macros or using complex
commands in Makefiles looks cute, but as soon as any changes is
required to the code you end up with either distractingly broken
alignment or unnecessarily big diffs where most of the changes
are just pushing all backslashes a few characters to one side.

Generated using

  $ git grep -El '[[:blank:]][[:blank:]]\\$' | \
    grep -E '*\.([chx]|am|mk)$$' | \
    while read f; do \
      sed -Ei 's/[[:blank:]]*[[:blank:]]\\$/ \\/g' "$f"; \
    done

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7 years agoqemu: domain: skip chain detection to end of backing chain
Peter Krempa [Fri, 29 Sep 2017 10:02:29 +0000 (12:02 +0200)]
qemu: domain: skip chain detection to end of backing chain

When a user provides the backing chain, we will not need to re-detect
all the backing stores again, but should move to the end of the user
specified chain. Additionally if a user provides a full terminated chain
we should not attempt any further detection.

7 years agoqemu: domain: Prepare TLS data for the whole backing chain
Peter Krempa [Fri, 20 Oct 2017 13:33:35 +0000 (15:33 +0200)]
qemu: domain: Prepare TLS data for the whole backing chain

Iterate through the backing chain when setting up TLS for disks.

7 years agoqemu: domain: Remove pointless alias check
Peter Krempa [Fri, 20 Oct 2017 13:12:49 +0000 (15:12 +0200)]
qemu: domain: Remove pointless alias check

When attaching the disks, aliases are always generated.

7 years agoqemu: domain: Destroy secrets for complete backing chain
Peter Krempa [Fri, 20 Oct 2017 12:16:28 +0000 (14:16 +0200)]
qemu: domain: Destroy secrets for complete backing chain

7 years agoqemu: domain: Extract setup for disk source secrets
Peter Krempa [Fri, 20 Oct 2017 11:50:23 +0000 (13:50 +0200)]
qemu: domain: Extract setup for disk source secrets

Separate it so that it deals only with single virStorageSource, so that
it can later be reused for full backing chain support.

Two aliases are passed since authentication is more relevant to the
'storage backend' whereas encryption is more relevant to the protocol
layer. When using node names, the aliases will be different.

7 years agoqemu: domain: Simplify using DAC permissions of top of backing chain
Peter Krempa [Mon, 16 Oct 2017 12:10:09 +0000 (14:10 +0200)]
qemu: domain: Simplify using DAC permissions of top of backing chain

qemuDomainGetImageIds and qemuDomainStorageFileInit are helpful when
trying to access a virStorageSource from the qemu driver since they
figure out the correct uid and gid for the image.

When accessing members of a backing chain the permissions for the top
level would be used. To allow using specific permissions per backing
chain level but still allow inheritance from the parent of the chain we
need to add a new parameter to the image ID APIs.

7 years agosecurity: selinux: Take parent security label into account
Peter Krempa [Tue, 17 Oct 2017 06:03:42 +0000 (08:03 +0200)]
security: selinux: Take parent security label into account

Until now we ignored user-provided backing chains and while detecting
the code inherited labels of the parent device. With user provided
chains we should keep this functionality, so label of the parent image
in the backing chain will be applied if an image-specific label is not
present.

7 years agosecurity: dac: Take parent security label into account
Peter Krempa [Tue, 17 Oct 2017 06:03:42 +0000 (08:03 +0200)]
security: dac: Take parent security label into account

Until now we ignored user-provided backing chains and while detecting
the code inherited labels of the parent device. With user provided
chains we should keep this functionality, so label of the parent image
in the backing chain will be applied if an image-specific label is not
present.

7 years agosecurity: selinux: Pass parent storage source into image labeling helper
Peter Krempa [Tue, 17 Oct 2017 05:25:51 +0000 (07:25 +0200)]
security: selinux: Pass parent storage source into image labeling helper

virSecuritySELinuxSetImageLabelInternal assigns different labels to
backing chain members than to the parent image. This was done via the
'first' flag. Convert it to passing in pointer to the parent
virStorageSource. This will allow us to use the parent virStorageSource
in further changes.

7 years agostorage: Extract error reporting for broken chains
Peter Krempa [Mon, 16 Oct 2017 11:53:30 +0000 (13:53 +0200)]
storage: Extract error reporting for broken chains

Simplify reporting the error if backing chain is broken for further
callers by extracting it into a separate function.

7 years agostorage: Add feature check for storage file backend supporting access check
Peter Krempa [Mon, 16 Oct 2017 11:42:21 +0000 (13:42 +0200)]
storage: Add feature check for storage file backend supporting access check

When the user provides backing chain, we don't need the full support for
traversing the backing chain. This patch adds a feature check for the
virStorageSourceAccess API.

7 years agostorage: Extract common code to retrieve driver backend for support check
Peter Krempa [Mon, 16 Oct 2017 11:23:51 +0000 (13:23 +0200)]
storage: Extract common code to retrieve driver backend for support check

The 'file access' module of the storage driver has few feature checks to
determine whether libvirt supports given storage driver method. The code
to retrieve the driver struct needed for the check is the same so it can
be extracted.

7 years agoqemu: Add support for block-incremental migration parameter
Jiri Denemark [Thu, 26 Oct 2017 19:51:37 +0000 (21:51 +0200)]
qemu: Add support for block-incremental migration parameter

We handle incremental storage migration in a different way. The support
for this new (as of QEMU 2.10) parameter is only needed for full
coverage of migration parameters used by QEMU.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemu: Add support for max-bandwidth migration parameter
Jiri Denemark [Thu, 26 Oct 2017 18:47:16 +0000 (20:47 +0200)]
qemu: Add support for max-bandwidth migration parameter

We already support several ways of setting migration bandwidth and this
is not adding another one. With this patch we are able to read and write
this parameter using query-migrate-parameters and migrate-set-parameters
in one call with all other parameters.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemu: Rename TLS related migration parameters
Jiri Denemark [Thu, 26 Oct 2017 18:11:47 +0000 (20:11 +0200)]
qemu: Rename TLS related migration parameters

The parameters used "migrate" prefix which is pretty redundant and
qemuMonitorMigrationParams structure is our internal representation of
QEMU migration parameters and it is supposed to use names which match
QEMU names.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemu: Add support for setting downtime-limit migration parameter
Jiri Denemark [Mon, 23 Oct 2017 14:55:02 +0000 (16:55 +0200)]
qemu: Add support for setting downtime-limit migration parameter

We already support setting the maximum downtime with a dedicated
virDomainMigrateSetMaxDowntime API. This patch does not implement
another way of setting the downtime by adding a new public migration
parameter. It just makes sure any parameter we are able to get from a
QEMU monitor by query-migrate-parameters can be passed back to QEMU via
migrate-set-parameters.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemumonitorjsontest: Rename 2nd CHECK macro in migration params test
Jiri Denemark [Thu, 26 Oct 2017 18:52:32 +0000 (20:52 +0200)]
qemumonitorjsontest: Rename 2nd CHECK macro in migration params test

The second CHECK macro was used for string parameters. Let's rename it
to CHECK_STR and move it up to have all checks in one place.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemumonitorjsontest: Rename 1st CHECK macro in migration params test
Jiri Denemark [Thu, 26 Oct 2017 18:50:35 +0000 (20:50 +0200)]
qemumonitorjsontest: Rename 1st CHECK macro in migration params test

The first CHECK macro in the test is used for checking integer values.
Let's make it a bit more generic to be usable for any numeric type and
use it for a new CHECK_INT macro.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemu: Drop giant if statement from qemuMonitorSetMigrationParams
Jiri Denemark [Thu, 26 Oct 2017 20:10:31 +0000 (22:10 +0200)]
qemu: Drop giant if statement from qemuMonitorSetMigrationParams

The check can be easily replaced with a simple test in the JSON
implementation and we don't need to update it every time a new parameter
is added.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemu: Use macro for setting string migration parameters
Jiri Denemark [Mon, 23 Oct 2017 15:06:57 +0000 (17:06 +0200)]
qemu: Use macro for setting string migration parameters

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemu: Generalize APPEND macro in qemuMonitorJSONSetMigrationParams
Jiri Denemark [Mon, 23 Oct 2017 15:03:25 +0000 (17:03 +0200)]
qemu: Generalize APPEND macro in qemuMonitorJSONSetMigrationParams

The APPEND macro is now be usable for any type.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemu: Use macro for parsing ull migration parameters
Jiri Denemark [Mon, 23 Oct 2017 15:17:58 +0000 (17:17 +0200)]
qemu: Use macro for parsing ull migration parameters

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemu: Use macro for parsing string migration parameters
Jiri Denemark [Mon, 23 Oct 2017 15:15:32 +0000 (17:15 +0200)]
qemu: Use macro for parsing string migration parameters

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoqemu: Generalize PARSE macro in qemuMonitorJSONGetMigrationParams
Jiri Denemark [Mon, 23 Oct 2017 15:11:10 +0000 (17:11 +0200)]
qemu: Generalize PARSE macro in qemuMonitorJSONGetMigrationParams

The macro (now called PARSE_SET) is now usable for any type which needs
a *_set bool for indicating a valid value.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agocpu_map: Add cqm alternative name for cmt
Jiri Denemark [Thu, 2 Nov 2017 13:03:14 +0000 (14:03 +0100)]
cpu_map: Add cqm alternative name for cmt

Linux kernel shows our "cmt" feature as "cqm". Let's mention the name in
the cpu_map.xml to make it easier to find.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agoPost-release version bump to 3.10.0
Jiri Denemark [Thu, 2 Nov 2017 20:43:00 +0000 (21:43 +0100)]
Post-release version bump to 3.10.0

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agoRelease of libvirt-3.9.0
Daniel Veillard [Thu, 2 Nov 2017 17:12:45 +0000 (18:12 +0100)]
Release of libvirt-3.9.0

* docs/news.xml: update for release
* po/*po*: regenerated

7 years agonews: Update for 3.9.0 release
Andrea Bolognani [Wed, 1 Nov 2017 16:12:21 +0000 (17:12 +0100)]
news: Update for 3.9.0 release

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
7 years agocputest: Skip tests requiring JSON_MODELS if QEMU is disabled
Jiri Denemark [Wed, 1 Nov 2017 17:35:57 +0000 (18:35 +0100)]
cputest: Skip tests requiring JSON_MODELS if QEMU is disabled

Some tests require JSON_MODELS to be parsed into qemuCaps and applied
when computing CPU models and such test cannot succeed if QEMU driver is
disabled. Let's mark the tests with JSON_MODELS_REQUIRED and skip the
appropriate parts if building without QEMU.

On the other hand, CPU tests with JSON_MODELS should succeed even if
model definitions from QEMU are not parsed and applied. Let's explicitly
test this by repeating the tests without JSON_MODELS set.

This fixes the build with QEMU driver disabled, e.g., on some
architectures on RHEL/CentOS.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
7 years agospec: Restart libvirtd in posttrans
Jiri Denemark [Mon, 23 Oct 2017 11:06:44 +0000 (13:06 +0200)]
spec: Restart libvirtd in posttrans

When upgrading libvirt packages, there's no strict ordering for the
installation or removal of the individual libvirt sub packages. Thus
libvirt-daemon may be upgraded (and its %postun scriptlet) started
before all sub packages with driver libraries are upgraded. When
libvirt-daemon's %postun scriptlet restarts the daemon old drivers may
still be laying around and the daemon may crash when it tries to use
them.

Let's restart the daemon in %posttrans to make sure libvirtd is
restarted only after all sub packages are at the same version.

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

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7 years agovirNetDevSupportBandwidth: Enable QoS for vhostuser
Michal Privoznik [Wed, 25 Oct 2017 10:45:03 +0000 (12:45 +0200)]
virNetDevSupportBandwidth: Enable QoS for vhostuser

Since vhostuser type is really a tap that is just plugged into
different type of bridge, supporting QoS is trivial.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoqemuDomainSetInterfaceParameters: Explicitly reject unsupported net types
Michal Privoznik [Wed, 25 Oct 2017 10:42:41 +0000 (12:42 +0200)]
qemuDomainSetInterfaceParameters: Explicitly reject unsupported net types

For instance, NET_TYPE_MCAST doesn't support setting QoS. Instead
of claiming success and doing nothing, we should be explicit
about that and report an error.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoqemuhotplugtest: Test user supplied alias
Michal Privoznik [Sun, 22 Oct 2017 13:42:45 +0000 (15:42 +0200)]
qemuhotplugtest: Test user supplied alias

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7 years agoqemu.conf: Clarify the various _tls_x509_cert_dir descriptions
John Ferlan [Fri, 27 Oct 2017 09:23:25 +0000 (05:23 -0400)]
qemu.conf: Clarify the various _tls_x509_cert_dir descriptions

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

Apparantly commit id 'dc4c2f75a' wasn't specific enough, so here's
a few more clarifications.

7 years agodocs: Add news article
John Ferlan [Fri, 6 Oct 2017 20:47:13 +0000 (16:47 -0400)]
docs: Add news article

7 years agostorage: Allow creation of a LUKS using logical volume
John Ferlan [Fri, 6 Oct 2017 20:30:47 +0000 (16:30 -0400)]
storage: Allow creation of a LUKS using logical volume

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

Use virStorageBackendCreateVolUsingQemuImg to apply the LUKS information
to the logical volume just created.  As part of the processing of the
lvcreate command add 2MB to the capacity to account for the LUKS header
when it's determined that the volume desires to use encryption.

7 years agostorage: Introduce virStorageBackendCreateVolUsingQemuImg
John Ferlan [Fri, 6 Oct 2017 20:29:21 +0000 (16:29 -0400)]
storage: Introduce virStorageBackendCreateVolUsingQemuImg

Create a shim that will allow other backends to make use of qemu-img
functionality to create or possibly modify the volume.

7 years agostorage: Extract out the LVCREATE
John Ferlan [Fri, 6 Oct 2017 16:45:01 +0000 (12:45 -0400)]
storage: Extract out the LVCREATE

Refactor to extract out the LVCREATE command.  This also removes the
need for the local @created since the error path can now only be reached
after the creation of the logical volume.

Signed-off-by: John Ferlan <jferlan@redhat.com>
7 years agodocs: Add news article for bug fix
John Ferlan [Fri, 6 Oct 2017 18:12:21 +0000 (14:12 -0400)]
docs: Add news article for bug fix

7 years agostorage: Properly resize a local volume using LUKS
John Ferlan [Fri, 6 Oct 2017 16:04:19 +0000 (12:04 -0400)]
storage: Properly resize a local volume using LUKS

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

Turns out the virStorageBackendVolResizeLocal did not differentiate
whether the target volume was a LUKS volume or not and just blindly
did the ftruncate() on the target volume.

Follow the volume creation logic (in general) and create a qemu-img
resize command to resize the target volume for LUKS ensuring that
the --object secret is provided as well as the '--image-opts' used
by the qemu-img resize logic to describe the path and secret ensuring
that it's using the luks driver on the volume of course.

7 years agostorage: Alter storageBackendCreateQemuImgSecretObject args
John Ferlan [Fri, 6 Oct 2017 15:06:13 +0000 (11:06 -0400)]
storage: Alter storageBackendCreateQemuImgSecretObject args

Since all that was really needed was a couple of fields and building
the object can be more generic, let's alter the args a bit. This will
be useful shortly for adding the secret object for a volume resize
operation on a luks volume that will need a secret object.