[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 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 <thomas.gazagnaire@xxxxxxxxxx>

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
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®.