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,6 +274,7 @@ func Version() (string, error) {
|
|||||||
|
|
||||||
// DeviceStatus represents devmapper device status information
|
// DeviceStatus represents devmapper device status information
|
||||||
type DeviceStatus struct {
|
type DeviceStatus struct {
|
||||||
|
RawOutput string
|
||||||
Offset int64
|
Offset int64
|
||||||
Length int64
|
Length int64
|
||||||
Target string
|
Target string
|
||||||
@ -291,6 +292,7 @@ func Status(deviceName string) (*DeviceStatus, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
status.RawOutput = output
|
||||||
|
|
||||||
// Status output format:
|
// Status output format:
|
||||||
// Offset (int64)
|
// 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 {
|
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
|
// 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,
|
return nil, multierror.Append(err,
|
||||||
s.pool.RemoveDevice(ctx, deviceName))
|
s.pool.RemoveDevice(ctx, deviceName))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user