]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
6 years agotools: Cleanup packet-libvirt.h
Michal Privoznik [Fri, 8 Feb 2019 08:54:40 +0000 (09:54 +0100)]
tools: Cleanup packet-libvirt.h

Move the majority of the packet-libvirt.h content into
packet-libvirt.c and expose only register functions which are the
only ones that are not static.

The rationale behind is that packet-libvirt.h will be included
from packet.c and therefore the header file needs to be as clean
as possible.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: domcaps: Remove dependency on libxl PVUSB support
Cole Robinson [Fri, 8 Feb 2019 17:00:22 +0000 (12:00 -0500)]
tests: domcaps: Remove dependency on libxl PVUSB support

Mock out libxlCapsHasPVUSB to always return true, so test results
aren't dependent on host libxl version

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agolibxl: Break out libxlCapsHasPVUSB
Cole Robinson [Fri, 8 Feb 2019 18:39:57 +0000 (13:39 -0500)]
libxl: Break out libxlCapsHasPVUSB

No functional change, but this will allow us to mock out the function
in the test suite

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agotests: Create a shared library with libxl driver
Cole Robinson [Fri, 8 Feb 2019 18:28:39 +0000 (13:28 -0500)]
tests: Create a shared library with libxl driver

This allows us to mock functions in the libxl driver, like
is already possible for the qemu driver

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agotests: Rename virmocklibxl.c -> libxlmock.c
Cole Robinson [Fri, 8 Feb 2019 16:51:25 +0000 (11:51 -0500)]
tests: Rename virmocklibxl.c -> libxlmock.c

Every other mock library is named ending in mock.c, move
virmocklibxl.c to follow that pattern

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agodocs: storage: owner/group default to libvirtd UID/GID
Cole Robinson [Wed, 6 Feb 2019 23:26:05 +0000 (18:26 -0500)]
docs: storage: owner/group default to libvirtd UID/GID

Commit fafcc818f changed the docs to say that when creating a
pool directory or file volume with no owner/group specified, they
will be inherited from the parent directory. This isn't correct
now and doesn't seem to have ever been correct

In reality default owner/group is whatever UID/GID libvirtd is
running as

Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agorpc: client: stream: fix multi thread abort/finish
Nikolay Shirokovskiy [Thu, 7 Feb 2019 12:58:47 +0000 (15:58 +0300)]
rpc: client: stream: fix multi thread abort/finish

If 2 threads call abort for example then one of them
will hang because client will send 2 abort messages and
server will reply only on first of them, the second will be
ignored. And on server reply client changes the state only
one of abort message to complete, the second will hang forever.
There are other similar issues.

We should complete all messages waiting reply if we got
error or expected abort/finish reply from server. Also if one
thread send finish and another abort one of them will win
the race and server will either abort or finish stream. If
stream is aborted then thread requested finishing should report
error. In order to archive this let's keep stream closing reason
in @closed field. If we receive VIR_NET_OK message for stream
then stream is finished if oldest (closest to queue end) message
in stream queue is finish message and stream is aborted if oldest
message is abort message. Otherwise it is protocol error.

By the way we need to fix case of receiving VIR_NET_CONTINUE
message. Now we take oldest message in queue and check if
this is dummy message. If one thread first sends abort and
second thread then receives data then oldest message is abort
message and second thread won't be notified when data arrives.
Let's find oldest dummy message instead.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agorpc: client stream: dispose private data on stream dispose
Nikolay Shirokovskiy [Thu, 7 Feb 2019 12:58:46 +0000 (15:58 +0300)]
rpc: client stream: dispose private data on stream dispose

If we call virStreamFinish and virStreamAbort from 2 distinct
threads for example we can have access to freed memory.
Because when virStreamFinish finishes for example virStreamAbort
yet to be finished and it access virNetClientStreamPtr object
in stream->privateData.

Also it does not make sense to clear @driver field. After
stream is finished/aborted it is better to have appropriate
error message instead of "unsupported error".

This commit reverts [1] or virNetClientStreamPtr and
virStreamPtr will never be unrefed due to cyclic dependency.
Before this patch we don't have leaks because all execution
paths we call virStreamFinish or virStreamAbort.

[1] 8b6ffe40 : virNetClientStreamNew: Track origin stream

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
6 years agorpc: client: don't set incomingEOF on errors
Nikolay Shirokovskiy [Thu, 7 Feb 2019 12:58:45 +0000 (15:58 +0300)]
rpc: client: don't set incomingEOF on errors

This mixing errors and EOF condition in one flag is odd.
Instead let's check st->err.code where appropriate.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
6 years agorpc: client: incapsulate error checks
Nikolay Shirokovskiy [Thu, 7 Feb 2019 12:58:44 +0000 (15:58 +0300)]
rpc: client: incapsulate error checks

Checking virNetClientStreamRaiseError without client lock
is racy which is fixed in [1] for example. Thus let's remove such checks
when we are sending message to server. And in other cases
(like virNetClientStreamRecvHole for example) let's move the check
into client stream code.

virNetClientStreamRecvPacket already have stream lock so we could
introduce another error checking function like virNetClientStreamRaiseErrorLocked
but as error is set when both client and stream lock are hold we
can remove locking from virNetClientStreamRaiseError because all
callers hold either client or stream lock.

Also let's split virNetClientStreamRaiseErrorLocked into checking
state function and checking message send status function. They are
same yet.

