mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
282d135ddbb7203565cd5527b451469b14953994
Back when macvtap support was added in commit315baab944in Feb. 2010 (libvirt-0.7.7), it was setup to autogenerate a name for the device if one wasn't supplied, in the pattern "macvtap%d" (or "macvlan%d"), similar to the way an unspecified standard tap device name will lead to an autogenerated "vnet%d". As a matter of fact, in commitca1b7cc8e4added in May 2010, the code was changed to *always* ignore a supplied device name for macvtap interfaces by deleting *any* name immediately during the <interface> parsing (this was intended to prevent one domain which had failed to completely start from deleting the macvtap device of another domain which had subsequently been provided the same device name (this will seem mildly ironic later). This was later fixed to only clear the device name when inactive XML was being parsed. HOWEVER - this was only done if the xml was <interface type='direct'> - autogenerated names were not cleared for <interface type='network'> (which could also result in a macvtap device). Although the names of "vnetX" tap devices had always been automatically cleared when parsing <interface> (see commitd1304583dfrom July 2008 (!)), at the time macvtap support was added, both vnetX and macvtapX device names were always included when formatting the XML. Then in commita8be259d0c(July 2011, libvirt-0.9.4), <interface> formatting was changed to also clear out "vnetX" device names during XML formatting as well. However the same treatment wasn't given to "macvtapX". Now in 2020, there has been a report that a failed migration leads to the macvtap device of some other unrelated guest on the destination host losing its network connectivity. It was determined that this was due to the domain XML in the migration containing a macvtap device name, e.g. "macvtap0", that was already in use by the other guest on the destination. Normally this wouldn't be a problem, because libvirt would see that the device was already in use, and then find a different unused name. But in this case, other external problems were causing the migration to fail prior to selecting a macvtap device and successfully opening it, and during error recovery, qemuProcessStop() was called, which went through all def->nets objects and (if they were macvtap) deleted the device specified in net->ifname; since libvirt hadn't gotten to the point of replacing the incoming "macvtap0" with the name of a device it actually created for this guest, that meant that "macvtap0" was deleted, *even though it was currently in use by a different guest*! Whew! So, it turns out that when formatting "migratable" XML, "vnetX" devices are omitted, just as when formatting "inactive" XML. By making the code in both interface parsing and formatting consistent for "vnetX", "macvtapX", and "macvlanX", we can thus make sure that the autogenerated (and unneeded / completely *not* wanted) macvtap device name will not be sent with the migration XML. This way when a migration fails, net->ifname will be NULL, and libvirt won't have any device to try and (erroneously) delete. Signed-off-by: Laine Stump <laine@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
.. image:: https://gitlab.com/libvirt/libvirt/badges/master/pipeline.svg
:target: https://gitlab.com/libvirt/libvirt/pipelines
:alt: GitLab CI Build Status
.. image:: https://bestpractices.coreinfrastructure.org/projects/355/badge
:target: https://bestpractices.coreinfrastructure.org/projects/355
:alt: CII Best Practices
.. image:: https://translate.fedoraproject.org/widgets/libvirt/-/libvirt/svg-badge.svg
:target: https://translate.fedoraproject.org/engage/libvirt/
:alt: Translation status
==============================
Libvirt API for virtualization
==============================
Libvirt provides a portable, long term stable C API for managing the
virtualization technologies provided by many operating systems. It
includes support for QEMU, KVM, Xen, LXC, bhyve, Virtuozzo, VMware
vCenter and ESX, VMware Desktop, Hyper-V, VirtualBox and the POWER
Hypervisor.
For some of these hypervisors, it provides a stateful management
daemon which runs on the virtualization host allowing access to the
API both by non-privileged local users and remote users.
Layered packages provide bindings of the libvirt C API into other
languages including Python, Perl, PHP, Go, Java, OCaml, as well as
mappings into object systems such as GObject, CIM and SNMP.
Further information about the libvirt project can be found on the
website:
https://libvirt.org
License
=======
The libvirt C API is distributed under the terms of GNU Lesser General
Public License, version 2.1 (or later). Some parts of the code that are
not part of the C library may have the more restrictive GNU General
Public License, version 2.0 (or later). See the files ``COPYING.LESSER``
and ``COPYING`` for full license terms & conditions.
Installation
============
Instructions on building and installing libvirt can be found on the website:
https://libvirt.org/compiling.html
Contributing
============
The libvirt project welcomes contributions in many ways. For most components
the best way to contribute is to send patches to the primary development
mailing list. Further guidance on this can be found on the website:
https://libvirt.org/contribute.html
Contact
=======
The libvirt project has two primary mailing lists:
* libvirt-users@redhat.com (**for user discussions**)
* libvir-list@redhat.com (**for development only**)
Further details on contacting the project are available on the website:
https://libvirt.org/contact.html
Description
Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt
Languages
C
94.8%
Python
2%
Meson
0.9%
Shell
0.8%
Dockerfile
0.6%
Other
0.8%