]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: fix netdev alias name assignment wrt type='hostdev'
authorLaine Stump <laine@laine.org>
Fri, 1 Jun 2012 16:50:37 +0000 (12:50 -0400)
committerCole Robinson <crobinso@redhat.com>
Thu, 14 Jun 2012 22:23:21 +0000 (18:23 -0400)
This patch resolves:

   https://bugzilla.redhat.com/show_bug.cgi?id=827519

The problem is that an interface with type='hostdev' will have an
alias of the form "hostdev%d", while the function that looks through
existing netdevs to determine the name to use for a new addition will
fail if there's an existing entry that does not match the form
"net%d".

This is another of the handful of places that need an exception due to
the hybrid nature of <interface type='hostdev'> (which is not exactly
an <interface> or a <hostdev>, but is both at the same time).
(cherry picked from commit 6734ce7bc8ec4da7900080aa17fef20c68d401ef)

src/qemu/qemu_command.c

index 6c404983e57cc057519b1b48ca4905e7b113498d..6f6ef04d8fe1102e7a0cfbadfbee5400cf07a82a 100644 (file)
@@ -542,6 +542,11 @@ qemuAssignDeviceNetAlias(virDomainDefPtr def, virDomainNetDefPtr net, int idx)
         idx = 0;
         for (i = 0 ; i < def->nnets ; i++) {
             int thisidx;
+
+            if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_HOSTDEV) {
+                /* type='hostdev' interfaces have a hostdev%d alias */
+               continue;
+            }
             if ((thisidx = qemuDomainDeviceAliasIndex(&def->nets[i]->info, "net")) < 0) {
                 qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                                 _("Unable to determine device index for network device"));