[1] 1b6a29c21: rpc: fix race on stream abort/finish and server side abort

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agorpc: add mising locking in virNetClientStreamRecvHole
Nikolay Shirokovskiy [Thu, 7 Feb 2019 12:58:43 +0000 (15:58 +0300)]
rpc: add mising locking in virNetClientStreamRecvHole

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
6 years agorpc: fix propagation of errors from server
Nikolay Shirokovskiy [Thu, 7 Feb 2019 12:58:42 +0000 (15:58 +0300)]
rpc: fix propagation of errors from server

Stream server error is not propagated if thread does not have the buck.
In case we have the buck we are ok due to the code added in [1].

Let's check for stream error on all paths. Now we don't need
to raise error in virNetClientCallDispatchStream.

Old code reported error only if the first message in wait
queue awaits reply. It is odd as depends on wait queue
situation. For example if we have only TX
message in queue and in one iteration loop both send the
message and receive error then thread sending TX message did
not receive the error. Next if we have RX message (first)
and TX message (second) in queue and in one iteration
loop both send the TX message and receive error then
thread sending TX message received error. In short
it was inconsistent. Let's report error whenever
we received it and for every type of message as it makes
sense to report errors as early as possible.

[1] 16c6e2b41: Fix propagation of RPC errors from streams

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
6 years agorpc: remove unused virNetClientSendNoReply
Nikolay Shirokovskiy [Thu, 7 Feb 2019 12:58:41 +0000 (15:58 +0300)]
rpc: remove unused virNetClientSendNoReply

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agorpc: use single function to send stream messages
Nikolay Shirokovskiy [Thu, 7 Feb 2019 12:58:40 +0000 (15:58 +0300)]
rpc: use single function to send stream messages

In next patches we'll add stream state checks to this
function that applicable to all call paths. This is handy
place because we hold client lock here.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
6 years agorpc: fix race on stream abort/finish and server side abort
Nikolay Shirokovskiy [Thu, 7 Feb 2019 12:58:39 +0000 (15:58 +0300)]
rpc: fix race on stream abort/finish and server side abort

Stream abort/finish can hang because we can receive abort message
from server and yet sent abort/finish message to server. The latter
will not be answered ever because after server sends abort message
it forgets the stream and messages for unknown stream are simply ignored.

We check for stream error at the very beginning of remoteStreamFinish/remoteStreamAbort
but stream error can be set after the check in another thread operating
on stream. Let's check for stream error under client lock similar
to what's done in [1].

[1] 833b901cb: stream: Check for stream EOF

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
6 years agoqemu: Unify style for qemuDomain*()
Andrea Bolognani [Wed, 6 Feb 2019 11:37:54 +0000 (12:37 +0100)]
qemu: Unify style for qemuDomain*()

These functions do mostly the same things, and it would be
preferrable if they did them in mostly the same ways. This
also fixes a few violations to our code style guidelines.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: Move qemuDomainSupportsPCI() to qemu_domain
Andrea Bolognani [Wed, 28 Nov 2018 16:45:37 +0000 (17:45 +0100)]
qemu: Move qemuDomainSupportsPCI() to qemu_domain

The function operates on a virDomainDef and is not tied to
device address assignment in any way, so it makes more sense
for it to live along with qemuDomainIs*() and the like.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: Make most qemuDomainMachine*() functions static
Andrea Bolognani [Wed, 28 Nov 2018 16:34:07 +0000 (17:34 +0100)]
qemu: Make most qemuDomainMachine*() functions static

Ideally we'd make all of them static, but there are a few
cases where we don't have a virDomainDef instance handy and
so they are the only option.

For the few ones we're forced to keep exporting, document
through comments that the alternative is preferred.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: Remove useless ARCH_IS_X86() call
Andrea Bolognani [Wed, 28 Nov 2018 16:08:49 +0000 (17:08 +0100)]
qemu: Remove useless ARCH_IS_X86() call

Now that we have added architecture checks to all
qemuDomainIs*() functions, we no longer need to perform the
same checks separately.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: Add arch checks to qemuDomainMachine*()
Andrea Bolognani [Wed, 28 Nov 2018 15:56:35 +0000 (16:56 +0100)]
qemu: Add arch checks to qemuDomainMachine*()

There is very little overlap in the machine types available
on different architectures, so broadly speaking checking the
machine type is usually enough; regardless, it's better to
check the architecture as well.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: Add arch parameter to qemuDomainMachine*()
Andrea Bolognani [Wed, 28 Nov 2018 15:48:41 +0000 (16:48 +0100)]
qemu: Add arch parameter to qemuDomainMachine*()

We want the signatures to be consistent, and also we're
going to start using the additional parameter next.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: Move functions around
Andrea Bolognani [Wed, 28 Nov 2018 15:15:31 +0000 (16:15 +0100)]
qemu: Move functions around

Make sure related functions, eg. all qemuDomainIs*(), are
close together instead of being sprinkled throughout both
the header and implementation file, and also that all
qemuDomainMachine*() functions are declared first since
we're going to make a bunch of them static later on.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: Use more specific prefixes
Andrea Bolognani [Wed, 28 Nov 2018 14:04:51 +0000 (15:04 +0100)]
qemu: Use more specific prefixes

While the chances of the current checks resulting in false
positives are basically zero, it's still nicer to check for
the full prefix instead of the prefix's prefix.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: Remove redundant condition
Andrea Bolognani [Wed, 28 Nov 2018 15:34:41 +0000 (16:34 +0100)]
qemu: Remove redundant condition

