]> xenbits.xensource.com Git - xcp/xen-api.git/commitdiff
VSwitch controller field may be blank on pool join
authorRob Hoes <rob.hoes@citrix.com>
Wed, 14 Jul 2010 15:43:28 +0000 (16:43 +0100)
committerRob Hoes <rob.hoes@citrix.com>
Wed, 14 Jul 2010 15:43:28 +0000 (16:43 +0100)
If the pool.vswitch_controller field is blank on a joining host, but not on the pool, the join is allowed. The openvswitch in the joining host will be controlled by the pool's controller.

Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
ocaml/idl/datamodel.ml
ocaml/xapi/xapi_pool.ml

index fe03c75a717f045f95a2f6ffb84b9a6293758bd8..c0a69b04881a621576b6e64fa976649f1c64b5d4 100644 (file)
@@ -5210,6 +5210,9 @@ let pool_audit_log_append = call
 let pool_set_vswitch_controller = call
   ~in_oss_since:None
   ~in_product_since:rel_midnight_ride
+  ~lifecycle:[
+    Published, rel_midnight_ride, "Set the IP address of the vswitch controller.";
+    Extended, rel_cowley, "Allow to be set to the empty string (no controller is used)."]
   ~name:"set_vswitch_controller"
   ~params:[String, "address", "IP address of the vswitch controller."]
   ~doc:"Set the IP address of the vswitch controller."
index 54acaafd3b7d150568156bbbf14d4b95c3e0c45d..d3459d925fbbdc74afb6f366b5e46fd47d923f30 100644 (file)
@@ -246,7 +246,7 @@ let pre_join_checks ~__context ~rpc ~session_id ~force =
                        let my_controller = Db.Pool.get_vswitch_controller ~__context ~self:my_pool in
                        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 then
+                       if my_controller <> controller && my_controller <> "" then
                                raise (Api_errors.Server_error(Api_errors.operation_not_allowed, ["vswitch controller address differs"]))
                | _ -> ()
        in
@@ -675,7 +675,7 @@ let eject ~__context ~host =
                (* delete me from the database - this will in turn cause PBDs and PIFs to be GCed *)
                Db.Host.destroy ~__context ~self:host;
 
-               debug "Reset CPU features";
+               debug "Pool.eject: resetting CPU features";
                (* Clear the CPU feature masks from the Xen command line *)
                ignore (Xen_cmdline.delete_cpuid_masks
                        ["cpuid_mask_ecx"; "cpuid_mask_edx"; "cpuid_mask_ext_ecx"; "cpuid_mask_ext_edx"]);
@@ -1416,7 +1416,8 @@ let set_vswitch_controller ~__context ~address =
                let pool = Helpers.get_pool ~__context in
                let current_address = Db.Pool.get_vswitch_controller ~__context ~self:pool in
                if current_address <> address then begin
-                       assert_is_valid_ip address;
+                       if address <> "" then
+                               assert_is_valid_ip address;
                        Db.Pool.set_vswitch_controller ~__context ~self:pool ~value:address;
                        List.iter (fun host -> Helpers.update_vswitch_controller ~__context ~host) (Db.Host.get_all ~__context)
                end