MCPcopy Index your code
hub / github.com/containerd/containerd / RemovePool

Method RemovePool

plugins/snapshots/devmapper/pool_device.go:586–606  ·  view source on GitHub ↗

RemovePool deactivates all child thin-devices and removes thin-pool device

(ctx context.Context)

Source from the content-addressed store, hash-verified

584
585// RemovePool deactivates all child thin-devices and removes thin-pool device
586func (p *PoolDevice) RemovePool(ctx context.Context) error {
587 deviceNames, err := p.metadata.GetDeviceNames(ctx)
588 if err != nil {
589 return fmt.Errorf("can't query device names: %w", err)
590 }
591
592 var result []error
593
594 // Deactivate devices if any
595 for _, name := range deviceNames {
596 if err := p.DeactivateDevice(ctx, name, true, true); err != nil {
597 result = append(result, fmt.Errorf("failed to remove %q: %w", name, err))
598 }
599 }
600
601 if err := dmsetup.RemoveDevice(p.poolName, dmsetup.RemoveWithForce, dmsetup.RemoveWithRetries, dmsetup.RemoveDeferred); err != nil {
602 result = append(result, fmt.Errorf("failed to remove pool %q: %w", p.poolName, err))
603 }
604
605 return errors.Join(result...)
606}
607
608// MarkDeviceState changes the device's state in metastore
609func (p *PoolDevice) MarkDeviceState(ctx context.Context, name string, state DeviceState) error {

Callers 2

TestPoolDeviceFunction · 0.95
createSnapshotterFunction · 0.80

Calls 3

DeactivateDeviceMethod · 0.95
RemoveDeviceFunction · 0.92
GetDeviceNamesMethod · 0.80

Tested by 2

TestPoolDeviceFunction · 0.76
createSnapshotterFunction · 0.64