<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <div class="moz-cite-prefix">On 12/06/2014 03:33 PM, Eric Blake
      wrote:<br>
    </div>
    <blockquote cite="mid:5482B137.4050506@redhat.com" type="cite">
      <pre wrap="">I just found out the hard way that we have a bug in snapshot-create-as,
when I corrupted a guest.  I was testing with an offline domain:

# virsh dumpxml win64 |grep -C1 driver
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw'/>
      <source dev='/dev/sda4'/>
# virsh snapshot-create-as win64 --disk-only --diskspec
hda,file=/var/lib/libvirt/images/win64.qcow2 --no-metadata
Domain snapshot 1417850911 created
# virsh dumpxml win64 |grep -C1 driver
    <disk type='block' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source dev='/var/lib/libvirt/images/win64.qcow2'/>
# systemctl restart libvirtd
# virsh dumpxml win64 |grep -C1 driver
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw'/>
      <source dev='/dev/sda4'/>

Even though we don't want to save the snapshot metadata, we DO need to
save the XML change.  Otherwise, the restarted libvirtd sees the wrong
disk as the source; worse, if the user started the guest before
restarting libvirtd, they run the risk of accidentally reverting to the
pre-snapshot state and losing all changes they made in the meantime,
perhaps even getting their guest filesystem into an inconsistent state.

I'm out of time to get to a root cause or fix before next week, but
wanted to report it now.  I'm not sure if --no-metadata is essential to
reproducing the bug, or if it happens in all cases.
</pre>
    </blockquote>
    <br>
    Hi Eric,<br>
    I can reproduce it without "--no-metadata" option. Can you give the
    bug number if you have file it so that QE can track it<br>
    I post a patch
    <a class="moz-txt-link-freetext" href="http://www.redhat.com/archives/libvir-list/2014-December/msg00369.html">http://www.redhat.com/archives/libvir-list/2014-December/msg00369.html</a>.
    It works for me after a simple test<br>
    <br>
    <br>
    <blockquote cite="mid:5482B137.4050506@redhat.com" type="cite">
      <pre wrap="">
</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">--
libvir-list mailing list
<a class="moz-txt-link-abbreviated" href="mailto:libvir-list@redhat.com">libvir-list@redhat.com</a>
<a class="moz-txt-link-freetext" href="https://www.redhat.com/mailman/listinfo/libvir-list">https://www.redhat.com/mailman/listinfo/libvir-list</a></pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Regards
shyu</pre>
  </body>
</html>