diff --git a/ocaml/idl/datamodel_common.ml b/ocaml/idl/datamodel_common.ml index c0ccb0a6848..ea642fc98b7 100644 --- a/ocaml/idl/datamodel_common.ml +++ b/ocaml/idl/datamodel_common.ml @@ -9,7 +9,7 @@ open Datamodel_roles to leave a gap for potential hotfixes needing to increment the schema version.*) let schema_major_vsn = 5 -let schema_minor_vsn = 756 +let schema_minor_vsn = 757 (* Historical schema versions just in case this is useful later *) let rio_schema_major_vsn = 5 diff --git a/ocaml/idl/datamodel_lifecycle.ml b/ocaml/idl/datamodel_lifecycle.ml index d563e81b969..06d3916c762 100644 --- a/ocaml/idl/datamodel_lifecycle.ml +++ b/ocaml/idl/datamodel_lifecycle.ml @@ -19,6 +19,8 @@ let prototyped_of_field = function Some "22.27.0" | "host", "last_software_update" -> Some "22.20.0" + | "pool", "migration_compression" -> + Some "22.32.0-next" | _ -> None diff --git a/ocaml/idl/datamodel_pool.ml b/ocaml/idl/datamodel_pool.ml index 4b97ab01c6d..19073e37fbe 100644 --- a/ocaml/idl/datamodel_pool.ml +++ b/ocaml/idl/datamodel_pool.ml @@ -1322,6 +1322,10 @@ let t = ~default_value:(Some (VRef null_ref)) "repository_proxy_password" "Password for the authentication of the proxy used in syncing with \ the enabled repositories" + ; field ~qualifier:RW ~lifecycle:[] ~ty:Bool + ~default_value:(Some (VBool false)) "migration_compression" + "Default behaviour during migration, True if stream compression \ + should be used" ] ) () diff --git a/ocaml/idl/schematest.ml b/ocaml/idl/schematest.ml index eac17751e9a..552575524bd 100644 --- a/ocaml/idl/schematest.ml +++ b/ocaml/idl/schematest.ml @@ -1,7 +1,7 @@ let hash x = Digest.string x |> Digest.to_hex (* BEWARE: if this changes, check that schema has been bumped accordingly *) -let last_known_schema_hash = "39db2a6a38076fdb59070df945072b81" +let last_known_schema_hash = "6d806eaf5515ca87daf909d3407a228f" let current_schema_hash : string = let open Datamodel_types in diff --git a/ocaml/tests/common/test_common.ml b/ocaml/tests/common/test_common.ml index cc0be3bcf93..f09e5512217 100644 --- a/ocaml/tests/common/test_common.ml +++ b/ocaml/tests/common/test_common.ml @@ -284,8 +284,8 @@ let make_pool ~__context ~master ?(name_label = "") ?(name_description = "") ?(uefi_certificates = "") ?(repositories = []) ?(client_certificate_auth_enabled = false) ?(client_certificate_auth_name = "") ?(repository_proxy_url = "") - ?(repository_proxy_username = "") ?(repository_proxy_password = Ref.null) () - = + ?(repository_proxy_username = "") ?(repository_proxy_password = Ref.null) + ?(migration_compression = false) () = let pool_ref = Ref.make () in Db.Pool.create ~__context ~ref:pool_ref ~uuid:(make_uuid ()) ~name_label ~name_description ~master ~default_SR ~suspend_image_SR ~crash_dump_SR @@ -299,7 +299,8 @@ let make_pool ~__context ~master ?(name_label = "") ?(name_description = "") ~live_patching_disabled ~uefi_certificates ~is_psr_pending:false ~tls_verification_enabled:false ~repositories ~client_certificate_auth_enabled ~client_certificate_auth_name - ~repository_proxy_url ~repository_proxy_username ~repository_proxy_password ; + ~repository_proxy_url ~repository_proxy_username ~repository_proxy_password + ~migration_compression ; pool_ref let default_sm_features = diff --git a/ocaml/xapi-cli-server/records.ml b/ocaml/xapi-cli-server/records.ml index a4db8432b82..71dacfd7105 100644 --- a/ocaml/xapi-cli-server/records.ml +++ b/ocaml/xapi-cli-server/records.ml @@ -1444,6 +1444,15 @@ let pool_record rpc session_id pool = ~value:(Stdlib.bool_of_string s) ) () + ; make_field ~name:"migration-compression" + ~get:(fun () -> + (x ()).API.pool_migration_compression |> string_of_bool + ) + ~set:(fun x -> + Client.Pool.set_migration_compression ~rpc ~session_id ~self:pool + ~value:(bool_of_string x) + ) + () ] } diff --git a/ocaml/xapi/dbsync_master.ml b/ocaml/xapi/dbsync_master.ml index 60bbd246898..d71458f254a 100644 --- a/ocaml/xapi/dbsync_master.ml +++ b/ocaml/xapi/dbsync_master.ml @@ -46,7 +46,7 @@ let create_pool_record ~__context = ~tls_verification_enabled:false ~repositories:[] ~client_certificate_auth_enabled:false ~client_certificate_auth_name:"" ~repository_proxy_url:"" ~repository_proxy_username:"" - ~repository_proxy_password:Ref.null + ~repository_proxy_password:Ref.null ~migration_compression:false let set_master_ip ~__context = let ip = diff --git a/ocaml/xapi/xapi_globs.ml b/ocaml/xapi/xapi_globs.ml index 60a5b9d8755..42b1fd72b21 100644 --- a/ocaml/xapi/xapi_globs.ml +++ b/ocaml/xapi/xapi_globs.ml @@ -924,8 +924,6 @@ let repository_gpgkey_name = ref "" let repository_gpgcheck = ref true -let migration_compression = ref false - let ignore_vtpm_unimplemented = ref false let evacuation_batch_size = ref 10 @@ -1380,11 +1378,6 @@ let other_options = , (fun () -> string_of_int !message_limit) , "Maximum number of messages kept before deleting oldest ones." ) - ; ( "migration-compression" - , Arg.Set migration_compression - , (fun () -> string_of_bool !migration_compression) - , "Use compression during VM migration when no API option provided." - ) ; ( "evacuation-batch-size" , Arg.Set_int evacuation_batch_size , (fun () -> string_of_int !evacuation_batch_size) diff --git a/ocaml/xapi/xapi_vm_migrate.ml b/ocaml/xapi/xapi_vm_migrate.ml index da8452026af..1fbb2633e63 100644 --- a/ocaml/xapi/xapi_vm_migrate.ml +++ b/ocaml/xapi/xapi_vm_migrate.ml @@ -80,7 +80,7 @@ let get_bool_option key values = (** Decide whether to use stream compression during migration based on options passed to the API, localhost, and destination *) -let use_compression options src dst = +let use_compression ~__context options src dst = debug "%s: options=%s" __FUNCTION__ (String.concat ", " (List.map (fun (k, v) -> Printf.sprintf "%s:%s" k v) options) @@ -91,7 +91,8 @@ let use_compression options src dst = | None, true -> false (* don't use for local migration *) | None, _ -> - !Xapi_globs.migration_compression + let pool = Helpers.get_pool ~__context in + Db.Pool.get_migration_compression ~__context ~self:pool let remote_of_dest ~__context dest = let maybe_set_https url = @@ -391,7 +392,7 @@ let pool_migrate ~__context ~vm ~host ~options = ~self:network ~host in let compress = - use_compression options (Helpers.get_localhost ~__context) host + use_compression ~__context options (Helpers.get_localhost ~__context) host in debug "%s using stream compression=%b" __FUNCTION__ compress ; let ip = Http.Url.maybe_wrap_IPv6_literal address in @@ -1160,7 +1161,9 @@ let migrate_send' ~__context ~vm ~dest ~live:_ ~vdi_map ~vif_map ~vgpu_map (* Copy mode means we don't destroy the VM on the source host. We also don't copy over the RRDs/messages *) let copy = try bool_of_string (List.assoc "copy" options) with _ -> false in - let compress = use_compression options localhost remote.dest_host in + let compress = + use_compression ~__context options localhost remote.dest_host + in debug "%s using stream compression=%b" __FUNCTION__ compress ; (* The first thing to do is to create mirrors of all the disks on the remote. diff --git a/scripts/xapi.conf b/scripts/xapi.conf index 073b1a1a249..18523ba428f 100644 --- a/scripts/xapi.conf +++ b/scripts/xapi.conf @@ -372,9 +372,6 @@ sm-plugins=ext nfs iscsi lvmoiscsi dummy file hba rawhba udev iso lvm lvmohba lv # Path for the firewall-port-config script # firewall_port_config_script = /etc/xapi.d/plugins/firewall-port -# migration-compression = true -# if not requested otherwise, use stream compression during migration of a VM - # evacuation-batch-size = 10 # number of VMs migrated in parallel in Host.evacuate