WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

[Xen-API] [PATCH 2 of 4] CA-38136: remove "xe snapshot-create-template"

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [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"
From: Thomas Gazagnaire <thomas.gazagnaire@xxxxxxxxxx>
Date: Mon, 22 Feb 2010 13:37:10 +0000
Delivery-date: Mon, 22 Feb 2010 05:36:41 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1266845828@steel>
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
# 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