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

Method RemoveDevice

plugins/snapshots/devmapper/metadata.go:274–291  ·  view source on GitHub ↗

RemoveDevice removes device info from store.

(ctx context.Context, name string)

Source from the content-addressed store, hash-verified

272
273// RemoveDevice removes device info from store.
274func (m *PoolMetadata) RemoveDevice(ctx context.Context, name string) error {
275 return m.db.Update(func(tx *bolt.Tx) error {
276 var (
277 device = &DeviceInfo{}
278 bucket = tx.Bucket(devicesBucketName)
279 )
280
281 if err := getObject(bucket, name, device); err != nil {
282 return err
283 }
284
285 if err := bucket.Delete([]byte(name)); err != nil {
286 return fmt.Errorf("failed to delete device info for %q: %w", name, err)
287 }
288
289 return markDeviceID(tx, device.DeviceID, deviceFree)
290 })
291}
292
293// WalkDevices walks all devmapper devices in metadata store and invokes the callback with device info.
294// The provided callback function must not modify the bucket.

Callers 7

removeDeviceMethod · 0.45
ResetPoolMethod · 0.45
createSnapshotMethod · 0.45
CleanupMethod · 0.45
testRemoveThinDeviceFunction · 0.45

Calls 4

getObjectFunction · 0.85
markDeviceIDFunction · 0.85
UpdateMethod · 0.65
DeleteMethod · 0.65

Tested by 3

testRemoveThinDeviceFunction · 0.36