Bug 1103714 - virsh vol-clone can't clone between two different pools
Summary: virsh vol-clone can't clone between two different pools
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-06-02 12:22 UTC by Benjamin Cama
Modified: 2016-04-20 13:16 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-04-20 13:16:13 UTC
Embargoed:


Attachments (Terms of Use)

Description Benjamin Cama 2014-06-02 12:22:30 UTC
Description of problem:

When trying to clone a volume from one pool to another (which looks possible according to the command documentation), virsh tries to create a new volume in the *origin* pool, not the destination one. This function thus can't work to clone a volume from one pool to another.

Looking at the code, it tries to lookup the original volume by name _through the destination pool_, and furthermore gives virStorageVolCreateXMLFrom() the original pool as first argument, while its documentation tells it should be the destination pool. Thus it doesn't work at all when cloning between different pools. The logic didn't change between 0.9.12 and the latest master revision I looked at.

Version-Release number of selected component (if applicable):

0.9.12

How reproducible:

Always, for me. Below is one example where I try to clone a volume *from* pool "vm-group" to pool "images".

Steps to Reproduce:
1. virsh vol-clone --pool images /dev/vm-group/ubuntu-12 ubuntu-12.img
2.
3.

Actual results:

error: Failed to clone vol from ubuntu-12
error: internal error Child process (/sbin/lvcreate --name ubuntu-12.img -L 20971520K vm-group) unexpected exit status 
5:   Volume group "vm-group" has insufficient free space (255 extents): 5120 required.


Expected results:

It clones the volume from "vm-group" to "images", instead of trying to create a volume in the original "vm-group" pool.

Additional info:

Using "virsh vol-create-from" with a manually copied XML works, though, as a workaround.

Comment 1 Cole Robinson 2016-04-19 21:56:45 UTC
Sorry for the delayed response. We could probably extend virsh to allow vol-clone across pools, but for now I just opted to make it explicit in the docs that it's  only intended to work within a single pool

http://www.redhat.com/archives/libvir-list/2016-April/msg01243.html

Comment 2 Cole Robinson 2016-04-20 13:16:13 UTC
Doc fix pushed now:

commit 2f1dc3de4672f4d7aa42bb4984618d382388e0d2
Author: Cole Robinson <crobinso>
Date:   Tue Apr 19 17:34:57 2016 -0400

    man: Clarify virsh vol-clone works within a single pool
    
    virsh vol-clone is expected to clone a volume within a single
    pool; it doesn't work for cloning across pools. Clarify the docs
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1103714


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