WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

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

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH 7 of 8] Tunnelling: unplugging a tunnel transport PIF also unplugs the access PIF
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
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1278687586@xxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1278687586@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.4.3
# 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