<div dir="ltr">Hi Han,<div><br></div><div>Any update on this?</div><div><br></div><div>Erlon</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 17, 2016 at 9:58 AM, Erlon Cruz <span dir="ltr"><<a href="mailto:sombrafam@gmail.com" target="_blank">sombrafam@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Han,<div><br></div><div>Did the same test again with libvirt debug enabled. This time I added the disk[1] without snaps (OK), and then added the disk[2] with snapshots. The libvirt log[3] (line 320) says:</div><div><br></div><div><b>Could not open '/opt/stack/data/nova/mnt/<wbr>a3b4c6ddd9bf82edd4f726872be58d<wbr>05/volume-a75b42e8-8175-4516-<wbr>b724-43ee6f3d2520': Permission denied\r\n", "id": "libvirt-33"}]</b><br></div><div><b><br></b></div><div>But this file has 777 permissions. I can access it with any user I tried[4]. Tough its mounted over NFS, the permissions seems to be right. </div><span class=""><div><br></div><div>Erlon</div><div><br></div><div>[1]  <a href="http://paste.openstack.org/show/556055/" target="_blank">http://paste.openstack.org/<wbr>show/556055/</a></div><div>[2]  <a href="http://paste.openstack.org/show/556056/" target="_blank">http://paste.openstack.org/<wbr>show/556056/</a></div></span><div>[3]  <a href="http://pastebin.com/CCFcKq5b" target="_blank">http://pastebin.com/CCFcKq5b</a></div><div>[4]  <a href="http://paste.openstack.org/show/559018/" target="_blank">http://paste.openstack.org/<wbr>show/559018/</a></div><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 16, 2016 at 2:41 PM, Erlon Cruz <span dir="ltr"><<a href="mailto:sombrafam@gmail.com" target="_blank">sombrafam@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Han,<div><br></div><div>Thanks for helping. What is the XML before the snapshot is created? Can you post the XML files you used too? The files are in the links pointed by the numbers [1], [2] etc.</div><div><br></div><div>The versions are:</div><div><div>qemu-system-x86_64 --version</div><div>QEMU emulator version 2.5.0 (Debian 1:2.5+dfsg-5ubuntu10.4), Copyright (c) 2003-2008 Fabrice Bellard</div></div><div><br></div><div><div>libvirtd --version</div><div>libvirtd (libvirt) 1.3.1</div></div><span><font color="#888888"><div><br></div><div><br></div><div><br></div><div>Erlon</div></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 15, 2016 at 12:56 AM, Han Han <span dir="ltr"><<a href="mailto:hhan@redhat.com" target="_blank">hhan@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,Erlon<br>
I was not able to reproduce your problem. It is ok to attach disk with external snapshot.<br>
I did it with following steps:<br>
# qemu-img create /tmp/vdb 100M<br>
Formatting '/tmp/vdb', fmt=raw size=104857600<br>
# virsh start snap<br>
Domain snap started<br>
# virsh snapshot-create-as snap s1 --disk-only --diskspec vdb,file=/tmp/vdb.s1 --quiesce<br>
Domain snapshot s1 created<br>
# virsh dumpxml snap|awk '/<disk/,/<\/disk/'<br>
    <disk type='file' device='disk'><br>
      <driver name='qemu' type='qcow2' cache='none'/><br>
      <source file='/var/lib/libvirt/images/<wbr>snap.s1'/><br>
      <backingStore type='file' index='1'><br>
        <format type='qcow2'/><br>
        <source file='/var/lib/libvirt/images/<wbr>snap.qcow2'/><br>
        <backingStore/><br>
      </backingStore><br>
      <target dev='vda' bus='virtio'/><br>
      <alias name='virtio-disk0'/><br>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/><br>
    </disk><br>
    <disk type='file' device='disk'><br>
      <driver name='qemu' type='qcow2'/><br>
      <source file='/tmp/vdb.s1'/><br>
      <backingStore type='file' index='1'><br>
        <format type='raw'/><br>
        <source file='/tmp/vdb'/><br>
        <backingStore/><br>
      </backingStore><br>
      <target dev='vdb' bus='virtio'/><br>
      <alias name='virtio-disk1'/><br>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/><br>
    </disk><br>
