libvirt/src/conf
Laine Stump 77f72a8615 conf: new "managed" attribute for target dev of <interface type='ethernet'>
Although <interface type='ethernet'> has always been able to use an
existing tap device, this is just a coincidence due to the fact that
the same ioctl is used to create a new tap device or get a handle to
an existing device.

Even then, once we have the handle to the device, we still insist on
doing extra setup to it (setting the MAC address and IFF_UP).  That
*might* be okay if libvirtd is running as a privileged process, but if
libvirtd is running as an unprivileged user, those attempted
modifications to the tap device will fail (yes, even if the tap is set
to be owned by the user running libvirtd). We could avoid this if we
knew that the device already existed, but as stated above, an existing
device and new device are both accessed in the same manner, and
anyway, we need to preserve existing behavior for those who are
already using pre-existing devices with privileged libvirtd (and
allowing/expecting libvirt to configure the pre-existing device).

In order to cleanly support the idea of using a pre-existing and
pre-configured tap device, this patch introduces a new optional
attribute "managed" for the interface <target> element. This
attribute is only valid for <interface type='ethernet'> (since all
other interface types have mandatory config that doesn't apply in the
case where we expect the tap device to be setup before we
get it). The syntax would look something like this:

   <interface type='ethernet'>
      <target dev='mytap0' managed='no'/>
      ...
   </interface>

This patch just adds managed to the grammar and parser for <target>,
but has no functionality behind it.

