From 5fa15f0ddd187576ca542ef9e816d3718ddc1ef9 Mon Sep 17 00:00:00 2001 From: Mark Syms Date: Thu, 19 Sep 2024 14:00:57 +0100 Subject: [PATCH 1/2] Fix the definition of the Data.mirror operation Defining as Copy of uri * uri results in JSON of `["Copy", ["uri", "uri"]]` but the unparse tries to enforce the `["uri", "uri"]` as a tuple, a type which is not supported by JSON. Signed-off-by: Mark Syms --- ocaml/xapi-storage/generator/lib/data.ml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ocaml/xapi-storage/generator/lib/data.ml b/ocaml/xapi-storage/generator/lib/data.ml index e4571892f71..7aa66db8909 100644 --- a/ocaml/xapi-storage/generator/lib/data.ml +++ b/ocaml/xapi-storage/generator/lib/data.ml @@ -239,14 +239,17 @@ end module Data (R : RPC) = struct open R + type copy_operation_v1 = string [@@deriving rpcty] + type mirror_operation_v1 = string [@@deriving rpcty] + (** The primary key for referring to a long-running operation. *) type operation = - | Copy of uri * uri - (** Copy (src,dst) represents an on-going copy operation - from the [src] URI to the [dst] URI. *) - | Mirror of uri * uri - (** Mirror (src,dst) represents an on-going mirror - operation from the [src] URI to the [dst] URI. *) + | CopyV1 of copy_operation_v1 + (** CopyV1 (key) represents an on-going copy operation + with the unique [key]. *) + | MirrorV1 of mirror_operation_v1 + (** MirrorV1 (key) represents an on-going mirror + operation with the unique [key]. *) [@@deriving rpcty] (** A list of operations. *) From b17a9424d209f389bbb77f75b9eccd50b766670e Mon Sep 17 00:00:00 2001 From: Mark Syms Date: Fri, 20 Sep 2024 13:37:49 +0100 Subject: [PATCH 2/2] Extend the Data.stat status to include `complete` Signed-off-by: Mark Syms --- ocaml/xapi-storage/generator/lib/data.ml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ocaml/xapi-storage/generator/lib/data.ml b/ocaml/xapi-storage/generator/lib/data.ml index 7aa66db8909..36b5d20f87d 100644 --- a/ocaml/xapi-storage/generator/lib/data.ml +++ b/ocaml/xapi-storage/generator/lib/data.ml @@ -240,6 +240,7 @@ module Data (R : RPC) = struct open R type copy_operation_v1 = string [@@deriving rpcty] + type mirror_operation_v1 = string [@@deriving rpcty] (** The primary key for referring to a long-running operation. *) @@ -259,7 +260,10 @@ module Data (R : RPC) = struct type status = { failed: bool (** [failed] will be set to true if the operation has failed for some - reason. *) + reason. *) + ; complete: bool + (** [complete] will be set true if the operation is complete, whether + successfully or not, see [failed]. *) ; progress: float option (** [progress] will be returned for a copy operation, and ranges between 0 and 1. *)