1
vendor/github.com/google/cadvisor/container/crio/client.go
generated
vendored
1
vendor/github.com/google/cadvisor/container/crio/client.go
generated
vendored
@@ -44,6 +44,7 @@ var (
|
||||
type Info struct {
|
||||
StorageDriver string `json:"storage_driver"`
|
||||
StorageRoot string `json:"storage_root"`
|
||||
StorageImage string `json:"storage_image"`
|
||||
}
|
||||
|
||||
// ContainerInfo represents a given container information
|
||||
|
14
vendor/github.com/google/cadvisor/container/crio/factory.go
generated
vendored
14
vendor/github.com/google/cadvisor/container/crio/factory.go
generated
vendored
@@ -32,6 +32,9 @@ import (
|
||||
// The namespace under which crio aliases are unique.
|
||||
const CrioNamespace = "crio"
|
||||
|
||||
// The namespace suffix under which crio aliases are unique.
|
||||
const CrioNamespaceSuffix = ".scope"
|
||||
|
||||
// The namespace systemd runs components under.
|
||||
const SystemdNamespace = "system-systemd"
|
||||
|
||||
@@ -114,16 +117,21 @@ func (f *crioFactory) CanHandleAndAccept(name string) (bool, bool, error) {
|
||||
// TODO(runcom): should we include crio-conmon cgroups?
|
||||
return false, false, nil
|
||||
}
|
||||
if !strings.HasPrefix(path.Base(name), CrioNamespace) {
|
||||
return false, false, nil
|
||||
}
|
||||
if strings.HasPrefix(path.Base(name), SystemdNamespace) {
|
||||
return true, false, nil
|
||||
}
|
||||
if !strings.HasPrefix(path.Base(name), CrioNamespace) {
|
||||
return false, false, nil
|
||||
}
|
||||
// if the container is not associated with CRI-O, we can't handle it or accept it.
|
||||
if !isContainerName(name) {
|
||||
return false, false, nil
|
||||
}
|
||||
|
||||
if !strings.HasSuffix(path.Base(name), CrioNamespaceSuffix) {
|
||||
// this mean it's a sandbox container
|
||||
return true, false, nil
|
||||
}
|
||||
return true, true, nil
|
||||
}
|
||||
|
||||
|
2
vendor/github.com/google/cadvisor/container/crio/plugin.go
generated
vendored
2
vendor/github.com/google/cadvisor/container/crio/plugin.go
generated
vendored
@@ -40,7 +40,7 @@ func (p *plugin) InitializeFSContext(context *fs.Context) error {
|
||||
if err != nil {
|
||||
klog.V(5).Infof("CRI-O not connected: %v", err)
|
||||
} else {
|
||||
context.Crio = fs.CrioContext{Root: crioInfo.StorageRoot}
|
||||
context.Crio = fs.CrioContext{Root: crioInfo.StorageRoot, ImageStore: crioInfo.StorageImage, Driver: crioInfo.StorageDriver}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
28
vendor/github.com/google/cadvisor/fs/fs.go
generated
vendored
28
vendor/github.com/google/cadvisor/fs/fs.go
generated
vendored
@@ -43,6 +43,7 @@ const (
|
||||
LabelSystemRoot = "root"
|
||||
LabelDockerImages = "docker-images"
|
||||
LabelCrioImages = "crio-images"
|
||||
LabelCrioContainers = "crio-containers"
|
||||
DriverStatusPoolName = "Pool Name"
|
||||
DriverStatusDataLoopFile = "Data loop file"
|
||||
)
|
||||
@@ -295,14 +296,37 @@ func (i *RealFsInfo) addDockerImagesLabel(context Context, mounts []*mount.Info)
|
||||
}
|
||||
|
||||
func (i *RealFsInfo) addCrioImagesLabel(context Context, mounts []*mount.Info) {
|
||||
labelCrioImageOrContainers := LabelCrioContainers
|
||||
// If imagestore is not specified, let's fall back to the original case.
|
||||
// Everything will be stored in crio-images
|
||||
if context.Crio.ImageStore == "" {
|
||||
labelCrioImageOrContainers = LabelCrioImages
|
||||
}
|
||||
if context.Crio.Root != "" {
|
||||
crioPath := context.Crio.Root
|
||||
crioImagePaths := map[string]struct{}{
|
||||
"/": {},
|
||||
}
|
||||
for _, dir := range []string{"devicemapper", "btrfs", "aufs", "overlay", "zfs"} {
|
||||
crioImagePaths[path.Join(crioPath, dir+"-images")] = struct{}{}
|
||||
imageOrContainerPath := context.Crio.Driver + "-containers"
|
||||
if context.Crio.ImageStore == "" {
|
||||
// If ImageStore is not specified then we will assume ImageFs is complete separate.
|
||||
// No need to split the image store.
|
||||
imageOrContainerPath = context.Crio.Driver + "-images"
|
||||
|
||||
}
|
||||
crioImagePaths[path.Join(crioPath, imageOrContainerPath)] = struct{}{}
|
||||
for crioPath != "/" && crioPath != "." {
|
||||
crioImagePaths[crioPath] = struct{}{}
|
||||
crioPath = filepath.Dir(crioPath)
|
||||
}
|
||||
i.updateContainerImagesPath(labelCrioImageOrContainers, mounts, crioImagePaths)
|
||||
}
|
||||
if context.Crio.ImageStore != "" {
|
||||
crioPath := context.Crio.ImageStore
|
||||
crioImagePaths := map[string]struct{}{
|
||||
"/": {},
|
||||
}
|
||||
crioImagePaths[path.Join(crioPath, context.Crio.Driver+"-images")] = struct{}{}
|
||||
for crioPath != "/" && crioPath != "." {
|
||||
crioImagePaths[crioPath] = struct{}{}
|
||||
crioPath = filepath.Dir(crioPath)
|
||||
|
4
vendor/github.com/google/cadvisor/fs/types.go
generated
vendored
4
vendor/github.com/google/cadvisor/fs/types.go
generated
vendored
@@ -38,7 +38,9 @@ type PodmanContext struct {
|
||||
}
|
||||
|
||||
type CrioContext struct {
|
||||
Root string
|
||||
Root string
|
||||
ImageStore string
|
||||
Driver string
|
||||
}
|
||||
|
||||
type DeviceInfo struct {
|
||||
|
6
vendor/github.com/google/cadvisor/perf/collector_libpfm.go
generated
vendored
6
vendor/github.com/google/cadvisor/perf/collector_libpfm.go
generated
vendored
@@ -253,9 +253,9 @@ func (c *collector) createLeaderFileDescriptors(events []Event, cgroupFd int, gr
|
||||
}
|
||||
|
||||
func readPerfEventAttr(name string, pfmGetOsEventEncoding func(string, unsafe.Pointer) error) (*unix.PerfEventAttr, error) {
|
||||
perfEventAttrMemory := C.malloc(C.ulong(unsafe.Sizeof(unix.PerfEventAttr{})))
|
||||
perfEventAttrMemory := C.malloc(C.size_t(unsafe.Sizeof(unix.PerfEventAttr{})))
|
||||
// Fill memory with 0 values.
|
||||
C.memset(perfEventAttrMemory, 0, C.ulong(unsafe.Sizeof(unix.PerfEventAttr{})))
|
||||
C.memset(perfEventAttrMemory, 0, C.size_t(unsafe.Sizeof(unix.PerfEventAttr{})))
|
||||
err := pfmGetOsEventEncoding(name, unsafe.Pointer(perfEventAttrMemory))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -269,7 +269,7 @@ func pfmGetOsEventEncoding(name string, perfEventAttrMemory unsafe.Pointer) erro
|
||||
defer C.free(unsafe.Pointer(fstr))
|
||||
event.fstr = unsafe.Pointer(fstr)
|
||||
event.attr = perfEventAttrMemory
|
||||
event.size = C.ulong(unsafe.Sizeof(event))
|
||||
event.size = C.size_t(unsafe.Sizeof(event))
|
||||
cSafeName := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(cSafeName))
|
||||
pErr := C.pfm_get_os_event_encoding(cSafeName, C.PFM_PLM0|C.PFM_PLM3, C.PFM_OS_PERF_EVENT, unsafe.Pointer(&event))
|
||||
|
2
vendor/github.com/google/cadvisor/stats/types.go
generated
vendored
2
vendor/github.com/google/cadvisor/stats/types.go
generated
vendored
@@ -22,7 +22,7 @@ import info "github.com/google/cadvisor/info/v1"
|
||||
// For each container detected by the cAdvisor manager, it will call
|
||||
// GetCollector() with the devices cgroup path for that container.
|
||||
// GetCollector() is supposed to return an object that can update
|
||||
// accelerator stats for that container.
|
||||
// external stats for that container.
|
||||
type Manager interface {
|
||||
Destroy()
|
||||
GetCollector(deviceCgroup string) (Collector, error)
|
||||
|
Reference in New Issue
Block a user