[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-API] [PATCH 2 of 2] CA-36384: [experimental PCI passthrough]: unplug/plug devices around migrate



# HG changeset patch
# User David Scott <dave.scott@xxxxxxxxxxxxx>
# Date 1263553145 0
# Node ID c841e1642ae566aaa78f46ad2cadf6c704feafb8
# Parent  6c0dc1298ff409515511ca313480ad1c7cb3a32f
CA-36384: [experimental PCI passthrough]: unplug/plug devices around migrate.

Note we simply unplug devices in series: no fancy parallel stuff.

Signed-off-by: David Scott <dave.scott@xxxxxxxxxxxxx>

diff -r 6c0dc1298ff4 -r c841e1642ae5 ocaml/xapi/xapi_vm_migrate.ml
--- a/ocaml/xapi/xapi_vm_migrate.ml     Fri Jan 15 10:57:09 2010 +0000
+++ b/ocaml/xapi/xapi_vm_migrate.ml     Fri Jan 15 10:59:05 2010 +0000
@@ -198,37 +198,7 @@
       raise (Vmops.Domain_shutdown_for_wrong_reason Xal.Crashed)
     end;
 
-    (* PCI: The following code only does anything if PCI devices have been 
passed-through
-       which is an unsupported configuration. *)
-    let pci_hotunplug_time = try float_of_string (List.assoc 
"pci-hotunplug-time" (Db.VM.get_other_config ~__context ~self:vm)) with _ -> 
0.8 in
-    let pci_devices_to_unplug = ref [] in (* XXX: currently only support 1 due 
to xenstore protocol *)
-    let pci_unplug_initiated_already = ref false in
-    let pci_unplug_initiate_noexn () = 
-      Helpers.log_exn_continue "pci_unplug_initiate"
-       (fun () ->
-          if not (!pci_unplug_initiated_already) then begin
-            pci_unplug_initiated_already := true;
-            debug "looking for PCI devices to hot unplug";
-            let devices = Device.PCI.list ~xc ~xs domid in
-            if List.length devices > 1 then warn "We can only handle one PCI 
device during migration!";
-            if List.length devices > 0 then begin
-              let (id, device) = List.hd devices in
-              let (domain, bus, dev, func) = device in
-              debug "requesting unplug of %.4x:%.2x:%.2x.%.1x" domain bus dev 
func;
-              Device.PCI.unplug ~xc ~xs device domid;
-              pci_devices_to_unplug := [ device ]
-            end        
-          end) () in
-    let pci_unplug_wait_noexn () = 
-      Helpers.log_exn_continue "pci_unplug_wait"
-       (fun () ->
-          debug "waiting for PCI hotunplug to complete";
-          List.iter (fun device -> 
-                       let (domain, bus, dev, func) = device in
-                       debug "synchronising with unplug of 
%.4x:%.2x:%.2x.%.1x" domain bus dev func;
-                       Device.PCI.unplug_wait ~xc ~xs domid
-                    ) !pci_devices_to_unplug) () in
-
+         Vmops.unplug_pcidevs_noexn ~__context ~vm domid (Device.PCI.list ~xc 
~xs domid);
 
     (* MTC: We want to be notified when libxc's xc_domain_save suspends the 
domain
      *      to go from background to foreground mode.  Therefore, we provide 
the
@@ -239,12 +209,9 @@
     Domain.suspend ~xc ~xs ~hvm domid fd (if live then [ Domain.Live ] else [])
       ~progress_callback:(fun x -> 
                            debug "migration_progress = %.2f" x;
-                           if x > pci_hotunplug_time then 
pci_unplug_initiate_noexn ();
                            migration_progress_cb ~__context vm_migrate_failed 
~vm (x *. 0.95)) 
       (fun () -> 
-        pci_unplug_initiate_noexn(); (* just in case *)
-        pci_unplug_wait_noexn ();
-        migration_suspend_cb ~xal ~xc ~xs ~__context vm_migrate_failed 
~self:vm domid Domain.Suspend);
+                  migration_suspend_cb ~xal ~xc ~xs ~__context 
vm_migrate_failed ~self:vm domid Domain.Suspend);
 
     (* <-- [2] Synchronisation point *)
 
1 file changed, 2 insertions(+), 35 deletions(-)
ocaml/xapi/xapi_vm_migrate.ml |   37 ++-----------------------------------


Attachment: xen-api.hg-2.patch
Description: Text Data

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.