[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-API] [PATCH 2 of 4] 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"



# HG changeset patch
# User Thomas Gazagnaire <thomas.gazagnaire@xxxxxxxxxx>
# Date 1266842150 0
# Node ID 2130f262d8902bb0957e97ee3dc75439d3438628
# Parent  a3e97f80a31d1f541051c8128193c82095aac2a5
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 <thomas.gazagnaire@xxxxxxxxxx>

diff -r a3e97f80a31d -r 2130f262d890 ocaml/xapi/cli_frontend.ml
--- a/ocaml/xapi/cli_frontend.ml        Mon Feb 22 12:35:50 2010 +0000
+++ b/ocaml/xapi/cli_frontend.ml        Mon Feb 22 12:35:50 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 a3e97f80a31d -r 2130f262d890 ocaml/xapi/cli_operations.ml
--- a/ocaml/xapi/cli_operations.ml      Mon Feb 22 12:35:50 2010 +0000
+++ b/ocaml/xapi/cli_operations.ml      Mon Feb 22 12:35:50 2010 +0000
@@ -2181,7 +2181,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
2 files changed, 17 insertions(+), 3 deletions(-)
ocaml/xapi/cli_frontend.ml   |   13 +++++++++++--
ocaml/xapi/cli_operations.ml |    7 ++++++-


Attachment: xen-api.hg-4.patch
Description: Text Data

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.