Domain snapshot names can have ending spaces

Bug #1036973 reported by vincent
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libvirt (Ubuntu)
Confirmed
Low
Unassigned

Bug Description

Platform: Ubuntu 12.04 LTS

i create two snapshot on guest snap_rhel_vnx

------------ snap1-rhel_vnx --------------
virsh # snapshot-create snap_rhel_vnx /etc/libvirt/qemu/snap_rhel_vnx_basesnap.xml
Domain snapshot snap1-rhel_vnx created from '/etc/libvirt/qemu/snap_rhel_vnx_basesnap.xml'

-------------- 1344991717 ---------------
virsh # snapshot-create snap_rhel_vnx
Domain snapshot 1344991717 created

virsh # snapshot-list snap_rhel_vnx
 Name Creation Time State
------------------------------------------------------------
 1344991717 2012-08-14 20:48:37 -0400 running
 snap1-rhel_vnx 2012-08-14 20:44:27 -0400 running

here is xml for snap1-rhel_vnx
<domainsnapshot>
    <name>snap1-rhel_vnx </name>
    <description>base snapshot when os install </description>
</domainsnapshot>

So far everything is ok. However there is problem when reverting back to "snap1-rhel_vnx"

virsh # snapshot-revert snap_rhel_vnx snap1-rhel_vnx
error: Domain snapshot not found: no snapshot with matching name 'snap1-rhel_vnx'

revert to " 1344991717 " is ok.

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Thanks for submitting this bug.

I can't reproduce this. There is an oddity in the bug description, in that you
use the same name for the domain and the snapshot. When I use 'p1-clone' for
both the domain and snapshot name (as you did), then I need to revert using

 virsh snapshot-revert p1-clone --snapshotname p1-clone

If I simply try

 virsh snapshot-revert p1-clone

I get

 error: --snapshotname or --current is required

which is not the same error you show. (The .xml I used was

<domainsnapshot>
    <name>p1-clone</name>
    <description> p1 clone base snapshot </description>
</domainsnapshot>

and I defined it, for domain p1-clone, using

 virsh snapshot-create p1-clone snapshot-p1-clone2.xml
)

I've marked this bug as affecting libvirt. Please do

 apport-collect 1036973

to have apport submit some information about your libvirt installation.

I'd highly recommend working around this by using a snapshot name which
is not the same as the domain name. If that doesn't work either, please
reply and let us know.

Changed in libvirt (Ubuntu):
importance: Undecided → Low
Changed in qemu-kvm (Ubuntu):
status: New → Invalid
Changed in libvirt (Ubuntu):
status: New → Incomplete
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

(Marking low priority as I believe there is a workaround).

Revision history for this message
vincent (vincent-y-chen) wrote :

the snapshot name and domain are similar, but not same. Sorry to make you confuse.
domain name: snap_rhel_vnx
snapshot name: snap1-rhel_vnx

Finally i find the root casue, which is the snapshot name

<domainsnapshot>
    <name>snap1-rhel_vnx </name>
    <description>base snapshot when os install </description>
</domainsnapshot>

there is the blank at end of snapshot name, so the snapshot name is "snap1-rhel_vnx " not "snap1-rhel_vnx"
the revert process success when i change to "snap1-rhel_vnx ".

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Oh, sorry about that.

I'm not sure whether the space would be deemed a bug or a feature, but I'm going to guess bug and mark this confirmed.

Changed in libvirt (Ubuntu):
status: Incomplete → Confirmed
summary: - Domain snapshot not found with name
+ Domain snapshot names can have ending spaces
no longer affects: qemu-kvm (Ubuntu)
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Just a note to say I just tested and this is still the case in utopic. I believe a satisfactory fix would be to either refuse spaces at the end, or to have snapshot-list indicate the spaces at the end.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.