RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1196066 - Disk type=block converted to disk type=file after block copy
Summary: Disk type=block converted to disk type=file after block copy
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.1
Hardware: Unspecified
OS: Linux
urgent
urgent
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On: 1195461
Blocks: 1176673
TreeView+ depends on / blocked
 
Reported: 2015-02-25 09:06 UTC by Jan Kurik
Modified: 2015-03-05 14:10 UTC (History)
33 users (show)

Fixed In Version: libvirt-1.2.8-16.el7_1.1
Doc Type: Bug Fix
Doc Text:
The block copy operation has previously been adjusted to change the disk type of the copied disk to "file". However, using block copy for moving block-based storage thus converted the new target to an incorrect type. Consequently, if a virtual disk was backed by a block device rather than a file, libvirt did not report the allocation information necessary to track a thin-provisioned volume. This update introduces a libvirt flag that makes it possible to specify that the target will be treated as a block device. As a result, users can now perform a block copy to a block target correctly.
Clone Of: 1195461
Environment:
Last Closed: 2015-03-05 14:10:13 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:0625 0 normal SHIPPED_LIVE libvirt bug fix update 2015-03-05 18:40:56 UTC

Description Jan Kurik 2015-02-25 09:06:16 UTC
This bug has been copied from bug #1195461 and has been proposed
to be backported to 7.1 z-stream (EUS).

Comment 9 Shanzhi Yu 2015-02-26 10:31:40 UTC
With packages
libvirt-1.2.8-16.el7_1.1.x86_64
qemu-kvm-rhev-2.2.0-5.el7.x86_64

My verify steps is as below:

1. Prepare logical volume lv01 ,lv02 and lv03, and format lv01 and lv02 to qcow2 with qemu-img

# pvcreate /dev/sda7
  Physical volume "/dev/sda7" successfully created
# vgcreate vg01 /dev/sda7
  Volume group "vg01" successfully created
# for i in 1 2 3 ;do lvcreate -L  10G  -n lv0$i vg01;done
  Logical volume "lv01" created.
  Logical volume "lv02" created.
  Logical volume "lv03" created.
# qemu-img create -f qcow2 /dev/vg01/lv01 10G
Formatting '/dev/vg01/lv01', fmt=qcow2 size=10737418240 encryption=off cluster_size=65536 lazy_refcounts=off 
# qemu-img create -f qcow2 /dev/vg01/lv02 10G
Formatting '/dev/vg01/lv02', fmt=qcow2 size=10737418240 encryption=off cluster_size=65536 lazy_refcounts=off

2. Prepare a transient guest with source file based on logical volume lv01

# virsh list --transient
 Id    Name                           State
----------------------------------------------------
 3     r7                             running

# virsh dumpxml r7|grep disk -A 5
    <disk type=block device=disk>
      <driver name=qemu type=qcow2/>
      <source dev=/dev/vg01/lv01/>
      <backingStore/>
      <target dev=vda bus=virtio/>
      <alias name=virtio-disk0/>
      <address type=pci domain=0x0000 bus=0x00 slot=0x04 function=0x0/>
    </disk>

3. Do blockcopy to lv02(qcow2 format)

3.1 doesn't use options --reuse-external

1. check do blockjob then abort the blockcopy

1). Do blockcopy
# virsh blockcopy r7 vda --blockdev /dev/vg01/lv02 --verbose --wait 

Now in mirroring phase

2). Check blockjob info

# virsh blockjob r7 vda 

NB:
No block job show 
[deserve a fix here?]

# virsh dumpxml r7|grep mirror -B 4
    <disk type='block' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source dev='/dev/vg01/lv01'/>
      <backingStore/>
      <mirror type='block' job='copy' ready='yes'>
        <format type='qcow2'/>
        <source dev='/dev/vg01/lv02'/>
      </mirror>


3). Abort the job
# virsh blockjob r7 vda --abort 

4). Recheck the source file type.

# virsh dumpxml r7|grep disk -A 4
    <disk type='block' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source dev='/dev/vg01/lv01'/>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>


2. check do blockjob then pivot the blockcopy

1) Do blockcopy 
# virsh blockcopy r7 vda --blockdev /dev/vg01/lv02 --verbose --wait 

Now in mirroring phase

2) Check blockjob info
# virsh blockjob r7 vda 

# virsh dumpxml r7|grep mirror -B 4 
    <disk type='block' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source dev='/dev/vg01/lv01'/>
      <backingStore/>
      <mirror type='block' job='copy' ready='yes'>
        <format type='qcow2'/>
        <source dev='/dev/vg01/lv02'/>
      </mirror>

