On 04/17/2013 12:14 PM, Eric Blake wrote: > Or, written another way, to implement the same results in only two coded > loops:
Missed a line:
>
> if name is set:
> if there is a snapshot with that name (loop 1):
> if id is set:
> if id matches:
> end searching successfully
> else:
> fail
> else:
> end searching successfully
> else if id is not set:
> set id to name
These two lines should instead be:
else if id is set:
fail
set id to name
> if there is a snapshot with id (loop 2):
> end searching successfully
and of course, all of the algorithms have an implied fail if you make it
through all of the loops without a successful search end.
The tweak above is needed so that a find(id, tag) that fails a tag
lookup does not then succeed on an id lookup.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
