Commit Graph

33303 Commits

Author SHA1 Message Date
Jonathon Jongsma
4273a30ecd src/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-19 17:12:30 +02:00
Jonathon Jongsma
b47fccfe70 src/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-19 17:12:30 +02:00
Jonathon Jongsma
bef4af0ea4 src/lxc: 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-19 17:12:30 +02:00
Jonathon Jongsma
91d16fdba0 src/locking: 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-19 17:12:30 +02:00
Ján Tomko
c0dc0e8e23 qemu: delete unused QEMUD_CPUMASK_LEN macro
Unused as of:
commit f136b83139
    qemu: Rework setting process affinity

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2019-06-19 16:48:44 +02:00
Ilias Stamatis
0d8079e913 test_driver: validate @source in testDomainInterfaceAddresses
Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2019-06-19 15:48:50 +02:00
Ilias Stamatis
4a6ee53581 test_driver: implement virDomainSendProcessSignal
Only succeed when @pid_value is 1, since according to the docs this is
the minimum requirement for any driver to implement this API.
Since this is test driver, we assume that any signal from the supported
list can be sent to pid 1 and we therefore succeed every time.

Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2019-06-19 15:13:39 +02:00
Daniel P. Berrangé
fbed24210e remote: remove obsolete & incorrect comment from libvirtd.conf
The libvirtd.conf file has a comment pointing people to format.html
which has nothing todo with the configuration file format.

It also has a comment about tests/daemon-conf which no longer exists,
and even if it did exist such comment is not relevant to end users
when this file is installed in /etc/.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-06-19 14:11:37 +01:00
Christian Ehrhardt
18ffb1670e
apparmor: Add openGraphicsFD rule for named profile
Commit a3ab6d42 changed the libvirtd profile to a named profile
but neglected to accommodate the change in the qemu profile
ptrace and signal rules.
Later on 4ec3cf9a fixed that for ptrace and signal but openGraphicsFD
is still missing.

As a result, libvirtd is unable to open UI on libvirt >=5.1 e.g. with
virt-manager.

Add openGraphicsFD rule that references the libvirtd profile
by name in addition to full binary path.

Fixes: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1833040

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
2019-06-19 14:22:47 +02:00
Daniel P. Berrangé
7c570f06bd network: add virNetworkPortRef API
Normal practice is to provide a Ref API for all objects, but this was
forgotten for the virNetworkPortPtr object.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-06-19 11:21:38 +01:00
Daniel P. Berrangé
ed16d81d6a conf: remove unused class_id variable
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-06-19 09:29:55 +01:00
Daniel P. Berrangé
473d2eba04 conf: add error checking of UUID generation
Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-06-19 08:47:12 +01:00
Daniel P. Berrangé
520f5752be conf: fix NULL deref when exporting ports
Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-06-19 08:47:10 +01:00
Daniel P. Berrangé
cce545ddb6 conf: fix leak of directory handle when loading network ports
Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-06-19 08:47:07 +01:00
Daniel P. Berrangé
0ce813a878 conf: fix leak when parsing network port XML
Use auto free to avoid leaking the "trustGuestRxFilters" strings

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-06-19 08:47:00 +01:00
Yi Li
cdd362e0e7 storage: escape ipv6 for ceph mon hosts to librados
Hosts for rbd are ceph monitor daemons. These have fixed IP addresses,
so they are often referenced by IP rather than hostname for
convenience, or to avoid relying on DNS. Using IPv4 addresses as the
host name works already, but IPv6 addresses require rbd-specific
escaping because the colon is used as an option separator in the
string passed to librados.

Escape these colons, and enclose the IPv6 address in square brackets
so it is distinguished from the port, which is currently mandatory.

Signed-off-by: Yi Li <yili@winhong.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-06-18 17:14:17 +02:00
Ján Tomko
53f3c43ac7 docs: fix some typos in networkport documentation
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2019-06-18 14:35:43 +02:00
Michal Privoznik
9d6c34718b Produce more verbose error if cppi not found
It's fairly easy (especially for new contributors) to not spot
the 'cppi not installed' line in the syntax-check output. Add a
banner that is shown at the end of syntax-check output if no cppi
was found.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
ACKed-by: Andrea Bolognani <abologna@redhat.com>
2019-06-18 08:55:03 +02:00
Michal Privoznik
68e503ee70 virpcitest: Separate two functions properly
There is a missing empty line between two functions since its
introduction in v1.2.0-rc1~150.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2019-06-17 17:47:18 +02:00
Daniel P. Berrangé
fe77197304 conf: switch over to use network port APIs for virt drivers
Change the domain conf so invoke the new network port public APIs instead
of the network callbacks.

Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-06-17 15:45:13 +01:00
Daniel P. Berrangé
90064d76bc conf: record a portid against the domain conf
The portid will be the UUID of the virNetworkPort object associated
with the network interface when a guest is running.

Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-06-17 15:45:09 +01:00
Daniel P. Berrangé
e64a08fba4 lxc, libxl: save domain status after reconnect
The various steps involved in reconnecting to a domain may cause updates
to the virDomainObj struct that need to be reflected in the saved status
file.

Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-06-17 15:44:58 +01:00
Daniel P. Berrangé
729a06c41a lxc, libxl: notify network driver of NICs during reconnect
When starting up it is important to notify the network driver of any
NICs which are used by running guests so that it can account for any
resources they are using.

Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-06-17 15:44:49 +01:00
Daniel P. Berrangé
4a998fb824 network: add implementation of network port APIs
This initial implementation just wires up the APIs and does tracking of
the port XML definitions. It is not yet integrated into the resource
allocation logic.

Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-06-17 15:44:36 +01:00
Daniel P. Berrangé
771b361e5b conf: support recording ports against virNetworkObjPtr
The virNetworkObjPtr state will need to maintain a record of all
virNetworkPortDefPtr objects associated with the network. Record these
in a hash and add APIs for manipulating them.

Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-06-17 15:41:31 +01:00
Daniel P. Berrangé
c2dd9ddf7b virsh: add support for network port APIs
Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-06-17 15:30:36 +01:00
Daniel P. Berrangé
0e2ef3a954 remote: add support for new network port APIs
Define the wire protocol for the virNetworkPort APIs and enable the
client/server RPC dispatch.

Reviewed-by: Laine Stump <laine@laine.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-06-17 15:30:22 +01:00
Daniel P. Berrangé
e69444e179 access: add permissions for network port objects
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é
c08fc8d199 network: add public APIs for network port object
Introduce a new virNetworPort object that will present an attachment to
a virtual network from a VM.

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é
378f03d545 network: introduce networkUpdatePortBandwidth
Separate network port bandwidth update 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é
73c6c4e438 network: introduce networkReleasePort
Separate network port deletion code from the domain driver network
callback implementation.

Reivewed-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é
8ba66562f2 network: introduce networkNotifyPort
Separate network port notification 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é
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