Bug 1029307

Summary: snapshot-create-as --disk-only is not support with nbd network disk
Product: Red Hat Enterprise Linux 7 Reporter: chhu
Component: libvirtAssignee: Eric Blake <eblake>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.0CC: ajia, dyuan, eblake, mzhan, rbalakri, shyu, yanyang
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-28 15:30:04 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 chhu 2013-11-12 06:38:34 UTC
Description of problem:
snapshot-create-as --disk-only is not support with nbd network disk

Version-Release number of selected component:
qemu-kvm-rhev-1.5.3-19.el7.x86_64
libvirt-1.1.1-12.el7.x86_64

How reproducible:
100%

Steps:
1. start a guest with nbd network disk
    <disk type='network' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source protocol='nbd'>
        <host name='10.66.5.93' port='10809'/>
      </source>
      <target dev='sda' bus='scsi'/>
    </disk>
   <controller type='scsi' index='0' model='virtio-scsi'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </controller>

# virsh define r7-qcow2.xml
Domain rh7-qcow2 defined from r7-qcow2.xml
# virsh start rh7-qcow2
Domain rh7-qcow2 started

2. do snapshot with --disk-only
# virsh snapshot-create-as rh7-qcow2 s1 --disk-only
error: unsupported configuration: cannot generate external snapshot name for disk 'sda' without source

# virsh snapshot-create-as rh7-qcow2 s2 --memspec file=s2,snapshot=external
error: unsupported configuration: cannot generate external snapshot name for disk 'sda' without source

3. do snapshot without --disk-only
# virsh snapshot-create-as rh7-qcow2 snap1
Domain snapshot snap1 created

# virsh snapshot-list rh7-qcow2
 Name                 Creation Time             State
------------------------------------------------------------
 snap1                2013-11-12 11:31:18 +0800 running

4. check the snapshot xml
# virsh snapshot-create-as rh7-qcow2 s1 --disk-only --print-xml
<domainsnapshot>
  <name>s1</name>
</domainsnapshot>

# virsh snapshot-create-as rh7-qcow2 snap1 --print-xml
<domainsnapshot>
  <name>snap1</name>
</domainsnapshot>

# virsh snapshot-dumpxml rh7-qcow2 snap1
<domainsnapshot>
  <name>snap1</name>
  <state>running</state>
  <creationTime>1384227078</creationTime>
  <memory snapshot='internal'/>
  <disks>
    <disk name='sda' snapshot='internal'/>
  </disks>
  <domain type='kvm'>
    <name>rh7-qcow2</name>
.......
      <disk type='network' device='disk'>
        <driver name='qemu' type='qcow2'/>
        <source protocol='nbd'>
          <host name='10.66.5.93' port='10809'/>
        </source>
        <target dev='sda' bus='scsi'/>
        <address type='drive' controller='0' bus='0' target='0' unit='0'/>
      </disk>

......
    <seclabel type='dynamic' model='selinux' relabel='yes'/>
  </domain>
</domainsnapshot>


Actual results:
In step2, got error: unsupported configuration

Expected results:
In step2, snapshot-create-as --disk-only success.

Comment 2 Shanzhi Yu 2013-11-22 07:27:22 UTC
update this bug with new test result

Steps:
1. 1. start a guest with nbd network disk
# virsh dumpxml nbd
..
  <disk type='network' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source protocol='nbd'>
        <host name='10.66.82.249' port='10808'/>
      </source>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </disk>
    <controller type='scsi' index='0' model='virtio-scsi'>
      <alias name='scsi0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </controller>
..
 <graphics type='spice' autoport='yes' listen='127.0.0.1'>
      <listen type='address' address='127.0.0.1'/>
    </graphics>

..
2. do external snapshot while the guest os is broken.

2.1 with --disk-only
# virsh snapshot-create-as nbd snap1 --disk-only --diskspec vda,file=/tmp/nbd.snap1
error: internal error: unable to execute QEMU command 'transaction': An IO error has occurred

2.2 with --memspec
# virsh snapshot-create-as nbd snap1 --memspec file=snap1,snapshot=external --diskspec vda,file=/tmp/nbd.snap1
error: internal error: unable to execute QEMU command 'transaction': An IO error has occurred

3. do external snapshot while the guest os works well.

3.1 with --disk-only
# virsh snapshot-create-as nbd snap1 --disk-only --diskspec vda,file=/tmp/nbd.snap1
error: internal error: unable to execute QEMU command 'transaction': Could not open '': Could not open file: No such file or directory: No such file or directory

3.2  with --memspec
# virsh snapshot-create-as nbd snap1 --disk-only --diskspec vda,file=/tmp/nbd.snap1
error: internal error: unable to execute QEMU command 'transaction': Could not open '': Could not open file: No such file or directory: No such file or directory



Actual results:

Expected results:

Additional Info:
I do the snapshot while keep the spice connection via virt-viewer. After step 2.2 and 3.2, the connection will lose

Comment 8 Eric Blake 2015-07-28 15:30:04 UTC
virsh snapshot-create-as is a convenience feature. It should always be possible to resort to virsh snapshot-create and passing in XML for any situation too complex to do by the convenience feature. At this point, I don't know that there is enough demand to add more syntax sugar to snapshot-create-as to cover non-file destinations.