Changing 'source file' on running VM.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



So I notice that some operations by libvirt such as creating a snapshot actually change the source of the active disk image for a domain without requiring a restart of the vm. How can this be achieved manually? There are instances where I am manipulating files with qemu-img or virsh commands and afterward need to change what file the vm is using as its disk. One example is when deleting a snapshot. Please see example below:
 
===============================================================
root >#virsh snapshot-create-as --domain $DOMAIN $SNAP $DESC --disk-only --diskspec vda,snapshot=external,file=/var/lib/libvirt/images/${SNAPFILE} --atomic
Domain snapshot ballyclient-1.snap1 created
root >#virsh dumpxml $DOMAIN | grep 'source file'
      <source file='/var/lib/libvirt/images/ballyclient-1.snap1.qcow2'/>
root >#virsh snapshot-delete --metadata $DOMAIN $SNAP
Domain snapshot ballyclient-1.snap1 deleted
  
root >#find /var/lib/libvirt/images/ -type f -name $SNAPFILE -delete
root >#virsh dumpxml $DOMAIN |grep 'source file'
      <source file='/var/lib/libvirt/images/ballyclient-1.snap1.qcow2'/>
root >#virsh dumpxml $DOMAIN | sed 's/snap1\.//g' >/tmp/$DOMAIN.xml && virsh define /tmp/$DOMAIN.xml && virsh destroy $DOMAIN  && virsh start $DOMAIN && virsh dumpxml $DOMAIN | grep 'source file'
Domain ballyclient-1 defined from /tmp/ballyclient-1.xml
Domain ballyclient-1 destroyed
Domain ballyclient-1 started
      <source file='/var/lib/libvirt/images/ballyclient-1.qcow2'/>
root >#
===============================================================

So how could I have told libvirt to go back to using the original base image as 'source file' after deleting the snapshot? I am guessing this is something trivial but `man virsh` has not helped me on this one. 

Mathew Moon
Systems Administrator

Cell: (205) 514-5058

_______________________________________________
libvirt-users mailing list
libvirt-users@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvirt-users

[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux