Bug 816667 - RFE: storage: add API for volume pull and rebase
RFE: storage: add API for volume pull and rebase
Status: NEW
Product: Virtualization Tools
Classification: Community
Component: libvirt (Show other bugs)
unspecified
x86_64 Linux
medium Severity medium
: ---
: ---
Assigned To: Libvirt Maintainers
: FutureFeature
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-26 12:17 EDT by Alex Jia
Modified: 2016-05-16 00:22 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Alex Jia 2012-04-26 12:17:37 EDT
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-26 23:21:31 EDT
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 02:36:47 EDT
(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 08:19:08 EDT
(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 11:45:35 EDT
(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 17:50:40 EDT
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.

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