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

A way to remotely check system_version on nodes with "status" command #643

Closed
vstax opened this issue Mar 16, 2017 · 4 comments
Closed

A way to remotely check system_version on nodes with "status" command #643

vstax opened this issue Mar 16, 2017 · 4 comments

Comments

@vstax
Copy link
Contributor

vstax commented Mar 16, 2017

Right now, there seem to be no way to check LeoFS version that some node runs on. This is needed to ensure that every node was indeed updated and is running latest version - since during node-by-node upgrade on running system nothing prevents you to run different version on different nodes, it is possible to overlook upgrade of some node (missing a number, or maybe some node was offline during upgrade and so on) and forget to upgrade it.

Example, with LeoFS 1.3.2.1:

[root@leo-m0 1.3.2.1]# rpm -q leofs
leofs-1.3.2.1-1.x86_64
[root@leo-m0 1.3.2.1]# grep system_version leo_manager_0/etc/app.config
      {system_version,"1.3.2"},
[root@leo-m0 1.3.2.1]# ./leofs-adm status |grep 'version'
                    system version | 1.3.2

(note that this shows another problem: there is no way to differentiate between 1.3.2 and 1.3.2.1. I understand that it was a rushed bugfix release, still, it would be nice if release version was synchronized with system_version in repo. But this is another matter)

Gateway and storage nodes:

[root@leo-m0 1.3.2.1]# ./leofs-adm status gateway_0@192.168.3.52|grep 'version'
                       version | 1.3.1
                    vm version | 7.3.1.2
[root@leo-m0 1.3.2.1]# ./leofs-adm status storage_0@192.168.3.53|grep 'version'
                              version | 1.3.1
                           vm version | 7.3.1.2
[root@leo-g0 1.3.2.1]# grep system_version leo_gateway/etc/app.config
      {system_version,"1.3.2"},
[root@leo-s0 1.3.2.1]# grep system_version leo_storage/etc/app.config
      {system_version,"1.3.2"},

They are running the same 1.3.2.1, but show "version" as 1.3.1. As I understand, it's something internal and different from system_version parameter. I'm not sure if it's needed for something, but showing "system version" just like management nodes do in addition to just "version" (or maybe replacing it) is needed to check the real version of gateway/storage nodes.

(there is also "leofs-adm version" command which isn't that useful right now because it shows only management node version - which is available from "status" command anyway - and can't show version of remote nodes. Would be totally great if it could show version of all nodes directly instead, akin to "leofs-adm status" command which shows node list and information)

@mocchira
Copy link
Member

@vstax Thanks for your suggestion. Totally agreed and sorry for bothering you that we missed the exact version on each component.

For a historical reason that we managed version numbers of each component independently,
there are lots of duplicated code defining a version number and that is error prone this kind of mistakes.
Now we have all components under the one leofs repo so defining a version number at the one right place prevent such mistakes in future.

