From bcabb3e7bbd3a0a523cc5a361d1cd11bc1762714 Mon Sep 17 00:00:00 2001 From: Nikita Kalyazin Date: Tue, 22 Aug 2023 11:37:43 +0000 Subject: [PATCH] feat(api_server): add put api for vhost-user drives This addes vhost-user optional object in the Drive object to provide vhost-user-specific configuration. Signed-off-by: Nikita Kalyazin --- src/api_server/swagger/firecracker.yaml | 14 +++++++++++++- tests/framework/vm_config.json | 3 ++- tests/framework/vm_config_cpu_template_C3.json | 3 ++- .../framework/vm_config_missing_mem_size_mib.json | 3 ++- tests/framework/vm_config_missing_vcpu_count.json | 3 ++- tests/framework/vm_config_smt_true.json | 3 ++- tests/framework/vm_config_with_mmdsv1.json | 3 ++- tests/framework/vm_config_with_mmdsv2.json | 3 ++- tests/integration_tests/functional/test_api.py | 4 ++++ 9 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/api_server/swagger/firecracker.yaml b/src/api_server/swagger/firecracker.yaml index 5a4977ef2948..faffaa2eeb8f 100644 --- a/src/api_server/swagger/firecracker.yaml +++ b/src/api_server/swagger/firecracker.yaml @@ -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: @@ -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: diff --git a/tests/framework/vm_config.json b/tests/framework/vm_config.json index 2244c7227f18..9c83ff218c42 100644 --- a/tests/framework/vm_config.json +++ b/tests/framework/vm_config.json @@ -19,7 +19,8 @@ "is_read_only": false, "io_engine": "Sync", "rate_limiter": null - } + }, + "vhost_user": null } ], "machine-config": { diff --git a/tests/framework/vm_config_cpu_template_C3.json b/tests/framework/vm_config_cpu_template_C3.json index 34163aa5377d..fd18de4c5c2c 100644 --- a/tests/framework/vm_config_cpu_template_C3.json +++ b/tests/framework/vm_config_cpu_template_C3.json @@ -12,7 +12,8 @@ "file": { "path_on_host": "bionic.rootfs.ext4", "is_read_only": false - } + }, + "vhost_user": null } ], "machine-config": { diff --git a/tests/framework/vm_config_missing_mem_size_mib.json b/tests/framework/vm_config_missing_mem_size_mib.json index 56bb358c299f..edb1cf539e28 100644 --- a/tests/framework/vm_config_missing_mem_size_mib.json +++ b/tests/framework/vm_config_missing_mem_size_mib.json @@ -12,7 +12,8 @@ "file": { "path_on_host": "bionic.rootfs.ext4", "is_read_only": false - } + }, + "vhost_user": null } ], "machine-config": { diff --git a/tests/framework/vm_config_missing_vcpu_count.json b/tests/framework/vm_config_missing_vcpu_count.json index f60b80b101e2..d82136dc6ff6 100644 --- a/tests/framework/vm_config_missing_vcpu_count.json +++ b/tests/framework/vm_config_missing_vcpu_count.json @@ -12,7 +12,8 @@ "file": { "path_on_host": "bionic.rootfs.ext4", "is_read_only": false - } + }, + "vhost_user": null } ], "machine-config": { diff --git a/tests/framework/vm_config_smt_true.json b/tests/framework/vm_config_smt_true.json index 7a22425c26a8..800b6e0f4ee1 100644 --- a/tests/framework/vm_config_smt_true.json +++ b/tests/framework/vm_config_smt_true.json @@ -12,7 +12,8 @@ "file": { "path_on_host": "bionic.rootfs.ext4", "is_read_only": false - } + }, + "vhost_user": null } ], "machine-config": { diff --git a/tests/framework/vm_config_with_mmdsv1.json b/tests/framework/vm_config_with_mmdsv1.json index 1112b111baa0..0ca76dd2af72 100644 --- a/tests/framework/vm_config_with_mmdsv1.json +++ b/tests/framework/vm_config_with_mmdsv1.json @@ -19,7 +19,8 @@ "is_read_only": false, "io_engine": "Sync", "rate_limiter": null - } + }, + "vhost_user": null } ], "machine-config": { diff --git a/tests/framework/vm_config_with_mmdsv2.json b/tests/framework/vm_config_with_mmdsv2.json index 8c6a49ff3b78..15c14e860617 100644 --- a/tests/framework/vm_config_with_mmdsv2.json +++ b/tests/framework/vm_config_with_mmdsv2.json @@ -19,7 +19,8 @@ "is_read_only": false, "io_engine": "Sync", "rate_limiter": null - } + }, + "vhost_user": null } ], "machine-config": { diff --git a/tests/integration_tests/functional/test_api.py b/tests/integration_tests/functional/test_api.py index fb47c22abde1..28bb0169facb 100644 --- a/tests/integration_tests/functional/test_api.py +++ b/tests/integration_tests/functional/test_api.py @@ -849,6 +849,7 @@ def _drive_patch(test_microvm): "rate_limiter": None, "io_engine": "Sync", }, + "vhost_user": None, }, { "drive_id": "scratch", @@ -875,6 +876,7 @@ def _drive_patch(test_microvm): }, "io_engine": "Async" if is_io_uring_supported() else "Sync", }, + "vhost_user": None, }, ] @@ -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, } ] @@ -1196,6 +1199,7 @@ def test_get_full_config(test_microvm_with_api): "rate_limiter": None, "io_engine": "Sync", }, + "vhost_user": None, } ]