Bug 1442700

Summary: The vm shutdown when restart libvirtd with no-autostart network destroyed
Product: Red Hat Enterprise Linux 7 Reporter: yalzhang <yalzhang>
Component: libvirtAssignee: Laine Stump <laine>
Status: CLOSED ERRATA QA Contact: yalzhang <yalzhang>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.4CC: laine, rbalakri, xuzhang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-3.2.0-4.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-02 00:05:54 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:

Description yalzhang@redhat.com 2017-04-17 07:47:18 UTC
Description of problem:
The vm shutdown when restart libvirtd with no-autostart network destroyed

Version-Release number of selected component (if applicable):
libvirt-3.2.0-2.el7.x86_64
qemu-kvm-rhev-2.8.0-6.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Set the network to persistent and no-autostart.

# virsh net-list --all
 Name                 State      Autostart     Persistent
----------------------------------------------------------
 default              active     no            yes

2. Start a vm connected to this network
# brctl show
bridge name    bridge id        STP enabled    interfaces
virbr0        8000.5254007f6545    yes        virbr0-nic
                            vnet0

3. Destroy the network, then restart libvirtd, the guest will be destroyed.
# virsh net-destroy default
Network default destroyed

# virsh list
 Id    Name                           State
----------------------------------------------------
 2     rhel7.3                        running

# systemctl restart libvirtd.service

# virsh list
 Id    Name                           State
----------------------------------------------------

The log says:
2017-04-13 06:27:56.754+0000: 15043: error : virNetDevGetMTU:422 : Cannot get interface MTU on 'virbr0': No such device
2017-04-13 06:27:56.960+0000: 15043: info : virDBusCall:1558 : DBUS_METHOD_ERROR: 'org.freedesktop.machine1.Manager.TerminateMachine' on '/org/freedesktop/machine1' at 'org.freedesktop.machine1' error org.freedesktop.machine1.NoSuchMachine: No machine 'qemu-2-rhel7.3' known


Actual results:
The vm destroyed when restart libvirtd with no-autostart network destroyed

Expected results:
The vm should be active

Additional info:

Comment 2 Laine Stump 2017-04-17 21:23:39 UTC
We're attempting to reconnect to the network (since we've detected that the guest is no longer connected) but failing to account for the possibility that the network is *still* down. That failure needs to be more graceful (i.e. just stop trying to reconnect rather than completely tearing everything else down).

Comment 3 Laine Stump 2017-04-25 17:24:35 UTC
Patches posted upstream:

https://www.redhat.com/archives/libvir-list/2017-April/msg01184.html

Comment 4 Laine Stump 2017-05-02 15:19:22 UTC
Pushed upstream, will be in libvirt-3.3.0:

commit cb182eb11d3a99adb06e188989899dcd488c43fc
Author: Laine Stump <laine>
Date:   Tue Apr 25 12:20:30 2017 -0400

    qemu: don't kill qemu process on restart if networkNotify fails

commit 7949de960eaba07661c1e0ab6e4aa945db8c1b25
Author: Laine Stump <laine>
Date:   Tue Apr 25 12:26:43 2017 -0400

    network: better log message when network is inactive during reconnect

Comment 7 yalzhang@redhat.com 2017-05-07 07:07:05 UTC
test on libvirt-3.2.0-4.el7.x86_64, the results is as expected, 

1. start a guest and connected to a transient not autostart network. 
# virsh net-list
 Name                 State      Autostart     Persistent
----------------------------------------------------------
 default              active     no            yes

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

# brctl show
bridge name	bridge id		STP enabled	interfaces
virbr0		8000.525400779a74	yes		virbr0-nic
							vnet0

2. destroy the transient network, then restart libvirtd, the guest do not shutdown.
# virsh net-destroy default
Network default destroyed

# systemctl restart libvirtd.service

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

3. check the log file
# cat /var/log/libvirt/libvirtd.log
...
2017-05-07 06:43:40.690+0000: 15029: debug : networkNotifyActualDevice:4688 : Requested operation is not valid: network 'default' is not active
...

Comment 8 errata-xmlrpc 2017-08-02 00:05:54 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://access.redhat.com/errata/RHEA-2017:1846

Comment 9 errata-xmlrpc 2017-08-02 01:30:05 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://access.redhat.com/errata/RHEA-2017:1846