From 51f275a867b4a7007ea6e2aa93f350f08be2680e Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Fri, 24 May 2024 14:17:03 +0200 Subject: client: update cache after image/restore Update the database with the new cache contents sent by the client after an image/restore operation. Resquest response structure: { ... 'cache': [ {'name': 'windows.img', 'size': 2432370213, checksum: '5d4dcc677bc19f40a647d0002f4ade90'}, {'name': 'linux.img', 'size': 243234534213, checksum: '3eb22f888f88a55ad954f55644e1192e'} ] ... } Parse the contents of the 'cache' field to update the data of the client's cache in the database. This is one of the required changes the make cache/list coherent and prevent cache desync between the server and clients. --- src/client.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/client.c b/src/client.c index 1486034..9989462 100644 --- a/src/client.c +++ b/src/client.c @@ -1065,6 +1065,8 @@ int og_agent_state_process_response(struct og_client *cli) break; case OG_CMD_IMAGE_RESTORE: err = og_resp_image_restore(root, cli); + if (!err) + err = og_resp_update_cache(root, cli); break; case OG_CMD_CACHE_DELETE: err = og_resp_update_cache(root, cli); -- cgit v1.2.3-18-g5258