3) Do pivot 

# virsh blockjob r7 vda --pivot 

4) Recheck the source file type

# virsh dumpxml r7|grep disk -A 4
    <disk type='block' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source dev='/dev/vg01/lv02'/>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>

3.2 use options --reuse-external 

1. check do blockjob then abort the blockcopy

1)Do blockcopy
# virsh blockcopy r7 vda --blockdev --reuse-external  /dev/vg01/lv02 --verbose --wait 

Now in mirroring phase


2)Check blockjob info

# virsh blockjob r7 vda 

# virsh dumpxml r7|grep mirror -B 4 
    <disk type='block' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source dev='/dev/vg01/lv01'/>
      <backingStore/>
      <mirror type='block' job='copy' ready='yes'>
        <format type='qcow2'/>
        <source dev='/dev/vg01/lv02'/>
      </mirror>

3) Abort the job
# virsh blockjob r7 vda --abort

# virsh dumpxml r7|grep mirror -B 4


4) Recheck the source file type.

# virsh dumpxml r7|grep disk -A 4
    <disk type='block' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source dev='/dev/vg01/lv01'/>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>

2. check do blockjob then pivot the blockcopy

1) Do blockcopy
# virsh blockcopy r7 vda /dev/vg01/lv02 --blockdev --reuse-external --verbose --wait 

Now in mirroring phase


2) Check blockjob info

# virsh blockjob r7 vda 

# virsh dumpxml r7|grep mirror -B 4 
    <disk type='block' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source dev='/dev/vg01/lv01'/>
      <backingStore/>
      <mirror type='block' job='copy' ready='yes'>
        <format type='qcow2'/>
        <source dev='/dev/vg01/lv01'/>
      </mirror>


3) Pivot the job

# virsh blockjob r7 vda --pivot 

# virsh dumpxml r7|grep mirror -B 4 

4) Recheck the source file type.

# virsh dumpxml r7|grep disk -A 4
    <disk type='block' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source dev='/dev/vg01/lv01'/>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>

4. Do blockcopy to lv03(raw format)

# qemu-img info /dev/vg01/lv03 
image: /dev/vg01/lv03
file format: raw
virtual size: 10G (10737418240 bytes)
disk size: 0

4.1 blockcopy + pivot 

# virsh blockcopy r7 vda /dev/vg01/lv03 --blockdev  --verbose --wait 

Now in mirroring phase

# virsh dumpxml r7|grep mirror -B 4
    <disk type='block' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source dev='/dev/vg01/lv01'/>
      <backingStore/>
      <mirror type='block' job='copy' ready='yes'>
        <format type='qcow2'/>
        <source dev='/dev/vg01/lv03'/>
      </mirror>

# qemu-img info /dev/vg01/lv03 
image: /dev/vg01/lv03
file format: qcow2
virtual size: 10G (10737418240 bytes)
disk size: 0
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: false
    corrupt: false

# virsh blockjob r7 vda --pivot 


# virsh dumpxml r7|grep disk -A 4 
    <disk type='block' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source dev='/dev/vg01/lv03'/>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>

4.2 blockcopy + abort

# virsh blockcopy r7 vda /dev/vg01/lv03 --blockdev  --verbose --wait 

Now in mirroring phase

# virsh dumpxml r7|grep mirror -B 4
    <disk type='block' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source dev='/dev/vg01/lv01'/>
      <backingStore/>
      <mirror type='block' job='copy' ready='yes'>
        <format type='qcow2'/>
        <source dev='/dev/vg01/lv03'/>
      </mirror>

# qemu-img info /dev/vg01/lv03 
image: /dev/vg01/lv03
file format: qcow2
virtual size: 10G (10737418240 bytes)
disk size: 0
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: false
    corrupt: false

# virsh blockjob r7 vda  --abort

# virsh dumpxml r7|grep disk -A  4
    <disk type='block' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source dev='/dev/vg01/lv01'/>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>

The only issue is there is no job info show when blockcopy is in mirror phase,  and there is no any difference whether I use "--reuse-external" or not. So that mean this option doens't work here? Does that matter?

# virsh blockjob r7 vda 

Otherwise, I will change this bug to verify.

Comment 10 Peter Krempa 2015-02-26 12:58:31 UTC
The block job state issue happens on upstream too so I think it's worth a separate bug.

Comment 13 errata-xmlrpc 2015-03-05 14:10:13 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-2015-0625.html


Note You need to log in before you can comment on or make changes to this bug.