clone: don't ever mark the clone's rootfs as being the old, on disk
clone: don't ever mark the clone's rootfs as being the old, on disk

Otherwise an interrupted clone can lead to the original rootfs
being delete.

There is a period during lxcapi_clone during which we have written down
a temporary configuration file on disk, for the new container, using the
old rootfs. Interruption of clone doesn't allow us to do the cleanup we
do in error paths, so a subsequent lxc-destroy removes the old rootfs.

Fix this by doing the copy_storage as early as possible, and not
writing down the rootfs when we write down the temporary configuration
file.

(note - I tested this by putting a series of
'if (strcmp(newname, "u%d") == 0) exit(1)' inline to trigger
interruption between most blocks.  If someone has a good idea
for a generic way to regression-test this henceforth that'd be
great)

See https://bugs.launchpad.net/lxc/+bug/1285850

Signed-off-by: Serge Hallyn <3df611b026e4639bee8aef7a4beb2e39fcebb313@ubuntu.com>
Acked-by: Stéphane Graber <089afc6d81f66f1168a9849e15660feae286e024@ubuntu.com>

ojkastl/lxc_Patches,ojkastl/lxc_Patches,ojkastl/lxc_Patches,ojkastl/lxc_Patches