Commit Graph

22958 Commits

Author SHA1 Message Date
John Ferlan
cb0159df9f lxc: Fix lxcDomainDestroyFlags endjob processing
Commit id '15ccb0dbf' added job functions for the lxc driver; however,
for shutdown and nonpersistent path, the vm was removed from the domain
object list and the vm pointer cleared before the endjob.

Adjust the code to perform the endjob first and then perform the
ObjListRemove as long as the vm wasn't NULL. This follows more closely
models from qemu and libxl

Found by Coverity (FORWARD_NULL)
2016-05-25 06:02:42 -04:00
John Ferlan
fb06350021 qemu: Remove unused persistentAddrs
Based on some digital archaeology performed by jtomko, it's been determined
that the persistentAddrs variable is no longer necessary...

The variable was added by:
commit 141dea6bc7
CommitDate: 2010-02-12 17:25:52 +0000
    Add persistence of PCI addresses to QEMU

Where it was set to 0 on domain startup if qemu did not support the
QEMUD_CMD_FLAG_DEVICE capability, to clear the addresses at shutdown,
because QEMU might make up different ones next time.

As of commit f5dd58a608
CommitDate: 2012-07-11 11:19:05 +0200
    qemu: Extended qemuDomainAssignAddresses to be callable from
    everywhere.

this was broken, when the persistentAddrs = 0 assignment was moved
inside qemuDomainAssignPCIAddresses and while it pretends to check
for !QEMU_CAPS_DEVICE, its parent qemuDomainAssignAddresses is only
called if QEMU_CAPS_DEVICE is present.
2016-05-25 06:02:42 -04:00
John Ferlan
f30672d5ee qemu: Remove dead code
Since commit id '20a0fa8e' removed the QEMU_CAPS_DEVICE, Coverity notes
that it's no longer possible to have 'addrs' be NULL when checking for
a live domain since qemuDomainPCIAddressSetCreate would have jumped to
cleanup if addrs was NULL.
2016-05-25 06:02:42 -04:00
Andrea Bolognani
54f325e925 conf: nodedev: Set PCI_PHYSICAL_FUNCTION flag more carefully
Instead of setting the flag before parsing the PCI address, set
it afterwards. This ensure we can never end up in a situation
where the flag has been set but pci_dev.physical_function has
not been filled in.
2016-05-25 10:38:01 +02:00
Andrea Bolognani
fc9ba9d574 pci: Fix virPCIGetPhysicalFunction()'s callers
Commit c8b1a83605 changed the function, making it
impossible for callers to be able to tell whether a
non-negative return value means "physical function
address found and parsed correctly" or "couldn't find
corresponding physical function".

The important difference between the two being that,
in the latter case, the returned pointer is NULL and
should never, ever be dereferenced.

In order to cope with these changes, the callers
have to be updated.
2016-05-25 10:38:01 +02:00
Andrea Bolognani
063da39376 pci: Document virPCIGetPhysicalFunction() 2016-05-25 10:38:01 +02:00
Andrea Bolognani
12b28f1bf8 pci: Initialize return location in virPCIGetPhysicalFunction()
Just an extra precaution in case the function returns early
due to an OOM error.
2016-05-25 10:38:01 +02:00
Peter Krempa
72a7ff6b50 qemu: hotplug: wait for the tray to eject only for drives with a tray
Use the detected tray presence flag to trigger the tray waiting code
only if the given storage device in qemu reports to have a tray.

This is necessary as the floppy device lost it's tray as of qemu commit:

commit abb3e55b5b718d6392441f56ba0729a62105ac56
Author: Max Reitz <mreitz@redhat.com>
Date:   Fri Jan 29 20:49:12 2016 +0100

    Revert "hw/block/fdc: Implement tray status"
2016-05-25 10:15:54 +02:00
Peter Krempa
2e75da42e4 qemu: hotplug: Fix error reported when cdrom tray is locked
Commit 1fad65d49a used a really big hammer
and overwrote the error message that might be reported by qemu if the
tray is locked. Fix it by reporting the error only if no error is
currently set.

