aboutsummaryrefslogtreecommitdiff
path: root/libpod/driver/driver.go
blob: 8694685ffcf24d6486efc47a8948c0b04a2d0b51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package driver

import (
	"github.com/containers/podman/v4/libpod/define"
	"github.com/containers/storage"
)

// GetDriverData returns information on a given store's running graph driver.
func GetDriverData(store storage.Store, layerID string) (*define.DriverData, error) {
	driver, err := store.GraphDriver()
	if err != nil {
		return nil, err
	}
	metaData, err := driver.Metadata(layerID)
	if err != nil {
		return nil, err
	}
	if mountTimes, err := store.Mounted(layerID); mountTimes == 0 || err != nil {
		delete(metaData, "MergedDir")
	}

	return &define.DriverData{
		Name: driver.String(),
		Data: metaData,
	}, nil
}