Commit Graph

33271 Commits

Author SHA1 Message Date
Daniel P. Berrangé
7475562d5b network: introduce networkAllocatePort
Separate network port allocation code from the domain driver network
callback implementation.

Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-06-17 15:19:54 +01:00
Daniel P. Berrangé
f02e21cb33 network: remove the virDomainNetBandwidthChangeAllowed callback
The current qemu driver code for changing bandwidth on a NIC first asks
the network driver if the change is supported, then changes the
bandwidth on the VIF, and then tells the network driver to update the
bandwidth on the bridge.

This is potentially racing if a parallel API call causes the network
driver to allocate bandwidth on the bridge between the check and the
update phases.

Change the code to just try to apply the network bridge update
immediately and rollback at the end if something failed.

Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-06-17 15:19:54 +01:00
Daniel P. Berrangé
6394cf9768 network: convert hook script to take a network port XML
When (un)plugging an interface into a network, the 'plugged'
and 'unplugged' operations are invoked in the hook script.

The data provided to the script contains the network XML, the
domain XML and the domain interface XML. When we strictly split the
drivers up this will no longer be possible and thus breakage is
unavoidable. The hook scripts are not considered to be covered by the
API guarantee so this is OK.

To avoid existing scripts taking the wrong action, the existing
operations are changed to 'port-created' and 'port-deleted'
instead. These will receive the network XML and the network port
XML.

Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-06-17 15:19:54 +01:00
Daniel P. Berrangé
04ada2f841 network: convert networkReleaseActualDevice to virNetworkPortDef
Convert the virDomainNetDef object into a virNetworkPortDef object
at the start of networkReleaseActualDevice. This largely decouples
the method impl from the domain object type.

Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-06-17 15:19:54 +01:00
Daniel P. Berrangé
116f87e98c network: convert networkNotifyActualDevice to virNetworkPortDef
Convert the virDomainNetDef object into a virNetworkPortDef object
at the start of networkNotifyActualDevice. This largely decouples
the method impl from the domain object type.

Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-06-17 15:19:54 +01:00
Daniel P. Berrangé
6cb0ec48bd network: convert networkAllocateActualDevice to virNetworkPortDef
Convert the virDomainNetDef object into a virNetworkPortDef object
at the start of networkAllocateActualDevice. This largely decouples
the method impl from the domain object type.

Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-06-17 15:19:54 +01:00
Daniel P. Berrangé
200bfd43ba conf: add APIs to convert virDomainNetDef to virNetworkPortDef
Helper APIs are needed to

 - Populate basic virNetworkPortDef from virDomainNetDef
 - Set a virDomainActualNetDef from virNetworkPortDef
 - Populate a full virNetworkPortDef from virDomainActualNetDef

Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-06-17 15:19:54 +01:00
Daniel P. Berrangé
19f9a864ba network: make networkLogAllocation independent of domain conf
Stop passing a virDomainNetDefPtr parameter to networkLogAllocation,
instead just pass in the MAC address. The actual device type is also not
required, since virNetworkForwardIfDefPtr has a type field that can be
used instead.

Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-06-17 15:19:54 +01:00
Daniel P. Berrangé
4b4a981d60 conf: introduce virNetworkPortDefPtr struct and XML support
Introduce a virNetworkPortDefPtr struct to represent the data associated
with a virtual network port. Add APIs for parsing/formatting XML docs
with the data.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-06-17 15:19:54 +01:00
Daniel P. Berrangé
c0c37de2d6 conf: allow bandwidth parsing / formatting to include class ID
The domain conf actual network def stores a <class id='3'/> element
separately from the <bandwidth>. The class ID should really just be
an attribute on the <bandwidth> element. We can't change existing
XML, and this isn't visible to users since it is internal XML only.
When we expose the new network port XML to users though, we should
get the design right.

Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-06-17 15:19:54 +01:00
Ján Tomko
f8a53a0795 docs: storage: document the 'lvm2' disk format oddness
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-17 16:14:24 +02:00
Ján Tomko
2681e13075 docs: storage: type out two
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-17 16:13:41 +02:00
Ján Tomko
6481ed8de6 docs: storage: fix spacing when enumerating volume formats
There was a space missing after 'qcow'.
Delete 'qcow' and 'cow' as examples to make the document
more relevant for the current decade.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-17 16:13:41 +02:00
Ján Tomko
e6d6a56fef tests: qemuMonitorTestAddInvalidCommandResponse: VIR_AUTOFREE
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-17 16:12:57 +02:00
Ján Tomko
3f0713a0b1 tests: qemuMonitorTestAddUnexpectedErrorResponse: VIR_AUTOFREE
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-17 16:12:57 +02:00
Ján Tomko
f6d1e243cc tests: refactor qemuMonitorTestProcessCommandDefaultValidate
Use VIR_AUTO* for cleanup and virBufferCurrentContent instead
of virBufferContentAndReset.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-17 16:12:57 +02:00
Ján Tomko
4659a1985c tests: refactor qemuMonitorTestProcessCommandDefault
Use VIR_AUTOPTR and get rid of the 'ret' variable.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-17 16:12:57 +02:00
Ján Tomko
20d3c483e8 tests: qemuMonitorReportError: use VIR_AUTOFREE
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-17 16:12:57 +02:00
Ján Tomko
6d11c756f2 tests: remove text monitor testing infrastructure
We removed testing for text monitor some time ago, remove
the remains from the test infrastructure.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-17 16:12:57 +02:00
Ján Tomko
fba29dff83 tests: qemuMonitorReportError: use tmp variable properly
There is no obvious benefit in putting the escaped message
back into msg while tmp holds the original message.