No need to check whether we're dealing with a pSeries guest
twice within just a few lines.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agoutil: Use a semicolon for all VIR_DEFINE_AUTOPTR_FUNC
John Ferlan [Thu, 7 Feb 2019 17:18:52 +0000 (12:18 -0500)]
util: Use a semicolon for all VIR_DEFINE_AUTOPTR_FUNC

For consistency, let's use the semicolon for all definitions.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agodocs: Update the AMD SEV's spec URL
Erik Skultety [Fri, 8 Feb 2019 10:42:14 +0000 (11:42 +0100)]
docs: Update the AMD SEV's spec URL

Luckily, the new URL still points to the same location, the only change
is in the document name where an escaped space (%20) was replaced by an
underscore.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: caps: Don't call 'query-events' when we probe events from QMP schema
Peter Krempa [Thu, 7 Feb 2019 12:03:37 +0000 (13:03 +0100)]
qemu: caps: Don't call 'query-events' when we probe events from QMP schema

Avoid calling the command and fix test fallout.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoqemu: caps: Probe events from 'query-qmp-schema' rather than 'query-events'
Peter Krempa [Thu, 7 Feb 2019 11:50:27 +0000 (12:50 +0100)]
qemu: caps: Probe events from 'query-qmp-schema' rather than 'query-events'

QEMU plans to deprecate 'query-events' as it's non-extensible. Events
are also described by 'query-qmp-schema' so we can use that one instead.

This patch adds detection of events to
virQEMUCapsProbeQMPSchemaCapabilities using the same structure declaring
them for the old approach (virQEMUCapsEvents). This is possible as the
name is the same in the QMP schema and our detector supports that
trivially.

For any complex queries virQEMUCapsQMPSchemaQueries can be used in the
future.

For now we still call 'query-events' and discard the result so that it's
obvious that the tests pass. This will be cleaned up later.

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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoqemu: caps: Always assume QEMU_CAPS_DEVICE_TRAY_MOVED
Peter Krempa [Thu, 7 Feb 2019 11:17:51 +0000 (12:17 +0100)]
qemu: caps: Always assume QEMU_CAPS_DEVICE_TRAY_MOVED

The event was added by qemu commit 6f382ed226f3 released in v1.1.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoqemu: caps: Always assume QEMU_CAPS_DEVICE_DEL_EVENT
Peter Krempa [Thu, 7 Feb 2019 11:08:57 +0000 (12:08 +0100)]
qemu: caps: Always assume QEMU_CAPS_DEVICE_DEL_EVENT

DEVICE_DELETED was added in qemu commit 0402a5d65ec00 which was released
in v1.5.0.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agotests: qemuhotplug: Remove leftovers for non-event testing
Peter Krempa [Thu, 7 Feb 2019 11:06:12 +0000 (12:06 +0100)]
tests: qemuhotplug: Remove leftovers for non-event testing

DO_TEST_ATTACH and DO_TEST_ATTACH_EVENT now do the same thing so we can
remove the latter including the infrastructure.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agotests: qemuhotplug: Use DEVICE_DELETED event in all hotunplug tests
Peter Krempa [Thu, 7 Feb 2019 10:55:12 +0000 (11:55 +0100)]
tests: qemuhotplug: Use DEVICE_DELETED event in all hotunplug tests

Currently all supported qemu versions now have support for the
DEVICE_DELETED event. This means that testing the old approach is a
waste of time.

Always add the QEMU_CAPS_DEVICE_DEL_EVENT capability in the hotplug test
and fix existing test cases.

The 'disk-virtio', 'disk-usb', 'disk-scsi', and 'disk-scsi-2' already
had variants that used the event, so the non-event variants will be
removed.

For all other cases the QMP_DEVICE_DELETED macro is used to add the
correct reply.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agotests: qemuhotplug: Remove unused test macro DO_TEST_DETACH_EVENT
Peter Krempa [Thu, 7 Feb 2019 10:28:14 +0000 (11:28 +0100)]
tests: qemuhotplug: Remove unused test macro DO_TEST_DETACH_EVENT

This variant is unused as we create the object including capabilities
with DO_TEST_ATTACH_EVENT, which is then reused.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoqemu: caps: Always assume QEMU_CAPS_SEAMLESS_MIGRATION
Peter Krempa [Thu, 7 Feb 2019 09:59:19 +0000 (10:59 +0100)]
qemu: caps: Always assume QEMU_CAPS_SEAMLESS_MIGRATION

The event was added by qemu commit 2fdd16e239c2a2 released in v1.3.0.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoqemu: Clean up usage of qemuDomainUpdateCurrentMemorySize
Peter Krempa [Thu, 7 Feb 2019 09:46:20 +0000 (10:46 +0100)]
qemu: Clean up usage of qemuDomainUpdateCurrentMemorySize

Remove the uneeded attribute and return value.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoqemu: caps: Always assume QEMU_CAPS_BALLOON_EVENT
Peter Krempa [Thu, 7 Feb 2019 09:36:01 +0000 (10:36 +0100)]
qemu: caps: Always assume QEMU_CAPS_BALLOON_EVENT

The event was added to qemu by commit 973603a813c5d60 which is contained
in the 1.2.0 release.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoqemu: caps: Add lockout for -blockdev if QEMU_CAPS_SCSI_DISK_DEVICE_ID is not present
Peter Krempa [Mon, 28 Jan 2019 16:12:01 +0000 (17:12 +0100)]
qemu: caps: Add lockout for -blockdev if QEMU_CAPS_SCSI_DISK_DEVICE_ID is not present

