Commit Graph

142 Commits

Author SHA1 Message Date
Tim Gross
d60071c20d filter volumes by type in 'nomad node status' output (#8902)
Volume requests can be either CSI or host volumes, so when displaying the CSI
volume info for `nomad node status -verbose` we need to filter out the host
volumes.
2020-09-16 15:00:12 -04:00
Tim Gross
21a4f60a00 csi: avoid panic in CLI for failed node attachment cleanup (#8525)
If the node API returns an attached volume that doesn't belong to an
alloc (because it's failed to clean up properly), `nomad node status`
will panic when rendering the response.

Also, avoid empty volumes output in node status
2020-07-24 08:17:27 -04:00
Tim Gross
a28f18ea1d csi: support Secrets parameter in CSI RPCs (#7923)
CSI plugins can require credentials for some publishing and
unpublishing workflow RPCs. Secrets are configured at the time of
volume registration, stored in the volume struct, and then passed
around as an opaque map by Nomad to the plugins.
2020-05-11 17:12:51 -04:00
Lang Martin
bc750d8bb0 csi: add node events to report progress mounting and unmounting volumes (#7547)
* nomad/structs/structs: new NodeEventSubsystemCSI

* client/client: pass triggerNodeEvent in the CSIConfig

* client/pluginmanager/csimanager/instance: add eventer to instanceManager

* client/pluginmanager/csimanager/manager: pass triggerNodeEvent

* client/pluginmanager/csimanager/volume: node event on [un]mount

* nomad/structs/structs: use storage, not CSI

* client/pluginmanager/csimanager/volume: use storage, not CSI

* client/pluginmanager/csimanager/volume_test: eventer

* client/pluginmanager/csimanager/volume: event on error

* client/pluginmanager/csimanager/volume_test: check event on error

* command/node_status: remove an extra space in event detail format

* client/pluginmanager/csimanager/volume: use snake_case for details

* client/pluginmanager/csimanager/volume_test: snake_case details
2020-03-31 17:13:52 -04:00
Lang Martin
1bef8b8879 csi: add mount_options to volumes and volume requests (#7398)
Add mount_options to both the volume definition on registration and to the volume block in the group where the volume is requested. If both are specified, the options provided in the request replace the options defined in the volume. They get passed to the NodePublishVolume, which causes the node plugin to actually mount the volume on the host.

Individual tasks just mount bind into the host mounted volume (unchanged behavior). An operator can mount the same volume with different options by specifying it twice in the group context.

closes #7007

* nomad/structs/volumes: add MountOptions to volume request

* jobspec/test-fixtures/basic.hcl: add mount_options to volume block

* jobspec/parse_test: add expected MountOptions

* api/tasks: add mount_options

* jobspec/parse_group: use hcl decode not mapstructure, mount_options

* client/allocrunner/csi_hook: pass MountOptions through

client/allocrunner/csi_hook: add a VolumeMountOptions

client/allocrunner/csi_hook: drop Options

client/allocrunner/csi_hook: use the structs options

* client/pluginmanager/csimanager/interface: UsageOptions.MountOptions

* client/pluginmanager/csimanager/volume: pass MountOptions in capabilities

* plugins/csi/plugin: remove todo 7007 comment

* nomad/structs/csi: MountOptions

* api/csi: add options to the api for parsing, match structs

* plugins/csi/plugin: move VolumeMountOptions to structs

* api/csi: use specific type for mount_options

* client/allocrunner/csi_hook: merge MountOptions here

* rename CSIOptions to CSIMountOptions

* client/allocrunner/csi_hook

* client/pluginmanager/csimanager/volume

* nomad/structs/csi

* plugins/csi/fake/client: add PrevVolumeCapability

* plugins/csi/plugin

* client/pluginmanager/csimanager/volume_test: remove debugging

* client/pluginmanager/csimanager/volume: fix odd merging logic

* api: rename CSIOptions -> CSIMountOptions

* nomad/csi_endpoint: remove a 7007 comment

* command/alloc_status: show mount options in the volume list

* nomad/structs/csi: include MountOptions in the volume stub

* api/csi: add MountOptions to stub

* command/volume_status_csi: clean up csiVolMountOption, add it

* command/alloc_status: csiVolMountOption lives in volume_csi_status

* command/node_status: display mount flags

* nomad/structs/volumes: npe

* plugins/csi/plugin: npe in ToCSIRepresentation

* jobspec/parse_test: expand volume parse test cases

* command/agent/job_endpoint: ApiTgToStructsTG needs MountOptions

* command/volume_status_csi: copy paste error

* jobspec/test-fixtures/basic: hclfmt

* command/volume_status_csi: clean up csiVolMountOption
2020-03-23 13:59:25 -04:00
Lang Martin
13e37865b7 csi: volumes listed in nomad node status (#7318)
* api/allocations: GetTaskGroup finds the taskgroup struct

* command/node_status: display CSI volume names

* nomad/state/state_store: new CSIVolumesByNodeID

* nomad/state/iterator: new SliceIterator type implements memdb.ResultIterator

* nomad/csi_endpoint: deal with a slice of volumes

* nomad/state/state_store: CSIVolumesByNodeID return a SliceIterator

* nomad/structs/csi: CSIVolumeListRequest takes a NodeID

* nomad/csi_endpoint: use the return iterator

* command/agent/csi_endpoint: parse query params for CSIVolumes.List

* api/nodes: new CSIVolumes to list volumes by node

* command/node_status: use the new list endpoint to print volumes

* nomad/state/state_store: error messages consider the operator

* command/node_status: include the Provider
2020-03-23 13:58:30 -04:00
Danielle Lancashire
d153561b13 node_status: Add CSI Summary info
This commit introduces two new fields to the basic output of `nomad
node status <node-id>`.

1) "CSI Controllers", which displays the names of registered controller
plugins.

2) "CSI Drivers", which displays the names of registered CSI Node
plugins.

However, it does not implement support for verbose output, such as
including health status or other fingerprinted data.
2020-03-23 13:58:29 -04:00
Mahmood Ali
81422d410a cli: show full id for single node or alloc status
Show full ID on individual alloc or node status views.  Shortening
the ID isn't very helpful in these cases, and makes looking up the full
id slightly more complicated when user needs to interact with API.

List views are unmodified and show short id unless `-vebose` flag is passed.

Before
```
$ nomad node status -self | head -n2
ID            = 21fc51f9
Name          = mars-2.local

$ nomad alloc status 15ae54cd | head -n3
ID                  = 15ae54cd-08dd-3681-03cf-4c23ace7e7c3
Eval ID             = a6b15f86
Name                = example.cache[0]
```

After:
```
$ nomad node status -self | head -n2
ID            = 21fc51f9-fd39-0fa0-fb41-f34c7aa36101
Name          = mars-2.local

$ nomad alloc status 15ae54cd | head -n3
ID                  = 15ae54cd-08dd-3681-03cf-4c23ace7e7c3
Eval ID             = a6b15f86-ca8e-e536-b544-4bfb43137ff3
Name                = example.cache[0]
```
2019-10-04 16:36:18 -04:00
Danielle Lancashire
2d2b23d788 remove hidden field from host volumes
We're not shipping support for "hidden" volumes in 0.10 any more, I'll
convert this to an issue+mini RFC for future enhancement.
2019-08-22 08:48:05 +02:00
Danielle Lancashire
282b672a2c api: Fix definition of HostVolumeInfo 2019-08-21 22:34:41 +02:00
Danielle Lancashire
a86a07770e command: Cleanup node-status 2019-08-12 15:39:09 +02:00
Danielle Lancashire
f478c8cc24 cli: Display host volume info in nomad node status 2019-08-12 15:39:09 +02:00
Preetha Appan
77225d1d1a nil check node resources to prevent panic 2019-01-22 19:34:02 -06:00
Mahmood Ali
7cca4b0d11 cli: support hitting pre-0.9 nomad agents
node.NodeResources is nil when operating against pre-0.9.
2019-01-08 19:32:26 -05:00
Mahmood Ali
313fc5f10d Merge pull request #4978 from hashicorp/f-device-tweaks
Display device attributes in `nomad node status -verbose`
2018-12-12 19:45:07 -05:00
Mahmood Ali
a802984c9a device attributes in nomad node status -verbose
This reports device attributes like the following:

```
$ nomad node status -self -verbose
ID          = f7adb958-29e1-2a5a-2303-9d61ffaab33a
Name        = mars.local
Class       = <none>
DC          = dc1
Drain       = false
Eligibility = eligible
Status      = ready
Uptime      = 12h40m13s

Drivers
Driver       Detected  Healthy  Message                               Time
docker       true      true     healthy                               2018-12-10T11:47:19-05:00
...

Attributes
cpu.arch                      = amd64
cpu.frequency                 = 2200
cpu.modelname                 = Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
cpu.numcores                  = 12
...

Device Group Attributes
Device Group = nomad/file/mock
block_device = sda1
filesystem   = ext4
size         = 63.2 GB

Meta
```
2018-12-10 12:18:24 -05:00
Alex Dadgar
0953d913ed Deprecate IOPS
IOPS have been modelled as a resource since Nomad 0.1 but has never
actually been detected and there is no plan in the short term to add
detection. This is because IOPS is a bit simplistic of a unit to define
the performance requirements from the underlying storage system. In its
current state it adds unnecessary confusion and can be removed without
impacting any users. This PR leaves IOPS defined at the jobspec parsing
level and in the api/ resources since these are the two public uses of
the field. These should be considered deprecated and only exist to allow
users to stop using them during the Nomad 0.9.x release. In the future,
there should be no expectation that the field will exist.
2018-12-06 15:09:26 -08:00
Mahmood Ali
6208d53275 Prepare to reuse device resources printing 2018-11-16 10:26:32 -05:00
Mahmood Ali
5e2cdb48d4 Display StatsObject nested objects as well 2018-11-15 08:09:54 -05:00
Mahmood Ali
8274555d1c Use disk display format for devices 2018-11-14 22:13:23 -05:00
Mahmood Ali
85f5007043 Print verbose device in nomad node status -stats 2018-11-14 22:13:23 -05:00
Mahmood Ali
276149eaa7 device stats summary in node status
Sample output with a mock device:

```
Host Resource Utilization
CPU             Memory          Disk
2651/26400 MHz  9.6 GiB/16 GiB  98 GiB/234 GiB

Device Resource Utilization
nomad/file/mock[README.md]    511 bytes
nomad/file/mock[e2e.go]       239 bytes
nomad/file/mock[e2e_test.go]  128 bytes

Allocations
No allocations placed
```
2018-11-14 22:13:23 -05:00
Alex Dadgar
aaf77ae13e Handle force draining 2018-06-06 13:05:39 -07:00
Michael Schurter
758e1cb7f3 cli: expand drain info for node status 2018-05-04 10:32:25 -07:00
Michael Schurter
443c1f3f3f Merge pull request #4178 from hashicorp/f-sort-drivers
cli: sort drivers in `node status <node_id>`
2018-04-20 14:03:26 -07:00
Michael Schurter
91cd1a2258 cli: sort drivers in node status <node_id> 2018-04-18 14:30:44 -07:00
Nick Ethier
45b0ce9177 command: improve help text when invalid arguments are given 2018-04-18 12:02:11 -04:00
Alex Dadgar
725f36a7ca Non-verbose driver formatting and don't display non-detected 2018-04-12 11:26:00 -07:00
Michael Schurter
1b1a8d44fd cli: remove outdated hints
Hints no longer apply in the 0.8 Node RPC world.
2018-04-09 12:09:47 -07:00
Chelsea Holland Komlo
bf89de322f correctly initialize array length 2018-04-09 10:51:08 -04:00
Chelsea Holland Komlo
3c9a149cf3 remove stray comma 2018-04-05 18:20:52 -04:00
Chelsea Holland Komlo
927ddd7ff1 Display truncated driver list in non-verbose mode
separate drivers by commas
2018-04-05 14:25:59 -04:00
Chelsea Holland Komlo
7679ba758e display driver status only in verbose mode or if the driver is unhealthy 2018-04-03 11:23:12 -04:00
Chelsea Holland Komlo
43f11cc930 add further driver info; driver name with subsystem 2018-03-29 13:34:30 -04:00
Chelsea Holland Komlo
0c6b896707 Revert "omit driver key/val from details"
This reverts commit 74fc5543ba.
2018-03-29 12:49:46 -04:00
Chelsea Holland Komlo
74fc5543ba omit driver key/val from details 2018-03-29 12:30:12 -04:00
Chelsea Holland Komlo
9645d5120e reformat message 2018-03-28 12:28:16 -04:00
Chelsea Holland Komlo
cdfeac13a1 specify driver health messages 2018-03-28 11:35:21 -04:00
Chelsea Holland Komlo
041786360e use time.Time for node events for compatibility 2018-03-27 15:43:57 -04:00
Chelsea Holland Komlo
6e35eec31e properly formatting unix timestamps 2018-03-27 15:43:57 -04:00
Alex Dadgar
01716489ba sort driver output 2018-03-23 10:59:18 -07:00
Alex Dadgar
95a7e1a90a Driver Info output 2018-03-22 17:18:32 -07:00
Alex Dadgar
d65ae92dfa Small refactor and cleanups 2018-03-21 16:51:44 -07:00
Alex Dadgar
d6399cb733 Add eligibility to node view 2018-03-21 16:51:44 -07:00
Alex Dadgar
2bdeacebff Drain cli, api, http 2018-03-21 16:51:43 -07:00
Alex Dadgar
eceabb66f8 nodeevents -> events 2018-03-13 18:08:22 -07:00
Alex Dadgar
57ddd511cc fixes 2018-03-13 18:08:22 -07:00
Chelsea Holland Komlo
319f80907c code review feedback 2018-03-13 18:08:21 -07:00
Chelsea Holland Komlo
6eb9911caf code review feedback 2018-03-13 18:08:21 -07:00
Chelsea Holland Komlo
fc819754a4 Ensure node updates don't strip node events
Add node events to CLI
2018-03-13 18:05:40 -07:00