Bug 1104862

Summary: [RFE] Volume creation as external snapshot shouldn't require capacity
Product: [Fedora] Fedora Reporter: Federico Simoncelli <fsimonce>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: agedosier, amureini, berrange, clalancette, eblake, itamar, jforbes, jtomko, kchamart, laine, libvirt-maint, nsoffer, shyu, veillard, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-02 07:48:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Federico Simoncelli 2014-06-04 20:43:53 UTC
Description of problem:
The capacity element should be optional when creating a volume with a backing file (by default it should be the same of the base):

# virsh vol-create default /dev/stdin <<EOF
<volume>
  <name>test-base.qcow2</name>
  <capacity unit='bytes'>21474836480</capacity>
  <target>
    <format type='qcow2'/>
  </target>
</volume>
EOF

# virsh vol-create default /dev/stdin <<EOF
<volume>
  <name>test-snapshot1.qcow2</name>
  <target>
    <format type='qcow2'/>
    <permissions>
      <mode>0600</mode>
      <owner>0</owner>
      <group>0</group>
      <label>system_u:object_r:virt_content_t:s0</label>
    </permissions>
  </target>
  <backingStore>
    <path>test-base.qcow2</path>
    <format type='qcow2'/>
  </backingStore>
</volume>
EOF

error: Failed to create vol from /dev/stdin
error: XML error: missing capacity element

Comment 1 Federico Simoncelli 2014-09-22 09:36:10 UTC
Eric, any insight about this?

Comment 2 Eric Blake 2014-09-22 15:51:03 UTC
What insight are you looking for? Yes, this sounds like a reasonable request that someone should code up.

Comment 3 Shanzhi Yu 2014-10-08 09:21:46 UTC
*** Bug 1150411 has been marked as a duplicate of this bug. ***

Comment 4 Ján Tomko 2015-03-02 07:48:49 UTC
Fixed upstream as of
commit 155ca616eb231181f6978efc9e3a1eb0eb60af8a
Author:     Ján Tomko <jtomko>
CommitDate: 2015-03-02 08:07:11 +0100

    Allow creating volumes with a backing store but no capacity
    
    The tool creating the image can get the capacity from the backing
    storage. Just refresh the volume afterwards.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=958510

git describe: v1.2.13-17-g155ca61