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

HostVolumes: Include volume info in nomad node status #6011

Merged
merged 3 commits into from
Aug 9, 2019

Conversation

endocrimes
Copy link
Contributor

NOTE: When #5923 is merged into f-host-volumes, this PR should be targeted against f-host-volumes

Short Output

$ nomad node status -self -short
ID           = 964f7030
Name         = mew
Class        = <none>
DC           = dc1
Drain        = false
Eligibility  = eligible
Status       = ready
Host Volumes = tmp-dir
Drivers      = docker,mock_driver,raw_exec

Allocations
No allocations placed

Verbose Output

ID          = 964f7030-9882-a359-7965-2bd432fbdd96
Name        = mew
Class       = <none>
DC          = dc1
Drain       = false
Eligibility = eligible
Status      = ready
Uptime      = 168h8m18s

Host Volumes
Name     ReadOnly  Hidden  Source
tmp-dir  false     false   /tmp

Drivers
Driver       Detected  Healthy  Message                  Time
docker       true      true     Healthy                  2019-07-25T15:30:20+02:00
exec         false     false    Driver must run as root  2019-07-25T15:30:20+02:00
java         false     false    Driver must run as root  2019-07-25T15:30:20+02:00
mock_driver  true      true     Healthy                  2019-07-25T15:30:20+02:00
qemu         false     false    <none>                   2019-07-25T15:30:20+02:00
raw_exec     true      true     Healthy                  2019-07-25T15:30:20+02:00
rkt          false     false    Driver must run as root  2019-07-25T15:30:20+02:00

Node Events
Time                       Subsystem  Message          Details
2019-07-25T15:30:20+02:00  Cluster    Node registered  <none>

Allocated Resources
CPU          Memory      Disk
0/32000 MHz  0 B/15 GiB  0 B/7.5 GiB

Allocation Resource Utilization
CPU          Memory
0/32000 MHz  0 B/15 GiB

Host Resource Utilization
CPU            Memory         Disk
516/32000 MHz  11 GiB/15 GiB  (tmpfs)

Allocations
No allocations placed

Attributes
{{omitted}}

Meta

@endocrimes endocrimes force-pushed the dani/rfc-host-volumes branch 3 times, most recently from d5ce4d7 to 4888b4c Compare July 25, 2019 14:14
@endocrimes endocrimes force-pushed the dani/rfc-host-volumes branch 2 times, most recently from 5935e7a to 4a1d99c Compare July 25, 2019 14:49
@endocrimes endocrimes added this to the 0.10.0 milestone Jul 25, 2019
Copy link
Contributor

@notnoop notnoop left a comment

Choose a reason for hiding this comment

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

Code lgtm - Had a minor code stylistic issues that aren't blockers. Would love some basic tests though for merging.

command/node_status.go Outdated Show resolved Hide resolved
command/node_status.go Outdated Show resolved Hide resolved
command/node_status.go Outdated Show resolved Hide resolved
command/node_status.go Outdated Show resolved Hide resolved
@endocrimes endocrimes changed the base branch from dani/rfc-host-volumes to f-host-volumes August 9, 2019 10:26
@endocrimes
Copy link
Contributor Author

@notnoop Generally cleaned up a couple of parts of this command to make it a bit easier to understand what's going on.

  • Made short be more self contained and return early, so we can not think about it for the remainder of the formatter.
  • Improved comments around what we're rendering

@endocrimes endocrimes requested a review from notnoop August 9, 2019 10:50
Copy link
Contributor

@notnoop notnoop left a comment

Choose a reason for hiding this comment

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

overall looks good to me. Nitpick about error messaging, but would be really nice to have some tests for this namespace.

func (c *NodeStatusCommand) outputAllocInfo(client *api.Client, node *api.Node) error {
nodeAllocs, _, err := client.Nodes().Allocations(node.ID, nil)
if err != nil {
return err
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd return the error prefix here instead of the caller side. Had the function been queryAllocInfo, having callers add the prefix would be reasonable imo.

Suggested change
return err
return fmt.Errorf("failed to query node allocations: %s", err)

}

c.Ui.Output(c.Colorize().Color(formatKV(basic)))
return 0
Copy link
Contributor

Choose a reason for hiding this comment

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

Terminating early here is very nice; it's much more obvious what the short flag displays here imo - thanks for doing this!

@endocrimes endocrimes merged commit 343d443 into f-host-volumes Aug 9, 2019
@endocrimes endocrimes deleted the dani/f-volume-node-status branch August 9, 2019 11:52
@github-actions
Copy link

github-actions bot commented Feb 5, 2023

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants