Skip to content

Commit 8ba825c

Browse files
author
David Scott
committed
'xenvm vgs': ask xenvmd first, to get an accurate count of LVs
Signed-off-by: David Scott <[email protected]>
1 parent 1db0a74 commit 8ba825c

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

xenvm/vgs.ml

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,28 @@ let vgs copts noheadings nosuffix units fields vg_names =
4141
let local_device = match info with
4242
| Some info -> info.local_device (* If we've got a default, use that *)
4343
| None -> failwith "Need to know the local device!" in
44-
Lwt.catch
45-
(fun () ->
46-
with_block local_device
47-
(fun x ->
48-
Vg_IO.connect [ x ] `RO >>|= fun vg ->
49-
return (Vg_IO.metadata_of vg)
44+
(* First try a network connection to get the most up to date information.
45+
We currently don't replay the redo log when opening the VG read/only--
46+
see [mirage/mirage-block-volume#68]. *)
47+
Lwt.catch Client.get
48+
(fun e ->
49+
stderr "WARNING: failed to contact xenvmd; falling back to reading the disk metadata"
50+
>>= fun () ->
51+
Lwt.catch
52+
(fun () ->
53+
with_block local_device
54+
(fun x ->
55+
Vg_IO.connect [ x ] `RO >>|= fun vg ->
56+
return (Vg_IO.metadata_of vg)
57+
)
5058
)
59+
(fun _ ->
60+
stderr " Volume group \"%s\" not found" vg_name
61+
>>= fun () ->
62+
stderr " Skipping volume group %s" vg_name
63+
>>= fun () ->
64+
exit 1)
5165
)
52-
(fun _ ->
53-
stderr " Volume group \"%s\" not found" vg_name
54-
>>= fun () ->
55-
stderr " Skipping volume group %s" vg_name
56-
>>= fun () ->
57-
exit 1)
5866
>>= fun vg ->
5967
Lwt.return (info,vg)) vg_names >>= fun vgs ->
6068
let rows = List.concat (List.map do_row vgs) in

0 commit comments

Comments
 (0)