remove dead code
This commit is contained in:
parent
13674cf06c
commit
9931854585
@ -131,16 +131,6 @@ func ContainerNameToDockerId(name string) string {
|
|||||||
return id
|
return id
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns a full container name for the specified Docker ID.
|
|
||||||
func FullContainerName(dockerId string) string {
|
|
||||||
// Add the full container name.
|
|
||||||
if UseSystemd() {
|
|
||||||
return path.Join("/system.slice", fmt.Sprintf("docker-%s.scope", dockerId))
|
|
||||||
} else {
|
|
||||||
return path.Join("/docker", dockerId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Docker handles all containers under /docker
|
// Docker handles all containers under /docker
|
||||||
func (self *dockerFactory) CanHandleAndAccept(name string) (bool, bool, error) {
|
func (self *dockerFactory) CanHandleAndAccept(name string) (bool, bool, error) {
|
||||||
// docker factory accepts all containers it can handle.
|
// docker factory accepts all containers it can handle.
|
||||||
|
@ -294,33 +294,9 @@ func (self *dockerContainerHandler) GetStats() (*info.ContainerStats, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (self *dockerContainerHandler) ListContainers(listType container.ListType) ([]info.ContainerReference, error) {
|
func (self *dockerContainerHandler) ListContainers(listType container.ListType) ([]info.ContainerReference, error) {
|
||||||
if self.name != "/docker" {
|
// No-op for Docker driver.
|
||||||
return []info.ContainerReference{}, nil
|
return []info.ContainerReference{}, nil
|
||||||
}
|
}
|
||||||
opt := docker.ListContainersOptions{
|
|
||||||
All: true,
|
|
||||||
}
|
|
||||||
containers, err := self.client.ListContainers(opt)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
ret := make([]info.ContainerReference, 0, len(containers)+1)
|
|
||||||
for _, c := range containers {
|
|
||||||
if !strings.HasPrefix(c.Status, "Up ") {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
ref := info.ContainerReference{
|
|
||||||
Name: FullContainerName(c.ID),
|
|
||||||
Aliases: append(c.Names, c.ID),
|
|
||||||
Namespace: DockerNamespace,
|
|
||||||
}
|
|
||||||
ret = append(ret, ref)
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (self *dockerContainerHandler) GetCgroupPath(resource string) (string, error) {
|
func (self *dockerContainerHandler) GetCgroupPath(resource string) (string, error) {
|
||||||
path, ok := self.cgroupPaths[resource]
|
path, ok := self.cgroupPaths[resource]
|
||||||
|
Loading…
Reference in New Issue
Block a user