Bug 1955667

Summary: blockCopy succeeds, but target volume "not assigned to domain" after pivot [rhel-8.4.0.z]
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: RHEL Program Management Team <pgm-rhel-tools>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED ERRATA QA Contact: Meina Li <meili>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 8.3CC: aliang, coli, ehadley, fjin, gveitmic, jdenemar, jsuchane, kwolf, lmen, meili, mkalinin, mtessun, nsoffer, pkrempa, virt-maint, xuzhang, yalzhang, ymankad
Target Milestone: rcKeywords: Triaged, ZStream
Target Release: 8.4   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-7.0.0-14.1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1951507 Environment:
Last Closed: 2021-06-02 15:12:05 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: 1951507    
Bug Blocks: 1957776    

Comment 1 Peter Krempa 2021-04-30 18:01:05 UTC
Scratch build:

https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=36435438

I've also already sent the backport earlier before this bug was cloned (Jirka will fix the bug link):

https://mailman-int.corp.redhat.com/archives/rhvirt-patches/2021-April/msg00170.html

Comment 5 Meina Li 2021-05-20 06:35:53 UTC
Test with scratch build:
libvirt-7.0.0-15.el8_rc.51bc9b53a8.x86_64
qemu-kvm-5.2.0-16.module+el8.4.0+10806+b7d97207.x86_64

Test Steps:
# cat test.sh
#!/bin/bash

DOMAIN=lmn
DISK=sda
TDISK="/dev/sdc"
LOG_FILE="/var/log/libvirt/libvirtd.log"
FIND_STR="not assigned to domain"

rm -rf /tmp/$DOMAIN.s*
for i in {1..100}
do
    echo "------$i------"
    virsh destroy $DOMAIN
    virsh create $DOMAIN.xml;
    sleep 3;
    virsh snapshot-create-as $DOMAIN --disk-only --diskspec $DISK,file=/tmp/$DOMAIN.s$i;
    virsh blockcopy $DOMAIN $DISK $TDISK --wait --verbose;
    sleep 2;
    virsh blockjob $DOMAIN $DISK --pivot;
    virsh dumpxml $DOMAIN | grep /disk -B8
    virsh domblkthreshold $DOMAIN $DISK 100 
    virsh domstats $DOMAIN --block --backing
    if [ `grep -c "$FIND_STR" $LOG_FILE` -ne '0' ]; then
        break
    else
        continue
    fi
done

# sh test.sh
......
------100------
Domain 'lmn' destroyed

Domain 'lmn' created from lmn.xml

Domain snapshot 1621492378 created
Block Copy: [100 %]
Now in mirroring phase

    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/dev/sdc' index='3'/>
      <backingStore/>
      <target dev='sda' bus='scsi'/>
      <alias name='scsi0-0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

Domain: 'lmn'
  block.count=1
  block.0.name=sda
  block.0.path=/dev/sdc
  block.0.backingIndex=3
  block.0.rd.reqs=1
  block.0.rd.bytes=512
  block.0.rd.times=94530
  block.0.wr.reqs=0
  block.0.wr.bytes=0
  block.0.wr.times=0
  block.0.fl.reqs=0
  block.0.fl.times=0
  block.0.allocation=1074135040
  block.0.capacity=1073741824
  block.0.physical=0
  block.0.threshold=100

Comment 9 Meina Li 2021-05-26 01:14:00 UTC
Also do the basic test with the libvirt-7.0.0-14.1.module+el8.4.0+11095+d46acebf.x86_64 and the test script in Comment 5:
# sh test.sh
......
------100------
Domain 'lmn' destroyed

Domain 'lmn' created from lmn.xml

Domain snapshot 1621991597 created
Block Copy: [100 %]
Now in mirroring phase

    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='block' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source dev='/dev/sdc' index='3'/>
      <backingStore/>
      <target dev='sda' bus='scsi'/>
      <alias name='scsi0-0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

Domain: 'lmn'
  block.count=1
  block.0.name=sda
  block.0.path=/dev/sdc
  block.0.backingIndex=3
  block.0.rd.reqs=1
  block.0.rd.bytes=512
  block.0.rd.times=92180
  block.0.wr.reqs=0
  block.0.wr.bytes=0
  block.0.wr.times=0
  block.0.fl.reqs=0
  block.0.fl.times=0
  block.0.allocation=1074135040
  block.0.capacity=1073741824
  block.0.physical=2147483648
  block.0.threshold=100

Both the auto test and the manual test were passed. So move this bug to be verified.

Comment 13 errata-xmlrpc 2021-06-02 15:12: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 (virt:av bug fix update), 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/RHBA-2021:2202