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 7 of 8] CA-43021: Fix bug detecting the backing vhd fil

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH 7 of 8] CA-43021: Fix bug detecting the backing vhd file caused by reading the wrong device's minor number
From: David Scott <dave.scott@xxxxxxxxxxxxx>
Date: Mon, 23 Aug 2010 13:17:47 +0100
Delivery-date: Mon, 23 Aug 2010 05:41:02 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1282565860@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.1282565860@ely>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.4.3
# HG changeset patch
# User David Scott <dave.scott@xxxxxxxxxxxxx>
# Date 1282565815 -3600
# Node ID 2b18e28b785b150c42ff1ffe52eaae906365bc42
# Parent  59d698275079a28b784df5651337ca7716746b67
CA-43021: Fix bug detecting the backing vhd file caused by reading the wrong 
device's minor number.

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

diff -r 59d698275079 -r 2b18e28b785b ocaml/xapi/sparse_dd.ml
--- a/ocaml/xapi/sparse_dd.ml   Mon Aug 23 13:16:53 2010 +0100
+++ b/ocaml/xapi/sparse_dd.ml   Mon Aug 23 13:16:55 2010 +0100
@@ -353,18 +353,23 @@
                        match Tapctl.of_device (Tapctl.create ()) path with
                        | _, _, (Some (_, vhd)) -> Some vhd
                        | _, _, _ -> raise Not_found
-               with Not_found -> None in
-       match tapdisk_of_path path with
-       | Some vhd -> Some vhd
-       | None ->
-               begin match find_underlying_tapdisk path with
-               | Some path ->
-                       begin match tapdisk_of_path path with
-                       | Some vhd -> Some vhd
-                       | None -> None
-                       end
+               with Tapctl.Not_blktap ->
+                       Printf.printf "Device %s is not controlled by blktap\n" 
path;
+                       None
+               | Tapctl.Not_a_device ->
+                       Printf.printf "%s is not a device\n" path;
+                       None
+               | _ -> 
+                       Printf.printf "Device %s has an unknown driver\n" path;
+                       None in
+       begin match find_underlying_tapdisk path with
+       | Some path ->
+               begin match tapdisk_of_path path with
+               | Some vhd -> Some vhd
                | None -> None
                end
+       | None -> None
+       end
 
 let deref_symlinks path = 
        let rec inner seen_already path = 
@@ -472,6 +477,7 @@
        end;
        let empty = Bat.of_list [] in
 
+       Printf.printf "src = %s; dest = %s; base = %s; size = %Ld\n" 
(Opt.default "None" !src) (Opt.default "None" !dest) (Opt.default "None" !base) 
!size;
         let size = Some !size in
 
        (** [chain_of_device device] returns [None] if [device] is None.
@@ -484,7 +490,7 @@
                let vhd : string option = flatten (Opt.map vhd_of_device 
device) in
                let chain : string list option = Opt.map chain_of_vhd vhd in
                let option y = Opt.default "None" (Opt.map (fun x -> "Some " ^ 
x) y) in
-               Printf.printf "%s has chain: [ %s ]" (option device) (option 
(Opt.map (String.concat "; ") chain));
+               Printf.printf "%s has chain: [ %s ]\n" (option device) (option 
(Opt.map (String.concat "; ") chain));
                chain in
 
        let bat : Bat.t option = 
 ocaml/xapi/sparse_dd.ml |  28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)


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

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