image: Detect cycles in image volume chain

When sorting volume chains, we could get into an endless loop if there
was a cycle in the volume chain, for example, a volume claiming to be
its own parent.  The endless loop create a new volume object on each
iteration, and adds it to the chain list, and will stop only when no
more memory is available or vdsm is stopped.

Now ImageIsNotLegalChain is raised as soon as a cycle is detected.

Change-Id: I687335f17bc7810071ba3523cba8ad980e7d5bdb
Bug-Url: https://bugzilla.redhat.com/1125197
Relates-To: https://bugzilla.redhat.com/1124498
Signed-off-by: Nir Soffer <nsoffer@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/30867
Reviewed-by: Allon Mureinik <amureini@redhat.com>
Reviewed-by: Federico Simoncelli <fsimonce@redhat.com>