Skip to content

Commit 7b79770

Browse files
author
David Scott
committed
xenlight: use eliloader to install PV guests
Since eliloader uses a different argument passing convention to pygrub, we simply run it first and then tell libxl that we have a kernel and ramdisk in our hand. Fixes xapi-project#21 Signed-off-by: David Scott <dave.scott@eu.citrix.com>
1 parent 3f84e9b commit 7b79770

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

xl/xenops_server_xenlight.ml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,6 +1651,10 @@ module VM = struct
16511651
let build ?restore_fd task vm vbds vifs =
16521652
let memory_upper_bound = None in
16531653
let k = vm.Vm.id in
1654+
1655+
(* We should prevent leaking files in our filesystem *)
1656+
let kernel_to_cleanup = ref None in
1657+
finally (fun () ->
16541658
with_xc_and_xs (fun xc xs ->
16551659
let persistent, non_persistent =
16561660
match DB.read k with
@@ -1757,12 +1761,24 @@ module VM = struct
17571761
| { ty = Pv b_info_pv_default } -> b_info_pv_default
17581762
| _ -> failwith "Expected PV build_info here!"
17591763
in
1760-
{ b_info_default with
1761-
ty = Pv { b_info_pv_default with
1762-
bootloader = Some i.Xenops_interface.Vm.bootloader;
1763-
bootloader_args = (*i.bootloader_args :: i.legacy_args :: i.extra_args ::*) [];
1764-
}
1765-
}
1764+
(* We can't use libxl's builtin support for a bootloader because it
1765+
doesn't understand the convention used by eliloader. *)
1766+
with_disk ~xc ~xs task d false
1767+
(fun dev ->
1768+
let b = Bootloader.extract task
1769+
~bootloader:i.Xenops_interface.Vm.bootloader
1770+
~legacy_args:i.legacy_args ~extra_args:i.extra_args
1771+
~pv_bootloader_args:i.Xenops_interface.Vm.bootloader_args
1772+
~disk:dev ~vm:vm.Vm.id () in
1773+
kernel_to_cleanup := Some b;
1774+
{ b_info_default with
1775+
ty = Pv { b_info_pv_default with
1776+
kernel = Some b.Bootloader.kernel_path;
1777+
cmdline = Some b.Bootloader.kernel_args;
1778+
ramdisk = b.Bootloader.initrd_path
1779+
}
1780+
}
1781+
);
17661782
in
17671783
let k = vm.Vm.id in
17681784
let d = DB.read_exn vm.Vm.id in
@@ -1888,6 +1904,7 @@ module VM = struct
18881904
| _ -> ());
18891905
)
18901906
)
1907+
) (fun () -> Opt.iter Bootloader.delete !kernel_to_cleanup)
18911908

18921909
let request_shutdown task vm reason ack_delay =
18931910
on_domain

0 commit comments

Comments
 (0)