Skip to content

Expand /info: Expose OSType (GOOS), Architecture (GOARCH)#13921

Closed
olleolleolle wants to merge 1 commit intomoby:masterfrom
olleolleolle:feature/host-arch-output-13634
Closed

Expand /info: Expose OSType (GOOS), Architecture (GOARCH)#13921
olleolleolle wants to merge 1 commit intomoby:masterfrom
olleolleolle:feature/host-arch-output-13634

Conversation

@olleolleolle
Copy link
Copy Markdown
Contributor

This change amends the diagnostic output of /info, to add two more keys. This supports Swarm's effort of helping users target multi-architecture Swarm clusters. See #13634.

These keys were introduced:

  • OSType (runtime.GOOS)
  • Architecture (runtime.GOARCH)

✨ to @runcom, who helped out a lot with this.

@olleolleolle olleolleolle force-pushed the feature/host-arch-output-13634 branch 2 times, most recently from 199088b to ccf408f Compare June 13, 2015 08:07
@olleolleolle olleolleolle changed the title WIP /info: Architecture, OperatingSystemType, Platform Expand /info: OperatingSystemType, Architecture, Platform Jun 13, 2015
@olleolleolle
Copy link
Copy Markdown
Contributor Author

(I asked in IRC for a re-run on janky.)

@runcom
Copy link
Copy Markdown
Member

runcom commented Jun 13, 2015

