Skip to content
Snippets Groups Projects
Commit 7d3484b8 authored by Klaus Aehlig's avatar Klaus Aehlig Committed by Guido Trotter
Browse files

Make _CreateDisk clean up partially created disks on failure


_CreateDisk used to just throw an exception if _CreateBlockDev failed
leaving the caller in the state that some disks were created, without
precise knowledge which. Usually, the clean up then overapproximated
by removing all disks of the instance. This can cause data loss in case
the disk creation failed because of a file being already in the place
where the disk is to be created.

With this patch, upon failure, _CreateDisk removes the disks that were
successfully created, leaving a well-defined state.

Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 7fb852bd
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment