summaryrefslogtreecommitdiff
path: root/libpod/driver/driver.go
blob: 6fe2cf8ac15cd7fa1ab60541ad0d33f47817010f (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/v3/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
}