Avoid regressions by disallowing the BLOCKDEV capability.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoqemu: Use the 'device_id' property of SCSI disks to avoid regressing
Peter Krempa [Mon, 28 Jan 2019 15:57:35 +0000 (16:57 +0100)]
qemu: Use the 'device_id' property of SCSI disks to avoid regressing

QEMU accidentally exposed the id of -drive (or same value as disk
serial, if provided) in one of the identifiers visible from the guest.

To avoid regression in case when -blockdev will be used we need to
always specify it ourselves.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoqemu: caps: Introduce capability for 'device_id' property of 'scsi-disk'
Peter Krempa [Mon, 28 Jan 2019 08:30:41 +0000 (09:30 +0100)]
qemu: caps: Introduce capability for 'device_id' property of 'scsi-disk'

The property allows to control the guest-visible content of the vendor
specific designator of the 'Device Identification' page of a SCSI
device's VPD (vital product data).

QEMU was leaking the id string of -drive as the value if the 'serial' of
the disk was not specified. Switching to -blockdev would impose an ABI
change.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agotest: qemucaps: Update caps with scsi 'device_id' property
Peter Krempa [Mon, 28 Jan 2019 08:06:37 +0000 (09:06 +0100)]
test: qemucaps: Update caps with scsi 'device_id' property

Based on qemu commit 'v3.1.0-1445-ga61faa3d02'. Will allow checking
for the scsi 'device_id' property.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agotests: qemuxml2argv: Add a 'serial' value for a SCSI disk
Peter Krempa [Mon, 28 Jan 2019 16:04:05 +0000 (17:04 +0100)]
tests: qemuxml2argv: Add a 'serial' value for a SCSI disk

Upcoming addition of a new field will need to make sure that SCSI disk
serial is tested as well. Add a case to one of the existing tests.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoqemu: command: Drop formatting of 'media=cdrom' from -drive
Peter Krempa [Mon, 28 Jan 2019 16:18:56 +0000 (17:18 +0100)]
qemu: command: Drop formatting of 'media=cdrom' from -drive

For SCSI, IDE, and AHCI cdroms the appropriate device types which select
the correct media are used. In qemu there's one other code path that
looks at -drive media=cdrom in the XEN pv code. Thankfully we don't
support it with qemu (see qemuBuildDiskDeviceStr). All other devices
ignore it as the comment states, thus we can drop that code.

The test fallout is expectedly only in the test added for uncommon cdrom
types.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agotests: qemuxml2argv: Add CDROM disks for all untested buses
Peter Krempa [Mon, 28 Jan 2019 14:59:36 +0000 (15:59 +0100)]
tests: qemuxml2argv: Add CDROM disks for all untested buses

Add full and empty cdroms on 'usb' and 'sd' bus to have test
coverage. Note that this does not guarantee that qemu will accept them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoqemu: Forbid cdroms on virtio bus
Peter Krempa [Mon, 28 Jan 2019 16:18:55 +0000 (17:18 +0100)]
qemu: Forbid cdroms on virtio bus

Attempting to create an empty virtio-blk drive results into:
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0xc,drive=drive-virtio-disk1,id=virtio-disk1: Device needs media, but drive is empty

Attempting to eject media from virtio-blk based drive results into:
error: internal error: unable to execute QEMU command 'eject': Device 'drive-virtio-disk0' is not removable

Forbid configurations where users would attempt to use cdroms in virtio
bus.

Fix few wrong examples which are not really relevant to the tested code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoqemu: command: Use correct type for switch in qemuBuildDiskDeviceStr
Peter Krempa [Mon, 28 Jan 2019 14:46:41 +0000 (15:46 +0100)]
qemu: command: Use correct type for switch in qemuBuildDiskDeviceStr

Cast disk->bus to proper type and add missing values to the enum so it's
more obvious what types are supported.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoqemu: caps: Always assume presence of 'ide-hd' and 'ide-cd' devices
Peter Krempa [Mon, 28 Jan 2019 13:44:57 +0000 (14:44 +0100)]
qemu: caps: Always assume presence of 'ide-hd' and 'ide-cd' devices

The split of ide-disk into the two separate devices was introduced by
qemu commit 1f56e32a7f4b3 released in qemu v0.15.

Note that when compared to the previous commit which made sure that no
disk related tests were touched, in this case it's not as careful.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoqemu: caps: Always assume presence of 'scsi-hd' and 'scsi-cd' device
Peter Krempa [Mon, 28 Jan 2019 13:29:10 +0000 (14:29 +0100)]
qemu: caps: Always assume presence of 'scsi-hd' and 'scsi-cd' device

The split of scsi-disk into the two separate devices was introduced by
qemu commit b443ae67 released in qemu v0.15.

All changes to test files are not really related to disk testing thanks
to previous refactors.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agotests: qemuxml2argv: Remove 'disk-virtio-scsi-ccw' test
Peter Krempa [Mon, 28 Jan 2019 13:21:11 +0000 (14:21 +0100)]
tests: qemuxml2argv: Remove 'disk-virtio-scsi-ccw' test

It's a subset of 'iothreads-virtio-scsi-ccw'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agotests: qemuxml2argv: Modernize virtio-scsi iothread tests
Peter Krempa [Mon, 28 Jan 2019 13:17:15 +0000 (14:17 +0100)]
tests: qemuxml2argv: Modernize virtio-scsi iothread tests

