Bug 1127226 - [RFE] Add support for specifying relative backing path when taking a snapshot
Summary: [RFE] Add support for specifying relative backing path when taking a snapshot
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.0
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: Han Han
URL:
Whiteboard:
Depends On: 1126329
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-08-06 12:27 UTC by Peter Krempa
Modified: 2018-06-01 06:10 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of: 1126329
Environment:
Last Closed: 2018-06-01 06:10:15 UTC


Attachments (Terms of Use)

Description Peter Krempa 2014-08-06 12:27:27 UTC
Description of problem:
Currently there's no sane way (except for using --reuse-external) to specify a relative backing name to be stored in the newly created snapshot and passing a relative file name doesn't work.

+++ This bug was initially created as a clone of Bug #1126329 +++

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

libvirt-1.1.1-29.el7_0.1.x86_64


How reproducible:
100%

Steps to Reproduce:

1. Create external disk snapshot with relative path

# pwd
/root

# virsh snapshot-create-as rhel6 s1 --diskspec vda,file=./rhel6.s1 --disk-only
Domain snapshot s1 created

# virsh snapshot-dumpxml rhel6 s1

<domainsnapshot>
  <name>s1</name>
  <state>disk-snapshot</state>
  <creationTime>1406813388</creationTime>
  <memory snapshot='no'/>
  <disks>
    <disk name='vda' snapshot='external' type='file'>
      <driver type='qcow2'/>
      <source file='./rhel6.s1'/>
    </disk>
  </disks>

# virsh dumpxml rhel6
..
<disk type='file' device='disk'>
      <driver type='qcow2' cache='none'/>
      <source file='./rhel6.s1'/>
      <backingStore type='file' index='1'>
        <format type='qcow2'/>
        <source file='/usr/local/var/lib/libvirt/images/rhel6.img'/>
        <backingStore/>
      </backingStore>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </disk>
..

2. Create external disk snapshot with absolute path

# virsh snapshot-create-as rhel6 s2 --diskspec vda,file=/usr/local/var/lib/libvirt/images/rhel6.s2 --disk-only
Domain snapshot s2 created

# virsh dumpxml rhel6

..
 <disk type='file' device='disk'>
      <driver type='qcow2' cache='none'/>
      <source file='/usr/local/var/lib/libvirt/images/rhel6.s2'/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </disk>
..

#qemu-img  info /usr/local/var/lib/libvirt/images/rhel6.s2
image: /usr/local/var/lib/libvirt/images/rhel6.s2
file format: qcow2
virtual size: 3.9G (4194304000 bytes)
disk size: 712K
cluster_size: 65536
backing file: ./rhel6.s1 (actual path: /usr/local/var/lib/libvirt/images/./rhel6.s1)


3. Create external disk snapshot 

# virsh snapshot-create-as rhel6 s3  --disk-only
error: internal error: unable to execute QEMU command 'transaction': Could not open '/usr/local/var/lib/libvirt/images/rhel6.s2': Could not open file: No such file or directory: No such file or directory


# ll /usr/local/var/lib/libvirt/images/rhel6.s2
-rw-------. 1 root root 2228224 Jul 31 21:42 /usr/local/var/lib/libvirt/images/rhel6.s2 

Actual results:


Expected results:


Additional info:

Comment 3 Peter Krempa 2018-06-01 06:10:15 UTC
With the upcomming -blockdev support this won't be necessary as you'll be able to express any backing chain in the XML and using relative paths will not be necessary.


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