# HG changeset patch # User Thomas Gazagnaire # Date 1268390594 0 # Node ID 628cc77f38df243749d747a2680584b65fdafd2e # Parent a1326fcc45c1007189224246c2fc2da6c1573f44 CA-38136: remove "xe snapshot-create-template" CLI call to replace it with "xe snapshot-clone" and "xe snapshot-copy" which have a similar semantics to "xe vm-clone" and "xe vm-copy". Signed-off-by: Thomas Gazagnaire diff -r a1326fcc45c1 -r 628cc77f38df ocaml/xapi/cli_frontend.ml --- a/ocaml/xapi/cli_frontend.ml Fri Mar 12 10:43:13 2010 +0000 +++ b/ocaml/xapi/cli_frontend.ml Fri Mar 12 10:43:14 2010 +0000 @@ -1254,12 +1254,21 @@ flags=[Standard]; }; - "snapshot-create-template", + "snapshot-clone", { reqd=["new-name-label"; "snapshot-uuid"]; optn=["new-name-description"]; help="Create a new template by cloning an existing snapshot, using storage-level fast disk clone operation where available."; - implementation= No_fd Cli_operations.snapshot_create_template; + implementation= No_fd Cli_operations.snapshot_clone; + flags=[Standard]; + }; + + "snapshot-copy", + { + reqd=["new-name-label"; "snapshot-uuid"]; + optn=["new-name-description"; "sr-uuid"]; + help="Create a new template by copying an existing VM, but without using storage-level fast disk clone operation (even if this is available). The disk images of the copied VM are guaranteed to be 'full images' - i.e. not part of a CoW chain."; + implementation= No_fd Cli_operations.snapshot_copy; flags=[Standard]; }; diff -r a1326fcc45c1 -r 628cc77f38df ocaml/xapi/cli_operations.ml --- a/ocaml/xapi/cli_operations.ml Fri Mar 12 10:43:13 2010 +0000 +++ b/ocaml/xapi/cli_operations.ml Fri Mar 12 10:43:14 2010 +0000 @@ -2182,7 +2182,12 @@ let new_uuid = Client.VM.get_uuid ~rpc ~session_id ~self:new_ref in printer (Cli_printer.PList [new_uuid]) -let snapshot_create_template printer = snapshot_op Client.VM.clone printer +let snapshot_clone printer = snapshot_op Client.VM.clone printer + +let snapshot_copy printer rpc session_id params = + let sr = if List.mem_assoc "sr-uuid" params then Client.SR.get_by_uuid rpc session_id (List.assoc "sr-uuid" params) else Ref.null in + let op = Client.VM.copy ~sr:sr in + snapshot_op op printer rpc session_id params let snapshot_destroy printer rpc session_id params = let snap_uuid = List.assoc "snapshot-uuid" params in