Bug 1344552 - Can't run virsh iface-edit on bonded NICs: internal error: could not get interface XML description: unspecified error
Summary: Can't run virsh iface-edit on bonded NICs: internal error: could not get int...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-06-10 02:47 UTC by redhat2@jeo.net
Modified: 2016-06-10 23:37 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-06-10 23:37:03 UTC
Embargoed:


Attachments (Terms of Use)

Description redhat2@jeo.net 2016-06-10 02:47:42 UTC
Description of problem: Bonded two NICs and can't work with bond0 via virsh. 

Version-Release number of selected component (if applicable):
$ virsh -V
Virsh command line tool of libvirt 1.3.1
See web site at http://libvirt.org/

Compiled with support for:
 Hypervisors: QEMU/KVM LXC UML Xen LibXL OpenVZ VMWare VirtualBox ESX Test
 Networking: Remote Network Bridging Interface netcf Nwfilter VirtualPort
 Storage: Dir Disk Filesystem SCSI Multipath iSCSI LVM RBD Sheepdog ZFS
 Miscellaneous: Daemon Nodedev AppArmor Secrets Debug Readline Modular


How reproducible: 100%


Steps to Reproduce:
1. Bond two NIC 
2. Run "virsh iface-edit bond0"
3. Get error: error: internal error: could not get interface XML description: unspecified error


Actual results:
Get error: error: internal error: could not get interface XML description: unspecified error


Expected results: 
Go into vim to edit XML


Additional info:
$ virsh --debug=0 iface-edit bond0
iface-edit: interface(optdata): bond0
iface-edit: found option <interface>: bond0
iface-edit: <interface> trying as interface NAME
error: internal error: could not get interface XML description: unspecified error

------------------------------------------------------------

$ virsh iface-dumpxml bond0
<interface type='bond' name='bond0'>
  <protocol family='ipv4'>
    <ip address='192.168.1.16' prefix='24'/>
  </protocol>
  <protocol family='ipv6'>
    <ip address='REDACTED:1bf5' prefix='64'/>
  </protocol>
  <link speed='2000' state='up'/>
  <bond>
    <interface type='ethernet' name='eno1'>
      <link speed='1000' state='up'/>
      <mac address='REDACTED:1b:f5'/>
    </interface>
    <interface type='ethernet' name='eno2'>
      <link speed='1000' state='up'/>
      <mac address='REDACTED:1b:f5'/>
    </interface>
  </bond>
</interface>


------------------------------------------------------------

$ more /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eno1
allow-bond eno1
iface eno1 inet manual
bond-master bond0

auto eno2
allow-bond eno2
iface eno2 inet manual
bond-master bond0

auto bond0
iface bond0 inet static
address 192.168.1.16
gateway 192.168.1.1
netmask 255.255.255.0
bond-mode 4
bond-miimon 100
bond-lacp-rate 1
bond-slaves eno1 eno2
pre-up (sleep 1 && ifup eno1) & 
pre-up (sleep 1 && ifup eno2) & 

------------------------------------------------------------
$ virsh iface-dumpxml eno1
<interface type='ethernet' name='eno1'>
  <link speed='1000' state='up'/>
  <mac address='REDACTED:1b:f5'/>
</interface>
------------------------------------------------------------

$ virsh iface-dumpxml eno2
<interface type='ethernet' name='eno2'>
  <link speed='1000' state='up'/>
  <mac address='REDACTED:1b:f5'/>
</interface>

-------------------------------------------------------------

Notes: 
* Mac addresses on eno1=eno2=bond0

* I can run "virsh iface-dumpxml bond0" (see above)

* This affects the Virtual Machine Manager GUI so you can't edit network config that way either.

Comment 1 redhat2@jeo.net 2016-06-10 10:58:35 UTC
Additional things tried: 

* Removing all comments from /etc/network/interfaces

(did not work)

* Running the following: s
$virsh iface-dumpxml bond0 > /tmp/bond0.xml
$virsh iface-define /tmp/bond0.xml

Got errors:
   error: Failed to define interface from /tmp/bond0.xml
   error: XML error: could not get interface XML description: XML invalid - Expecting an element start, got nothing

Comment 2 Laine Stump 2016-06-10 13:39:44 UTC
Unfortunately, even the author of the debian/ubuntu port of the netcf library (which is what handles the backend of this) doesn't regularly use debian or ubuntu. You may get a better response if you file a bug against the netcf package in the ubuntu bug system (launchpad.net).

In the meantime, you might get better info about the error by saving the output of "ncftool dumpxml bond0 >/tmp/bond0.xml && ncftool define /tmp/bond0.xml". If this is successful, then rry editing /tmp/bond0.xml followed by "ncftool define /tmp/bond0.xml" again - this is essentially what is happening when you run virsh iface-edit.

Comment 3 redhat2@jeo.net 2016-06-10 15:26:39 UTC
Thanks - ncftool was not installed, so I'm guessing something else was being called or some other underlying error? 

Installing ncftool made no difference in virsh errors or functionality. 

Running ncftool gave the following error: 

ncftool> dumpxml bond0
error: unspecified error

Since this also affects netcf, I opened a ticket against the netcf package in the ubuntu bug system. https://bugs.launchpad.net/canonical-devices-system-image/+bug/1591249 

Thanks again.

Comment 4 Laine Stump 2016-06-10 16:06:40 UTC
ncftool is a commandline utility that is usually packaged separately from the netcf library and often not installed by default (e.g. "netcf-libs" for the libraries that libvirt uses, and "netcf" for the commandline utility).

The difference between "virsh iface-dumpxml bond0" and "ncftool dumpxml bond0" is that the former shows the *state* of the interface, while the latter shows what is in its config. I'm guessing that "ncftool dumpxml --live" would be successful (and that "virsh iface-dumpxml bond0 --inactive" would fail).

So it appears that the debian/ubuntu backend is not correctly parsing the interfaces file in the case of bonds (at least not in the axact format you have them) and that it's returning an error code without a corresponding log message set.

Comment 5 redhat2@jeo.net 2016-06-10 16:59:28 UTC
>  it appears that the debian/ubuntu backend is not correctly parsing the interfaces file in the case of bonds (at least not in the axact format you have them) and that it's returning an error code without a corresponding log message set.

I think you are correct: 

I got ncftool to give a very similar dump to virsh's with --live

ncftool> dumpxml --live bond0
<?xml version="1.0"?>
<interface name="bond0" type="bond">
  <link state="up" speed="2000"/>
  <bond>
    <interface name="eno1" type="ethernet">
      <link state="up" speed="1000"/>
      <mac address="REDACTED:1b:f4"/>
    </interface>
    <interface name="eno2" type="ethernet">
      <link state="up" speed="1000"/>
      <mac address="REDACTED:1b:f4"/>yy
    </interface>
  </bond>
  <protocol family="ipv4">
    <ip address="192.168.1.16" prefix="24"/>
  </protocol>
  <protocol family="ipv6">
    <ip address="REDACTED:1bf4" prefix="64"/>
  </protocol>
</interface>


The only differences being:
 * single vs double quotes
 * a prepending of "<?xml version="1.0"?>"
 * order of xml elements

None of that should make a difference. 

-----------
Running
$ncftool dumpxml --live bond0 > /tmp/bond0.xml
$ncftool define /tmp/bond0.xml 
error: XML invalid
error: Expecting an element start, got nothing
----------------------

So yes - there's something in the backend which is bombing out on the processing of the XML. I guess you can close this ticket against libvirt as there's something deeper that's the cause. 

Thanks again!


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