(NB: when managed='no' (the default when not specified is 'yes'), the
target dev is always a name explicitly provided, so we don't
auto-remove it from the config just because it starts with "vnet"
(VIR_NET_GENERATED_TAP_PREFIX); this makes it possible to use the
same pattern of names that libvirt itself uses when it automatically
creates the tap devices.)

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2019-09-09 14:35:54 -04:00
..
capabilities.c Always put _LAST enums on second line of VIR_ENUM_IMPL 2019-04-11 12:47:23 -04:00
capabilities.h conf: domain: use generic XML namespace types 2019-08-21 10:29:20 +02:00
checkpoint_conf.c maint: Improve use of configmake.h on mingw 2019-08-19 17:04:05 -05:00
checkpoint_conf.h qemu: Pass correct qemuCaps to virDomainDefParseNode 2019-08-09 13:55:54 +02:00
cpu_conf.c conf: Introduce virCPUDefCheckFeatures 2019-06-20 14:02:36 +02:00
cpu_conf.h conf: Introduce virCPUDefCheckFeatures 2019-06-20 14:02:36 +02:00
device_conf.c lib: Format PCI address differently 2019-08-05 19:42:15 +02:00
device_conf.h device-conf: removed unneeded virDomainDeviceInfoCopy() 2019-06-26 09:24:09 +02:00
domain_addr.c lib: Format PCI address differently 2019-08-05 19:42:15 +02:00
domain_addr.h conf: domain: use #pragma once in headers 2019-06-13 17:05:08 +02:00
domain_audit.c lib: Unify PCI address formatting 2019-08-05 19:42:15 +02:00
domain_audit.h conf: domain: use #pragma once in headers 2019-06-13 17:05:08 +02:00
domain_capabilities.c qemu: Move rng model validation to domcaps 2019-08-06 19:45:50 -04:00
domain_capabilities.h qemu: Move rng model validation to domcaps 2019-08-06 19:45:50 -04:00
domain_conf.c conf: new "managed" attribute for target dev of <interface type='ethernet'> 2019-09-09 14:35:54 -04:00
domain_conf.h conf: new "managed" attribute for target dev of <interface type='ethernet'> 2019-09-09 14:35:54 -04:00
domain_event.c Require a semicolon for VIR_ONCE_GLOBAL_INIT calls 2019-02-03 17:46:29 -05:00
domain_event.h conf: domain: use #pragma once in headers 2019-06-13 17:05:08 +02:00
domain_nwfilter.c Remove all Author(s): lines from source file headers 2018-12-13 16:08:38 +00:00
domain_nwfilter.h conf: domain: use #pragma once in headers 2019-06-13 17:05:08 +02:00
interface_conf.c Require a semicolon for VIR_ENUM_IMPL calls 2019-02-03 17:46:29 -05:00
interface_conf.h conf: misc: use #pragma once in headers 2019-06-13 17:05:09 +02:00
Makefile.inc.am backup: Allow for lists of checkpoint objects 2019-07-26 16:48:58 -05:00
moment_conf.c snapshot: Make virDomainSnapshotDef a virObject 2019-05-09 10:02:53 -05:00
moment_conf.h conf: misc: use #pragma once in headers 2019-06-13 17:05:09 +02:00
netdev_bandwidth_conf.c conf: allow bandwidth parsing / formatting to include class ID 2019-06-17 15:19:54 +01:00
netdev_bandwidth_conf.h conf: allow bandwidth parsing / formatting to include class ID 2019-06-17 15:19:54 +01:00
netdev_vlan_conf.c Always put _LAST enums on second line of VIR_ENUM_IMPL 2019-04-11 12:47:23 -04:00
netdev_vlan_conf.h conf: network: use #pragma once in headers 2019-06-13 17:05:09 +02:00
netdev_vport_profile_conf.c Remove all Author(s): lines from source file headers 2018-12-13 16:08:38 +00:00
netdev_vport_profile_conf.h conf: network: use #pragma once in headers 2019-06-13 17:05:09 +02:00
network_conf.c conf: network: use virXMLNamespaceRegister 2019-08-21 10:29:21 +02:00
network_conf.h conf: network: use generic XML namespace types 2019-08-21 10:29:20 +02:00
network_event.c Require a semicolon for VIR_ONCE_GLOBAL_INIT calls 2019-02-03 17:46:29 -05:00
network_event.h conf: network: use #pragma once in headers 2019-06-13 17:05:09 +02:00
networkcommon_conf.c Remove all Author(s): lines from source file headers 2018-12-13 16:08:38 +00:00
networkcommon_conf.h conf: network: use #pragma once in headers 2019-06-13 17:05:09 +02:00
node_device_conf.c lib: Format PCI address differently 2019-08-05 19:42:15 +02:00
node_device_conf.h conf: node device: use #pragma once in headers 2019-06-13 17:05:09 +02:00
node_device_event.c Require a semicolon for VIR_ONCE_GLOBAL_INIT calls 2019-02-03 17:46:29 -05:00
node_device_event.h conf: node device: use #pragma once in headers 2019-06-13 17:05:09 +02:00
node_device_util.c util: Don't include 'viralloc.h' into other header files 2019-04-10 09:12:04 +02:00
node_device_util.h conf: node device: use #pragma once in headers 2019-06-13 17:05:09 +02:00
numa_conf.c Always put _LAST enums on second line of VIR_ENUM_IMPL 2019-04-11 12:47:23 -04:00
numa_conf.h conf: misc: use #pragma once in headers 2019-06-13 17:05:09 +02:00
nwfilter_conf.c Always put _LAST enums on second line of VIR_ENUM_IMPL 2019-04-11 12:47:23 -04:00
nwfilter_conf.h conf: nwfilter: use #pragma once in headers 2019-06-13 17:05:09 +02:00
nwfilter_ipaddrmap.c Remove all Author(s): lines from source file headers 2018-12-13 16:08:38 +00:00
nwfilter_ipaddrmap.h conf: nwfilter: use #pragma once in headers 2019-06-13 17:05:09 +02:00
nwfilter_params.c Remove all Author(s): lines from source file headers 2018-12-13 16:08:38 +00:00
nwfilter_params.h conf: nwfilter: use #pragma once in headers 2019-06-13 17:05:09 +02:00
object_event_private.h conf: misc: use #pragma once in headers 2019-06-13 17:05:09 +02:00
object_event.c Require a semicolon for VIR_ONCE_GLOBAL_INIT calls 2019-02-03 17:46:29 -05:00
object_event.h conf: misc: use #pragma once in headers 2019-06-13 17:05:09 +02:00
secret_conf.c secret: Add support for usage type vTPM, extend schema and test case 2019-07-26 09:59:27 +01:00
secret_conf.h conf: misc: use #pragma once in headers 2019-06-13 17:05:09 +02:00
secret_event.c Require a semicolon for VIR_ONCE_GLOBAL_INIT calls 2019-02-03 17:46:29 -05:00
secret_event.h conf: misc: use #pragma once in headers 2019-06-13 17:05:09 +02:00
snapshot_conf_priv.h conf: snapshot: Provide a function to free virDomainSnapshotDiskDefPtr 2019-07-18 17:59:34 +02:00
snapshot_conf.c qemu: Pass correct qemuCaps to virDomainDefParseNode 2019-08-09 13:55:54 +02:00
snapshot_conf.h qemu: Pass correct qemuCaps to virDomainDefParseNode 2019-08-09 13:55:54 +02:00
storage_adapter_conf.c conf: make virPCIDeviceAddressFormat void 2019-02-19 15:59:38 +00:00
storage_adapter_conf.h conf: storage: use #pragma once in headers 2019-06-13 17:05:09 +02:00
storage_capabilities.c conf: Add storage pool capability formatting 2019-03-06 11:12:48 -05:00
storage_capabilities.h conf: storage: use #pragma once in headers 2019-06-13 17:05:09 +02:00
storage_conf.c conf: storage: use virXMLNamespaceRegister 2019-08-21 10:29:21 +02:00
storage_conf.h conf: storage: use generic XML namespace types 2019-08-21 10:29:20 +02:00
storage_event.c Require a semicolon for VIR_ONCE_GLOBAL_INIT calls 2019-02-03 17:46:29 -05:00
storage_event.h conf: storage: use #pragma once in headers 2019-06-13 17:05:09 +02:00
virchrdev.c Remove all Author(s): lines from source file headers 2018-12-13 16:08:38 +00:00
virchrdev.h conf: misc: use #pragma once in headers 2019-06-13 17:05:09 +02:00
virconftypes.h conf: domain: use generic XML namespace types 2019-08-21 10:29:20 +02:00
virdomaincheckpointobjlist.c backup: Allow for lists of checkpoint objects 2019-07-26 16:48:58 -05:00
virdomaincheckpointobjlist.h backup: Allow for lists of checkpoint objects 2019-07-26 16:48:58 -05:00
virdomainmomentobjlist.c backup: Allow for lists of checkpoint objects 2019-07-26 16:48:58 -05:00
virdomainmomentobjlist.h backup: Allow for lists of checkpoint objects 2019-07-26 16:48:58 -05:00
virdomainobjlist.c lib: Grab write lock when modifying list of domains 2019-09-07 08:22:30 +02:00
virdomainobjlist.h lib: Grab write lock when modifying list of domains 2019-09-07 08:22:30 +02:00
virdomainsnapshotobjlist.c snapshot: Don't leak moment obj list metaroot to callers 2019-07-24 17:03:34 -05:00
virdomainsnapshotobjlist.h snapshot: Don't leak moment obj list metaroot to callers 2019-07-24 17:03:34 -05:00
virinterfaceobj.c Require a semicolon for VIR_ONCE_GLOBAL_INIT calls 2019-02-03 17:46:29 -05:00
virinterfaceobj.h conf: misc: use #pragma once in headers 2019-06-13 17:05:09 +02:00
virnetworkobj.c conf: Add network xmlopt argument 2019-07-17 17:18:56 -04:00
virnetworkobj.h conf: Add network xmlopt argument 2019-07-17 17:18:56 -04:00
virnetworkportdef.c conf: remove unused class_id variable 2019-06-19 09:29:55 +01:00
virnetworkportdef.h conf: introduce virNetworkPortDefPtr struct and XML support 2019-06-17 15:19:54 +01:00
virnodedeviceobj.c Require a semicolon for VIR_ONCE_GLOBAL_INIT calls 2019-02-03 17:46:29 -05:00
virnodedeviceobj.h nodedev: acquire a pidfile in the driver root directory 2019-07-11 12:46:20 +01:00
virnwfilterbindingdef.c conf: add support for parsing/formatting virNWFilterBindingDefPtr 2018-06-26 11:22:07 +01:00
virnwfilterbindingdef.h conf: nwfilter: use #pragma once in headers 2019-06-13 17:05:09 +02:00
virnwfilterbindingobj.c Revert "Include unistd.h directly by files using it" 2019-04-10 12:26:32 +02:00
virnwfilterbindingobj.h conf: nwfilter: use #pragma once in headers 2019-06-13 17:05:09 +02:00
virnwfilterbindingobjlist.c virNWFilterBindingObjListAddLocked: Produce better error message than 'Duplicate key' 2019-04-04 09:16:24 +02:00
virnwfilterbindingobjlist.h conf: nwfilter: use #pragma once in headers 2019-06-13 17:05:09 +02:00
virnwfilterobj.c util: Rename virFileStripSuffix() to virStringStripSuffix() 2019-03-07 10:10:43 +01:00
virnwfilterobj.h nwfilter: acquire a pidfile in the driver root directory 2019-07-11 12:46:20 +01:00
virsavecookie.c use virXMLNodeNameEqual instead of xmlStrEqual 2017-08-14 14:31:52 +02:00
virsavecookie.h conf: misc: use #pragma once in headers 2019-06-13 17:05:09 +02:00
virsecretobj.c Use virStringHasSuffix() where possible 2019-03-07 10:10:49 +01:00
virsecretobj.h conf: misc: use #pragma once in headers 2019-06-13 17:05:09 +02:00
virstorageobj.c storage_driver: Protect pool def during startup and build 2019-08-23 09:32:26 +02:00
virstorageobj.h storage_driver: Protect pool def during startup and build 2019-08-23 09:32:26 +02:00