Skip to content

Allow volume drivers to provide a Status field#21006

Merged
vdemeester merged 1 commit into
moby:masterfrom
cpuguy83:volume_inspect_meta
Apr 15, 2016
Merged

Allow volume drivers to provide a Status field#21006
vdemeester merged 1 commit into
moby:masterfrom
cpuguy83:volume_inspect_meta

Conversation

@cpuguy83

@cpuguy83 cpuguy83 commented Mar 7, 2016

Copy link
Copy Markdown
Member

The Status field is a [][]string which allows the driver to pass
back low-level details about the underlying volume.

If all are good with design review I'll open a PR to engine-api.

7680799_orig

@cpuguy83

cpuguy83 commented Mar 7, 2016

Copy link
Copy Markdown
Member Author

ping @erikh @lukemarsden @clintonskitson @jvinod @srust @ibuildthecloud

@cpuguy83 cpuguy83 force-pushed the volume_inspect_meta branch from c7209d0 to 7b4ca7d Compare March 7, 2016 21:31
@srust

srust commented Mar 7, 2016

Copy link
Copy Markdown
Contributor

@cpuguy83 nice! This will be great. Thanks for the ping.

I was thinking of the name of the field. I know, this is always the most difficult part ;) The types of information included in this field could be wide and varying. Config, run-time state, volume options, status of the volume, other driver specific information, etc. An alternative would be to just call it Metadata.

That said, I think either one could work, there's probably not a perfect answer. Would be curious what others thought.

@cpuguy83

cpuguy83 commented Mar 7, 2016

Copy link
Copy Markdown
Member Author

Yeah, I wanted to avoid Metadata -- but also not tied to Status.

@clintkitson

Copy link
Copy Markdown
Contributor

How about details? Any reason reason for this not being map[string]string?

@srust

srust commented Mar 7, 2016

Copy link
Copy Markdown
Contributor

Okay..

One more suggestion: Detail or Details.

This would follow from the description of "low-level details of the volume". Perhaps this could someday allow inspect to conditionally show these extended "details".

Example:

[
    {
        "Name": "test-vol",
        "Driver": "driver",
        "Mountpoint": "/mnt/test-vol"
        "Details": {
            "CreatedAt": "2016-03-07T21:15:24.27864192Z"
            "Status":    "online",
            "User":      "cpuguy83",
            "Mode":      "readwrite",
        },
    }
]

@cpuguy83

cpuguy83 commented Mar 8, 2016

Copy link
Copy Markdown
Member Author

[][]string allows you to, for instance, provide a list instead of a simple "string"="string"

[
    [ "foo", "bar", "baz", "qux"],
    ["hello", "world"]
]

This can really come in handy especially when presenting something other than straight json to the user.

@erikh

erikh commented Mar 8, 2016

Copy link
Copy Markdown
Contributor

Cool!

@cpuguy83 cpuguy83 force-pushed the volume_inspect_meta branch from 7b4ca7d to d5489d3 Compare March 8, 2016 00:57
@erikh

erikh commented Mar 8, 2016

Copy link
Copy Markdown
Contributor

+1 for Details and map[string]string

On 7 Mar 2016, at 14:30, Clinton Kitson wrote:

How about details? Any reason reason for this not being
map[string]string?


Reply to this email directly or view it on GitHub:
#21006 (comment)

@cpuguy83

cpuguy83 commented Mar 8, 2016

Copy link
Copy Markdown
Member Author

Some weirdness on the CI.

@icecrime icecrime added the status/failing-ci Indicates that the PR in its current state fails the test suite label Mar 8, 2016
@calavera

calavera commented Mar 8, 2016

Copy link
Copy Markdown
Contributor

Design LGTM.

@clintkitson

Copy link
Copy Markdown
Contributor

@cpuguy83 I do like the example that @srust gave above re how Details would show up if it was map[string]string. It seems like the [][]string would be a pretty unstructured view when it comes out of the CLI. Any ideas for how that would get laid out?

@srust

srust commented Mar 10, 2016

Copy link
Copy Markdown
Contributor

Hi @cpuguy83,

Please tell me if this is beyond the scope of this PR, but I think it would be pretty awesome if there were two separate objects returned here. One for the user-supplied 'Opts', and one for the driver 'Details'. This would give the user a clear view as to how the volume was configured. And the driver could put any of its own driver-specific details in the 'Details'.