### ASIS
find apps/ -type f|xargs grep "1\.3\." |grep -v eunit|grep -v Binary
apps/leo_gateway/ebin/leo_gateway.app:              {vsn,"1.3.1"},
apps/leo_gateway/ebin/leo_gateway.app:              {env,[{system_version,"1.3.0"},
apps/leo_gateway/rebar.config:        {leo_object_storage,    ".*", {git, "https://github.com/leo-project/leo_object_storage.git",    {tag, "1.3.1"}}},
apps/leo_gateway/priv/leo_gateway.schema:  {default, "1.3.2"}
apps/leo_gateway/src/leo_gateway.app.src:  {vsn, "1.3.1"},
apps/leo_gateway/src/leo_gateway.app.src:         {system_version, "1.3.0" },
apps/leo_storage/ebin/leo_storage.app:              {vsn,"1.3.1"},
apps/leo_storage/rebar.config:        {leo_object_storage,    ".*", {git, "https://github.com/leo-project/leo_object_storage.git",    {tag, "1.3.1"}}},
apps/leo_storage/priv/leo_storage.schema:  {default, "1.3.2"}
apps/leo_storage/priv/leo_storage.schema:%% Leo' Object-Storage (v1.3.3-)
apps/leo_storage/priv/leo_storage.schema:%% Leo' Object-Storage (v1.3.3-)
apps/leo_storage/priv/leo_storage.schema:%% Leo' Object-Storage (v1.3.1-)
apps/leo_storage/priv/leo_storage.schema:%% Leo' Object-Storage (v1.3.1-)
apps/leo_storage/priv/leo_storage.schema:%% Leo' Object-Storage (v1.3.1-)
apps/leo_storage/src/leo_storage.app.src:  {vsn, "1.3.1"},
apps/leo_manager/ebin/leo_manager.app:              {vsn,"1.3.1"},
apps/leo_manager/ebin/leo_manager.app:              {env,[{system_version,"1.3.0"},
apps/leo_manager/rebar.config:        {leo_object_storage,    ".*", {git, "https://github.com/leo-project/leo_object_storage.git",    {tag, "1.3.1"}}},
apps/leo_manager/priv/leo_manager_0.schema:  {default, "1.3.2"}
apps/leo_manager/priv/leo_manager_1.schema:  {default, "1.3.2"}
apps/leo_manager/src/leo_manager.app.src:  {vsn, "1.3.1"},
apps/leo_manager/src/leo_manager.app.src:  {env, [{system_version,"1.3.0"},


### TOBE
### there is only one file to define a version like https://github.com/erlang/otp/blob/master/OTP_VERSION
### and every component include that version into each schema and app.src file when building packages.
LEOFS_VERSION

(there is also "leofs-adm version" command which isn't that useful right now because it shows only management node version - which is available from "status" command anyway - and can't show version of remote nodes. Would be totally great if it could show version of all nodes directly instead, akin to "leofs-adm status" command which shows node list and information)

Agreed.
like this?

./leofs-adm version
 [Version of Node(s)]
-------+--------------------------+--------------
 type  |           node           |    version
-------+--------------------------+--------------
  M    | manager_0@127.0.0.1      | 1.3.3
  M    | manager_1@127.0.0.1      | 1.3.3
  S    | storage_0@127.0.0.1      | 1.3.3
  G    | gateway_0@127.0.0.1      | 1.3.2.1
-------+--------------------------+--------------

@vstax
Copy link
Contributor Author

vstax commented Mar 21, 2017

@mocchira Yes - this output look nice! Makes version check very simple for everyone (it might be best to use different command like "remote-version" or "versions", though, in order not to break current output of "version" for anyone. Even if no one actually relies on it right now, it's hard to be sure about it. Well, I'm not sure what current policy about such changes is).

Based on your comment about all the different versions that should be the same, it looks like I was wrong about "version = 1.3.1" meaning something useful. So until a proper change is implemented, just replacing that 1.3.1 with actual version for all types of node will fix "status" output for the next release.

@mocchira
Copy link
Member

Yes - this output look nice! Makes version check very simple for everyone (it might be best to use different command like "remote-version" or "versions", though, in order not to break current output of "version" for anyone. Even if no one actually relies on it right now, it's hard to be sure about it. Well, I'm not sure what current policy about such changes is).

Thanks for your suggestion.
Yes we take care the backward compatibility in various places especially for those that cause users to take any action when upgrading. In this case, as you mentioned providing as a different command or providing through "version" command with the additional argument like "./leofs-adm version all" make sense. We'd stick with either way.

Notes that while we'd take care the backward compatibility in machine readable formats like JSON,
The representation of raw text format maybe changed and that may cause your program not to work so to get your PG robust for long term, please use JSON in this case (not parsing raw text with grep/sed/awk like xnix tools but parsing JSON with python -m json.tool or jq(https://stedolan.github.io/jq/) or something else you would prefer.

ASIS output via JSON port

$ ./leofs-adm version | python -m json.tool
{
    "result": "1.3.2"
}

TOBE output via JSON port

$ ./leofs-adm version all | python -m json.tool
{
    "result": [
        {
            "node": "manager_0@127.0.0.1",
            "type": "M",
            "version": "1.3.3"
        },
        {
            "node": "manager_1@127.0.0.1",
            "type": "M",
            "version": "1.3.3"
        },
        {
            "node": "storage_0@127.0.0.1",
            "type": "S",
            "version": "1.3.3"
        },
        {
            "node": "gateway_0@127.0.0.1",
            "type": "G",
            "version": "1.3.2.1"
        },
    ]
}

TOBE output via text port

that would be same with the prev comment

Based on your comment about all the different versions that should be the same, it looks like I was wrong about "version = 1.3.1" meaning something useful. So until a proper change is implemented, just replacing that 1.3.1 with actual version for all types of node will fix "status" output for the next release.

Right.

@yosukehara
Copy link
Member

FIXED

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

No branches or pull requests

3 participants