Bug 816667 - RFE: storage: add API for volume pull and rebase
Summary: RFE: storage: add API for volume pull and rebase
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-04-26 16:17 UTC by Alex Jia
Modified: 2020-11-03 16:34 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-11-03 16:34:38 UTC
Embargoed:


Attachments (Terms of Use)

Description Alex Jia 2012-04-26 16:17:37 UTC
Description of problem:
At present, we can only populate a disk from its backing image for a running domain, sometimes, we need also to do this for a inactive domain. 

Version-Release number of selected component (if applicable):
# rpm -q libvirt qemu-kvm-rhev
libvirt-0.9.10-14.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.285.el6.x86_64

How reproducible:
always

Steps to Reproduce:
$ qemu-img create /var/lib/libvirt/images/test 1M

$ cat > /tmp/test.xml <<EOF
<domain type='qemu'>
  <name>test</name>
  <memory>219200</memory>
  <vcpu>1</vcpu>
  <os>
    <type arch='x86_64'>hvm</type>
    <boot dev='hd'/>
  </os>
  <devices>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/test'/>
      <target dev='vda' bus='virtio'/>
    </disk>
    <input type='mouse' bus='ps2'/>
    <graphics type='spice' autoport='yes' listen='0.0.0.0'/>
  </devices>
</domain>
EOF

$ virsh define /tmp/test.xml
$ virsh blockpull test /var/lib/libvirt/images/test --wait
  
Actual results:
error: unsupported configuration: block jobs not supported with this QEMU
binary

Expected results:
can successfully run virsh blockpull for a inactive domain.

Additional info:
Eric has confirmed this issues, I will quote his comments in here:
"I'd have to research whether qemu-img can do this (and if not, we may also need
an enhancement to qemu-img).  The idea is nice, but the amount of work to make
libvirt track this as a block job is non-trivial; we are too late for 6.3;
please open a new RFE BZ against 6.4."

Comment 1 Alex Jia 2012-04-27 03:21:31 UTC
Hi Eric,
The blockcopy has the same issue for a offline domain:

# virsh domstate test2
shut off

# virsh blockcopy test2 /var/lib/libvirt/images/test2 /var/lib/libvirt/images/
error: unsupported configuration: block copy is not supported with this QEMU binary

Need I separately open a new RFE bug to track it?

Thanks,
Alex