Use DO_TEST_CAPS_LATEST to obtain modern results.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agotests: qemuxml2argv: Use 1.5.3 version for the oldest case of 'disk-cache'
Peter Krempa [Mon, 28 Jan 2019 13:11:36 +0000 (14:11 +0100)]
tests: qemuxml2argv: Use 1.5.3 version for the oldest case of 'disk-cache'

Rather than testing random set of flags add a case also for the oldest
supported qemu.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agotests: qemu: Merge 'disk-scsi-vscsi' test into 'disk-scsi'
Peter Krempa [Mon, 28 Jan 2019 12:51:44 +0000 (13:51 +0100)]
tests: qemu: Merge 'disk-scsi-vscsi' test into 'disk-scsi'

As we support multiple scsi controllers there's no need to have a
special test for this controller.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agotests: qemu: Merge 'disk-scsi-mptsas1068' test into 'disk-scsi'
Peter Krempa [Mon, 28 Jan 2019 12:51:44 +0000 (13:51 +0100)]
tests: qemu: Merge 'disk-scsi-mptsas1068' test into 'disk-scsi'

As we support multiple scsi controllers there's no need to have a
special test for this controller.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agotests: qemu: Merge 'disk-scsi-megasas' test into 'disk-scsi'
Peter Krempa [Mon, 28 Jan 2019 12:51:44 +0000 (13:51 +0100)]
tests: qemu: Merge 'disk-scsi-megasas' test into 'disk-scsi'

As we support multiple scsi controllers there's no need to have a
special test for this controller.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agotests: qemuxml2argv: Modernize 'disk-scsi' test
Peter Krempa [Mon, 28 Jan 2019 11:59:49 +0000 (12:59 +0100)]
tests: qemuxml2argv: Modernize 'disk-scsi' test

Use DO_TEST_CAPS_LATEST rather than a predetermined set of caps.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agotests: qemu: Rename 'disk-scsi-device' to 'disk-scsi'
Peter Krempa [Mon, 28 Jan 2019 11:56:11 +0000 (12:56 +0100)]
tests: qemu: Rename 'disk-scsi-device' to 'disk-scsi'

Drop the 'device' suffix which is quite pointless.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agotests: qemuxml2argv: Move cases from 'disk-shared-locking' into 'disk-shared'
Peter Krempa [Mon, 28 Jan 2019 10:45:50 +0000 (11:45 +0100)]
tests: qemuxml2argv: Move cases from 'disk-shared-locking' into 'disk-shared'

The tests are for the same feature. Move all the cases to 'disk-shared'
case as it's already using DO_TEST_CAPS_LATEST

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agotests: qemuxml2argv: Remove the 'after startup XML' testing machinery
Peter Krempa [Mon, 28 Jan 2019 11:50:25 +0000 (12:50 +0100)]
tests: qemuxml2argv: Remove the 'after startup XML' testing machinery

A lot of code with no real impact and popularity. Remove all the helpers
now that the only test case is gone.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agotests: qemuxml2argv: Remove testing of post startup change to 'cachemode' for shared...
Peter Krempa [Mon, 28 Jan 2019 11:43:13 +0000 (12:43 +0100)]
tests: qemuxml2argv: Remove testing of post startup change to 'cachemode' for shared disks

Testing that the cachemode is properly recorded to the configuration
after startup does not add much value and overcomplicates the xml2argv
test.

Remove the 'disk-shared' test with old capabilities as the test with
real capabilities covers the code sufficiently.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agotests: qemuxml2argv: Use real caps when auto-generating SCSI controller type
Peter Krempa [Mon, 28 Jan 2019 10:25:12 +0000 (11:25 +0100)]
tests: qemuxml2argv: Use real caps when auto-generating SCSI controller type

Using an old strict set of capabilities is not of much use if a code
path would select a more modern controller by accident.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agotests: qemuxml: Merge 'ioeventfd' variant of 'virtio-scsi' test into the common file
Peter Krempa [Mon, 28 Jan 2019 09:52:36 +0000 (10:52 +0100)]
tests: qemuxml: Merge 'ioeventfd' variant of 'virtio-scsi' test into the common file

We don't need separate files for this test. Also modernize it in the
process.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agotests: qemuxml: Merge 'max_sectors' variant of 'virtio-scsi' test into the common...
Peter Krempa [Mon, 28 Jan 2019 09:52:36 +0000 (10:52 +0100)]
tests: qemuxml: Merge 'max_sectors' variant of 'virtio-scsi' test into the common file

We don't need separate files for this test. Also modernize it in the
process.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agotests: qemuxml: Merge 'cmd_per_lun' variant of 'virtio-scsi' test into the common...
Peter Krempa [Mon, 28 Jan 2019 09:52:36 +0000 (10:52 +0100)]
tests: qemuxml: Merge 'cmd_per_lun' variant of 'virtio-scsi' test into the common file

We don't need separate files for this test. Also modernize it in the
process.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agotests: qemuxml: Merge 'num-queues' variant of 'virtio-scsi' test into the common...
Peter Krempa [Mon, 28 Jan 2019 09:52:36 +0000 (10:52 +0100)]
tests: qemuxml: Merge 'num-queues' variant of 'virtio-scsi' test into the common file

We don't need separate files for this test. Also modernize it in the
process.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agotests: qemu: Remove 'disk-scsi-virtio-scsi' test
Peter Krempa [Mon, 28 Jan 2019 12:17:10 +0000 (13:17 +0100)]
tests: qemu: Remove 'disk-scsi-virtio-scsi' test