Error after commit mentioned above:
error: internal error: timed out waiting for disk tray status update

New error:
error: internal error: unable to execute QEMU command 'eject': Tray of
device 'drive-ide0-0-0' is not open
2016-05-25 10:15:54 +02:00
Peter Krempa
0aa19f35e0 qemu: hotplug: Extract code for waiting for tray eject
The code grew rather convoluted. Extract it to a separate function.
2016-05-25 10:15:54 +02:00
Peter Krempa
894dc85fd1 qemu: process: Fix and improve disk data extraction
Extract information for all disks and update tray state and source only
for removable drives. Additionally store whether a drive is removable
and whether it has a tray.
2016-05-25 10:15:54 +02:00
Peter Krempa
d9bee413ad qemu: Move and rename qemuDomainCheckEjectableMedia to qemuProcessRefreshDisks
Move it to a more sane place since it's refreshing data about disks.
2016-05-25 10:15:54 +02:00
Peter Krempa
f1690dc3d7 qemu: Extract more information about qemu drives
Extract whether a given drive has a tray and whether there is no image
inserted.

Negative logic for the image insertion is chosen so that the flag is set
only if we are certain of the fact.
2016-05-25 10:15:54 +02:00
Peter Krempa
5f963d89b1 qemu: Move struct qemuDomainDiskInfo to qemu_domain.h 2016-05-25 10:15:54 +02:00
Joao Martins
293668cd70 xenconfig: xm: check for driver on disk format
When reviewing libxl vif typename series[0] I found a bug
on xen-xm formatter where "virsh domxml-to-native xen-xm file.xml"
can lead to a NULL dereference if the disk driver isn't specified.
Fix this by checking for driver before writing/testing it down.

[0] https://www.redhat.com/archives/libvir-list/2016-April/msg01434.html

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
2016-05-24 19:19:50 -06:00
Laine Stump
002b7704ff lxc: support <interface type='ethernet'>
This is identical to type='bridge', but without the "connect to a
bridge" part, so it can be handled by using the same functions (and
often even the same cases in switch statements), after renaming
virLXCProcessSetupInterfaceBridged() to virLXCProcessInterfaceTap()
and enhancing it to skip bridge-related items when brname == NULL.

To be truly useful, we need to support setting the ip address on the
host side veth as well as guest side veth (already supported for
type='bridge'), as well as setting the peer address for both.

The <script> element (supported by type='ethernet' in qemu) isn't
supported in this patch. An error is logged at domain start time if it
is encountered. This may be changed in a later patch.
2016-05-24 15:21:05 -04:00
Katerina Koukiou
306b3a8504 lxc: completely rework reference counting
This patch follows the pattern used in qemu driver regarding
reference counting.
It changes lxcDomObjFromDomain() to ref the domain (using
virDomainObjListFindByUUIDRef()) and adds virDomainObjEndAPI() which
should be the only function in which the return value of
virObjectUnref() is checked.  This makes all reference counting
deterministic and makes the code a bit clearer.

Signed-off-by: Katerina Koukiou <k.koukiou@gmail.com>
2016-05-24 16:54:01 +02:00
Katerina Koukiou
6ce89dcae0 lxc: use job functions in lxcDomainLxcOpenNamespace & lxcDomainSendProcessSignal
Use the recently added job functions in lxcDomainLxcOpenNamespace,
lxcDomainSendProcessSignal.

Signed-off-by: Katerina Koukiou <k.koukiou@gmail.com>
2016-05-24 16:35:02 +02:00
Pavel Hrdina
750b83137b qemucapstest: update caps for qemu-2.6.0
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-05-24 15:46:03 +02:00
Pavel Hrdina
733b2a9174 qemucapstest: update caps for qemu-2.5.0
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-05-24 15:46:03 +02:00
Pavel Hrdina
b728ede9f2 qemucapstest: update caps for qemu-2.4.0
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-05-24 15:46:03 +02:00
Pavel Hrdina
e1d09e88a0 qemucapstest: update caps for qemu-2.1.1 2016-05-24 15:46:03 +02:00
Pavel Hrdina
233851b4c7 qemucapstest: update caps for qemu-1.6.0
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-05-24 15:46:03 +02:00
Pavel Hrdina
f91284045c qemucapstest: update caps for qemu-1.5.3
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-05-24 15:46:02 +02:00
Pavel Hrdina
5063c49375 qemucapstest: update caps for qemu-1.4.2
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-05-24 15:46:02 +02:00
Pavel Hrdina
6815c9e0eb qemucapstest: update caps for qemu-1.3.1
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-05-24 15:46:02 +02:00
Pavel Hrdina
98e638d655 qemucapstest: update caps for qemu-1.2.2
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-05-24 15:46:02 +02:00
Maxim Nestratov
2f5e24ba00 nwfilter: fix lock order deadlock
Below is backtraces of two deadlocked threads:

thread #1:
 virDomainConfVMNWFilterTeardown
   virNWFilterTeardownFilter
       lock updateMutex <------------
       _virNWFilterTeardownFilter
            try to lock interface <----------

thread #2:
 learnIPAddressThread
    lock interface <-------
    virNWFilterInstantiateFilterLate
        try to lock updateMutex <----------

The problem is fixed by unlocking interface before calling
virNWFilterInstantiateFilterLate to avoid updateMutex and interface ordering
deadlocks. Otherwise we are going to instantiate the filter while holding
interface lock, which will try to lock updateMutex, and if some other thread
instantiating a filter in parallel is holding updateMutex and is trying to
lock interface, both will deadlock.
Also it is safe to unlock interface before virNWFilterInstantiateFilterLate
because learnIPAddressThread stopped capturing packets and applied necessary
rules on the interface, while instantiating a new filter doesn't require a
locked interface.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-05-24 15:24:37 +03:00
Pavel Hrdina
a94efa50e2 maint: fix syntax-check sc_prohibit_int_ijk exclude rule
Fix the regex for excluding files for this syntax-rule.  The rule "include/"
will not work, because we are matching the whole line like this
"^(...|include/|...)$ so we need to use "include/libvirt/libvirt.+".  The second
issue is that we are using only one '$' but there should be two of those at the
end.  The last small adjustment is to escape dots '.' so it match only dot.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-05-24 13:36:11 +02:00
Pavel Hrdina
9db7308502 makefile: fix build on systems where gnutls is not in /usr/include
We need to append GNUTLS_CFLAGS while building utils because virtcrypto
is using it.  This fixes build on freebsd where gnutuls is in
/usr/local/include.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-05-24 13:30:01 +02:00
Pavel Hrdina
9753dd7470 qemuxml2argvtest: skip test that depends on gnutls_cipher_encrypt()
Test disk-drive-network-rbd-auth-AES depends on existence of
gnutls_cipher_encrypt() function which was introduced in gnutls 2.10.0.
On systems without this function we should skip this test.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-05-24 01:01:07 +02:00
Jovanka Gulicoska
580dbf06a4 storage: Replace VIR_ERROR with standard vir*Error in state driver init
Replace VIR_ERROR with virReportError and virReportSystemError
2016-05-23 15:42:46 -04:00
Jovanka Gulicoska
1433c803c9 nwfilter: Replace VIR_ERROR with standard vir*Error in state driver init
Replace VIR_ERROR with virReportError
2016-05-23 15:42:46 -04:00
Jovanka Gulicoska
1223f7b23e libxl: Replace VIR_ERROR with standard vir*Error in state driver init
Replace VIR_ERROR with virReportError
2016-05-23 15:42:46 -04:00
Jovanka Gulicoska
86d1ae0479 bhyve: Replace VIR_ERROR with standard vir*Error in state driver init
Replace VIR_ERROR with virReportError
2016-05-23 15:42:46 -04:00
Laine Stump
9cdac8afc9 qemu: simplify addition of USB controller in qemuParseCommandLine
virDomainDefAddUSBController() does everything that the multiple lines
of code were doing.
2016-05-23 15:26:57 -04:00
Mikhail Feoktistov
4aeb1d5158 vz: add error code for case if vm is already stopped
If try to stop VM or container which is already stopped than
Virtuozzo 7 returns code PRL_ERR_INVALID_ACTION_REQUESTED.
Error code PRL_ERR_DISP_VM_IS_NOT_STARTED is used in Virtuozzo 6
2016-05-23 20:06:17 +03:00
Ján Tomko
d033d4762f Revert "qemu_cgroup: allow access to /dev/dri for virtio-vga"
This reverts commit 3943bdd60c.
2016-05-23 10:48:27 +02:00
Ján Tomko
21fdb4fe70 storage: do not clear vols before volume upload
Commit 5e54361c added virStoragePoolObjClearVols before refreshPool
to prevent duplicate volume entries.