Remove the assignment and use 'tmp' directly'.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-17 16:12:57 +02:00
Ján Tomko
87bd437777 tests: qemuMonitorTestAddErrorResponse: use VIR_AUTOFREE
Use VIR_AUTOFREE.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-17 16:12:57 +02:00
Ján Tomko
6806051078 tests: always assume JSON in qemuMonitorTestNew
Now that all the callers call qemuMonitorTestNew with json=true,
remove the argument and always assume JSON.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-17 16:12:57 +02:00
Ján Tomko
92f130a2e1 tests: assume JSON monitor in qemuMonitorTestNewSimple
The only user of the qemuMonitorTestNewSimple macro is using JSON.
Always pass 'true' to qemuMonitorTestNew and remove the 'json'
argument.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-17 16:12:57 +02:00
Daniel P. Berrangé
0c1e035085 nodesuspend: report unsupported if systemd & pm-utils aren't available
When libvirtd is run inside a container it is normal that neither
systemd nor pm-utils will be available. In this case there is no way to
suspend the host, so libvirt should just report the feature unsupported
instead of raising an error.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-06-17 15:02:24 +01:00
Jie Wang
7a232286b9 qemu: Try harder to remove pr-helper object and kill pr-helper process
If libvirt receives DISCONNECTED event and prDaemonRunning is set
to false, and qemuDomainRemoveDiskDevice() is performing in the
meantime, then qemuDomainRemoveDiskDevice() will fail to remove
pr-helper object because prDaemonRunning is false. But removing
that check from qemuHotplugRemoveManagedPR() is not enough,
because after removing the object through monitor the
qemuProcessKillManagedPRDaemon() is called which contains the
same check. Thus the pr-helper process might be left behind.

