Skip to content

Commit b7c8136

Browse files
authored
Merge pull request #5283 from alakesh/check-out-of-space
devmapper: log pool status when mkfs fails
2 parents 5dde642 + 5ce35ac commit b7c8136

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

snapshots/devmapper/dmsetup/dmsetup.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,11 @@ func Version() (string, error) {
274274

275275
// DeviceStatus represents devmapper device status information
276276
type DeviceStatus struct {
277-
Offset int64
278-
Length int64
279-
Target string
280-
Params []string
277+
RawOutput string
278+
Offset int64
279+
Length int64
280+
Target string
281+
Params []string
281282
}
282283

283284
// Status provides status information for devmapper device
@@ -291,6 +292,7 @@ func Status(deviceName string) (*DeviceStatus, error) {
291292
if err != nil {
292293
return nil, err
293294
}
295+
status.RawOutput = output
294296

295297
// Status output format:
296298
// Offset (int64)

snapshots/devmapper/snapshotter.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,13 @@ func (s *Snapshotter) createSnapshot(ctx context.Context, kind snapshots.Kind, k
366366
}
367367

368368
if err := mkfs(ctx, dmsetup.GetFullDevicePath(deviceName)); err != nil {
369+
status, sErr := dmsetup.Status(s.pool.poolName)
370+
if sErr != nil {
371+
multierror.Append(err, sErr)
372+
}
373+
369374
// Rollback thin device creation if mkfs failed
370-
log.G(ctx).WithError(err).Errorf("failed to initialize thin device %q for snapshot %s", deviceName, snap.ID)
375+
log.G(ctx).WithError(err).Errorf("failed to initialize thin device %q for snapshot %s pool status %s", deviceName, snap.ID, status.RawOutput)
371376
return nil, multierror.Append(err,
372377
s.pool.RemoveDevice(ctx, deviceName))
373378
}

0 commit comments

Comments
 (0)