Bug 1122743 - Fails copying a simple interface configuration to a bridge
Fails copying a simple interface configuration to a bridge
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: virt-manager (Show other bugs)
rawhide
x86_64 Unspecified
unspecified Severity medium
: ---
: ---
Assigned To: Cole Robinson
Fedora Extras Quality Assurance
:
: 1124101 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2014-07-23 20:44 EDT by Adam Williamson
Modified: 2015-01-19 06:58 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-09-22 18:05:11 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Adam Williamson 2014-07-23 20:44:47 EDT
Testing virt-manager's ability to copy a simple interface config when setting up a bridge.

I set up a /etc/sysconfig/network-scripts/ifcfg-enp0s25 which looked like this:

DEVICE="enp0s25"
ONBOOT="yes"
BOOTPROTO="dhcp"

reloaded configs in NetworkManger and restarted NetworkManager to be sure NM was using that actual connection profile for the interface. Then I ran virt-manager and tried to create a new bridge, with enp0s25 checked in 'Choose interface(s) to bridge:' and 'IP settings:' set to "Copy configuration from 'enp0s25'" (which is the default after checking enp0s25 in the interface list). Hitting Finish resulted in:

Error creating interface: 'Could not define interface: XML error: could not get interface XML description: XML invalid - Did not expect element ip there'

the backtrace runs through /usr/share/virt-manager/virtManager/asyncjob.py line 91 cb_wrapper callback , /usr/share/virt-manager/virtManager/createinterface.py line 1126 do_install self.interface.install(meter, create=activate) and /usr/share/virt-manager/virtinst/interface.py line 248, install raise RuntimeError().

This is virt-manager 1.0.1-3.fc21.1.noarch, today's Rawhide. What I was actually trying to do was reproduce behaviour on my desktop where copying an existing config that uses DHCP resulted in a bridge config with static addressing (using the IP *currently* assigned by DHCP), but instead I hit this error...
Comment 1 Giuseppe Scrivano 2014-07-24 05:47:04 EDT
I could reproduce it here.  virt-manager generates this XML:

<interface type="bridge" name="br1">
  <bridge stp="on" delay="0.0">
    <interface type="ethernet" name="eth0">
      <protocol family="ipv4">
        <ip address="192.168.125.134" prefix="24"/>
        <ip address="192.168.125.135" prefix="24"/>
      </protocol>
      <protocol family="ipv6">
        <ip address="fe80::5054:ff:fe70:aec7" prefix="64"/>
      </protocol>
      <mac address="52:54:00:70:ae:c7"/>
    </interface>
  </bridge>
  <protocol family="ipv4">
      <ip address="192.168.125.134" prefix="24"/>
      <ip address="192.168.125.135" prefix="24"/>
    </protocol>
  <protocol family="ipv6">
      <ip address="fe80::5054:ff:fe70:aec7" prefix="64"/>
    </protocol>
  <start mode="none"/>
</interface>

The problem seems to be in the two "<ip>" elements under "<protocol>" where there should be only one.
Comment 2 Cole Robinson 2014-07-25 15:03:58 EDT
Giuseppe, thanks for confirming, can you poke at this when you get some time? (not urgent though)
Comment 3 Giuseppe Scrivano 2014-07-25 15:20:19 EDT
sure, I will.  I've tried again few other times while debugging it but I wasn't able to hit it.  I will try harder and try to understand what changed.
Comment 4 Adam Williamson 2014-07-25 15:26:36 EDT
I suppose it might somehow depend on the exact address you got from the router via DHCP?

As I noted at the end, I was actually trying to reproduce a different bug, and I think that bug might be relevant. So, let me try to describe it.

You start with an ethernet adapter (let's call it eth0) which is configured to use DHCP, it does *not* use static addressing. Let's say it's currently assigned IP address 192.168.1.135. You then set up a bridge in virt-manager and pick "Copy configuration from 'eth0'".

What I saw the first time I tried it wasn't this crash, but a different bug. The bridge config was successfully created, but it didn't configure the bridge to use DHCP - it configured the bridge to use 192.168.1.135 statically. That's not what I'd expect when I say to 'copy' the configuration of the adapter.

So assuming that bug actually happens every time, I figure at this point virt-manager is trying to configure the bridge to use the IP address currently assigned to the ethernet adapter (instead of configuring it to use DHCP, which is really what it should do), and somehow in some specific cases it for some reason gets fooled into believing there are *two* IP addresses (note in your XML there's both .134 and .135), then that causes the crash?

I'll have a quick look at the code that copies the config and see if I see anything...
Comment 5 Adam Williamson 2014-07-28 21:03:37 EDT
Reproduced the "DHCP turns into static" bug and filed as https://bugzilla.redhat.com/show_bug.cgi?id=1124101 .
Comment 6 Cole Robinson 2014-09-21 15:03:15 EDT
*** Bug 1124101 has been marked as a duplicate of this bug. ***
Comment 7 Cole Robinson 2014-09-21 15:11:26 EDT
Fixed upstream now:

commit bd0bcba0b5957cdc7547048675d51e27bbcf5f02
Author: Cole Robinson <crobinso@redhat.com>
Date:   Sun Sep 21 15:02:27 2014 -0400

    createinterface: Fix 'copy child protocol' behavior (bug 1122743)
    
    We should only copy the inactive protocol XML, which lists things
    like dhcp, vs the running XML, which is the same format as static
    addressing.
Comment 8 Cole Robinson 2014-09-22 18:05:11 EDT
Fixed in virt-manager-1.1.0-2.git30db9ece2.fc22

Note You need to log in before you can comment on or make changes to this bug.