Comment 2 Alex Jia 2012-04-27 06:36:47 UTC
(In reply to comment #1)
> Hi Eric,
> The blockcopy has the same issue for a offline domain:
> 
> # virsh domstate test2
> shut off
> 
> # virsh blockcopy test2 /var/lib/libvirt/images/test2 /var/lib/libvirt/images/
> error: unsupported configuration: block copy is not supported with this QEMU
> binary
> 
> Need I separately open a new RFE bug to track it?
> 
> Thanks,
> Alex

In addition, there are 2 issues for virsh blockresize command:

1. doesn't support domain offline blockresize now
Need libvirt to support this like blockpull?

2. if a running domain with a snapshot then run virsh blockresize,
will meet the following error:
error: Failed to resize block device '/var/lib/libvirt/images/test'
error: internal error unable to execute QEMU command 'block_resize': this feature or command is not currently supported

Notes, we know libvirt has supported 'block_resize' qemu command, in here, the error should be "this feature is not currently supported", if so, do we plan to
support the feature in the future?




Additional info:

# virsh snapshot-create-as test test-hello
Domain snapshot test-hello created

# virsh snapshot-list test
 Name                 Creation Time             State
------------------------------------------------------------
 test-hello          2012-04-27 13:01:32 +0800 running

# virsh blockresize test /var/lib/libvirt/images/test 10M
error: Failed to resize block device '/var/lib/libvirt/images/test'
error: internal error unable to execute QEMU command 'block_resize': this feature or command is not currently supported

# virsh snapshot-delete test test-hello
Domain snapshot test-hello deleted

# virsh blockresize test /var/lib/libvirt/images/test 10M
Block device '/var/lib/libvirt/images/test' is resized

# qemu-img info /var/lib/libvirt/images/test
image: /var/lib/libvirt/images/test
file format: qcow2
virtual size: 10M (10485760 bytes)
disk size: 1.1M
cluster_size: 65536

Comment 3 Eric Blake 2012-04-27 12:19:08 UTC
(In reply to comment #2)
> (In reply to comment #1)
> > Hi Eric,
> > The blockcopy has the same issue for a offline domain:
> > 
> > # virsh domstate test2
> > shut off
> > 
> > # virsh blockcopy test2 /var/lib/libvirt/images/test2 /var/lib/libvirt/images/
> > error: unsupported configuration: block copy is not supported with this QEMU
> > binary
> > 
> > Need I separately open a new RFE bug to track it?

bug 816662 should cover this

> > 
> > Thanks,
> > Alex
> 
> In addition, there are 2 issues for virsh blockresize command:
> 
> 1. doesn't support domain offline blockresize now
> Need libvirt to support this like blockpull?

You can do offline block resizing via 'virsh vol-resize'.  Wiring up 'virsh blockresize' to call the same underlying code as 'virsh vol-resize' for offline domains is worth a separate RFE BZ for the 6.4 timeframe, but at least for 6.3 you can already do it with existing API without having to resort to qemu-img calls yourself.

> 
> 2. if a running domain with a snapshot then run virsh blockresize,
> will meet the following error:
> error: Failed to resize block device '/var/lib/libvirt/images/test'
> error: internal error unable to execute QEMU command 'block_resize': this
> feature or command is not currently supported

Yes, that is a known qemu limitation; there have been upstream patches proposed (basically, introducing version 3 of the qcow format), but as far as I know, they are not scheduled for inclusion in RHEL 6.3, and will have to wait for 6.4.

> 
> Notes, we know libvirt has supported 'block_resize' qemu command, in here, the
> error should be "this feature is not currently supported", if so, do we plan to
> support the feature in the future?

We plan to support it as soon as qemu supports it.

Comment 4 Alex Jia 2012-04-27 15:45:35 UTC
(In reply to comment #3)
> > > Need I separately open a new RFE bug to track it?
> 
> bug 816662 should cover this

Good to know this.
> 
> > 1. doesn't support domain offline blockresize now
> > Need libvirt to support this like blockpull?
> 
> You can do offline block resizing via 'virsh vol-resize'.  Wiring up 'virsh
> blockresize' to call the same underlying code as 'virsh vol-resize' for offline
> domains is worth a separate RFE BZ for the 6.4 timeframe, but at least for 6.3
> you can already do it with existing API without having to resort to qemu-img
> calls yourself.
Got it, I will open a separate RFE BZ for virsh blockresize supports offline domain in 6.4.
> 
> > 
> Yes, that is a known qemu limitation; there have been upstream patches proposed
> (basically, introducing version 3 of the qcow format), but as far as I know,
> they are not scheduled for inclusion in RHEL 6.3, and will have to wait for
> 6.4.
Got it.
> 
> > 
> > Notes, we know libvirt has supported 'block_resize' qemu command, in here, the
> > error should be "this feature is not currently supported", if so, do we plan to
> > support the feature in the future?
> 
> We plan to support it as soon as qemu supports it.
Good to know this.

Eric, thanks for your comments.

Comment 6 Cole Robinson 2016-03-23 21:50:40 UTC
I think the main bit of work here is supporting this in the storage layer first, there aren't any APIs to do the equivalent of blockpull and blockrebase on individual image files. Once we have that an app could handle offline blockpull on its own, or we could wire up the syntactic sugar in the qemu driver.

Comment 7 Daniel Berrangé 2020-11-03 16:34:38 UTC
Thank you for reporting this issue to the libvirt project. Unfortunately we have been unable to resolve this issue due to insufficient maintainer capacity and it will now be closed. This is not a reflection on the possible validity of the issue, merely the lack of resources to investigate and address it, for which we apologise. If you none the less feel the issue is still important, you may choose to report it again at the new project issue tracker https://gitlab.com/libvirt/libvirt/-/issues The project also welcomes contribution from anyone who believes they can provide a solution.


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