A user supplied value in the volume 'Opts' could impact the volume in many ways (ie: an option is not necessarily a 1-1 mapping to something in Detail. It could turn on many different capabilities / fields).

And both 'Opts' and 'Details' would be optional, for a driver to return.

Example:
docker volume inspect $(docker volume create --opt type=awesome)

[
    {
        "Name": "test-vol",
        "Driver": "driver",
        "Mountpoint": "/mnt/test-vol",
        "Opts": {
            "type": "awesome",
        },
        "Details": {
            "CreatedAt": "2016-03-07T21:15:24.27864192Z"
            "Status":    "online",
            "User":      "cpuguy83",
            "Mode":      "readwrite",
            "Speed":     "fast",
        },
    }
]

I'm also on board with map[string]string. I think it is important to be able to show fields such as "Status": "online" in the details, as a clear key/value. Unless I'm missing something with how [][]string would work?

Thanks.

@cpuguy83

Copy link
Copy Markdown
Member Author

@srust we'll have a separate API for getting driver related info... Likely something like "docker plugin inspect "

@srust

srust commented Mar 10, 2016

Copy link
Copy Markdown
Contributor

@cpuguy83 oh, cool! In the context of this PR, I'm still referring to the volume info..

@cpuguy83

Copy link
Copy Markdown
Member Author

@srust We can keep this in one field for now and always expand later if it's really needed.

In terms of presentation, we can handle this at the client level, it's not a big deal.
I'll change this to [][2]string, though, which makes the output a bit more predictable.

@mavenugo

Copy link
Copy Markdown
Contributor

@cpuguy83 FWIW libnetwork provides a DriverInfo() (map[string]interface{}, error) where the key is well-known label and value-type is derived out of it. This gives more control and portable way for docker daemon to depend on the data returned by a particular driver. But this can very well be a [string]string.

@cpuguy83

Copy link
Copy Markdown
Member Author

@mavenugo Is this for info on networks or for network drivers?
I don't plan to use any of this information in engine... but map[string]interface{} does work as well.

@lukemarsden

Copy link
Copy Markdown
Contributor

LGTM

How are you planning on formatting the struct in the CLI? Can we give some examples of what this would look like as CLI transcripts showing how we could render [][]string, map[string][string], or just string and how they might look? I am slightly leaning towards map[string][string] because it's more structured, but would be curious to see how you imagine this being rendered in docker volume ls.

Or is that not the use case for this? In which case what is?

@cpuguy83

Copy link
Copy Markdown
Member Author

@lukemarsden I would not display this info on volume ls only on inspect.

@cpuguy83

Copy link
Copy Markdown
Member Author

btw, I updated the engine-api PR to use a map[string]interface

Comment thread docs/extend/plugins_volume.md Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this how it's serialized ? oO

@thaJeztah

Copy link
Copy Markdown
Member

@cpuguy83 perhaps we should add a change-log to docs/extend/plugins_volume.md as well (like we have for the remote API). It may make it easier for plugin-developers to see what changed between versions?

@cpuguy83 cpuguy83 force-pushed the volume_inspect_meta branch 2 times, most recently from 48aacd5 to fd9d7cd Compare April 15, 2016 14:47
@cpuguy83

Copy link
Copy Markdown
Member Author

Updated, added changelog to volume plugin doc.

Comment thread docs/extend/plugins_volume.md Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

you missed a closing )

(perhaps add a # before the PR number as well)

@cpuguy83 cpuguy83 force-pushed the volume_inspect_meta branch 2 times, most recently from f91309d to 6988c55 Compare April 15, 2016 14:55
The `Status` field is a `map[string]interface{}` which allows the driver to pass
back low-level details about the underlying volume.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
@thaJeztah

Copy link
Copy Markdown
Member

docs LGTM, thanks!

@vdemeester

Copy link
Copy Markdown
Member

LGTM 🐮

@wallnerryan

wallnerryan commented Jun 23, 2016

Copy link
Copy Markdown

@cpuguy83, request to reach out to myself or @wallrj or @myechuri for future items that would relate to clusterhq/flocker volumes. cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.