Skip to content

Values set in CLI command get overwritten by JSON-BODY for oxide disk create #1383

@paudmir

Description

@paudmir

To create a disk via CLI, one must set the json-body or else we get an error message regardless of whether we set the name, size and description in the command. Furthermore, the values in the command get overwritten by the ones in the JSON file. IF we don't set those in the command, we also get an error saying we must.

If it's already necessary to provide a JSON file, and the values from it are the ones that are true, then if might be worth considering deprecating options from it so users don't get confused.

Example:
Provided everything, except the JSON file. Complained.

→ oxide disk create --name n-disk-yaml-localdisk-cli --description 'This is just for testing purposes' --size 53687091200 --project verdant --profile preview
        stderr: error: the following required arguments were not provided:
  --json-body <JSON-FILE>

Usage: oxide disk create --project <project> --json-body <JSON-FILE> --name <name> --description <description> --size <size> --profile <PROFILE>

Provided JSON file with just 'disk_backend' (because I had already filled out the rest in the command line). Complained that name, size and description were missing in the JSON file.

oxide disk create --description 'This is just for testing purposes' --json-body json/disk_create.json --name localdisk-cli --project verdant --size 53687091200 --profile preview
        stderr: failed to parse json/disk_create.json: missing field `description` at line 5 column 3

oxide disk create  [exit: 1]  (54ms)
        → oxide disk create --description 'This is just for testing purposes' --json-body json/disk_create.json --name localdisk-cli --project verdant --size 53687091200 --profile preview
        stderr: failed to parse json/disk_create.json: missing field `name` at line 6 column 3

oxide disk create --description 'This is just for testing purposes' --json-body json/disk_create.json --name localdisk-cli --project verdant --size 53687091200 --profile preview
        stderr: failed to parse json/disk_create.json: missing field `size` at line 7 column 3

Provided ONLY the JSON file. PASS.

→ oxide disk create --json-body json/disk_create.json --project verdant --profile preview
        stdout: {
  "block_size": 4096,
  "description": "localdisk-testing",
  "device_path": "/mnt/localdisk",
  "disk_type": "local",
  "id": "5507110b-296e-495d-8455-eb26c90ce7c3",
  "name": "localdisk",
  "project_id": "54b9bdc4-313e-46c9-a9bc-2328c14cc303",
  "read_only": false,
  "size": 4294967296,
  "state": {
    "state": "creating"
  },
  "time_created": "2026-03-09T23:48:27.897730Z",
  "time_modified": "2026-03-09T23:48:27.897730Z"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions