From 98b94de7c7103443fd5d376e28656fb6cb57ead2 Mon Sep 17 00:00:00 2001 From: Mathias Gibbens Date: Tue, 18 Nov 2025 15:33:01 -0700 Subject: [PATCH] incus-osd/rest: Rename API endpoint /1.0/system/storage/:import-encryption-key to /1.0/system/storage/:import-pool Signed-off-by: Mathias Gibbens --- incus-osd/internal/rest/api_system_storage.go | 12 ++++++------ incus-osd/internal/rest/server.go | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/incus-osd/internal/rest/api_system_storage.go b/incus-osd/internal/rest/api_system_storage.go index 2c6b892..e736a9b 100644 --- a/incus-osd/internal/rest/api_system_storage.go +++ b/incus-osd/internal/rest/api_system_storage.go @@ -263,11 +263,11 @@ func (*Server) apiSystemStorageWipeDrive(w http.ResponseWriter, r *http.Request) _ = response.EmptySyncResponse.Render(w) } -// swagger:operation POST /1.0/system/storage/:import-encryption-key system system_post_storage_import_encryption_key +// swagger:operation POST /1.0/system/storage/:import-pool system system_post_storage_import_pool // -// Import an existing encryption key +// Import an existing encrypted storage pool // -// Sets the encryption key when importing an existing storage pool. +// Imports an existing encrypted ZFS storage pool and save its encryption key. // // --- // consumes: @@ -277,7 +277,7 @@ func (*Server) apiSystemStorageWipeDrive(w http.ResponseWriter, r *http.Request) // parameters: // - in: body // name: configuration -// description: Pool encryption information +// description: Existing pool information // required: true // schema: // type: object @@ -289,7 +289,7 @@ func (*Server) apiSystemStorageWipeDrive(w http.ResponseWriter, r *http.Request) // $ref: "#/responses/BadRequest" // "500": // $ref: "#/responses/InternalServerError" -func (*Server) apiSystemStorageImportEncryptionKey(w http.ResponseWriter, r *http.Request) { +func (*Server) apiSystemStorageImportPool(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") if r.Method != http.MethodPost { @@ -322,7 +322,7 @@ func (*Server) apiSystemStorageImportEncryptionKey(w http.ResponseWriter, r *htt return } - err = storage.SetEncryptionKey(r.Context(), poolStruct.Name, poolStruct.EncryptionKey) + err = zfs.ImportExistingPool(r.Context(), poolStruct.Name, poolStruct.EncryptionKey) if err != nil { _ = response.InternalError(err).Render(w) diff --git a/incus-osd/internal/rest/server.go b/incus-osd/internal/rest/server.go index 1fe362c..4e6358a 100644 --- a/incus-osd/internal/rest/server.go +++ b/incus-osd/internal/rest/server.go @@ -77,7 +77,7 @@ func (s *Server) Serve(ctx context.Context) error { router.HandleFunc("/1.0/system/security/:tpm-rebind", s.apiSystemSecurityTPMRebind) router.HandleFunc("/1.0/system/storage", s.apiSystemStorage) router.HandleFunc("/1.0/system/storage/:delete-pool", s.apiSystemStorageDeletePool) - router.HandleFunc("/1.0/system/storage/:import-encryption-key", s.apiSystemStorageImportEncryptionKey) + router.HandleFunc("/1.0/system/storage/:import-pool", s.apiSystemStorageImportPool) router.HandleFunc("/1.0/system/storage/:wipe-drive", s.apiSystemStorageWipeDrive) router.HandleFunc("/1.0/system/update", s.apiSystemUpdate) router.HandleFunc("/1.0/system/update/:check", s.apiSystemUpdateCheck)