Skip to content

Commit d083e77

Browse files
committed
Xen 4.1: xenguest updates for Xen4
Signed-off-by: Ian Campbell <[email protected]> Signed-off-by: Zheng Li <[email protected]>
1 parent ff63a08 commit d083e77

File tree

9 files changed

+171
-200
lines changed

9 files changed

+171
-200
lines changed

ocaml/xapi/vmops.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ let general_domain_create_check ~__context ~vm ~snapshot =
303303
key/value pairs representing the VM's vCPU configuration. *)
304304
let vcpu_configuration snapshot =
305305
let vcpus = Int64.to_int snapshot.API.vM_VCPUs_max in
306-
306+
let vcpus_current = Int64.to_int snapshot.API.vM_VCPUs_at_startup in
307307
let pcpus = with_xc (fun xc -> (Xc.physinfo xc).Xc.max_nr_cpus) in
308308
debug "xen reports max %d pCPUs" pcpus;
309309

@@ -326,7 +326,8 @@ let vcpu_configuration snapshot =
326326
let weight = Opt.map (fun x -> [ "vcpu/weight", string_of_int x ]) weight in
327327
let cap = Opt.map (fun x -> [ "vcpu/cap", string_of_int x ]) cap in
328328

329-
[ "vcpu/number", string_of_int vcpus ]
329+
[ "vcpu/number", string_of_int vcpus;
330+
"vcpu/current", string_of_int vcpus_current ]
330331
@ (Opt.default [] affinity)
331332
@ (Opt.default [] weight)
332333
@ (Opt.default [] cap)

ocaml/xenguest/OMakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ OCAML_CLIBS = xenguest_stubs
55
OCAML_LINK_FLAGS += $(XEN_OCAML_LINK_FLAGS) -cclib -L$(XEN_ROOT)/usr/$(LIBDIR) -cclib -lz -cclib -lxenguest -cclib -lxenctrl -cclib -lxenstore
66
OCAMLPACKS = unix
77

8-
XENGUEST_SRC_FILES = dumpcore.ml xenguest.ml xenguest_main.ml xenguest_stubs.c save_helpers.c
8+
XENGUEST_SRC_FILES = dumpcore.ml xenguest.ml xenguest_main.ml xenguest_stubs.c
99

10-
StaticCLibrary(xenguest_stubs, save_helpers xenguest_stubs)
10+
StaticCLibrary(xenguest_stubs, xenguest_stubs)
1111
OCamlLibraryClib(xenguest, xenguest, xenguest_stubs)
1212

1313
section

ocaml/xenguest/save_helpers.c

Lines changed: 0 additions & 115 deletions
This file was deleted.

ocaml/xenguest/xenguest.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ external linux_build : handle -> domid -> int -> int -> string ->
2929
= "stub_xc_linux_build_bytecode" "stub_xc_linux_build_native"
3030

3131
(** build a hvm domain *)
32-
external hvm_build : handle -> domid -> int -> int -> string ->
33-
int -> nativeint
32+
external hvm_build : handle -> domid -> int -> int -> string -> int -> int ->
33+
(nativeint * nativeint)
3434
= "stub_xc_hvm_build_bytecode" "stub_xc_hvm_build_native"
3535

3636
(** resume an uncooperative domain *)

ocaml/xenguest/xenguest_main.ml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,13 @@ let linux_build_real domid mem_max_mib mem_start_mib image ramdisk cmdline featu
238238
Nativeint.to_string console_mfn; proto ]
239239
)
240240

241-
let hvm_build_real domid mem_max_mib mem_start_mib image store_port =
241+
let hvm_build_real domid mem_max_mib mem_start_mib image store_port console_port=
242242
with_xenguest (fun xc ->
243-
let store_mfn =
243+
let store_mfn, console_mfn =
244244
Xenguest.hvm_build xc domid mem_max_mib mem_start_mib image
245-
store_port in
246-
Nativeint.to_string store_mfn
245+
store_port console_port in
246+
String.concat " " [Nativeint.to_string store_mfn;
247+
Nativeint.to_string console_mfn]
247248
)
248249

249250
let domain_save_real fd domid x y flags hvm =
@@ -263,14 +264,14 @@ let domain_restore_real fd domid store_port console_port hvm =
263264

264265
(** fake operations *)
265266
let linux_build_fake domid mem_max_mib mem_start_mib image ramdisk cmdline features flags store_port console_port = "10 10 x86-32"
266-
let hvm_build_fake domid mem_max_mib mem_start_mib image store_port = "2901"
267+
let hvm_build_fake domid mem_max_mib mem_start_mib image store_port console_port = "2901 2901"
267268
let domain_save_fake fd domid x y flags hvm = Unix.sleep 1; ignore (suspend_callback domid); ""
268269
let domain_restore_fake fd domid store_port console_port hvm = "10 10"
269270

270271
(** operation vector *)
271272
type ops = {
272273
linux_build: int -> int -> int -> string -> string option -> string -> string -> int -> int -> int -> string;
273-
hvm_build: int -> int -> int -> string -> int -> string;
274+
hvm_build: int -> int -> int -> string -> int -> int -> string;
274275
domain_save: Unix.file_descr -> int -> int -> int -> Xenguest.suspend_flags list -> bool -> string;
275276
domain_restore: Unix.file_descr -> int -> int -> int -> bool -> string;
276277
}
@@ -402,15 +403,17 @@ let _ =
402403
cmdline features flags store_port console_port)
403404
| Some "hvm_build" ->
404405
debug "hvm_build mode selected";
405-
require [ "domid"; "mem_max_mib"; "mem_start_mib"; "image"; "store_port" ];
406+
require [ "domid"; "mem_max_mib"; "mem_start_mib"; "image";
407+
"store_port"; "console_port" ];
406408
let domid = int_of_string (get_param "domid")
407409
and mem_max_mib = int_of_string (get_param "mem_max_mib")
408410
and mem_start_mib = int_of_string (get_param "mem_start_mib")
409411
and image = get_param "image"
410-
and store_port = int_of_string (get_param "store_port") in
412+
and store_port = int_of_string (get_param "store_port")
413+
and console_port = int_of_string (get_param "console_port") in
411414

412415
with_logging (fun () -> ops.hvm_build domid mem_max_mib mem_start_mib image
413-
store_port)
416+
store_port console_port)
414417
| Some "test" ->
415418
debug "test mode selected";
416419
with_logging (fun () -> ignore(Unix.system "/tmp/test"); "result")

0 commit comments

Comments
 (0)