Bug 1408464

Summary: [10.0.z] nova creates an invalid ethernet/bridge interface definition in virsh xml
Product: Red Hat OpenStack Reporter: RHOS Integration <rhos-integ>
Component: openstack-novaAssignee: Artom Lifshitz <alifshit>
Status: CLOSED ERRATA QA Contact: Prasanth Anbalagan <panbalag>
Severity: high Docs Contact:
Priority: high    
Version: 10.0 (Newton)CC: alifshit, awaugama, berrange, dasmith, ddomingo, eglynn, gbarros, jschluet, kchamart, nyechiel, sbauza, sferdjao, sgordon, srevivo, vromanso
Target Milestone: z2Keywords: Regression, Triaged, ZStream
Target Release: 10.0 (Newton)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openstack-nova-14.0.3-5.el7ost Doc Type: Bug Fix
Doc Text:
With this update, XML generated by the Compute service is now fully compatible with libvirt 2.0.0. Instances spawned prior to this update will need to have their XML regenerated through a hard reboot, rebuild, or unshelve operation in order to be compatible.
Story Points: ---
Clone Of:
: 1416881 1416884 1416886 1416887 (view as bug list) Environment:
Last Closed: 2017-02-23 21:15:08 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1412834    
Bug Blocks: 1415954, 1416881, 1416884, 1416886, 1416887, 1422563, 1431252    

Description RHOS Integration 2016-12-23 14:23:13 UTC
Cloned from launchpad bug 1649527.

Description:

Description
===========

https://github.com/openstack/nova/blob/master/nova/virt/libvirt/designer.py#L61
sets the script path of an ethernet interface to ""

https://github.com/openstack/nova/blob/master/nova/virt/libvirt/config.py#L1228
checks script for None. As it is not none but a string it adds an empty 
script path to the ethernet interface definition in the virsh xml

Steps to reproduce
==================

nova generated virsh:

[root@overcloud-novacompute-0 heat-admin]# cat 2.xml |grep tap -A5 -B3
    <interface type='ethernet'>
      <mac address='02:b9:38:d2:ef:bf'/>
      <script path=''/>
      <target dev='tapb938d2ef-bf'/>
      <model type='virtio'/>
      <driver name='qemu'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

XML validation:

[root@overcloud-novacompute-0 heat-admin]# virt-xml-validate 2.xml
Relax-NG validity error : Extra element devices in interleave
2.xml:59: element devices: Relax-NG validity error : Element domain failed to validate content
2.xml fails to validate

removing the <script path=''/> element the xml validation succeeds:

[root@overcloud-novacompute-0 heat-admin]# cat 1.xml |grep tap -A5 -B2
    <interface type='ethernet'>
      <mac address='02:b9:38:d2:ef:bf'/>
      <target dev='tapb938d2ef-bf'/>
      <model type='virtio'/>
      <driver name='qemu'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
[root@overcloud-novacompute-0 heat-admin]# virt-xml-validate 1.xml
1.xml validates

Point is that libvirt <2.0.0 is more tolerant. libvirt 2.0.0 throws a segfault:
 
Dec  9 13:30:32 comp1 kernel: libvirtd[1048]: segfault at 8 ip 00007fc9ff09e1c3 sp 00007fc9edfef1d0 error 4 in libvirt.so.0.2000.0[7fc9fef4b000+352000]
Dec  9 13:30:32 comp1 journal: End of file while reading data: Input/output error
Dec  9 13:30:32 comp1 systemd: libvirtd.service: main process exited, code=killed, status=11/SEGV
Dec  9 13:30:32 comp1 systemd: Unit libvirtd.service entered failed state.
Dec  9 13:30:32 comp1 systemd: libvirtd.service failed.
Dec  9 13:30:32 comp1 systemd: libvirtd.service holdoff time over, scheduling restart.
Dec  9 13:30:32 comp1 systemd: Starting Virtualization daemon...
Dec  9 13:30:32 comp1 systemd: Started Virtualization daemon. 

Expected result
===============
VM can be started
instead of checking for None, config.py should check for an empty string before
adding script path


Actual result
=============
VM doesn't start

Environment
===========
OSP10/Newton, libvirt 2.0.0

Specification URL (additional information):

https://bugs.launchpad.net/nova/+bug/1649527

Comment 1 Stephen Gordon 2016-12-23 14:25:39 UTC
There is some additional context here:

    http://lists.openstack.org/pipermail/openstack-dev/2016-December/109401.html

It seems like there are at least two aspects at play here:

1) Stop Nova generating XML with path=''.

2) Re-mediation for guests that already have this.

Comment 2 Stephen Gordon 2016-12-23 14:29:25 UTC
From upstream conversation this would seem to impact at least the 'ivs', 'iovisor', 'midonet' and 'vrouter' plugins. We also need to ensure we fix not just in-tree but also in os-vif.

Comment 8 Stephen Gordon 2017-02-15 00:07:25 UTC
*** Bug 1422278 has been marked as a duplicate of this bug. ***

Comment 10 Prasanth Anbalagan 2017-02-15 20:12:02 UTC
Verified as follows,

*********
VERSION
*********

[heat-admin@compute-0 ~]$ yum list installed | grep openstack-nova
openstack-nova-api.noarch        1:14.0.3-8.el7ost     @rhos-10.0-signed        
openstack-nova-cert.noarch       1:14.0.3-8.el7ost     @rhos-10.0-signed        
openstack-nova-common.noarch     1:14.0.3-8.el7ost     @rhos-10.0-signed        
openstack-nova-compute.noarch    1:14.0.3-8.el7ost     @rhos-10.0-signed        
openstack-nova-conductor.noarch  1:14.0.3-8.el7ost     @rhos-10.0-signed        
openstack-nova-console.noarch    1:14.0.3-8.el7ost     @rhos-10.0-signed        
openstack-nova-novncproxy.noarch 1:14.0.3-8.el7ost     @rhos-10.0-signed        
openstack-nova-scheduler.noarch  1:14.0.3-8.el7ost     @rhos-10.0-signed        

*****
LOGS
*****

[heat-admin@compute-0 ~]$ sudo virsh list --all
 Id    Name                           State
----------------------------------------------------
 1     instance-00000001              running

[heat-admin@compute-0 ~]$ sudo virsh dumpxml 1
.
..
...
    <interface type='bridge'>
      <mac address='fa:16:3e:31:c7:0b'/>
      <source bridge='qbrba0f5a90-1a'/>
      <target dev='tapba0f5a90-1a'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
...
..
.
[heat-admin@compute-0 ~]$ sudo virsh dumpxml 1 > 1.xml
[heat-admin@compute-0 ~]$ virt-xml-validate 1.xml
1.xml validates

Comment 12 errata-xmlrpc 2017-02-23 21:15:08 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2017-0319.html