<br>
Save the dumped vdb's xml to /tmp/vdb.xml<br>
# virsh detach-device snap /tmp/vdb.xml<br>
Device detached successfully<br>
# virsh attach-device snap /tmp/vdb.xml<br>
Device attached successfully<br>
# virsh dumpxml snap|awk '/<disk/,/<\/disk/'<br>
    <disk type='file' device='disk'><br>
      <driver name='qemu' type='qcow2' cache='none'/><br>
      <source file='/var/lib/libvirt/images/<wbr>snap.s1'/><br>
      <backingStore type='file' index='1'><br>
        <format type='qcow2'/><br>
        <source file='/var/lib/libvirt/images/<wbr>snap.qcow2'/><br>
        <backingStore/><br>
      </backingStore><br>
      <target dev='vda' bus='virtio'/><br>
      <alias name='virtio-disk0'/><br>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/><br>
    </disk><br>
    <disk type='file' device='disk'><br>
      <driver name='qemu' type='qcow2'/><br>
      <source file='/tmp/vdb.s1'/><br>
      <backingStore type='file' index='1'><br>
        <format type='raw'/><br>
        <source file='/tmp/vdb'/><br>
        <backingStore/><br>
      </backingStore><br>
      <target dev='vdb' bus='virtio'/><br>
      <alias name='virtio-disk1'/><br>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/><br>
    </disk><br>
<br>
So I managed to attach disks with snapshot.<br>
I want to know what is your libvirt and qemu-kvm version?<br>
And can you provide your files: /tmp/disk.xml[1], /tmp/snap-from-disk.xml[2], /tmp/disk-with-snap.xml[4], /tmp/disk-with-snap.xml . I need more details.<br>
<br>
Han Han<br>
<div><div><br>
----- Original Message -----<br>
From: "Erlon Cruz" <<a href="mailto:sombrafam@gmail.com" target="_blank">sombrafam@gmail.com</a>><br>
To: <a href="mailto:libvirt-users@redhat.com" target="_blank">libvirt-users@redhat.com</a><br>
Sent: Friday, August 12, 2016 10:23:24 AM<br>
Subject: [libvirt-users] Attaching disks with external snapshots<br>
<br>
Hi folks,<br>
<br>
I'm trying to to attach a disk to an instance using libvirt. The problem is, this disk has external snapshots. The process tried was:<br>
<br>
1 - Attach a disk in the domain:<br>
virsh# attach-device instance-00000006 /tmp/disk.xml[1] --live<br>
<br>
2 - Snapshot the disk[2]:<br>
virsh# snapshot-create instance-00000006 --quiesce --xmlfile /tmp/snap-from-disk.xml[2] --disk-only<br>
<br>
3 - Dump the domain XML and create a new disk file from it:<br>
virsh# dumpxml instance-00000006<br>
... [3]<br>
<br>
4 - Dettach the device and re-add it using the new disk file:<br>
virsh# detach-device instance-00000006 /tmp/disk-with-snap.xml[4]<br>
Device detached successfully<br>
virsh# attach-device instance-00000006 /tmp/disk-with-snap.xml<br>
error: Failed to attach device from /tmp/disk-with-snap.xml<br>
error: internal error: unable to execute QEMU command 'device_add': Property 'virtio-blk-device.drive' can't find value 'drive-virtio-disk1'<br>
<br>
Question, is this operation supported? If yes, how is the correct procedure?<br>
<br>
Erlon<br>
<br>
<br>
[1] <a href="http://paste.openstack.org/show/556055/" rel="noreferrer" target="_blank">http://paste.openstack.org/sho<wbr>w/556055/</a><br>
[2] <a href="http://paste.openstack.org/show/556056/" rel="noreferrer" target="_blank">http://paste.openstack.org/sho<wbr>w/556056/</a><br>
[3] <a href="http://paste.openstack.org/show/556063/" rel="noreferrer" target="_blank">http://paste.openstack.org/sho<wbr>w/556063/</a><br>
[4] <a href="http://paste.openstack.org/show/556064/" rel="noreferrer" target="_blank">http://paste.openstack.org/sho<wbr>w/556064/</a><br>
<br>
</div></div>______________________________<wbr>_________________<br>
libvirt-users mailing list<br>
<a href="mailto:libvirt-users@redhat.com" target="_blank">libvirt-users@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/libvirt-users" rel="noreferrer" target="_blank">https://www.redhat.com/mailman<wbr>/listinfo/libvirt-users</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>