Skip to content

Commit

Permalink
Fix validation for disks (#235)
Browse files Browse the repository at this point in the history
The "valid" JSON path has to point to the "bus" field,
because "disk" field always exists, even if it is "nil".

Signed-off-by: Andrej Krejcir <[email protected]>
  • Loading branch information
akrejcir authored Sep 30, 2020
1 parent f137a74 commit 36a7aff
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions templates/VALIDATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ kind: Template
[
{
"name": "supported-bus",
"valid": "jsonpath::.spec.domain.devices.disks[*].disk",
"valid": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
"path": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
"rule": "enum",
"message": "the disk bus type must be one of the supported values",
Expand Down Expand Up @@ -333,7 +333,7 @@ kind: Template
[
{
"name": "supported-bus",
"valid": "jsonpath::.spec.domain.devices.disks[*].disk",
"valid": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
"path": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
"rule": "enum",
"message": "the disk bus type must be one of the supported values",
Expand Down
4 changes: 2 additions & 2 deletions templates/win2k12r2-deprecated.tpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ metadata:
}, {
"name": "windows-virtio-bus",
"path": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
"valid": "jsonpath::.spec.domain.devices.disks[*]",
"valid": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
"rule": "enum",
"message": "virto disk bus type has better performance, install virtio drivers in VM and change bus type",
"values": ["virtio"],
"justWarning": true
}, {
"name": "windows-disk-bus",
"path": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
"valid": "jsonpath::.spec.domain.devices.disks[*]",
"valid": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
"rule": "enum",
"message": "disk bus has to be either virtio or sata",
"values": ["virtio", "sata"]
Expand Down
4 changes: 2 additions & 2 deletions templates/windows.tpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ metadata:
}, {
"name": "windows-virtio-bus",
"path": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
"valid": "jsonpath::.spec.domain.devices.disks[*]",
"valid": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
"rule": "enum",
"message": "virto disk bus type has better performance, install virtio drivers in VM and change bus type",
"values": ["virtio"],
"justWarning": true
}, {
"name": "windows-disk-bus",
"path": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
"valid": "jsonpath::.spec.domain.devices.disks[*]",
"valid": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
"rule": "enum",
"message": "disk bus has to be either virtio or sata",
"values": ["virtio", "sata"]
Expand Down
4 changes: 2 additions & 2 deletions templates/windows10.tpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ metadata:
}, {
"name": "windows-virtio-bus",
"path": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
"valid": "jsonpath::.spec.domain.devices.disks[*]",
"valid": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
"rule": "enum",
"message": "virto disk bus type has better performance, install virtio drivers in VM and change bus type",
"values": ["virtio"],
"justWarning": true
}, {
"name": "windows-disk-bus",
"path": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
"valid": "jsonpath::.spec.domain.devices.disks[*]",
"valid": "jsonpath::.spec.domain.devices.disks[*].disk.bus",
"rule": "enum",
"message": "disk bus has to be either virtio or sata",
"values": ["virtio", "sata"]
Expand Down

0 comments on commit 36a7aff

Please sign in to comment.