Merge pull request #320 from vmarmol/docker-raw
Let the raw driver handle the /docker container.
This commit is contained in:
commit
6885e0c8f2
@ -117,10 +117,7 @@ func FullContainerName(dockerId string) string {
|
|||||||
|
|
||||||
// Docker handles all containers under /docker
|
// Docker handles all containers under /docker
|
||||||
func (self *dockerFactory) CanHandle(name string) (bool, error) {
|
func (self *dockerFactory) CanHandle(name string) (bool, error) {
|
||||||
if name == "/docker" {
|
if !IsDockerContainerName(name) {
|
||||||
// We need the docker driver to handle /docker. Otherwise the aggregation at the API level will break.
|
|
||||||
return true, nil
|
|
||||||
} else if !IsDockerContainerName(name) {
|
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,6 +200,7 @@ func Register(factory info.MachineInfoFactory) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glog.Infof("Registering Docker factory")
|
||||||
f := &dockerFactory{
|
f := &dockerFactory{
|
||||||
machineInfoFactory: factory,
|
machineInfoFactory: factory,
|
||||||
client: client,
|
client: client,
|
||||||
|
@ -82,9 +82,6 @@ func newDockerContainerHandler(
|
|||||||
fsInfo: fsInfo,
|
fsInfo: fsInfo,
|
||||||
}
|
}
|
||||||
handler.storageDirs = append(handler.storageDirs, path.Join(dockerRootDir, pathToAufsDir, path.Base(name)))
|
handler.storageDirs = append(handler.storageDirs, path.Join(dockerRootDir, pathToAufsDir, path.Base(name)))
|
||||||
if handler.isDockerRoot() {
|
|
||||||
return handler, nil
|
|
||||||
}
|
|
||||||
id := ContainerNameToDockerId(name)
|
id := ContainerNameToDockerId(name)
|
||||||
handler.id = id
|
handler.id = id
|
||||||
ctnr, err := client.InspectContainer(id)
|
ctnr, err := client.InspectContainer(id)
|
||||||
@ -108,10 +105,6 @@ func (self *dockerContainerHandler) ContainerReference() (info.ContainerReferenc
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *dockerContainerHandler) isDockerRoot() bool {
|
|
||||||
return self.name == "/docker"
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO(vmarmol): Switch to getting this from libcontainer once we have a solid API.
|
// TODO(vmarmol): Switch to getting this from libcontainer once we have a solid API.
|
||||||
func (self *dockerContainerHandler) readLibcontainerConfig() (config *libcontainer.Config, err error) {
|
func (self *dockerContainerHandler) readLibcontainerConfig() (config *libcontainer.Config, err error) {
|
||||||
configPath := path.Join(self.libcontainerStateDir, self.id, "container.json")
|
configPath := path.Join(self.libcontainerStateDir, self.id, "container.json")
|
||||||
@ -201,9 +194,6 @@ func libcontainerConfigToContainerSpec(config *libcontainer.Config, mi *info.Mac
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (self *dockerContainerHandler) GetSpec() (spec info.ContainerSpec, err error) {
|
func (self *dockerContainerHandler) GetSpec() (spec info.ContainerSpec, err error) {
|
||||||
if self.isDockerRoot() {
|
|
||||||
return info.ContainerSpec{}, nil
|
|
||||||
}
|
|
||||||
mi, err := self.machineInfoFactory.GetMachineInfo()
|
mi, err := self.machineInfoFactory.GetMachineInfo()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
@ -266,9 +256,6 @@ func (self *dockerContainerHandler) getFsStats(stats *info.ContainerStats) error
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (self *dockerContainerHandler) GetStats() (stats *info.ContainerStats, err error) {
|
func (self *dockerContainerHandler) GetStats() (stats *info.ContainerStats, err error) {
|
||||||
if self.isDockerRoot() {
|
|
||||||
return &info.ContainerStats{}, nil
|
|
||||||
}
|
|
||||||
state, err := self.readLibcontainerState()
|
state, err := self.readLibcontainerState()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == fileNotFound {
|
if err == fileNotFound {
|
||||||
|
Loading…
Reference in New Issue
Block a user