-
Notifications
You must be signed in to change notification settings - Fork 259
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
internal/hcs/schema
should probably not be internal, or needs more wrapping functions.
#1073
Comments
Yea the layer concern is valid... The point of making the binds for computestorage was so we could eventually use all of these in containerd, so it's currently failing it's job somewhat :P Truth be told, I don't know why the schema IS in internal, seems like it would easier to use this repo to interact with hcs if it was exported (whether that be for hobby or for a Containerd use case like this is mentioning). For much of the docker/v1 hcs code (in the root of the repo) that we rarely change, we just end up assigning the internal types to an exported one at the root anyways, albeit like I said this is only v1 definitions. https://github.com/microsoft/hcsshim/blob/master/container.go#L16-L43
This was likely an oversight and they should be generated and live in schema2 also. I'll get back to this in the morning after talking to some folks. |
Sounds good. And I'm glad to see that type-aliases would work, if we wanted to go that way, like schema1. That would definitely be a short fix for my use-case, and since I'm using a hcsshim branch anyway, it would be easy to hack away at to determine if this is actually related to the problem I'm chasing. And just now I learned the difference in Go between type alias, e.g. |
@kevpar @ambarve @anmaxvl @katiewasnothere Anyone have opinions here? Should we just type alias whatever is needed for computestorage like we do at the root of the repo for the v1 schema? |
Something I forgot to mention earlier, but it might be nice if the functional tests were less reliant on the It might make sense to disallow |
An idea mentioned in-passing in microsoft#1073, this would ensure that tests can be looked at as usage examples, which use of internal APIs prevents. vendor/ and internal/ are excluded, the former because we only care about direct dependencies, and the latter so that if tests are done that depend on an unpublished API, it's possible _and_ explicit. Signed-off-by: Paul "TBBle" Hampson <[email protected]>
An idea mentioned in-passing in microsoft#1073, this would ensure that tests can be looked at as usage examples, which use of internal APIs prevents. vendor/ and internal/ are excluded, the former because we only care about direct dependencies, and the latter so that if tests are done that depend on an unpublished API, it's possible _and_ explicit. Signed-off-by: Paul "TBBle" Hampson <[email protected]>
An idea mentioned in-passing in microsoft#1073, this would ensure that tests can be looked at as usage examples, which use of internal APIs prevents. vendor/ and internal/ are excluded, the former because we only care about direct dependencies, and the latter so that if tests are done that depend on an unpublished API, it's possible _and_ explicit. Signed-off-by: Paul "TBBle" Hampson <[email protected]>
An idea mentioned in-passing in microsoft#1073, this would ensure that tests can be looked at as usage examples, which use of internal APIs prevents. vendor/ and internal/ are excluded, the former because we only care about direct dependencies, and the latter so that if tests are done that depend on an unpublished API, it's possible _and_ explicit. Signed-off-by: Paul "TBBle" Hampson <[email protected]>
An idea mentioned in-passing in microsoft#1073, this would ensure that tests can be looked at as usage examples, which use of internal APIs prevents. vendor/ and internal/ are excluded, the former because we only care about direct dependencies, and the latter so that if tests are done that depend on an unpublished API, it's possible _and_ explicit. Signed-off-by: Paul "TBBle" Hampson <[email protected]>
An idea mentioned in-passing in microsoft#1073, this would ensure that tests can be looked at as usage examples, which use of internal APIs prevents. vendor/ and internal/ are excluded, the former because we only care about direct dependencies, and the latter so that if tests are done that depend on an unpublished API, it's possible _and_ explicit. Signed-off-by: Paul "TBBle" Hampson <[email protected]>
An idea mentioned in-passing in microsoft#1073, this would ensure that tests can be looked at as usage examples, which use of internal APIs prevents. vendor/ and internal/ are excluded, the former because we only care about direct dependencies, and the latter so that if tests are done that depend on an unpublished API, it's possible _and_ explicit. Signed-off-by: Paul "TBBle" Hampson <[email protected]>
An idea mentioned in-passing in microsoft#1073, this would ensure that tests can be looked at as usage examples, which use of internal APIs prevents. vendor/ and internal/ are excluded, the former because we only care about direct dependencies, and the latter so that if tests are done that depend on an unpublished API, it's possible _and_ explicit. Signed-off-by: Paul "TBBle" Hampson <[email protected]>
An idea mentioned in-passing in microsoft#1073, this would ensure that tests can be looked at as usage examples, which use of internal APIs prevents. vendor/ and internal/ are excluded, the former because we only care about direct dependencies, and the latter so that if tests are done that depend on an unpublished API, it's possible _and_ explicit. Signed-off-by: Paul "TBBle" Hampson <[email protected]>
An idea mentioned in-passing in microsoft#1073, this would ensure that tests can be looked at as usage examples, which use of internal APIs prevents. vendor/ and internal/ are excluded, the former because we only care about direct dependencies, and the latter so that if tests are done that depend on an unpublished API, it's possible _and_ explicit. Signed-off-by: Paul "TBBle" Hampson <[email protected]>
An idea mentioned in-passing in microsoft#1073, this would ensure that tests can be looked at as usage examples, which use of internal APIs prevents. vendor/ and internal/ are excluded, the former because we only care about direct dependencies, and the latter so that if tests are done that depend on an unpublished API, it's possible _and_ explicit. Signed-off-by: Paul "TBBle" Hampson <[email protected]>
I was trying to migrate the containerd WCOW layer code from the RS1 hcs API (
"github.com/Microsoft/hcsshim"
) to the RS5 computestorage API ("github.com/Microsoft/hcsshim/computestorage"
), and I fell at the very first post: I can't see how to build aLayerData
forcomputestorage.AttachLayerStorageFilter
.Specifically, storage.go has this:
but from outside (i.e. containerd) there's no way to generate either
hcsschema.Version
norhcsschema.Layer
values, as the types are declared in"github.com/Microsoft/hcsshim/internal/hcs/schema2"
.I saw that for
hcsschema.Version
, there's the handySchemaV21()
in"github.com/Microsoft/hcsshim/internal/hcs/schema2"
, although that is also currentlyinternal
. I can also do the following to work around not being able to name the type.I'd rather
though.
I couldn't find any existing wrappers for
hcsschema.Layer
that aren't also internal, e.g.MountContainerLayers
in"github.com/Microsoft/hcsshim/internal/layers"
(which would probably be awesome to export as well...). And being a slice, I have to be able to name the type tomake
orappend
to it, as far as I know.So I guess the obvious options going forward are:
MountContainerLayers
and similar wrappers for the other computestorage APIs that are wrapping things that require schema access.MakeLayerData(...) (*LayerData, err)
.LayerData
defined manually, butLayer
was exported by code-gen?LayerData
is present in the schema. I see the same thing for the other types defined directly incomputestorage
:ExportLayerOptions
,OsLayerOptions
andOsLayerType
.internal
, as well as exposing any important helpers likeSchemaV21()
.I've only looked at
computestorage
, and perhaps the other use-cases are already covered by one of the above approaches, or some other approach that hasn't occurred to me.I suspect that if I needed to do this now, I could generate the relevant JSON myself (I could run the codegen elsewhere, or just
YOLOhand-roll it) and then unmarshall onto the visibleLayerData
struct, but that seems fairly user-unfriendly.Side-question: Is https://github.com/MicrosoftDocs/Virtualization-Documentation/tree/master/hyperv-samples/hcs-samples/JSON_files the right source for the OpenAPI specs? All three claim to be "2.4" in their header, but the docs say they should be 2.1, 2.2., and 2.3 for 1809, 1903, and 2004 respectively. (The content looks correct, I just want to make sure I'm looking at the canonical schema specs)
Related side-question: Did anyone write down the swagger-codegen command used to generate the schema? I see lots of edits in the directory history, it's unclear if those were manual or if everyone knew the regenerate command, and just assumes everyone else does too.
Also, sadly #1004 merged before #930 and hence a single file was left in the old location which left me quite confused for a little while. Fix proposed in #1074
The text was updated successfully, but these errors were encountered: