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 3 of 3] CP-1884: The pool master should forward VDI.cop

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH 3 of 3] CP-1884: The pool master should forward VDI.copy calls to a host which can see the source SR; now that we have cross-host copying it isn't necessary to be able to find a host which can see both the source and destination SRs
From: David Scott <dave.scott@xxxxxxxxxxxxx>
Date: Mon, 23 Aug 2010 13:06:42 +0100
Delivery-date: Mon, 23 Aug 2010 05:28:29 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1282565199@ely>
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>
References: <patchbomb.1282565199@ely>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.4.3
# HG changeset patch
# User David Scott <dave.scott@xxxxxxxxxxxxx>
# Date 1282565149 -3600
# Node ID d7be370e494a2154e9e243102b5bd5f71189f6da
# Parent  f9725bc799887fb205bf1da8cf3474288529dc90
CP-1884: The pool master should forward VDI.copy calls to a host which can see 
the source SR; now that we have cross-host copying it isn't necessary to be 
able to find a host which can see both the source and destination SRs.

Signed-off-by: David Scott <dave.scott@xxxxxxxxxxxxx>

diff -r f9725bc79988 -r d7be370e494a ocaml/xapi/message_forwarding.ml
--- a/ocaml/xapi/message_forwarding.ml  Mon Aug 23 13:05:48 2010 +0100
+++ b/ocaml/xapi/message_forwarding.ml  Mon Aug 23 13:05:49 2010 +0100
@@ -960,18 +960,12 @@
       info "VM.copy: VM = '%s'; new_name = '%s'; SR = '%s'" (vm_uuid 
~__context vm) new_name (sr_uuid ~__context sr);
       let task_id = Ref.string_of (Context.get_task_id __context) in
       let local_fn = Local.VM.copy ~vm ~new_name ~sr in
-      (* Are we copying to a new SR? *)
-      let new_sr_copy = try ignore(Db.SR.get_uuid ~__context ~self:sr); true 
with _ -> false in
-      let fwd_fn = 
-       if new_sr_copy 
-       then forward_to_access_srs_and ~extra_sr:sr
-       else forward_to_access_srs in
       (* We mark the VM as cloning. We don't mark the disks; the 
implementation of the clone
         uses the API to clone and lock the individual VDIs. We don't give any 
atomicity
         guarantees here but we do prevent disk corruption. *)
       with_vm_operation ~__context ~self:vm ~doc:"VM.copy" ~op:`copy
        (fun () ->
-          fwd_fn ~local_fn ~__context ~vm 
+          forward_to_access_srs ~local_fn ~__context ~vm 
             (fun session_id rpc -> Client.VM.copy rpc session_id vm new_name 
sr))
 
     
diff -r f9725bc79988 -r d7be370e494a ocaml/xapi/sm_fs_ops.ml
--- a/ocaml/xapi/sm_fs_ops.ml   Mon Aug 23 13:05:48 2010 +0100
+++ b/ocaml/xapi/sm_fs_ops.ml   Mon Aug 23 13:05:49 2010 +0100
@@ -310,7 +310,7 @@
                let ifd=Unix.openfile device_src [Unix.O_RDONLY] 0o600 in
                finally
                (fun () ->
-                       if local_copy 
+                       if local_copy && not (Xapi_fist.force_remote_vdi_copy 
())
                        then with_block_attached_device __context rpc 
session_id vdi_dst `RW
                                (fun device_dst ->
                                        let ofd=Unix.openfile device_dst 
[Unix.O_WRONLY; Unix.O_SYNC] 0o600 in
diff -r f9725bc79988 -r d7be370e494a ocaml/xapi/xapi_fist.ml
--- a/ocaml/xapi/xapi_fist.ml   Mon Aug 23 13:05:48 2010 +0100
+++ b/ocaml/xapi/xapi_fist.ml   Mon Aug 23 13:05:49 2010 +0100
@@ -114,3 +114,6 @@
 
 (** Disables the artificial reboot delay, for faster testing. *)
 let disable_reboot_delay () = fistpoint "disable_reboot_delay"
+
+
+let force_remote_vdi_copy () = fistpoint "force_remote_vdi_copy"
\ No newline at end of file
 ocaml/xapi/message_forwarding.ml |  8 +-------
 ocaml/xapi/sm_fs_ops.ml          |  2 +-
 ocaml/xapi/xapi_fist.ml          |  3 +++
 3 files changed, 5 insertions(+), 8 deletions(-)


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

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api
<Prev in Thread] Current Thread [Next in Thread>