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] Hosts in a pool should use the same networking backend

To: xen-api <xen-api@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-API] [PATCH] Hosts in a pool should use the same networking backend
From: Rob Hoes <rob.hoes@xxxxxxxxxx>
Date: Mon, 30 Aug 2010 14:11:13 +0100
Delivery-date: Mon, 30 Aug 2010 06:12:09 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Rob Hoes <rob.hoes@xxxxxxxxxx>
Hosts in a pool should use the same networking backend

This patch adds the following restrictions in order to prevent (as much as 
possible) trouble caused by hosts in a pool not having the same network 
backends (bridge/openvswitch):
1. Block pool join if the network backend of the joining host is not the same 
as the master's.
2. Block tunnel.create if at least one of the hosts in the pool uses the 
bridging backend.

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

diff -r 57c8f8bc6e2e ocaml/idl/datamodel.ml
--- a/ocaml/idl/datamodel.ml
+++ b/ocaml/idl/datamodel.ml
@@ -451,7 +451,7 @@
     ~doc:"The specified device was not found." ();
 
   error Api_errors.openvswitch_not_active []
-    ~doc:"This operation needs the OpenVSwitch networking backend to be 
enabled." ();
+    ~doc:"This operation needs the OpenVSwitch networking backend to be 
enabled on all hosts in the pool." ();
   error Api_errors.transport_pif_not_configured ["PIF"]
     ~doc:"The tunnel transport PIF has no IP configuration set." ();
   error Api_errors.is_tunnel_access_pif ["PIF"]
diff -r 57c8f8bc6e2e ocaml/xapi/xapi_pool.ml
--- a/ocaml/xapi/xapi_pool.ml
+++ b/ocaml/xapi/xapi_pool.ml
@@ -227,7 +227,20 @@
                        let pool = List.hd (Client.Pool.get_all rpc session_id) 
in
                        let controller = Client.Pool.get_vswitch_controller 
~rpc ~session_id ~self:pool in
                        if my_controller <> controller && my_controller <> "" 
then
-                               raise 
(Api_errors.Server_error(Api_errors.operation_not_allowed, ["vswitch controller 
address differs"]))
+                               raise 
(Api_errors.Server_error(Api_errors.operation_not_allowed, ["vswitch controller 
address differs"]));
+
+                       (* The network backend must be the same as the remote 
master's backend *)
+                       let my_backend = Netdev.string_of_kind 
Netdev.network.Netdev.kind in
+                       let remote_master = Client.Pool.get_master ~rpc 
~session_id ~self:pool in
+                       let remote_masters_backend =
+                               let v = Client.Host.get_software_version ~rpc 
~session_id ~self:remote_master in
+                               if not (List.mem_assoc "network_backend" v) then
+                                       Netdev.string_of_kind Netdev.Bridge
+                               else
+                                       List.assoc "network_backend" v
+                       in
+                       if my_backend <> remote_masters_backend then
+                               raise 
(Api_errors.Server_error(Api_errors.operation_not_allowed, ["Network backends 
differ"]));
                | _ -> ()
        in
 
diff -r 57c8f8bc6e2e ocaml/xapi/xapi_tunnel.ml
--- a/ocaml/xapi/xapi_tunnel.ml
+++ b/ocaml/xapi/xapi_tunnel.ml
@@ -28,8 +28,13 @@
        let pool = Helpers.get_pool ~__context in
        let host = Db.PIF.get_host ~__context ~self:transport_PIF in
        Xapi_pif.assert_no_other_local_pifs ~__context ~host ~network;
-       if Netdev.network.Netdev.kind <> Netdev.Vswitch then
-               raise (Api_errors.Server_error 
(Api_errors.openvswitch_not_active, []));
+       let hosts = Db.Host.get_all ~__context in
+       List.iter
+               (fun h ->
+                       let v = Db.Host.get_software_version ~__context ~self:h 
in
+                       if not (List.mem_assoc "network_backend" v && 
List.assoc "network_backend" v = "openvswitch") then
+                               raise (Api_errors.Server_error 
(Api_errors.openvswitch_not_active, []));
+               ) hosts;
        if Db.PIF.get_tunnel_access_PIF_of ~__context ~self:transport_PIF <> [] 
then
                raise (Api_errors.Server_error 
(Api_errors.is_tunnel_access_pif, [Ref.string_of transport_PIF]));
        let tunnel = Ref.make () in

Attachment: vswitch-restrict-mixed-mode
Description: Text document

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-API] [PATCH] Hosts in a pool should use the same networking backend, Rob Hoes <=