Bug 975359

Summary: libvirtd crash when destroy one guest with floor setting and remove bandwidth setting from network
Product: Red Hat Enterprise Linux 7 Reporter: hongming <honzhang>
Component: libvirtAssignee: Ján Tomko <jtomko>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 7.0CC: acathrow, dyuan, gsun, jtomko, mzhan
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-1.1.0-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 09:43:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
libvirtd debug log none

Description hongming 2013-06-18 08:51:07 UTC
Created attachment 762418 [details]
libvirtd debug log

Description of problem:
When remove the bandwidth settings from network then restart it , destroy one guest with floor attribute ,  libvirtd will crash. 

Version-Release number of selected component (if applicable):
libvirt-1.0.6-1.el7.x86_64
qemu-kvm-1.5.0-2.el7.x86_64
kernel-3.10.0-0.rc4.59.el7.x86_64 

How reproducible:
100%

Steps to Reproduce:
# virsh net-dumpxml default
<network connections='1'>
  <name>default</name>
  <uuid>16965c76-4dc7-40ae-9fb5-201761bca504</uuid>
  <forward mode='nat'>
    <nat>
      <port start='1024' end='65535'/>
    </nat>
  </forward>
  <bridge name='virbr0' stp='on' delay='0' />
  <mac address='52:54:00:af:87:36'/>
  <bandwidth>
    <inbound average='4000' peak='5000' burst='1000'/>
    <outbound average='4000' peak='5000' burst='1000'/>
  </bandwidth>
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.2' end='192.168.122.254' />
    </dhcp>
  </ip>
</network>

# virsh dumpxml rhel7|grep bandwidth -A 5
      <bandwidth>
        <inbound average='1000' peak='1000' floor='200' burst='1024'/>
        <outbound average='128' peak='256' burst='256'/>
      </bandwidth>
     ......

Remove the bandwidth part from network .
# virsh net-edit default
Network default XML configuration edited.

# virsh net-destroy default
Network default destroyed

# virsh net-start default
Network default started


# virsh destroy rhel7
error: Failed to destroy domain rhel7
error: End of file while reading data: Input/output error
error: One or more references were leaked after disconnect from the hypervisor
error: Failed to reconnect to the hypervisor 

Actual results:
libvirtd crash 

Expected results:
Throw exception

Additional info:

Comment 2 Ján Tomko 2013-06-21 17:31:33 UTC
Upstream patch proposed:
https://www.redhat.com/archives/libvir-list/2013-June/msg00917.html

Comment 3 Ján Tomko 2013-06-27 10:17:47 UTC
Now fixed upstream:
commit 658c932ab4aec2222b0ce3840a96748e73b39b3f
Author:     Ján Tomko <jtomko>
AuthorDate: 2013-06-21 19:20:31 +0200
Commit:     Ján Tomko <jtomko>
CommitDate: 2013-06-27 12:11:42 +0200

    bridge: don't crash on bandwidth unplug with no bandwidth
    
    If networkUnplugBandwidth is called on a network which has
    no bandwidth defined, print a warning instead of crashing.
    
    This can happen when destroying a domain with bandwidth if
    bandwidth was removed from the network after the domain was
    started.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=975359

git describe: v1.1.0-rc1-29-g658c932

Comment 4 hongming 2013-07-03 09:28:42 UTC
Verify it as follows. The result is expected. 

# rpm -q libvirt
libvirt-1.1.0-1.el7.x86_64

# virsh net-dumpxml default
<network connections='1'>
  <name>default</name>
  <uuid>16965c76-4dc7-40ae-9fb5-201761bca504</uuid>
  <forward mode='nat'>
    <nat>
      <port start='1024' end='65535'/>
    </nat>
  </forward>
  <bridge name='virbr0' stp='on' delay='0' />
  <mac address='52:54:00:af:87:36'/>
  <bandwidth>
    <inbound average='8000' peak='10000' burst='1024'/>
    <outbound average='8000' peak='10000' burst='1024'/>
  </bandwidth>
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.2' end='192.168.122.254' />
    </dhcp>
  </ip>
</network>

# virsh dumpxml rhel7-1|grep bandwidth -A 2
      <bandwidth>
        <inbound average='2000' peak='2000' floor='2000' burst='1024'/>
        <outbound average='2000' peak='2000' burst='1024'/>
      </bandwidth>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>


# virsh net-edit default
Network default XML configuration edited.

# virsh net-destroy default
Network default destroyed

# virsh net-start default
Network default started

# virsh list
 Id    Name                           State
----------------------------------------------------
 6     rhel7-1                        running

# virsh destroy rhel7-1
Domain rhel7-1 destroyed

# virsh start rhel7-1
error: Failed to start domain rhel7-1
error: Operation not supported: Invalid use of 'floor' on interface with MAC address 52:54:00:3f:f0:2e - network 'default' has no inbound QoS set

Comment 5 Ludek Smid 2014-06-13 09:43:35 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.