@olleolleolle does swarm need only Platform and the other two fields as well or does it need only os platform? (from what I've read seems like only Platform is needed but I may have missed something)

@runcom
Copy link
Copy Markdown
Member

runcom commented Jun 13, 2015

Also platform seems really redunant as it can be composed of GOOS + GOARCH, wdyt?

@olleolleolle
Copy link
Copy Markdown
Contributor Author

My understanding is: These two would be the minimal for Swarm's current needs:

  • OperatingSystemType: runtime.GOOS,
  • Architecture: runtime.GOARCH,

@runcom
Copy link
Copy Markdown
Member

runcom commented Jun 13, 2015

@olleolleolle yup and in case the concat would be done elsewhere I suppose (because only swarm may need the underscore between the two), let's see what others have to say about this :)

@olleolleolle
Copy link
Copy Markdown
Contributor Author

I agree! I will run over the existing commit with the reduced one.

@runcom
Copy link
Copy Markdown
Member

runcom commented Jun 13, 2015

ping @vieux @aluzzardi

@olleolleolle olleolleolle force-pushed the feature/host-arch-output-13634 branch from ccf408f to 24f6d19 Compare June 13, 2015 09:33
@olleolleolle olleolleolle changed the title Expand /info: OperatingSystemType, Architecture, Platform Expand /info: OperatingSystemType, Architecture Jun 13, 2015
@tiborvass
Copy link
Copy Markdown
Contributor

I am not a fan of OperatingSystemType :S not sure what would be the best. Platform with GOOS/GOARCH could work I guess. What do others think?

@runcom
Copy link
Copy Markdown
Member

runcom commented Jun 13, 2015

Naming apart, just GOOS and GOARCH is OK for me as I've already said. So ppl (swarm) can play with them

@estesp
Copy link
Copy Markdown
Contributor

estesp commented Jun 15, 2015

I think one of the "problems" here is that GOOS is really what we should be calling "Operating System" in current "/info" results. What we return today as operating system has nothing to do with whether the OS is Linux or Windows, but simply whether we can find a nice "PRETTY_NAME" from a common file in Linux distros (which from a recent issue/bug has been found to be missing on some distros), or in the Windows case, the release number/variant of Windows from the registry.

I think GOOS should become OperatingSystem in the info structure, and the pretty name/OS variant parsing result should go in a new field OS Variant/Version or something like that. GOOS is stable and easily parseable and well-defined, whereas the distro format for PRETTY_NAME is free-form and up to how the distro wants to make a value that is (quote) A pretty operating system name in a format suitable for presentation to the user. May or may not contain a release code name or OS version of some kind, as suitable. (see http://www.freedesktop.org/software/systemd/man/os-release.html)

@aluzzardi
Copy link
Copy Markdown
Member

I agree with @tiborvass: Not a fan or OperatingSystemType.

I think Platform is pretty standard (arch + OS pair).

@tiborvass
Copy link
Copy Markdown
Contributor

Agree with @estesp too... should we change what OperatingSystem is, now? Or should we just use Platform ?

@duglin
Copy link
Copy Markdown
Contributor

duglin commented Jun 17, 2015

Given I don't think we can change what's there today because it will probably break someone, I would recommend:

  • deprecate OperatingSystem
  • add OS and map it to GOOS
  • add OSVariant and map it to today's OperatingSystem, aka PRETTY_NAME
  • add Architecture per the current PR, GOARCH

@olleolleolle olleolleolle force-pushed the feature/host-arch-output-13634 branch 2 times, most recently from 97d727f to adb626c Compare June 17, 2015 21:07
@icecrime
Copy link
Copy Markdown
Contributor

icecrime commented Jul 7, 2015

Not fond of the name OSVariant, but LGTM!

@calavera
Copy link
Copy Markdown
Contributor

calavera commented Jul 7, 2015

deprecate OperatingSystem

why don't we version those fields by the api version? that's what we normally do.

@runcom
Copy link
Copy Markdown
Member

runcom commented Jul 14, 2015

I agree with @calavera, we could version this and not expose the new fields to old api
Wdyt @icecrime @calavera

@abronan
Copy link
Copy Markdown
Contributor

abronan commented Jul 14, 2015

+1 with @calavera and @runcom. Also not fond of the name OSVariant.

@tiborvass
Copy link
Copy Markdown
Contributor

Ping @olleolleolle please rebase and modify according to #13921 (comment)

Let us know if you don't have time, we can always carry your commit.

@olleolleolle olleolleolle force-pushed the feature/host-arch-output-13634 branch from adb626c to c89ae46 Compare July 23, 2015 21:07
@olleolleolle olleolleolle changed the title Expand /info: OperatingSystemType, Architecture Expand /info: Expose GOOS, GOARCH as OS, Architecture Jul 23, 2015
@thaJeztah
Copy link
Copy Markdown
Member

ping @tiborvass @estesp @duglin PTAL

Thanks so much @olleolleolle, apologies for all the bike shedding ❤️

@olleolleolle olleolleolle changed the title Expand /info: Expose OSType (GOOS), Architecture (run-time architecture) WIP: Expand /info: Expose OSType (GOOS), Architecture (run-time architecture) Sep 27, 2015
@olleolleolle
Copy link
Copy Markdown
Contributor Author

Hi all. Back again, getting ready to introduce the new folder pkg/parser/architecture/ and use that in daemon/info.go.


Detecting runtime architecture

...on Windows. Following the leads given by @tiborvass, I came upon counter-indications.

In the docs for the SYSTEM_INFO struct for Windows, a contributed comment presented the value found there as not-runtime (quite similar to previous discussion):

wProcessorArchitecture documentation is wrong
The documentation for the wProcessorArchitecture is wrong. It is in fact not the "processor architecture of the installed operating system" but rather is the process architecture the app was built for. An x86 process running on x64 will get a value of PROCESSOR_ARCHITECTURE_INTEL.

Also, the SDK defines a number of PROCESSOR_ARCHITECTURE values that aren't present in this documentation.

@duglin
Copy link
Copy Markdown
Contributor

duglin commented Sep 27, 2015

I like the two fields, if we can just get GOARCH to return the right thing.
I think GOOS does it correctly.

@olleolleolle
Copy link
Copy Markdown
Contributor Author

Added a few incomplete files in order to show the plan.

@jessfraz
Copy link
Copy Markdown
Contributor

jessfraz commented Oct 1, 2015

+1 to @tiborvass comment in #13921 (comment)

@tiborvass
Copy link
Copy Markdown
Contributor

Collective review:

We all agree with #13921 (comment) and would just add an ommission: the name of the field for the architecture should be Architecture like it is in the code right now.

@olleolleolle if you have better alternatives for how to actually detect Architecture at runtime for those different platforms we're all ears, but if not, we agree on the proposal mentioned above.

Thanks!!

@tiborvass tiborvass added status/2-code-review and removed status/1-design-review status/needs-attention Calls for a collective discussion during a review session labels Oct 1, 2015
@olleolleolle
Copy link
Copy Markdown
Contributor Author

Thanks, great, then I can go forward with the simplest possible thing. Glad to hear it.

(Now removed the WIP commit I had created while misunderstanding Tibor's plan outline.)

@olleolleolle olleolleolle force-pushed the feature/host-arch-output-13634 branch from 431fa60 to 96184fc Compare October 1, 2015 18:15
@olleolleolle
Copy link
Copy Markdown
Contributor Author

@tiborvass You can remove the GitHub label impact/deprecation.

@olleolleolle olleolleolle changed the title WIP: Expand /info: Expose OSType (GOOS), Architecture (run-time architecture) Expand /info: Expose OSType (GOOS), Architecture (run-time architecture) Oct 1, 2015
@olleolleolle olleolleolle changed the title Expand /info: Expose OSType (GOOS), Architecture (run-time architecture) Expand /info: Expose OSType (GOOS), Architecture (GOARCH) Oct 1, 2015
@tiborvass
Copy link
Copy Markdown
Contributor

@tiborvass
Copy link
Copy Markdown
Contributor

@olleolleolle any updates? Would you prefer someone carries this PR?

@olleolleolle
Copy link
Copy Markdown
Contributor Author

Ah, no updates - and yes please do carry it, anyone.

(Good process, that!)

On 15 Oct 2015, at 02:46, Tibor Vass [email protected] wrote:

@olleolleolle any updates? Would you prefer someone carries this PR?


Reply to this email directly or view it on GitHub.

@thaJeztah
Copy link
Copy Markdown
Member

Talked with @vdemeester earlier and he is planning on carrying this PR tomorrow. Thanks so much again for being patient with us @olleolleolle

@icecrime
Copy link
Copy Markdown
Contributor

Ping @vdemeester: was that carried?

@vdemeester
Copy link
Copy Markdown
Member

@icecrime in the process (writing some stuff on pkg/architecture taking account @tiborvass comments). PR to come tomorrow I think 😉

@icecrime
Copy link
Copy Markdown
Contributor

@vdemeester 🎉

@vdemeester
Copy link
Copy Markdown
Member

Closing this as carrying in #17478.

@vdemeester vdemeester closed this Oct 30, 2015
@olleolleolle olleolleolle deleted the feature/host-arch-output-13634 branch September 27, 2017 15:57
thaJeztah added a commit to thaJeztah/docker that referenced this pull request Apr 8, 2023
It was not immediately clear why we were not using runtime.GOARCH for
these (with a conversion to other formats, such as x86_64). These docs
are based on comments that were posted when implementing this package;

- moby#13921 (comment)
- moby#13921 (comment)

Some links were now redirecting to a new location, so updated them to
not depend on the redirect.

While at it, also updated a call to logrus to use structured formatting
(WithError()).

Signed-off-by: Sebastiaan van Stijn <[email protected]>
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.