However it is not needed here because we're not refreshing the pool yet,
just checking for the existence of the refresh callback.

The actual refresh is done via virStorageVolFDStreamCloseCb
in virStorageVolPoolRefreshThread, which already calls
virStoragePoolObjClearVols.
2016-05-23 10:47:32 +02:00
Ján Tomko
71cfa668eb Deprecate QEMU_CAPS_PCIDEVICE
Before removal of QEMU_CAPS_DEVICE, its only usage was
or'd with QEMU_CAPS_DEVICE.

Now it's unused.
2016-05-23 10:40:22 +02:00
Ján Tomko
5572cd7f0e Deprecate QEMU_CAPS_DEVICE
We support qemu version 0.12.0+, which has it.
2016-05-23 10:38:45 +02:00
Ján Tomko
e9488fcd20 Deprecate QEMU_CAPS_DRIVE_READONLY
We have been assuming its support if qemu supports -device,
which all the supported versions do.
2016-05-23 10:37:09 +02:00
Ján Tomko
00c9877e77 qemu: always assume QEMU_CAPS_DRIVE_READONLY
We have been always setting the capability on if qemu has
QEMU_CAPS_DEVICE.
2016-05-23 10:35:44 +02:00
Ján Tomko
ec9d19952a tests: always assume QEMU_CAPS_DRIVE_READONLY 2016-05-23 10:34:16 +02:00
Ján Tomko
b88f5f1af9 tests: remove <readonly/> from IDE disks
Read-only IDE disks are not supported, but the error
is raised only when QEMU_CAPS_DRIVE_READONLY is set.
2016-05-23 09:39:40 +02:00
Ján Tomko
1e463880c9 tests: remove disk-drive-fat test
This test requests a read-only virtual FAT drive on the IDE bus.
Read-only IDE drives are unsupported, but libvirt only displays
the error if it has the QEMU_CAPS_DRIVE_READONLY capability.
Read-write FAT drives are also unsupported.
2016-05-23 09:39:40 +02:00
Ján Tomko
5c4b6e8f5f qemu: assume QEMU_CAPS_DEVICE almost everywhere
Remove more checks that are no longer necessary.
2016-05-23 09:39:40 +02:00
Ján Tomko
34ab070c0d qemu_command: assume QEMU_CAPS_DEVICE
Drop some checks that are no longer necessary as well as
-usbdevice -pcidevice and -soundhw support.
2016-05-23 09:39:40 +02:00
Mikhail Feoktistov
33705aeec0 util: fix build without GNUTLS 2016-05-22 08:53:58 +03:00
Cole Robinson
f3d5e255cb tests: qemu: test <address type='pci'/> with aarch64
This is an interesting test case since PCI isn't the default for
aarch64.
2016-05-20 13:54:26 -04:00