-
Notifications
You must be signed in to change notification settings - Fork 6
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
misc api and commandset #411
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To avoid these outputs: root@dev2n1:~/dev/om3# ./om3 foo00* resource ls OBJECT NODE RID TYPE foo003 dev2n3 fs#1 fs.flag foo003 dev2n3 fs#2 fs.tmpfs foo003 dev2n3 subset#task:goo <status is not found> ^^^^^^^^^^^^^^^^^^^^^
* Rename GET /networks to GET /networks * Add GET /network/ip * Convert "network ls" to the tab output * Remove "network status", now all info is avail via "network ls" * Add "network ip ls" Example: $ ./om3 network ls NAME TYPE NETWORK FREE USED SIZE PCT backend routed_bridge 172.10.8.0/22 0 0 0 0 default bridge 10.22.0.0/16 0 0 0 0 lo lo 0 0 0 0 $ ./om3 network ip ls OBJECT NODE RID IP NET_NAME NET_TYPE nginx002 dev2n1 ip#1 172.10.8.56 backend routed_bridge nginx001 dev2n1 ip#1 172.10.8.57 backend routed_bridge nginx002 dev2n3 ip#1 172.10.10.94 backend routed_bridge nginx002 dev2n2 ip#1 172.10.9.94 backend routed_bridge
$ ./om3 net ls NAME TYPE NETWORK SIZE USED FREE USE_PCT local routed_bridge 172.11.8.0/30 4 0 4 0 backend routed_bridge 172.10.8.0/22 1024 4 1020 0.390625 lo lo 1 0 1 0 default bridge 10.22.0.0/16 65536 0 65536 0
* Add resourceid.Match(s1, s2 string) * Add resourceid.T.Match() * Make resource.T.MatchRID() use resourceid.T.Match() * Use resourceid.Match() in the GET /resource* api handlers instead of the simple rid equality test Example: $ ./om3 '*' resource status ls --rid f*0 OBJECT NODE RID TYPE STATUS drbd001 dev2n1 fs#0 fs.flag down drbd001 dev2n2 fs#0 fs.flag down drbd001 dev2n3 fs#0 fs.flag down
So we don't have to: 1/ add yaml tags to all serialized struct 2/ add yaml tags to api.yaml schemas using a go-specific extension
* Use the tab renderer for "pool ls" and "pool volume ls" * Fix the PoolList not reporting the "shm" pool * Use a int64 to report pool usage and vol size in bytes * Add Pool and Size to instance.Config so "volume ls" doesn't have to go to disk to read this on every request * Add a path.Relations type to ease conversion to/from string slice
Refresh every minute or when the node or cluster conf changes. Make sure only one refresh runs at a time. GET /pool is now served by this cache, and it now contains the volume count.
Dedicate the package to the nodesinfo.json management. The only caller of GET /nodesinfo is nodeselector, so move the api func call there.
As in "pool volume ls".
This Marshal concrete > Unmarshal in a any-type var was done to produce a unstructured dataset with keys aligned with the json tags. But this method has poor performance issue and the resulting data has unexpected glitches (for example big int64 value end up in float-like format, as seen in "pool ls" outputs). This patch add a unstructed.L type and a Unstructured() map[string]any type-func to every type passed to the core/output renderer with tab as the default. The unstructed type will also allow commands to mangle the dataset for unit changes and pretty prints, as values can change type and even new keys can be added.
Instead of stacking. Example: $ ./om3 foo002 print st -o tab=. unstructured interface is not implemented: object.Digest
* Remove handlers and commands (unnecessarily fined-grained) instance config instance monitor instance status resource config resource monitor resource status * Use plurals for GET /objects GET /instances GET /resources GET /pools GET /pool/volumes GET /networks GET /network/ips * Don't return lists. Use a wrapper struct like {"kind": "NodeList", "items": []Node{}}
So it's easy to understand what kind of element users are reading data of.
Mangle the items received from the api to add bin_free, bin_used and bin_size as 3-digits+unit approximation of the original int64 values. Example: { "bin_free": "2.12g", "bin_size": "30.3g", "bin_used": "26.6g", } For original values: { "free": 2278817792, "size": 32574881792, "used": 28615196672, }
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.