From 6e30b841ee247dc106c4362f1ae99aead03a26f1 Mon Sep 17 00:00:00 2001 From: Rob Hoes Date: Tue, 21 Jan 2025 15:50:58 +0000 Subject: [PATCH 1/3] Update XE_SR_ERRORCODES.xml from SM Signed-off-by: Rob Hoes --- ocaml/sdk-gen/csharp/XE_SR_ERRORCODES.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ocaml/sdk-gen/csharp/XE_SR_ERRORCODES.xml b/ocaml/sdk-gen/csharp/XE_SR_ERRORCODES.xml index 725d14feb78..47fefd83086 100644 --- a/ocaml/sdk-gen/csharp/XE_SR_ERRORCODES.xml +++ b/ocaml/sdk-gen/csharp/XE_SR_ERRORCODES.xml @@ -534,6 +534,11 @@ A Failure occurred accessing an API object 153 + + APIProtocolError + A protocol error was received when accessing the API + 154 + From 65afcc7bce384eb7fa2ed4d2f0ed33dd5066be57 Mon Sep 17 00:00:00 2001 From: Rob Hoes Date: Tue, 21 Jan 2025 15:51:18 +0000 Subject: [PATCH 2/3] CA-404611: SXM: check power-state just before metadata export A VM's power-state may change during a cross-pool storage migration, as a VM that was originally running may shut down while the disks are being copied (or vice versa). This case is handled, because copying disks can take a very long time. VM metadata is exported and imported into the remote pool after copying has completed, and the VM power-state is used to decide whether to do CPUID checks. Unfortunately, the power-state is currently taken from the DB right at the start if the function, which does not take into account that is may change. Straightforward fix. Signed-off-by: Rob Hoes --- ocaml/xapi/xapi_vm_migrate.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ocaml/xapi/xapi_vm_migrate.ml b/ocaml/xapi/xapi_vm_migrate.ml index 3b561e370ab..8a8f7f181e0 100644 --- a/ocaml/xapi/xapi_vm_migrate.ml +++ b/ocaml/xapi/xapi_vm_migrate.ml @@ -1194,7 +1194,6 @@ let migrate_send' ~__context ~vm ~dest ~live:_ ~vdi_map ~vif_map ~vgpu_map We look at the VDIs of the VM, the VDIs of all of the snapshots, and any suspend-image VDIs. *) let vm_uuid = Db.VM.get_uuid ~__context ~self:vm in - let power_state = Db.VM.get_power_state ~__context ~self:vm in let vbds = Db.VM.get_VBDs ~__context ~self:vm in let vifs = Db.VM.get_VIFs ~__context ~self:vm in 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 ) vgpu_map in + let power_state = Db.VM.get_power_state ~__context ~self:vm in inter_pool_metadata_transfer ~__context ~remote ~vm ~vdi_map ~vif_map ~vgpu_map ~dry_run:false ~live:true ~copy ~check_cpu:((not force) && power_state <> `Halted) From d3bad20cd934a686ddd428a4ec49aba277876995 Mon Sep 17 00:00:00 2001 From: Rob Hoes Date: Tue, 21 Jan 2025 16:04:32 +0000 Subject: [PATCH 3/3] CA-404611: live import: only check CPUID if VM is not Halted This is just an additional safety check following the previous commit. Signed-off-by: Rob Hoes --- ocaml/xapi/import.ml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ocaml/xapi/import.ml b/ocaml/xapi/import.ml index 3dd311d72e9..6f2c29acca8 100644 --- a/ocaml/xapi/import.ml +++ b/ocaml/xapi/import.ml @@ -76,7 +76,9 @@ type config = { let is_live config = match config.import_type with Metadata_import {live; _} -> live | _ -> false -let needs_cpu_check config = +let needs_cpu_check config vm_record = + vm_record.API.vM_power_state <> `Halted + && match config.import_type with | Metadata_import {check_cpu; _} -> check_cpu @@ -519,7 +521,7 @@ module VM : HandlerTools = struct | Replace (_, vm_record) | Clean_import vm_record -> if is_live config then assert_can_live_import __context vm_record ; - ( if needs_cpu_check config then + ( if needs_cpu_check config vm_record then let vmm_record = find_in_export (Ref.string_of vm_record.API.vM_metrics)