Now that we have a specific test for testing the 'virtio-scsi'
controller and other tests which test a combination of scsi and non-scsi
devices this test no longer makes sense.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agotests: qemuxml: Add a common test file for the 'virtio-scsi' controller
Peter Krempa [Mon, 28 Jan 2019 09:47:21 +0000 (10:47 +0100)]
tests: qemuxml: Add a common test file for the 'virtio-scsi' controller

Add a file to aggregate testing for 'virtio-scsi' based on the modern
framework.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoqemu: capabilities: Probe caps for 'ide-hd' instead of 'ide-drive'
Peter Krempa [Mon, 28 Jan 2019 13:52:22 +0000 (14:52 +0100)]
qemu: capabilities: Probe caps for 'ide-hd' instead of 'ide-drive'

Since commit a4cda054e7 we are using 'ide-hd' and 'ide-cd' instead of
'ide-drive'. We also should probe capabilities for 'ide-hd' instead of
'ide-drive'. It is safe to do as 'ide-drive' is the common denominator
of both 'ide-hd' and 'ide-cd' so all the properties were common.

For now the test data are modified by just changing the appropriate type
when probing for caps.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agoqemu: capabilities: Probe caps for 'scsi-hd' instead of 'scsi-disk'
Peter Krempa [Mon, 28 Jan 2019 09:03:25 +0000 (10:03 +0100)]
qemu: capabilities: Probe caps for 'scsi-hd' instead of 'scsi-disk'

Since commit 02e8d0cfdf8 we are using 'scsi-hd' and 'scsi-cd' instead of
'scsi-disk'. We also should probe capabilities for 'scsi-hd' instead of
'scsi-disk'. It is safe to do as 'scsi-disk' is the common denominator
of both 'scsi-hd' and 'scsi-cd' so all the properties were common.

For now the test data are modified by just changing the appropriate type
when probing for caps.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agotests: qemucaps: Make fake 'microcodeVersion' depend on filename instead of length
Peter Krempa [Mon, 28 Jan 2019 09:22:00 +0000 (10:22 +0100)]
tests: qemucaps: Make fake 'microcodeVersion' depend on filename instead of length

To avoid changes to the filled in microcode in case we change the caps
replies file for any reason make the number depend on the filename.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
6 years agovirsh: Add support for setting post-copy migration bandwidth
Jiri Denemark [Thu, 31 Jan 2019 09:45:35 +0000 (10:45 +0100)]
virsh: Add support for setting post-copy migration bandwidth

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Implement VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY flag
Jiri Denemark [Mon, 4 Feb 2019 16:10:38 +0000 (17:10 +0100)]
qemu: Implement VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY flag

This flag tells virDomainMigrateSetMaxSpeed and
virDomainMigrateGetMaxSpeed APIs to work on post-copy migration
bandwidth.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Implement VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY
Jiri Denemark [Thu, 31 Jan 2019 09:25:11 +0000 (10:25 +0100)]
qemu: Implement VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY

This typed parameter for virDomainMigrate3 and virDomainMigrateToURI3
APIs may be used for setting maximum post-copy migration bandwidth.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoPublic API for post-copy migration bandwidth
Jiri Denemark [Mon, 4 Feb 2019 16:08:36 +0000 (17:08 +0100)]
Public API for post-copy migration bandwidth

This patch adds a new VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY typed
parameter for virDomainMigrate3 and virDomainMigrateToURI3 for setting
maximum post-copy migration bandwidth.

In case the initial VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY value turns out
to be suboptimal a new VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY flag for
virDomainMigrateSetMaxSpeed and virDomainMigrateGetMaxSpeed may be used
to set/get the maximum post-copy migration bandwidth while migration is
already running.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Make migration params usable outside migration
Jiri Denemark [Mon, 4 Feb 2019 16:11:42 +0000 (17:11 +0100)]
qemu: Make migration params usable outside migration

So far migration parameters were changed only at the beginning of
migration mostly via an automatic translation from flags and typed
parameters. We need to export a few more functions to support APIs which
may set migration parameters while migration is already running.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Rework qemuDomainMigrateSetMaxSpeed
Jiri Denemark [Mon, 4 Feb 2019 15:52:05 +0000 (16:52 +0100)]
qemu: Rework qemuDomainMigrateSetMaxSpeed

Let's make the code flow easier to follow and get rid of the ugly endjob
label inside if branch.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Add optional unit to qemuMigrationParamsTPMapItem
Jiri Denemark [Thu, 31 Jan 2019 09:02:17 +0000 (10:02 +0100)]
qemu: Add optional unit to qemuMigrationParamsTPMapItem

Some migration parameters supported by libvirt may use units that differ
from the units used by QEMU for the corresponding parameters. For
example, libvirt defines migration bandwidth in MiB/s while QEMU expects
B/s. Let's add a unit field to qemuMigrationParamsTPMapItem for
automatic conversion when translating between libvirt's migration typed
parameters and QEMU's migration paramteres.

