Merge pull request #5283 from alakesh/check-out-of-space
devmapper: log pool status when mkfs fails
This commit is contained in:
commit
b7c8136901
@ -274,10 +274,11 @@ func Version() (string, error) {
|
||||
|
||||
// DeviceStatus represents devmapper device status information
|
||||
type DeviceStatus struct {
|
||||
Offset int64
|
||||
Length int64
|
||||
Target string
|
||||
Params []string
|
||||
RawOutput string
|
||||
Offset int64
|
||||
Length int64
|
||||
Target string
|
||||
Params []string
|
||||
}
|
||||
|
||||
// Status provides status information for devmapper device
|
||||
@ -291,6 +292,7 @@ func Status(deviceName string) (*DeviceStatus, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
status.RawOutput = output
|
||||
|
||||
// Status output format:
|
||||
// Offset (int64)
|
||||
|
@ -366,8 +366,13 @@ func (s *Snapshotter) createSnapshot(ctx context.Context, kind snapshots.Kind, k
|
||||
}
|
||||
|
||||
if err := mkfs(ctx, dmsetup.GetFullDevicePath(deviceName)); err != nil {
|
||||
status, sErr := dmsetup.Status(s.pool.poolName)
|
||||
if sErr != nil {
|
||||
multierror.Append(err, sErr)
|
||||
}
|
||||
|
||||
// Rollback thin device creation if mkfs failed
|
||||
log.G(ctx).WithError(err).Errorf("failed to initialize thin device %q for snapshot %s", deviceName, snap.ID)
|
||||
log.G(ctx).WithError(err).Errorf("failed to initialize thin device %q for snapshot %s pool status %s", deviceName, snap.ID, status.RawOutput)
|
||||
return nil, multierror.Append(err,
|
||||
s.pool.RemoveDevice(ctx, deviceName))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user