Check the instance ID before creating it

At least with libvirt 1.x instance goes into shutdown state
before its ID is changed. This means that there's a race
condition during reboot where nova might try to create an
instance that's already defined. By checking if the ID of
the new and old instance is the same, we avoid that situation
and reiterate on the loop.

The tests for this are added in
I6215f80bd15820dac80151e7063916dbbc21d761

Change-Id: I493b828f0c6848fbadc591be2f47fd1b12fd3a51
Fixes: bug 1181924
Merge "Check the instance ID before creating it"