The following patchset introduces code to defer setting netdevs online (and therefore registering MACs) until right before beginning guest CPU execution. The first patch introduces some infrastructure changes in preparation of the actual function added in the 2nd patch.
Associated BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1081461 Changes for v2: * Ping for comments, esp. on patch #2. * Moved @flags operand of virNetDevMacVLanCreateWithVPortProfile to the end of the operand list. * Minor changes based on comments by Martin Kletzander. * Added detail to patch #2 commit message. * Martin suggested that I replace various ? operations with if/else statements, but I ended up leaving them alone as they were being used to conditionally assign values to constant fields. * I left the contents of qemu_interface as-is, rather than collapsing them into non-qemu-specific functions, in order to keep Makefile linkage consistent & happy (needs to be part of QEMU_DRIVER_SOURCES). Instead, incorporated copyright suggestions from previous comments. Martin, if you feel strongly about not having these new functions in a qemu-specific part, feel free to comment. Changes since RFC: * Add a separate patch to introduce a flags field for macvlan/macvtap creation. * Use macvlan/tap IFUP flags to skip virNetDevSetOnline (for qemu only). * Add hotplug support. * For macvlan, save the current virNetDevVPortProfileOp in virDomainNetDef during qemuPhysIfaceConnect. As Laine mentioned, could use this field in a future patch to eliminate passing virNetDevVPortProfileOp everywhere. * Add qemu_interface.c and qemu_interface.h to encapsulate new functions. Matthew Rosato (2): util: Introduce flags field for macvtap creation network: Bring netdevs online later src/Makefile.am | 3 +- src/conf/domain_conf.h | 2 ++ src/lxc/lxc_process.c | 6 ++-- src/qemu/qemu_command.c | 12 +++++-- src/qemu/qemu_hotplug.c | 7 ++++ src/qemu/qemu_interface.c | 78 +++++++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_interface.h | 32 ++++++++++++++++++ src/qemu/qemu_process.c | 4 +++ src/util/virnetdevmacvlan.c | 36 ++++++++++++-------- src/util/virnetdevmacvlan.h | 16 ++++++--- 10 files changed, 172 insertions(+), 24 deletions(-) create mode 100644 src/qemu/qemu_interface.c create mode 100644 src/qemu/qemu_interface.h -- 1.7.9.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list