Skip to content

Commit 210a756

Browse files
committed
Add xe vdi-export-changed-blocks CLI command
Signed-off-by: Gabor Igloi <[email protected]>
1 parent 046000c commit 210a756

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

ocaml/xapi/cli_frontend.ml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1993,6 +1993,14 @@ let rec cmdtable_data : (string*cmd_spec) list =
19931993
implementation=No_fd Cli_operations.vdi_data_destroy;
19941994
flags=[];
19951995
};
1996+
"vdi-export-changed-blocks",
1997+
{
1998+
reqd=["vdi-from"; "vdi-to"];
1999+
optn=[];
2000+
help="Write the changed blocks between the two given VDIs to the standard output as a base64-encoded bitmap string.";
2001+
implementation=With_fd Cli_operations.vdi_export_changed_blocks;
2002+
flags=[];
2003+
};
19962004
"diagnostic-vdi-status",
19972005
{
19982006
reqd=["uuid"];

ocaml/xapi/cli_operations.ml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,6 +1260,12 @@ let vdi_data_destroy printer rpc session_id params =
12601260
let vdi = Client.VDI.get_by_uuid rpc session_id (List.assoc "uuid" params) in
12611261
Client.VDI.data_destroy rpc session_id vdi
12621262

1263+
let vdi_export_changed_blocks socket _ rpc session_id params =
1264+
let vdi_from = Client.VDI.get_by_uuid rpc session_id (List.assoc "vdi-from" params) in
1265+
let vdi_to = Client.VDI.get_by_uuid rpc session_id (List.assoc "vdi-to" params) in
1266+
let bitmap = Client.VDI.export_changed_blocks ~rpc ~session_id ~vdi_from ~vdi_to in
1267+
marshal socket (Command (Print bitmap))
1268+
12631269
let diagnostic_vdi_status printer rpc session_id params =
12641270
let vdi = Client.VDI.get_by_uuid rpc session_id (List.assoc "uuid" params) in
12651271
let vdi_r = vdi_record rpc session_id vdi in

0 commit comments

Comments
 (0)