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: David Scott <dave.scott@xxxxxxxxxxxxx>
Date: Fri, 12 Mar 2010 10:43:56 +0000
Delivery-date: Fri, 12 Mar 2010 02:36:50 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1268390634@xxxxxxxxxxxxxxxxxxxx>
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 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