Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Log details on a failed assertion in xapi_xenops.shutdown. #1660

Closed
wants to merge 2 commits into from

4 participants

thomassa Rob Hoes John Else Jon Ludlam
thomassa
Owner

The assertion that the vm power state was Halted has failed in
some test-runs (CA-118388) and some more logged details might help
with diagnosis.

Signed-off-by: Thomas Sanders thomas.sanders@citrix.com

thomassa
Owner

xapi_xenops has lots of assertions. Most of these should probably be given a similar treatment so that we get details in the logs when they fail. For the time being I feel this change is a worthwhile first step.

thomassa added some commits
thomassa thomassa Log details on a failed assertion in xapi_xenops.shutdown.
The assertion that the vm power state was Halted has failed in
some test-runs (CA-118388) and some more logged details might help
with diagnosis.

Signed-off-by: Thomas Sanders <thomas.sanders@citrix.com>
9146384
thomassa thomassa Merge branch 'master' of github.com:xapi-project/xen-api into xenops-…
…asserts-ca-118388
4534a20
Jon Ludlam jonludlam added the master label
Rob Hoes
Owner

This PR has a merge commit in it. @thomassa I don't think that was the intention?

John Else
Owner

Looks like this conflicts with #1976

John Else
Owner

@thomassa can this be closed? It looks like #1976 was a more complete version of this change.

thomassa
Owner

Yes. Closing.

thomassa thomassa closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 24, 2014
  1. thomassa

    Log details on a failed assertion in xapi_xenops.shutdown.

    thomassa authored
    The assertion that the vm power state was Halted has failed in
    some test-runs (CA-118388) and some more logged details might help
    with diagnosis.
    
    Signed-off-by: Thomas Sanders <thomas.sanders@citrix.com>
Commits on Apr 3, 2014
  1. thomassa
This page is out of date. Refresh to see the latest.
Showing with 20 additions and 2 deletions.
  1. +20 −2 ocaml/xapi/xapi_xenops.ml
22 ocaml/xapi/xapi_xenops.ml
View
@@ -32,6 +32,12 @@ let xenapi_of_xenops_power_state = function
| Some Paused -> `Paused
| None -> `Halted
+let string_of_xenapi_power_state = function
+ | `Running -> "Running"
+ | `Halted -> "Halted"
+ | `Suspended -> "Suspended"
+ | `Paused -> "Paused"
+
module Platform = struct
(* Keys we push through to xenstore. *)
let acpi = "acpi"
@@ -1567,7 +1573,10 @@ let events_from_xenopsd () =
let assert_resident_on ~__context ~self =
let localhost = Helpers.get_localhost ~__context in
- assert (Db.VM.get_resident_on ~__context ~self = localhost)
+ if not (Db.VM.get_resident_on ~__context ~self = localhost) then (
+ error "assert_resident_on failing; context: %s" (Context.string_of_task __context);
+ assert false
+ )
module Events_from_xapi = struct
let greatest_token = ref ""
@@ -2002,7 +2011,16 @@ let shutdown ~__context ~self timeout =
info "xenops: VM.shutdown %s" id;
Client.VM.shutdown dbg id timeout |> sync_with_task __context;
Events_from_xenopsd.wait dbg id ();
- assert (Db.VM.get_power_state ~__context ~self = `Halted);
+ let vm_power_state = Db.VM.get_power_state ~__context ~self in
+ if (vm_power_state <> `Halted) then (
+ (* Happened in CA-118388 so log, don't just assert. *)
+ (* If we get to here there's a bug in some of the code we've just called. *)
+ error "xenops: VM.shutdown: power state should be Halted but is %s. id=\"%s\" dbg=\"%s\" timeout=\"%s\" backtrace: %s"
+ (string_of_xenapi_power_state vm_power_state) id dbg
+ (match timeout with None -> "(no-timeout)" | Some f -> string_of_float f)
+ (try assert false with _ -> Printexc.get_backtrace ());
+ assert false
+ );
(* force_state_reset called from the xenopsd event loop above *)
assert (Db.VM.get_resident_on ~__context ~self = Ref.null);
List.iter
Something went wrong with that request. Please try again.