• L
    conf: fix virDomainNetGetActualDirect*() and BridgeName() · 48aaabd9
    Laine Stump 提交于
    This resolves:
    
       https://bugzilla.redhat.com/show_bug.cgi?id=881480
    
    These three functions:
    
      virDomainNetGetActualBridgeName
      virDomainNetGetActualDirectDev
      virDomainNetGetActualDirectMode
    
    return attributes that are in a union whose contents are interpreted
    differently depending on the actual->type and so they should only
    return non-0 when actual->type is 'bridge' (in the first case) or
    'direct' (in the other two cases, but I had neglected to do that, so
    ...DirectDev() was returning bridge.brname (which happens to share the
    same spot in the union with direct.linkdev) if actual->type was
    'bridge', and ...BridgeName was returning direct.linkdev when
    actual->type was 'direct'.
    
    How does this involve Bug 881480 (which was about the inability to
    switch between two networks that both have "<forward mode='bridge'/>
    <bridge name='xxx'/>"? Whenever the return value of
    virDomainNetGetActualDirectDev() for the new and old network
    definitions doesn't match, qemuDomainChangeNet() requires a "complete
    reconnect" of the device, which qemu currently doesn't
    support. ...DirectDev() *should* have been returning NULL for old and
    new, but was instead returning the old and new bridge names, which
    differ.
    
    (The other two functions weren't causing any behavioral problems in
    virDomainChangeNet(), but their problem and fix was identical, so I
    included them in this same patch).
    (cherry picked from commit 3738cf41)
    48aaabd9
domain_conf.c 484.9 KB