Bug 1495474

Summary: Fail to quit source qemu when do live migration after mirroring guest to NBD server [rhel-7.4.z]
Product: Red Hat Enterprise Linux 7 Reporter: Oneata Mircea Teodor <toneata>
Component: qemu-kvm-rhevAssignee: Eric Blake <eblake>
Status: CLOSED ERRATA QA Contact: Longxiang Lyu <lolyu>
Severity: high Docs Contact:
Priority: high    
Version: 7.4CC: aliang, chayang, coli, dgilbert, eblake, famz, jsuchane, juzhang, knoel, lbopf, lolyu, michen, mtessun, ppandit, qzhang, shuang, stefanha, virt-maint
Target Milestone: rcKeywords: Regression, ZStream
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: qemu-kvm-rhev-2.9.0-16.el7_4.9 Doc Type: Bug Fix
Doc Text:
Improvements made for qemu 2.9 to the NBD code used during live storage migration were not robust to an abrupt exit of the other end of the connection; the result was that live migration could fail if the source side NBD connection failed. The NBD code has been fixed to be more robust regardless of what the other side of the connection does.
Story Points: ---
Clone Of: 1482478 Environment:
Last Closed: 2017-11-30 20:34:33 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: 1482478    
Bug Blocks:    

Description Oneata Mircea Teodor 2017-09-26 07:00:19 UTC
This bug has been copied from bug #1482478 and has been proposed to be backported to 7.4 z-stream (EUS).

Comment 5 Miroslav Rezanina 2017-10-09 10:28:25 UTC
Fix included in qemu-kvm-rhev-2.9.0-16.el7_4.9

Comment 6 Longxiang Lyu 2017-10-10 02:23:46 UTC
Bug is verified pass for qemu-kvm-rhev-2.9.0-16.el7_4.9

Steps for verification:
1. boot guest on src
#!/bin/bash
/usr/libexec/qemu-kvm \
-name guest=test-virt \
-machine pc,usb=off,vmport=off,dump-guest-core=off \
-cpu SandyBridge \
-m 2G \
-smp 4,sockets=4,cores=1,threads=1 \
-boot strict=on \
-drive file=/home/test/nbd01/test.qcow2,if=none,cache=none,snapshot=off,format=qcow2,id=img0 \
-device virtio-blk-pci,bus=pci.0,addr=0x7,drive=img0,id=virtio-disk0,bootindex=1 \
-netdev tap,id=hostnet0,vhost=on \
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:12:b3:20:61,bus=pci.0,addr=0x3 \
-device VGA \
-usbdevice tablet \
-vnc :1 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x8 \
-monitor stdio \
-qmp tcp:0:4444,server,nowait

2. create dest mirror image 
# qemu-img create -f qcow2 mirror1.qcow2 20G

3. start dest guest and setup as NBD server
#!/bin/bash
/usr/libexec/qemu-kvm \
-name guest=test-virt \
-machine pc,accel=kvm,usb=off,vmport=off,dump-guest-core=off \
-cpu SandyBridge \
-m 2G \
-smp 4,sockets=4,cores=1,threads=1 \
-boot strict=on \
-drive file=/home/test/nbd01/mirror1.qcow2,if=none,cache=none,snapshot=off,format=qcow2,id=img0 \
-device virtio-blk-pci,bus=pci.0,addr=0x7,drive=img0,id=virtio-disk0,bootindex=1 \
-netdev tap,id=hostnet0,vhost=on \
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:12:b3:20:61,bus=pci.0,addr=0x3 \
-device VGA \
-usbdevice tablet \
-vnc :3 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x8 \
-monitor stdio \
-qmp tcp:0:5555,server,nowait \
-incoming tcp:0:6666 

{ "execute": "qmp_capabilities" }
{ "execute": "nbd-server-start", "arguments": { "addr": { "type": "inet", "data": { "host": "127.0.0.1", "port": "9999" } } } }
{ "execute": "nbd-server-add", "arguments": { "device": "img0", "writable": true } }

4. invoke drive-mirror on src to dest
{ "execute": "qmp_capabilities" }
{ "execute": "drive-mirror", "arguments": { "device": "img0", "target": "nbd://127.0.0.1:9999/img0", "sync": "full", "format": "raw", "mode": "existing" } }

5. reopen src to mirror when block mirror is ready
{"execute": "block-job-complete", "arguments": { "device": "img0"} }

6. invoke migration on src
(qemu) migrate -d tcp:0:6666

7. invoke nbd-server-stop when migration completes, and cont to start guest on dest
{ "execute" : "nbd-server-stop", "arguments" : {} }
(qemu) cont

After, the guest could run on dest. Both src and dest qemu could quit normally.

Comment 9 errata-xmlrpc 2017-11-30 20:34:33 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/RHSA-2017:3369