Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: add snapshotter info into container json #1130

Merged

Conversation

HusterWan
Copy link
Contributor

@HusterWan HusterWan commented Apr 15, 2018

Signed-off-by: Michael Wan zirenwan@gmail.com

Ⅰ. Describe what this PR did

add snapshotter info into container json

since graphdriver has been replace by snapshotter, so i also rename the GraphDriver to Snapshotter in pouch

Ⅱ. Does this pull request fix one issue?

fixes #1011

root@osboxes:wanziren -> pouch inspect -f "{{.GraphDriver.Data.UpperDir}}" test
/var/lib/pouch/containerd/root/io.containerd.snapshotter.v1.overlayfs/snapshots/1809/fs

Ⅲ. Describe how you did it

Ⅳ. Describe how to verify it

now we has snapshotter info in container json

        "Snapshotter": {
            "Data": {
                "MergedDir": "/var/lib/pouch/containerd/state/io.containerd.runtime.v1.linux/default/6933c23039432c5a1b1f88c6d94c39fe8fd88943121ac7af419b2c42a2e440fe/rootfs",
                "UpperDir": "/var/lib/pouch/containerd/root/io.containerd.snapshotter.v1.overlayfs/snapshots/1809/fs"
            },
            "Name": "overlayfs"
        },
root@osboxes:wanziren -> pouch inspect test
[
    {
        "Args": null,
        "Config": {
            "Cmd": [
                "sh"
            ],
            "Entrypoint": null,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
            ],
            "Image": "registry.hub.docker.com/library/busybox:latest",
            "OnBuild": null,
            "Shell": null
        },
        "Created": "2018-04-15T17:01:17.359541477Z",
        "GraphDriver": {
            "Data": {
                "MergedDir": "/var/lib/pouch/containerd/state/io.containerd.runtime.v1.linux/default/6933c23039432c5a1b1f88c6d94c39fe8fd88943121ac7af419b2c42a2e440fe/rootfs",
                "UpperDir": "/var/lib/pouch/containerd/root/io.containerd.snapshotter.v1.overlayfs/snapshots/1809/fs"
            },
            "Name": "overlayfs"
        },
        "HostConfig": {
            "NetworkMode": "bridge",
            "OomScoreAdj": -500,
            "RestartPolicy": {
                "Name": "no"
            },
            "Runtime": "runc",
            "BlkioDeviceReadBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceWriteIOps": null,
            "BlkioWeightDevice": null,
            "CgroupParent": "default",
            "DeviceCgroupRules": null,
            "Devices": [],
            "MemoryExtra": 0,
            "MemorySwappiness": -1,
            "MemoryWmarkRatio": 0,
            "OomKillDisable": false,
            "Ulimits": null
        },
        "Id": "6933c23039432c5a1b1f88c6d94c39fe8fd88943121ac7af419b2c42a2e440fe",
        "Image": "registry.hub.docker.com/library/busybox:latest",
        "Mounts": [],
        "Name": "test",
        "NetworkSettings": {
            "Networks": {
                "bridge": {
                    "Aliases": null,
                    "EndpointID": "58889c2650a2051fc2ad76d44d1e0fe54044bf043a38f4b74104c4f5c14cde1f",
                    "Gateway": "172.17.0.1",
                    "IPAddress": "172.17.0.2",
                    "IPPrefixLen": 24,
                    "Links": null,
                    "MacAddress": "02:42:ac:11:00:02",
                    "NetworkID": "3f31a4ebae28cb6ec7dbe6950ae736929ee9dac611a49a7d369b8b8bcdfb5e6c"
                }
            },
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null
        },
        "Snapshotter": {
            "Data": {
                "MergedDir": "/var/lib/pouch/containerd/state/io.containerd.runtime.v1.linux/default/6933c23039432c5a1b1f88c6d94c39fe8fd88943121ac7af419b2c42a2e440fe/rootfs",
                "UpperDir": "/var/lib/pouch/containerd/root/io.containerd.snapshotter.v1.overlayfs/snapshots/1809/fs"
            },
            "Name": "overlayfs"
        },
        "State": {
            "Pid": 10364,
            "StartedAt": "2018-04-15T17:01:17.71750248Z",
            "Status": "running"
        }
    }
]

Ⅴ. Special notes for reviews

@HusterWan
Copy link
Contributor Author

HusterWan commented Apr 15, 2018

In fact, i am not sure whether this PR match your requirement, @yyb196 can you pls review this PR and give me some advice?

apis/swagger.yml Outdated
@@ -2808,8 +2808,8 @@ definitions:
x-nullable: true
Config:
$ref: "#/definitions/ContainerConfig"
GraphDriver:
$ref: "#/definitions/GraphDriverData"
Snapshotter:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering if removing GraphDriver is reasonable, since it will break the compatibility of API. WDYT? @yyb196

@codecov-io
Copy link

codecov-io commented Apr 15, 2018

Codecov Report

Merging #1130 into master will decrease coverage by <.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1130      +/-   ##
==========================================
- Coverage   15.62%   15.61%   -0.01%     
==========================================
  Files         172      172              
  Lines        9672     9674       +2     
==========================================
  Hits         1511     1511              
- Misses       8052     8054       +2     
  Partials      109      109
Impacted Files Coverage Δ
daemon/mgr/container_types.go 15.38% <ø> (ø) ⬆️
apis/server/container_bridge.go 0% <0%> (ø) ⬆️
daemon/mgr/container.go 4.89% <0%> (-0.09%) ⬇️
ctrd/snapshot.go 0% <0%> (ø) ⬆️
client/client.go 20% <0%> (-8%) ⬇️
ctrd/image.go 0% <0%> (ø) ⬆️
daemon/mgr/cri.go 0% <0%> (ø) ⬆️
pkg/kernel/kernel.go 72.72% <0%> (+22.72%) ⬆️

@HusterWan HusterWan force-pushed the zr/overlay-dir-dev branch from a28252b to 7ba7af5 Compare April 16, 2018 02:58
Signed-off-by: Michael Wan <zirenwan@gmail.com>
@HusterWan HusterWan force-pushed the zr/overlay-dir-dev branch from 7ba7af5 to 3048ff7 Compare April 16, 2018 03:04
@allencloud
Copy link
Collaborator

LGTM

@pouchrobot pouchrobot added the LGTM one maintainer or community participant agrees to merge the pull reuqest. label Apr 16, 2018
@allencloud allencloud merged commit 65b9dc2 into AliyunContainerService:master Apr 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature LGTM one maintainer or community participant agrees to merge the pull reuqest. size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature] support #pouch inspect -f "{{.GraphDriver.Data.UpperDir}}" $CID
4 participants