Signed-off-by: Jie Wang <wangjie88@huawei.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2019-06-14 09:51:10 +02:00
Michal Privoznik
d5c5d61514 virNodeDeviceCapPCIDefFormat: Drop useless space before end of tags
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2019-06-14 09:27:23 +02:00
Jonathon Jongsma
64ac2b7786 src/logging: use #pragma once in headers
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-13 17:05:10 +02:00
Jonathon Jongsma
250721afbb src/libxl: use #pragma once in headers
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-13 17:05:10 +02:00
Jonathon Jongsma
9d239be524 src/libvirt_internal.h: use #pragma once
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-13 17:05:10 +02:00
Jonathon Jongsma
127b79f77f src/internal.h: use #pragma once
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-13 17:05:09 +02:00
Jonathon Jongsma
e31f3df7ca src/interface: use #pragma once in headers
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-13 17:05:09 +02:00
Jonathon Jongsma
07729eedf3 src/hyperv: use #pragma once in headers
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-13 17:05:09 +02:00
Jonathon Jongsma
a037259055 src/esx: use #pragma once in headers
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-13 17:05:09 +02:00
Jonathon Jongsma
d293ff8efc src/datatypes.h: use #pragma once
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-13 17:05:09 +02:00
Jonathon Jongsma
b7779b2938 src/cpu: use #pragma once in headers
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-13 17:05:09 +02:00
Jonathon Jongsma
222e0f0f08 conf: misc: use #pragma once in headers
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-13 17:05:09 +02:00
Jonathon Jongsma
5ef190a4d2 conf: storage: use #pragma once in headers
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-13 17:05:09 +02:00
Jonathon Jongsma
787be820f3 conf: node device: use #pragma once in headers
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-13 17:05:09 +02:00
Jonathon Jongsma
44dc50ec23 conf: nwfilter: use #pragma once in headers
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-13 17:05:09 +02:00
Jonathon Jongsma
54c5224e75 conf: network: use #pragma once in headers
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-13 17:05:09 +02:00
Jonathon Jongsma
b268e87319 conf: domain: use #pragma once in headers
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-13 17:05:08 +02:00
Jonathon Jongsma
b7356e826c src/bhyve: use #pragma once in headers
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-13 17:05:08 +02:00
Jonathon Jongsma
99527e9e0c src/admin: use #pragma once in headers
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-13 17:05:08 +02:00
Jonathon Jongsma
bed1143ff5 src/access: use #pragma once in headers
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-13 17:05:08 +02:00
Jonathon Jongsma
e97f8228b9 Use #pragma once in driver headers
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-13 17:05:08 +02:00
Peter Krempa
e6635c626a qemu: domain: Log some useful data in qemuDomainStorageSourceAccessModify
Log the flags passed to the function in a exploded state so that it's
easily visible what's happening to the image.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-06-13 09:43:02 +02:00
Andrea Bolognani
73cfc36211 tests: Include LDADDS in qemu_LDADDS
At this point, all test programs that use qemu_LDADDS also
use LDADDS, so we can remove a bunch of repetition by simply
including the latter in the former.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2019-06-12 20:31:23 +02:00
Andrea Bolognani
6b8048b48d tests: Tweak vircapstest_LDADD
We optionally include QEMU and LXC support in this test and
depending on which is enabled (if either is enabled at all) we
need to link in different objects.

Right now we implicitly depend on the fact that qemu_LDADDS is
empty when QEMU is not enabled to get the correct set of objects,
but it's better to be explicit about it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2019-06-12 20:31:18 +02:00
Andrea Bolognani
74d8909f76 tests: Tweak cputest_LDADDS
We want all test programs using qemu_LDADDS to also use LDADDS,
and cputest is the only existing exception.

We can't just replace GNULIB_LIBS with LDADDS though, even though
the latter is a superset of the former, because that would result
in a linking error due to including the same object twice:

  /usr/bin/ld:
  ../src/libvirt_probes.o:.../src/libvirt_probes.o.dtrace-temp.c:141:
  multiple definition of `libvirt_object_new_semaphore';
  ../src/libvirt_probes.o:.../src/libvirt_probes.o.dtrace-temp.c:141:
  first defined here

To work around this, we include both qemu_LDADDS and LDADDS when
QEMU support is enabled, and just LDADDS otherwise.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2019-06-12 20:30:46 +02:00
Ilias Stamatis
072390cbf0 test_driver: Implement virDomainGetLaunchSecurityInfo
Since the behaviour of launch security is heavily dependent on 3rd party
vendors (e.g. AMD SEV) where the data returned can be essentially
anything, the most reasonable approach here in the test driver is not to
try return any data.

Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-06-12 12:37:03 +02:00