[libvirt-users] snapshot troubles

Dear all, I created some snapshots, a long time ago, using the xml description option, so the snapshots have a name with a space in it... Really a bad choice apparently, since it seems impossible to delete them now: I cannot find how to enter the snapshot name properly due to the space. Quotes don't seem to help; escaping the space doesn't help either. Anybody knows how to solve this? eg: snapshot-delete DOMINO1-prealloc --snapshotname 'W2K3-virgin install' error: Domain snapshot not found: no snapshot with matching name ''W2K3-virgin' (-> notive also the extra ' added ) root@VLET3:~# time virsh snapshot-delete DOMINO1-prealloc "W2K3-virgin\ install" error: unexpected data 'install' Thanks, Juergen

On 01/21/2013 03:43 PM, jurgen.depicker@let.be wrote:
Dear all, I created some snapshots, a long time ago, using the xml description option, so the snapshots have a name with a space in it... Really a bad choice apparently, since it seems impossible to delete them now: I cannot find how to enter the snapshot name properly due to the space. Quotes don't seem to help; escaping the space doesn't help either. Anybody knows how to solve this? eg: snapshot-delete DOMINO1-prealloc --snapshotname 'W2K3-virgin install'
What version of libvirt are you using? And is this within the virsh batch mode, or from the command line?
error: Domain snapshot not found: no snapshot with matching name ''W2K3-virgin' (-> notive also the extra ' added )
That's not supposed to happen; quoting of spaces is supposed to mimic shell quoting, so that you can use arguments with spaces in both command line and batch mode. To test: # virsh echo two spaces two spaces # virsh echo 'two spaces' two spaces # virsh Welcome to virsh, the virtualization interactive terminal. Type: 'help' for help with commands 'quit' to quit virsh # echo two spaces two spaces virsh # echo 'two spaces' two spaces virsh # quit
root@VLET3:~# time virsh snapshot-delete DOMINO1-prealloc "W2K3-virgin\ install" error: unexpected data 'install'
I'm not reproducing this; I tested with libvirt 0.10.2.2 (Fedora 18): # virsh snapshot-list fedora-local Name Creation Time State ------------------------------------------------------------ name with spaces 2013-01-22 09:05:07 -0700 shutoff # virsh snapshot-delete fedora-local 'name with spaces' Domain snapshot name with spaces deleted -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

Dear all, I created some snapshots, a long time ago, using the xml description option, so the snapshots have a name with a space in it... Really a bad choice apparently, since it seems impossible to delete
On 01/21/2013 03:43 PM, jurgen.depicker@let.be wrote: them
now: I cannot find how to enter the snapshot name properly due to the space. Quotes don't seem to help; escaping the space doesn't help either. Anybody knows how to solve this? eg: snapshot-delete DOMINO1-prealloc --snapshotname 'W2K3-virgin install'
What version of libvirt are you using? And is this within the virsh batch mode, or from the command line? root@VLET3:~# virsh --version 0.8.3 (ubuntu 10.10 : I cannot upgrade it right now; I need to wait at least a month but need to remove the snapshots since I run out of disk space...) The error happens both on command-line and batch mode.
error: Domain snapshot not found: no snapshot with matching name ''W2K3-virgin' (-> notive also the extra ' added )
That's not supposed to happen; quoting of spaces is supposed to mimic shell quoting, so that you can use arguments with spaces in both command line and batch mode. To test:
# virsh echo two spaces two spaces # virsh echo 'two spaces' two spaces
root@VLET3:~# virsh echo two spaces error: unknown command: 'echo' So, or I pray that my 20G remaining will suffice for one more month, or maybe someone knows how to rename a snapshot, or edit some config file where that name is configured? I am very very sorry to see that this bug was solved in later versions... but I really cannot upgrade that server now... Grts, J

On 01/22/2013 09:27 AM, jurgen.depicker@let.be wrote:
What version of libvirt are you using? And is this within the virsh batch mode, or from the command line? root@VLET3:~# virsh --version 0.8.3
That explains it. Older virsh had lousy command line handling.
root@VLET3:~# virsh echo two spaces error: unknown command: 'echo'
Yep, I added the 'virsh echo' command when I fixed command line parsing. Meanwhile, you don't have to use virsh. You could write your own C program that directly calls virDomainSnapshotDelete() from libvirt.so, or you could use python bindings. I'm not a python whiz, but I think it would probably be something like: $ python
import libvirt conn = libvirt.open(None) dom = conn.lookupByName("DOMINO1-prealloc") snap = dom.snapshotLookupByName("W2K3-virgin install", 0) snap.delete(0) quit()
So, or I pray that my 20G remaining will suffice for one more month, or maybe someone knows how to rename a snapshot, or edit some config file where that name is configured?
Just because virsh command-line parsing is lousy doesn't mean that the underlying APIs won't work - you just have to get at them from somewhere other than virsh. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

Meanwhile, you don't have to use virsh. You could write your own C program that directly calls virDomainSnapshotDelete() from libvirt.so, or you could use python bindings. I'm not a python whiz, but I think it would probably be something like:
$ python
import libvirt conn = libvirt.open(None) dom = conn.lookupByName("DOMINO1-prealloc") snap = dom.snapshotLookupByName("W2K3-virgin install", 0) snap.delete(0) quit()
Worked like a charm! Thanks a lot for the help!! Grts, J
participants (2)
-
Eric Blake
-
jurgen.depicker@let.be