mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #32468 from coolljt0725/clean_thin
devicemapper: remove thin pool if 'initDevmapper' failed
This commit is contained in:
commit
bccebdac18
1 changed files with 9 additions and 1 deletions
|
@ -1689,7 +1689,7 @@ func (devices *DeviceSet) enableDeferredRemovalDeletion() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (devices *DeviceSet) initDevmapper(doInit bool) error {
|
func (devices *DeviceSet) initDevmapper(doInit bool) (retErr error) {
|
||||||
// give ourselves to libdm as a log handler
|
// give ourselves to libdm as a log handler
|
||||||
devicemapper.LogInit(devices)
|
devicemapper.LogInit(devices)
|
||||||
|
|
||||||
|
@ -1871,6 +1871,14 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
|
||||||
if err := devicemapper.CreatePool(devices.getPoolName(), dataFile, metadataFile, devices.thinpBlockSize); err != nil {
|
if err := devicemapper.CreatePool(devices.getPoolName(), dataFile, metadataFile, devices.thinpBlockSize); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
defer func() {
|
||||||
|
if retErr != nil {
|
||||||
|
err = devices.deactivatePool()
|
||||||
|
if err != nil {
|
||||||
|
logrus.Warnf("devmapper: Failed to deactivatePool: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pool already exists and caller did not pass us a pool. That means
|
// Pool already exists and caller did not pass us a pool. That means
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue