Commit Graph

3821 Commits

Author SHA1 Message Date
ChengyuZhu6
d788d4af2f runtime: Add KataVirtualVolume struct in runtime
Add the corresponding data structure in the runtime part according to
kata-containers/kata-containers/pull/7698.

Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com>
2023-09-13 09:30:30 +08:00
stevenhorsman
9ebb91f94c runk: Fix rust unecessary mut error
- Fix `error: variable does not need to be mutable`
in rust 1.72

Fixes: #7902
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2023-09-12 15:16:50 +01:00
stevenhorsman
f7fd2c1dfc kata-ctl: useless-vec warning
- Fix clippy::useless-vec warning

Fixes: #7902
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2023-09-12 15:16:50 +01:00
stevenhorsman
c0668ef7eb kata-ctl: Resolve non-minimal-cfg warning
- In rust 1.72, clippy warned clippy::non-minimal-cfg
as the cfg has only one condition, so doesn't
need to be wrapped in the any combinator.

Fixes: #7902
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2023-09-12 15:16:50 +01:00
stevenhorsman
0a33d27c30 agent-ctl: Allow clippy lint
- Allow `clippy::redundant-closure-call`
which has issues with the guard function passed into
the `run_if_auto_values` macro

Fixes: #7902
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2023-09-12 15:16:50 +01:00
stevenhorsman
48465d0547 runtime-rs: Fix useless-vec warning
Fix clippy::useless-vec warning

Fixes: #7902
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2023-09-12 15:16:50 +01:00
stevenhorsman
cb7cc1d708 runtime-rs: Remove mut
Fix `error: variable does not need to be mutable`

Fixes: #7902
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2023-09-12 15:16:50 +01:00
stevenhorsman
6e508ae322 dragonball: Allow ambiguous-glob-reexports
The bindgen generated code is triggering lots of
ambiguous-glob-reexports warnings in rust 1.70+

Fixes: #7902
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2023-09-12 15:16:50 +01:00
stevenhorsman
91916ed118 dragonball: Resolve non-minimal-cfg warning
- In rust 1.72, clippy warned clippy::non-minimal-cfg
as the cfg has only one condition, so doesn't
need to be wrapped in the all combinators.

Fixes: #7902
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2023-09-12 15:16:50 +01:00
stevenhorsman
d1d49675a0 agent: config: Allow clippy lint
- Allow `clippy::redundant-closure-call` in `from_cmdline`
which has issues with the guard function passed into
the `parse_cmdline_param` macro

Fixes: #7902
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2023-09-12 15:16:50 +01:00
stevenhorsman
3416e104b8 agent: config: Fix useles-vec warning
Fix clippy::useless-vec warning

Fixes: #7902
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2023-09-12 15:16:50 +01:00
stevenhorsman
495b9825e5 libs: Fix clippy unnecesary hashes error
- Fix error: unnecessary hashes around raw string literal

Fixes: #7902
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2023-09-12 14:19:41 +01:00
Biao Lu
13943fb81b agent: launch api-server-rest
If 'rest_api' is configured, start api-server-rest after
attestation-agent and confidential-data-hub.

Fixes: #7555

Signed-off-by: Biao Lu <biao.lu@intel.com>
2023-09-07 09:55:46 +08:00
Biao lu
47c28923d7 agent: Add config for api-server-rest
Add configuration for 'rest api server'.
Optional configurations are
  'agent.rest_api=attestation' will enable attestation api
  'agent.rest_api=resource' will enable resource api
  'agent.rest_api=all' will enable all (attestation and resource) api

Fixes: #7555

Signed-off-by: Biao lu <biao.lu@intel.com>
2023-09-07 09:55:46 +08:00
Linda Yu
212229df83 runtime: add sealed secret configuration
Fixes: #7555

Signed-off-by: Linda Yu <linda.yu@intel.com>
2023-09-07 09:55:46 +08:00
Linda Yu
f1573b4747 agent: unittest for sealed secret as file in kata
Fixes: #7555

Signed-off-by: Linda Yu <linda.yu@intel.com>
2023-09-07 09:55:46 +08:00
Linda Yu
d7873e5251 agent: support sealed secret as file in kata
Fixes: #7555

Signed-off-by: Linda Yu <linda.yu@intel.com>
2023-09-07 09:55:40 +08:00
Linda Yu
c60adedf99 agent: add feature for confidential data hub (cdh)
Fixes: #7555

Signed-off-by: Linda Yu <linda.yu@intel.com>
2023-09-07 09:00:25 +08:00
Linda Yu
9c02722d46 agent: unittest for sealed secret as env in kata
Fixes: #7555

Signed-off-by: Linda Yu <linda.yu@intel.com>
2023-09-07 09:00:25 +08:00
Linda Yu
75def881e5 agent: support sealed secret as env in kata
Fixes: #7555

Signed-off-by: Linda Yu <linda.yu@intel.com>
2023-09-07 09:00:25 +08:00
Biao Lu
5316839165 agent: launch confidential-data-hub
confidential-data-hub depends attestation-agent, and
confidential-data-hab need to start before rpc server, so move the
function 'init_attestation_agent' from image_rpc.rs to main.rs and
launch confidential-data-hub after 'init_attestation_agent'.

Fixes: #7544

Signed-off-by: Biao Lu <biao.lu@intel.com>
2023-09-07 08:59:31 +08:00
Biao Lu
acd0a75efd agent: rootfs: add sealed-secret in Makefile
When set SEALED_SECRET to "yes", the kata-agent is built with
sealed-secret capability, default value is "no".

Fixes: #7544

Signed-off-by: Biao Lu <biao.lu@intel.com>
2023-09-06 10:57:34 +08:00
Biao Lu
4e3a1ebcaf protocols: add support sealed_secret
To call CDH ttrpc API, 'unseal_secret' for 'sealed_secret', add
protocol file and generate ttrpc code.

Fixes: #7544

Signed-off-by: Biao Lu <biao.lu@intel.com>
2023-09-06 10:57:34 +08:00
Jiang Liu
f45ee1fe1d agent: refine StorageDeviceGeneric::cleanup()
Refine StorageDeviceGeneric::cleanup() to improve safety.

Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
2023-09-02 17:05:29 +08:00
Jiang Liu
1f4facdfe9 agent: implement StorageDeviceGeneric::cleanup()
Refactor cleanup_sandbox_storage as StorageDeviceGeneric::cleanup().

Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
2023-09-02 17:05:16 +08:00
Jiang Liu
d955f9dcf8 types: make StorageDevice::cleanup() return possible error code
Make StorageDevice::cleanup() return possible error code.

Fixes: #7818

Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
2023-09-02 17:04:55 +08:00
Jiang Liu
039fde2b66 agent: move StorageDeviceGeneric from kata-types into agent
Move StorageDeviceGeneric from kata-types into agent, so we can
refactor code later.

Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
2023-09-02 17:04:36 +08:00
Jiang Liu
eac38d1a05 agent: avoid possible leakage of storage device
When a storage device is used by more than one container, the second
and forth instances will cause storage device reference count leakage,
thus cause storage device leakage. The reason is:
add_storages() will increase reference count of existing storage device,
but forget to add the device to the `mount_list` array, thus leak the
reference count.

Fixes: #7820

Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
2023-09-02 17:04:16 +08:00
stevenhorsman
c888facd24 versions: Bump guest-components
Bump image-rs and attestation-agent to use the latest guest-components
with the rust clap version fix

Fixes: #7580
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2023-08-30 14:33:35 +01:00
Jiang Liu
412e8554f3 agent: simplify storage device by removing StorageDeviceObject
Simplify storage device implementation by removing StorageDeviceObject.

Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
2023-08-28 09:53:20 +08:00
Jiang Liu
d5483aaf7c agent: move storage device related code into dedicated files
Move storage device related code into dedicated files.

Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
2023-08-28 09:53:20 +08:00
Jiang Liu
3b1af40b16 agent: refine storage related code a bit
Refine storage related code by:
- remove the STORAGE_HANDLER_LIST
- define type alias
- move code near to its caller

Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
2023-08-28 09:53:19 +08:00
Jiang Liu
331e35bc1a agent: switch to new storage subsystem
Switch to new storage subsystem to create a StorageDevice for each
storage object.

Fixes: #7614

Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
2023-08-28 09:53:19 +08:00
Jiang Liu
aee71b16f1 kata-types: introduce StorageDevice and StorageHandlerManager
Introduce StorageDevice and StorageHandlerManager, which will be used
to refine storage device management for kata-agent.

Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
2023-08-28 09:53:19 +08:00
Jiang Liu
0d5a9eaeff agent: simplify the way to manage storage object
Simplify the way to manage storage objects, and introduce
StorageStateCommon structures for coming extensions.

Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
2023-08-28 09:53:19 +08:00
Jiang Liu
6dcd164c4e sys-util: support more mount flags in parse_mount_options()
Support more mount flags in parse_mount_options().

Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
2023-08-28 09:53:19 +08:00
Jiang Liu
cf15777edd agent: use create_mount_destination() from kata-sys-util
Use create_mount_destination() from kata-sys-util crate to reduce
redundant code.

Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
2023-08-28 09:53:19 +08:00
Jiang Liu
7f12e27a68 types: add more mount related constants
Add more mount related constants.

Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
2023-08-28 09:53:19 +08:00
Jiang Liu
b6218beef6 agent: use function from kata-sys-utils to reduce code
Use function get_linux_mount_info() from kata-sys-util crate to share
common code.

Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
2023-08-25 22:23:03 +08:00
Jiang Liu
bb644ee3ed Merge pull request #7744 from jiangliu/pick-7698
CC | cherry-pick PR #7698 into CCv0
2023-08-24 15:31:42 +08:00
Fabiano Fidêncio
aef93c7aaf Merge pull request #7576 from surajssd/update-aa-imagers-tdshim
Update AA, image-rs td-shim
2023-08-24 08:38:29 +02:00
Jiang Liu
15d1b2431c kata-types: implement serde methods for KataVirtualVolume
Implement serilization/deserialization methods for KataVirtualVolume.

Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
2023-08-24 13:02:56 +08:00
Jiang Liu
61340c3d63 kata-types: validate KataVirtualVolume object
Implement method validate() for KataVirtualVolume to validate message
format.

Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
2023-08-24 13:02:42 +08:00
Jiang Liu
6d07df4b15 kata-types: implement two conversion helpers for KataVirtualVolume
Enable conversions from NydusExtraOptions/DirectVolumeMountInfo to
KataVirtualVolume.

Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
2023-08-24 13:02:28 +08:00
Jiang Liu
7e553e6707 kata-types: introduce KataVirtualVolume
Introduce structure KataVirtualVolume to to encapsulate information
for extra mount options and direct volumes, so we could build a common
infrastructure to handle these cases.

Fixes: #7699

Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
2023-08-24 13:02:11 +08:00
Suraj Deshmukh
d8953498c6 CCv0: Update image-rs, AA and td-shim
- image-rs & AA: 3d8192f8d3efab041916ea4d60e32248ac6ec43d
- td-shim: 35c8ec33311877f0711412fd34cee929ae57e80e

Fixes: #7580

Signed-off-by: Suraj Deshmukh <suraj.deshmukh@microsoft.com>
2023-08-23 14:34:07 +00:00
Jiang Liu
f218a3104e agent/image: move image service related code into image-rpc.rs
Move image service related code into image-rpc.rs, to simplify
maintenance.

Fixes: #7633

Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
Co-authored-by: wllenyj <wllenyj@linux.alibaba.com>
Co-authored-by: jordan9500 <jordan.jackson@ibm.com>
Co-authored-by: stevenhorsman <steven@uk.ibm.com>
2023-08-21 19:29:09 +08:00
Jiang Liu
81980388d4 agent/image: export the image service singleton instance
Export the image service singleton instance.

Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
2023-08-21 19:28:44 +08:00
Jiang Liu
624d3c063a agent/image: syntax only change to image service implementation
Syntax only change to image service implementation.

Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
2023-08-21 19:28:32 +08:00
Fabiano Fidêncio
516468815e cc: Merge from main to CCv0 - Aug 14th
Conflicts:
	src/agent/src/rpc.rs

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-08-14 09:22:03 +02:00