Skip to content

Commit 9b92df3

Browse files
author
David Scott
committed
test: add a test for 'lvchange --offline'
Signed-off-by: David Scott <[email protected]>
1 parent a8ef604 commit 9b92df3

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/test.ml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,27 @@ let vgs_offline =
4747
)
4848
)
4949

50+
let lvchange_offline =
51+
"lvchange vg/lv --offline: check that we can activate volumes offline" >::
52+
fun () ->
53+
with_temp_file (fun filename' ->
54+
with_loop_device filename' (fun loop ->
55+
xenvm [ "vgcreate"; vg; loop ] |> ignore_string;
56+
xenvm [ "set-vg-info"; "--pvpath"; loop; "-S"; "/tmp/xenvmd"; vg; "--local-allocator-path"; "/tmp/xenvm-local-allocator"; "--uri"; "file://local/services/xenvmd/"^vg ] |> ignore_string;
57+
file_of_string "test.xenvmd.conf" ("( (listenPort ()) (listenPath (Some \"/tmp/xenvmd\")) (host_allocation_quantum 128) (host_low_water_mark 8) (vg "^vg^") (devices ("^loop^")))");
58+
xenvmd [ "--config"; "./test.xenvmd.conf"; "--daemon" ] |> ignore_string;
59+
Xenvm_client.Rpc.uri := "file://local/services/xenvmd/" ^ vg;
60+
Xenvm_client.unix_domain_socket_path := "/tmp/xenvmd";
61+
finally
62+
(fun () ->
63+
xenvm [ "lvcreate"; "-n"; "test"; "-L"; "3"; vg ] |> ignore_string;
64+
) (fun () ->
65+
xenvm [ "shutdown"; "/dev/"^vg ] |> ignore_string
66+
);
67+
xenvm [ "lvchange"; "-ay"; vg ^ "/test"; "--offline" ] |> ignore_string;
68+
)
69+
)
70+
5071
let pvremove =
5172
"pvremove <device>: check that we can make a PV unrecognisable" >::
5273
(fun () ->
@@ -69,6 +90,7 @@ let pvremove =
6990
let no_xenvmd_suite = "Commands which should work without xenvmd" >::: [
7091
vgcreate;
7192
vgs_offline;
93+
lvchange_offline;
7294
pvremove;
7395
]
7496

0 commit comments

Comments
 (0)