Skip to content

Commit

Permalink
feat(api_server): add put api for vhost-user drives
Browse files Browse the repository at this point in the history
This addes vhost-user optional object in the Drive object
to provide vhost-user-specific configuration.

Signed-off-by: Nikita Kalyazin <[email protected]>
  • Loading branch information
kalyazin committed Sep 22, 2023
1 parent 4840f0a commit ddc0313
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 8 deletions.
14 changes: 13 additions & 1 deletion src/api_server/swagger/firecracker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,10 @@ definitions:
This parameter has been deprecated since v1.6.0.
Use parameters in `file` instead.
$ref: "#/definitions/RateLimiter"

vhost_user:
description:
Configuration for the vhost-user-backed device.
$ref: "#/definitions/VhostUserConfig"
Error:
type: object
properties:
Expand Down Expand Up @@ -1302,6 +1305,15 @@ definitions:
description: The total number of tokens this bucket can hold.
minimum: 0

VhostUserConfig:
type: object
required:
- socket
properties:
socket:
type: string
description: Socket path for vhost-user backend.

Vm:
type: object
description:
Expand Down
3 changes: 2 additions & 1 deletion tests/framework/vm_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"is_read_only": false,
"io_engine": "Sync",
"rate_limiter": null
}
},
"vhost_user": null
}
],
"machine-config": {
Expand Down
3 changes: 2 additions & 1 deletion tests/framework/vm_config_cpu_template_C3.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"file": {
"path_on_host": "bionic.rootfs.ext4",
"is_read_only": false
}
},
"vhost_user": null
}
],
"machine-config": {
Expand Down
3 changes: 2 additions & 1 deletion tests/framework/vm_config_missing_mem_size_mib.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"file": {
"path_on_host": "bionic.rootfs.ext4",
"is_read_only": false
}
},
"vhost_user": null
}
],
"machine-config": {
Expand Down
3 changes: 2 additions & 1 deletion tests/framework/vm_config_missing_vcpu_count.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"file": {
"path_on_host": "bionic.rootfs.ext4",
"is_read_only": false
}
},
"vhost_user": null
}
],
"machine-config": {
Expand Down
3 changes: 2 additions & 1 deletion tests/framework/vm_config_smt_true.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"file": {
"path_on_host": "bionic.rootfs.ext4",
"is_read_only": false
}
},
"vhost_user": null
}
],
"machine-config": {
Expand Down
3 changes: 2 additions & 1 deletion tests/framework/vm_config_with_mmdsv1.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"is_read_only": false,
"io_engine": "Sync",
"rate_limiter": null
}
},
"vhost_user": null
}
],
"machine-config": {
Expand Down
3 changes: 2 additions & 1 deletion tests/framework/vm_config_with_mmdsv2.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"is_read_only": false,
"io_engine": "Sync",
"rate_limiter": null
}
},
"vhost_user": null
}
],
"machine-config": {
Expand Down
4 changes: 4 additions & 0 deletions tests/integration_tests/functional/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,7 @@ def _drive_patch(test_microvm):
"rate_limiter": None,
"io_engine": "Sync",
},
"vhost_user": None,
},
{
"drive_id": "scratch",
Expand All @@ -875,6 +876,7 @@ def _drive_patch(test_microvm):
},
"io_engine": "Async" if is_io_uring_supported() else "Sync",
},
"vhost_user": None,
},
]

Expand Down Expand Up @@ -1081,6 +1083,7 @@ def test_get_full_config_after_restoring_snapshot(microvm_factory, uvm_nano):
"rate_limiter": None,
"io_engine": "Sync",
},
"vhost_user": None,
}
]

Expand Down Expand Up @@ -1196,6 +1199,7 @@ def test_get_full_config(test_microvm_with_api):
"rate_limiter": None,
"io_engine": "Sync",
},
"vhost_user": None,
}
]

Expand Down

0 comments on commit ddc0313

Please sign in to comment.