Adding 'HasDiskIo' to Container Spec to indicate if diskio stats are available for a given container.
This commit is contained in:
parent
82bd9e927e
commit
aedf42ba8c
@ -229,6 +229,8 @@ func libcontainerConfigToContainerSpec(config *libcontainer.Config, mi *info.Mac
|
||||
}
|
||||
|
||||
spec.HasNetwork = true
|
||||
spec.HasDiskIo = true
|
||||
|
||||
return spec
|
||||
}
|
||||
|
||||
|
@ -225,6 +225,11 @@ func (self *rawContainerHandler) GetSpec() (info.ContainerSpec, error) {
|
||||
//Network
|
||||
spec.HasNetwork = self.hasNetwork
|
||||
|
||||
// DiskIo.
|
||||
if blkioRoot, ok := self.cgroupPaths["blkio"]; ok && utils.FileExists(blkioRoot) {
|
||||
spec.HasDiskIo = true
|
||||
}
|
||||
|
||||
// Check physical network devices for root container.
|
||||
nd, err := self.GetRootNetworkDevices()
|
||||
if err != nil {
|
||||
|
@ -49,6 +49,9 @@ type ContainerSpec struct {
|
||||
HasNetwork bool `json:"has_network"`
|
||||
|
||||
HasFilesystem bool `json:"has_filesystem"`
|
||||
|
||||
// HasDiskIo when true, indicates that DiskIo stats will be available.
|
||||
HasDiskIo bool `json:"has_diskio"`
|
||||
}
|
||||
|
||||
// Container reference contains enough information to uniquely identify a container
|
||||
|
@ -199,6 +199,7 @@ func TestDockerContainerSpec(t *testing.T) {
|
||||
assert.Equal(containerInfo.Spec.Memory.Limit, memoryLimit, "Container should have memory limit of %d, has %d", memoryLimit, containerInfo.Spec.Memory.Limit)
|
||||
assert.True(containerInfo.Spec.HasNetwork, "Network should be isolated")
|
||||
assert.True(containerInfo.Spec.HasFilesystem, "Filesystem should be isolated")
|
||||
assert.True(containerInfo.Spec.HasDiskIo, "Blkio should be isolated")
|
||||
}
|
||||
|
||||
// Check the CPU ContainerStats.
|
||||
|
Loading…
Reference in New Issue
Block a user