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

[Xen-API] [PATCH 7 of 8] Tunnelling: unplugging a tunnel transport PIF also unplugs the access PIF


  • To: xen-api@xxxxxxxxxxxxxxxxxxx
  • From: Rob Hoes <rob.hoes@xxxxxxxxxx>
  • Date: Fri, 9 Jul 2010 15:59:53 +0100
  • Delivery-date: Fri, 09 Jul 2010 08:06:16 -0700
  • List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>

# HG changeset patch
# User Rob Hoes <rob.hoes@xxxxxxxxxx>
# Date 1278673891 -3600
# Node ID 1c34e2bd452112970632c09eaa52346e778f3d14
# Parent  170d86bd910a03d06f78432ab1962d71b880589b
Tunnelling: unplugging a tunnel transport PIF also unplugs the access PIF

Signed-off-by: Rob Hoes <rob.hoes@xxxxxxxxxx>

diff -r 170d86bd910a -r 1c34e2bd4521 ocaml/xapi/xapi_pif.ml
--- a/ocaml/xapi/xapi_pif.ml
+++ b/ocaml/xapi/xapi_pif.ml
@@ -415,25 +415,37 @@
      device (e.g. because it's a management i/f that was brought up 
independently by init scripts) *)
   mark_pif_as_dirty (Db.PIF.get_device ~__context ~self) (Db.PIF.get_VLAN 
~__context ~self)
 
-let unplug ~__context ~self = 
+let rec unplug ~__context ~self = 
   assert_no_protection_enabled ~__context ~self;
   assert_not_management_pif ~__context ~self;
   let host = Db.PIF.get_host ~__context ~self in
   if Db.Host.get_enabled ~__context ~self:host
   then abort_if_network_attached_to_protected_vms ~__context ~self;
+
+  let network = Db.PIF.get_network ~__context ~self in
+  let tunnel = Db.PIF.get_tunnel_transport_PIF_of ~__context ~self in
+  if tunnel <> [] then begin
+    debug "PIF is tunnel transport PIF... also bringing down access PIF";
+    let tunnel = List.hd tunnel in
+    let access_PIF = Db.Tunnel.get_access_PIF ~__context ~self:tunnel in
+    unplug ~__context ~self:access_PIF
+  end;
   Nm.bring_pif_down ~__context self
 
 let rec plug ~__context ~self =
   let network = Db.PIF.get_network ~__context ~self in
   let host = Db.PIF.get_host ~__context ~self in
   let tunnel = Db.PIF.get_tunnel_access_PIF_of ~__context ~self in
-  if tunnel <> [] then
+  if tunnel <> [] then begin
     let tunnel = List.hd tunnel in
     let transport_PIF = Db.Tunnel.get_transport_PIF ~__context ~self:tunnel in
     if Db.PIF.get_ip_configuration_mode ~__context ~self:transport_PIF = `None 
then
       raise (Api_errors.Server_error (Api_errors.transport_pif_not_configured, 
[Ref.string_of transport_PIF]))
-    else
-         plug ~__context ~self:transport_PIF;    
+    else begin
+      debug "PIF is tunnel access PIF... also bringing up transport PIF";
+      plug ~__context ~self:transport_PIF
+    end
+  end;
   Xapi_network.attach ~__context ~network ~host
    
 let calculate_pifs_required_at_start_of_day ~__context =
 ocaml/xapi/xapi_pif.ml |  20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)


Attachment: xen-api.hg-7.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®.