[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-API] [PATCH 7 of 8] CA-43021: Fix bug detecting the backing vhd file caused by reading the wrong device's minor number



# 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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.