On 12/06/2015 10:04 AM, Jim Fehlig wrote:
On 12/04/2015 12:45 PM, Joao Martins wrote:
> Commit d2e5538b1 changes virDomainDef to include ifnames
> that autogenerated by libxl, and that are also cleared
> on domain cleanup. One place that's missing is on
> migration, when domain xml is sent to dst libvirtd and
> would contain ifnames from the source libvirtd. This
> would lead to erronous behaviour (as seen in osstest CI)
> such as failing to migrate when a vif with the same name
> existed (belonging to another domain) on destination.
Your patch is certainly one way to fix this issue, but I wonder if we should be
adding the generated ifname to the XML that is sent to the destination.
virDomainNetDefFormat() has this interesting piece of logic
if (def->ifname &&
!((flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE) &&
(STRPREFIX(def->ifname, VIR_NET_GENERATED_PREFIX)))) {
/* Skip auto-generated target names for inactive config. */
virBufferEscapeString(buf, "<target dev='%s'/>\n",
def->ifname);
}
In the Begin phase, we format the XML that will be sent to the destination based
on current vm->def of the machine running on the source. Calling
virDomainDefFormat() with VIR_DOMAIN_DEF_FORMAT_INACTIVE doesn't seem right. I
tried to see how this is handled in the qemu driver, but couldn't quite figure
it out. Jirka is one of the experts of the qemu migration code, adding him to cc
to see if he has any insights.
I think this is actually handled on the destination when parsing the incoming
XML in the Prepare phase. Something like the below patch may be a better solution.
Regards,
Jim