(ctx context.Context, baseInfo, snapInfo *DeviceInfo)
| 375 | } |
| 376 | |
| 377 | func (p *PoolDevice) createSnapshot(ctx context.Context, baseInfo, snapInfo *DeviceInfo) error { |
| 378 | if err := p.transition(ctx, snapInfo.Name, Creating, Created, func() error { |
| 379 | return dmsetup.CreateSnapshot(p.poolName, snapInfo.DeviceID, baseInfo.DeviceID) |
| 380 | }); err != nil { |
| 381 | return fmt.Errorf( |
| 382 | "failed to create snapshot %q (dev: %d) from %q (dev: %d): %w", |
| 383 | snapInfo.Name, |
| 384 | snapInfo.DeviceID, |
| 385 | baseInfo.Name, |
| 386 | baseInfo.DeviceID, err, |
| 387 | ) |
| 388 | } |
| 389 | |
| 390 | return nil |
| 391 | } |
| 392 | |
| 393 | // SuspendDevice flushes the outstanding IO and blocks the further IO |
| 394 | func (p *PoolDevice) SuspendDevice(ctx context.Context, deviceName string) error { |
no test coverage detected