Skip to content

Commit 7abefc4

Browse files
authored
CA-404611: Fix SXM when VM is shut down midway (#6246)
2 parents f2743cf + d3bad20 commit 7abefc4

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

ocaml/sdk-gen/csharp/XE_SR_ERRORCODES.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,11 @@
534534
<description>A Failure occurred accessing an API object</description>
535535
<value>153</value>
536536
</code>
537+
<code>
538+
<name>APIProtocolError</name>
539+
<description>A protocol error was received when accessing the API</description>
540+
<value>154</value>
541+
</code>
537542

538543
<!-- Netapp Specific Error codes -->
539544
<code>

ocaml/xapi/import.ml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ type config = {
7676
let is_live config =
7777
match config.import_type with Metadata_import {live; _} -> live | _ -> false
7878

79-
let needs_cpu_check config =
79+
let needs_cpu_check config vm_record =
80+
vm_record.API.vM_power_state <> `Halted
81+
&&
8082
match config.import_type with
8183
| Metadata_import {check_cpu; _} ->
8284
check_cpu
@@ -519,7 +521,7 @@ module VM : HandlerTools = struct
519521
| Replace (_, vm_record) | Clean_import vm_record ->
520522
if is_live config then
521523
assert_can_live_import __context vm_record ;
522-
( if needs_cpu_check config then
524+
( if needs_cpu_check config vm_record then
523525
let vmm_record =
524526
find_in_export
525527
(Ref.string_of vm_record.API.vM_metrics)

ocaml/xapi/xapi_vm_migrate.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,6 @@ let migrate_send' ~__context ~vm ~dest ~live:_ ~vdi_map ~vif_map ~vgpu_map
11941194
We look at the VDIs of the VM, the VDIs of all of the snapshots, and any
11951195
suspend-image VDIs. *)
11961196
let vm_uuid = Db.VM.get_uuid ~__context ~self:vm in
1197-
let power_state = Db.VM.get_power_state ~__context ~self:vm in
11981197
let vbds = Db.VM.get_VBDs ~__context ~self:vm in
11991198
let vifs = Db.VM.get_VIFs ~__context ~self:vm in
12001199
let snapshots = Db.VM.get_snapshots ~__context ~self:vm in
@@ -1466,6 +1465,7 @@ let migrate_send' ~__context ~vm ~dest ~live:_ ~vdi_map ~vif_map ~vgpu_map
14661465
)
14671466
vgpu_map
14681467
in
1468+
let power_state = Db.VM.get_power_state ~__context ~self:vm in
14691469
inter_pool_metadata_transfer ~__context ~remote ~vm ~vdi_map
14701470
~vif_map ~vgpu_map ~dry_run:false ~live:true ~copy
14711471
~check_cpu:((not force) && power_state <> `Halted)

0 commit comments

Comments
 (0)