This patch is a preparation for future parameters as the existing
VIR_MIGRATE_PARAM_BANDWIDTH parameter is set using "migrate_set_speed"
QMP command rather than "migrate-set-parameters" for backward
compatibility.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Use C99 initializers for qemuMigrationParamsTPMap
Jiri Denemark [Thu, 31 Jan 2019 08:32:42 +0000 (09:32 +0100)]
qemu: Use C99 initializers for qemuMigrationParamsTPMap

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agovirinitctl: Provide a stub list of init fifos for non-Linux
Michal Privoznik [Thu, 7 Feb 2019 11:47:26 +0000 (12:47 +0100)]
virinitctl: Provide a stub list of init fifos for non-Linux

The virInitctlFifos list is exported, but lacks definition for
non-Linux and/or non-BSD case.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6 years agoqemu: Use data in qemuBlockJobDataPtr instead of re-generating job name
Peter Krempa [Thu, 24 Jan 2019 16:50:59 +0000 (17:50 +0100)]
qemu: Use data in qemuBlockJobDataPtr instead of re-generating job name

qemuDomainBlockPivot and qemuDomainBlockJobAbort need the job name for
cancelling or pivoting but were generating it locally instead of
accessing the existing copy in the job data structure.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Remove unused 'cfg' qemuDomainBlockPivot
Peter Krempa [Thu, 24 Jan 2019 16:37:48 +0000 (17:37 +0100)]
qemu: Remove unused 'cfg' qemuDomainBlockPivot

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Move shareable disk check for block copy
Peter Krempa [Thu, 24 Jan 2019 16:24:56 +0000 (17:24 +0100)]
qemu: Move shareable disk check for block copy

The writing to an image actually starts when the copy job is initiated,
so checking this at the time of the pivot operation is too late.

Move the check to qemuDomainBlockCopyCommon. Note that modern qemu would
have prevented two writers with qcow2 so the slim possibility of a job
started with libvirtd without this patch missing the check is not really
worth worrying about.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: Always save status XML in qemuDomainBlockJobAbort
Peter Krempa [Thu, 24 Jan 2019 16:13:58 +0000 (17:13 +0100)]
qemu: Always save status XML in qemuDomainBlockJobAbort

For copy and active commit jobs we record the state of the mirror so
that we can recover. The status XML was not saved in case of
qemuDomainBlockPivot due to an oversight.

Save the XML always when invoking qemuDomainBlockJobAbort even if
the job is not currently tracking any state. This will change later and
also this is not a particularly hot code path.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agolxc: Don't reboot host on virDomainReboot
Michal Privoznik [Fri, 25 Jan 2019 11:42:54 +0000 (12:42 +0100)]
lxc: Don't reboot host on virDomainReboot

If the container is really a simple one (init is just bash and
the whole root is passed through) then virDomainReboot and
virDomainShutdown will talk to the actual init within the host.
Therefore, 'virsh shutdown $dom' will result in shutting down the
host. True, at that point the container is shut down too but
looks a bit harsh to me.

The solution is to check if the init inside the container is or
is not the same as the init running on the host.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agovirinitctl: Expose fifo paths and allow caller to chose one
Michal Privoznik [Fri, 25 Jan 2019 11:37:53 +0000 (12:37 +0100)]
virinitctl: Expose fifo paths and allow caller to chose one

So far the virInitctlSetRunLevel() is fully automatic. It finds
the correct fifo to use to talk to the init and it will set the
desired runlevel. Well, callers (so far there is just one) will
need to inspect the fifo a bit just before the runlevel is set.
Therefore, expose the internal list of fifos and also allow
caller to explicitly use one.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agolxc: Restore seclabels after the container is killed
Michal Privoznik [Thu, 24 Jan 2019 16:38:10 +0000 (17:38 +0100)]
lxc: Restore seclabels after the container is killed

Due to a bug the seclabels are restored before any PID in the
container is killed. This should be done afterwards in
virLXCProcessCleanup.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agovircgroup: Try harder to kill cgroup
Michal Privoznik [Thu, 24 Jan 2019 16:20:58 +0000 (17:20 +0100)]
vircgroup: Try harder to kill cgroup

Prior to rewrite of cgroup code we only had one backend to try.
After the rewrite the virCgroupBackendGetAll() returns both
backends (for v1 and v2). However, not both have to really be
present on the system which results in killRecursive callback
failing which in turn might mean we won't try the other backend.

At the same time, this function reports no error as it should.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agolxc: Use correct job type for destroying a domain
Michal Privoznik [Thu, 24 Jan 2019 07:32:27 +0000 (08:32 +0100)]
lxc: Use correct job type for destroying a domain

Not that it would matter because LXC driver doesn't differentiate
the job types so far, but nevertheless the Destroy() should grab
LXC_JOB_DESTROY.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoconf: Remove iothreads restriction in virDomainDefCheckABIStabilityFlags
Jie Wang [Thu, 31 Jan 2019 12:50:31 +0000 (20:50 +0800)]
conf: Remove iothreads restriction in virDomainDefCheckABIStabilityFlags

The number of iothreads is not part of the vm state sent during
migration, nor exposed to the guest ABI, so this restriction is
a mistake in libvirt. Let's remove that bit of code.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Jie Wang <wangjie88@huawei.com>
6 years agodosc: schema: fix usb source address device attribute format
Nikolay Shirokovskiy [Mon, 21 Jan 2019 08:40:09 +0000 (11:40 +0300)]
dosc: schema: fix usb source address device attribute format

Device attribute does not have dotted "portAddr" format. Instead it
has single number format described but "usbAddr" which corresponds
to device parsing code in virDomainHostdevSubsysUSBDefParseXML.

Looks like [1] mistakenly changed device format for hostdev devices.
And [2] copy-n-paste this for hostdev network interfaces.

[1] 31710a53 Modify USB port to be defined as a port path
[2] 3b1c191f conf: parse/format type='hostdev' network interfaces

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
6 years agoqemu: Refactor virtio-input capabilities checks
Andrea Bolognani [Wed, 5 Sep 2018 16:28:58 +0000 (18:28 +0200)]
qemu: Refactor virtio-input capabilities checks

The checks and error messages are mostly the same across
all virtio-input devices, so we can avoid having multiple
copies of the same code.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: Unify qemucaps2xml output files
Andrea Bolognani [Fri, 1 Feb 2019 12:16:18 +0000 (13:16 +0100)]
tests: Unify qemucaps2xml output files

Turns out different versions of QEMU on the same architecture
produce the same output, so we can have a single output file
per architecture instead of duplicating the same data over and
over again.

Spotted-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agoqemu: caps: Don't try to ask for CAP_DAC_OVERRIDE if non-root
Peter Krempa [Mon, 4 Feb 2019 15:24:15 +0000 (16:24 +0100)]
qemu: caps: Don't try to ask for CAP_DAC_OVERRIDE if non-root

It will not work. This breaks qemu capabilities probing as a user.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoqemu: Refresh state before starting the VCPUs
Marc Hartmayer [Mon, 4 Feb 2019 12:36:24 +0000 (13:36 +0100)]
qemu: Refresh state before starting the VCPUs

For normal starts (no incoming migration) the refresh of the QEMU
state must be done before the VCPUs getting started since otherwise
there might be a race condition between a possible shutdown of the
guest OS and the QEMU monitor queries.

This fixes "qemu: migration: Refresh device information after
transferring state" (93db7eea1b864).

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
6 years agoqemu: Assume migration with a network disk migration is safe
Michal Privoznik [Thu, 24 Jan 2019 08:58:38 +0000 (09:58 +0100)]
qemu: Assume migration with a network disk migration is safe

If a domain has a disk that is type='network' we require specific
cache mode to allow migration with it (either 'directsync' or
'none'). This doesn't make much sense since network disks are
supposed to be safe to migrate by default.

At the same time, we should be checking for the actual source
type, not apparent type set in the domain XML.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
6 years agoqemu: domain: Use 'raw' for 'volume' disks without format
Peter Krempa [Thu, 31 Jan 2019 14:37:53 +0000 (15:37 +0100)]
qemu: domain: Use 'raw' for 'volume' disks without format

Storage pools might want to specify format of the image when translating
the volume thus we can't add any default format when parsing the XML.

Add a explicit format when starting the VM and format is not present
neither by user specifying it nor by the storage pool translation
function.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: domain: Assume 'raw' default storage format also for network storage
Peter Krempa [Thu, 4 Oct 2018 12:43:46 +0000 (14:43 +0200)]
qemu: domain: Assume 'raw' default storage format also for network storage

Post parse callback adds the 'raw' type only for local files. Remote
files can also have backing store (even local) so we should do this also
for network backed storage.

Note that virStorageFileGetMetadata always considers files with no type
as raw so we will not accidentally traverse the backing chain and allow
unexpected files being labelled with svirt labels.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agotests: qemu: Test network disks without format specified explicitly
Peter Krempa [Mon, 8 Oct 2018 13:30:36 +0000 (15:30 +0200)]
tests: qemu: Test network disks without format specified explicitly

Modify some existing tests of network-based disks to omit the storage
format specification.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
6 years agoqemu: command: Don't skip 'readonly' and throttling info for empty drive
Peter Krempa [Fri, 1 Feb 2019 16:54:46 +0000 (17:54 +0100)]
qemu: command: Don't skip 'readonly' and throttling info for empty drive

In commit f80eae8c2ae I was too agresive in removing properties of
-drive for empty drives. It turns out that qemu actually persists the
state of 'readonly' and the throttling information even for the empty
drive.

Removing 'readonly' thus made qemu open any subsequent images added via
the 'change' command as RW which was forbidden by selinux thanks to the
restrictive sVirt label for readonly media.

Fix this by formating the property again and bump the tests and leave a
note detailing why the rest of the properties needs to be skipped.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6 years agonews: Fix typo
Andrea Bolognani [Mon, 4 Feb 2019 08:22:31 +0000 (09:22 +0100)]
news: Fix typo

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6 years agoRequire a semicolon for VIR_ONCE_GLOBAL_INIT calls
Cole Robinson [Sun, 20 Jan 2019 17:23:29 +0000 (12:23 -0500)]
Require a semicolon for VIR_ONCE_GLOBAL_INIT calls

Missing semicolon at the end of macros can confuse some analyzers
(like cppcheck <filename>). VIR_ONCE_GLOBAL_INIT is almost
exclusively called without an ending semicolon, but let's
standardize on using one like the other macros.

Add a dummy struct definition at the end of the macro, so
the compiler will require callers to add a semicolon.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agoRequire a semicolon for VIR_LOG_INIT calls
Cole Robinson [Sun, 20 Jan 2019 16:32:42 +0000 (11:32 -0500)]
Require a semicolon for VIR_LOG_INIT calls

Missing semicolon at the end of macros can confuse some analyzers
(like cppcheck <filename>), and we have a mix of semicolon and
non-semicolon usage through the code. Let's standardize on using
a semicolon for VIR_LOG_INIT calls.

Drop the semicolon from the final statement of the macro, so
the compiler will require callers to add a semicolon.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>