Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2699 from kc284/master
CA-215578: Fixed issue where halted control domains were deleted from…
- Loading branch information
Showing
5 changed files
with
58 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
(* | ||
* Copyright (C) 2016 Citrix Systems Inc. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation; version 2.1 only. with the special | ||
* exception on linking described in file LICENSE. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
*) | ||
|
||
open OUnit | ||
open Test_common | ||
open Dbsync_master | ||
|
||
let run_test vm = | ||
let (nameLabel, isControlDomain, powerState) = vm in | ||
let __context = Test_common.make_test_database () in | ||
let vm = Test_common.make_vm ~__context ~name_label:nameLabel () | ||
in | ||
Db.VM.set_is_control_domain ~__context ~self:vm ~value:isControlDomain; | ||
Db.VM.set_power_state ~__context ~self:vm ~value:powerState; | ||
Db.VM.set_resident_on ~__context ~self:vm ~value:Ref.null; | ||
|
||
Dbsync_master.reset_vms_running_on_missing_hosts ~__context; | ||
|
||
assert_equal ~msg:(Printf.sprintf "The VM %s is not halted" nameLabel) | ||
(Db.VM.get_power_state ~__context ~self:vm) `Halted | ||
|
||
let test_cases = [ | ||
("vm1", false, `Running); | ||
("vm2", false, `Halted); | ||
("dom1", true, `Running); | ||
("dom2", true, `Halted) | ||
] | ||
|
||
let test_reset_vms_on_missing_host () = | ||
List.iter run_test test_cases | ||
|
||
|
||
let test = | ||
"pool_restore_database" >::: | ||
[ | ||
"test_reset_vms_on_missing_host" >:: test_reset_vms_on_missing_host; | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters