Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions ocaml/xapi/helpers.ml
Original file line number Diff line number Diff line change
Expand Up @@ -514,8 +514,11 @@ let boot_method_of_vm ~__context ~vm =
NB that just because a VM's current configuration looks like HVM doesn't imply it
actually booted that way; you must check the boot_record to be sure *)
let is_hvm ~__context (x: API.vM_t) =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we just replace this with:

let is_hvm (x: API.vM_t) = x.API.vM_HVM_boot_policy <> ""

The additional ~__context parameter only came in recently, it can go if we don't need it.

@jonludlam what do you think?

let vm_ref = Db.VM.get_by_uuid ~__context ~uuid:x.API.vM_uuid in
(not (is_domain_zero ~__context vm_ref)) && x.API.vM_HVM_boot_policy <> ""
let result = x.API.vM_HVM_boot_policy <> "" in
try
let vm_ref = Db.VM.get_by_uuid ~__context ~uuid:x.API.vM_uuid in
(not (is_domain_zero ~__context vm_ref)) && result
with _ -> result

let will_boot_hvm ~__context ~self = Db.VM.get_HVM_boot_policy ~__context ~self <> ""

Expand Down