if the Rename during an image delete fails, just delete the original dir
Signed-off-by: Doug Davis <dug@us.ibm.com>
This commit is contained in:
parent
5ad82d3ea6
commit
86a3a9a282
1 changed files with 10 additions and 6 deletions
|
@ -302,13 +302,17 @@ func (graph *Graph) Delete(name string) error {
|
|||
return err
|
||||
}
|
||||
tmp, err := graph.Mktemp("")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
graph.idIndex.Delete(id)
|
||||
err = os.Rename(graph.ImageRoot(id), tmp)
|
||||
if err != nil {
|
||||
return err
|
||||
if err == nil {
|
||||
err = os.Rename(graph.ImageRoot(id), tmp)
|
||||
// On err make tmp point to old dir and cleanup unused tmp dir
|
||||
if err != nil {
|
||||
os.RemoveAll(tmp)
|
||||
tmp = graph.ImageRoot(id)
|
||||
}
|
||||
} else {
|
||||
// On err make tmp point to old dir for cleanup
|
||||
tmp = graph.ImageRoot(id)
|
||||
}
|
||||
// Remove rootfs data from the driver
|
||||
graph.driver.Remove(id)
|
||||
|
|
Loading…
Reference in a new issue