Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Moved VM.migrate_receive to Host.migrate_receive.

Removed the SR parameter.

Signed-off-by: Jerome Maloberti <jerome.maloberti@citrix.com>
  • Loading branch information...
commit 3264cb8dda0e9e060d2e78211ba32821cccf608e 1 parent e9b0249
jeromemaloberti jeromemaloberti authored djs55 committed
2  .gitignore
View
@@ -207,3 +207,5 @@ ocaml/xenops/xenopsd
xapi.spec
ocaml/fhs.*
+/ocaml/sm-cli/smtest
+/ocaml/xenops/cancel_utils_test
7 ocaml/idl/datamodel.ml
View
@@ -1901,13 +1901,12 @@ let vm_pool_migrate_complete = call
~allowed_roles:_R_VM_POWER_ADMIN
()
-let vm_migrate_receive = call
+let host_migrate_receive = call
~in_oss_since:None
~in_product_since:rel_tampa
~name:"migrate_receive"
~doc:"Prepare to receive a VM, returning a token which can be passed to VM.migrate."
~params:[Ref _host, "host", "The target host";
- Ref _sr, "SR", "The target SR";
Map(String, String), "options", "Extra configuration operations" ]
~result:(Map(String,String), "A value which should be passed to VM.migrate")
~allowed_roles:_R_VM_POWER_ADMIN
@@ -1993,7 +1992,7 @@ let vm_migrate = call
~in_product_since:rel_rio
~doc: "Migrate the VM to another host. This can only be called when the specified VM is in the Running state."
~params:[Ref _vm, "vm", "The VM";
- Map(String,String), "dest", "The result of a VM.migrate_receive call.";
+ Map(String,String), "dest", "The result of a Host.migrate_receive call.";
Bool, "live", "Live migration";
Map (String, String), "options", "Other parameters"]
~errs:[Api_errors.vm_bad_power_state]
@@ -4068,6 +4067,7 @@ let host =
host_sync_vlans;
host_sync_tunnels;
host_sync_pif_currently_attached;
+ host_migrate_receive;
]
~contents:
([ uid _host;
@@ -6415,7 +6415,6 @@ let vm =
vm_send_sysrq; vm_send_trigger;
vm_maximise_memory;
vm_migrate;
- vm_migrate_receive;
vm_get_boot_record;
vm_get_data_sources; vm_record_data_source; vm_query_data_source; vm_forget_data_source_archives;
assert_operation_valid vm_operations _vm _self;
16 ocaml/xapi/cli_operations.ml
View
@@ -2460,7 +2460,7 @@ let vm_migrate printer rpc session_id params =
then we're using the new codepath *)
if List.mem_assoc "remote-address" params && (List.mem_assoc "remote-username" params)
&& (List.mem_assoc "remote-password" params) then begin
- printer (Cli_printer.PMsg "Using the new cross-host, cross-SR, cross-pool, cross-everything codepath.");
+ printer (Cli_printer.PMsg "Using the new cross-host, cross-pool, cross-everything codepath.");
let ip = List.assoc "remote-address" params in
let remote_rpc xml =
let open Xmlrpc_client in
@@ -2484,20 +2484,10 @@ let vm_migrate printer rpc session_id params =
List.hd all
end in
printer (Cli_printer.PMsg (Printf.sprintf "Will migrate to remote host: %s" host_record.API.host_name_label));
- let sr =
- if List.mem_assoc "destination-sr-uuid" params
- then Client.SR.get_by_uuid remote_rpc remote_session (List.assoc "destination-sr-uuid" params)
- else
- let pool = Client.Pool.get_all remote_rpc remote_session |> List.hd in
- let sr = Client.Pool.get_default_SR remote_rpc remote_session pool in
- (try ignore (Client.SR.get_uuid remote_rpc remote_session sr)
- with _ -> failwith "No destination SR specified and no default SR on remote pool");
- sr in
- printer (Cli_printer.PMsg (Printf.sprintf "Will migrate to remote SR: %s" (Client.SR.get_name_label remote_rpc remote_session sr)));
- let token = Client.VM.migrate_receive remote_rpc remote_session host sr options in
+ let token = Client.Host.migrate_receive remote_rpc remote_session host options in
printer (Cli_printer.PMsg (Printf.sprintf "Received token: [ %s ]" (String.concat "; " (List.map (fun (k, v) -> k ^ ":" ^ v) token))));
ignore(do_vm_op ~include_control_vms:true printer rpc session_id (fun vm -> Client.VM.migrate rpc session_id (vm.getref ()) token true options)
- params ["host"; "host-uuid"; "host-name"; "live"; "encrypt"; "remote-address"; "remote-username"; "remote-password"; "destination-sr-uuid" ])
+ params ["host"; "host-uuid"; "host-name"; "live"; "encrypt"; "remote-address"; "remote-username"; "remote-password" ])
)
(fun () -> Client.Session.logout remote_rpc remote_session)
end else begin
8 ocaml/xapi/message_forwarding.ml
View
@@ -1594,10 +1594,6 @@ module Forward = functor(Local: Custom_actions.CUSTOM_ACTIONS) -> struct
update_vbd_operations ~__context ~vm;
update_vif_operations ~__context ~vm
- let migrate_receive ~__context ~host ~sR ~options =
- info "VM.migrate_receive: host = '%s'; SR = '%s'" (host_uuid ~__context host) (sr_uuid ~__context sR);
- Local.VM.migrate_receive ~__context ~host ~sR ~options
-
let send_trigger ~__context ~vm ~trigger =
info "VM.send_trigger: VM = '%s'; trigger = '%s'" (vm_uuid ~__context vm) trigger;
let local_fn = Local.VM.send_trigger ~vm ~trigger in
@@ -2431,6 +2427,10 @@ module Forward = functor(Local: Custom_actions.CUSTOM_ACTIONS) -> struct
let sync_pif_currently_attached ~__context ~host ~bridges =
info "Host.sync_pif_currently_attached: host = '%s'" (host_uuid ~__context host);
Local.Host.sync_pif_currently_attached ~__context ~host ~bridges
+
+ let migrate_receive ~__context ~host ~options =
+ info "Host.migrate_receive: host = '%s'" (host_uuid ~__context host);
+ Local.Host.migrate_receive ~__context ~host ~options
end
module Host_crashdump = struct
10 ocaml/xapi/xapi_host.ml
View
@@ -1532,3 +1532,13 @@ let sync_pif_currently_attached ~__context ~host ~bridges =
end;
) pifs
+let migrate_receive ~__context ~host ~options =
+ let session_id = Ref.string_of (Context.get_session_id __context) in
+ let ip = Db.Host.get_address ~__context ~self:host in
+ let sm_url = Printf.sprintf "http://%s/services/SM?session_id=%s" ip session_id in
+ let xenops_url = Printf.sprintf "http://%s/services/xenops?session_id=%s" ip session_id in
+ [ Xapi_vm_migrate._sm, sm_url;
+ Xapi_vm_migrate._host, Ref.string_of host;
+ Xapi_vm_migrate._xenops, xenops_url;
+ Xapi_vm_migrate._session_id, session_id;
+ ]
1  ocaml/xapi/xapi_host.mli
View
@@ -285,3 +285,4 @@ val sync_tunnels : __context:Context.t -> host:API.ref_host -> unit
* The parameter [bridges] contains a list of bridge names reflecting all bridges that are up. *)
val sync_pif_currently_attached : __context:Context.t -> host:API.ref_host -> bridges:string list -> unit
+val migrate_receive : __context:Context.t -> host:API.ref_host -> options:API.string_to_string_map -> API.string_to_string_map
12 ocaml/xapi/xapi_vm_migrate.ml
View
@@ -186,15 +186,3 @@ let migrate ~__context ~vm ~dest ~live ~options =
) vdis;
raise e
-let migrate_receive ~__context ~host ~sR ~options =
- let session_id = Ref.string_of (Context.get_session_id __context) in
- let ip = Db.Host.get_address ~__context ~self:host in
- let sm_url = Printf.sprintf "http://%s/services/SM?session_id=%s" ip session_id in
- let sr = Db.SR.get_uuid ~__context ~self:sR in
- let xenops_url = Printf.sprintf "http://%s/services/xenops?session_id=%s" ip session_id in
- [ _sm, sm_url;
- _sr, sr;
- _host, Ref.string_of host;
- _xenops, xenops_url;
- _session_id, session_id;
- ]
Please sign in to comment.
Something went wrong with that request. Please try again.