[ovs-dev] [PATCH 2/2] xenserver: Make OVS xsconsole plugin configure management channel

Justin Pettit jpettit at nicira.com
Fri Mar 19 06:51:04 UTC 2010


Ben responded out of band:

-=-=-=-=-=-=-=-=-=-
I think this will work fine in practice.  It doesn't completely parse
the strings that "ovs-vsctl get" can output--for example, it doesn't
replace \\ by \--but the strings in question should only consist of
[a-z0-9.:] anyhow so I guess it doesn't matter.  (Maybe that really
means that ovs-vsctl should at least have a mode to do less quoting.)
-=-=-=-=-=-=-=-=-=-

I decided to just push it as is.

--Justin


On Mar 13, 2010, at 6:20 AM, Justin Pettit wrote:

> Previously, the xsconsole plugin configured a single OpenFlow controller
> configuration across all bridges.  With the management channel, we can
> now have the manager configure the bridges' controllers individually.
> This changes the plugin to only set that management IP.
> ---
> xenserver/etc_xapi.d_plugins_vswitch-cfg-update    |   11 ++++++-----
> ..._lib_xsconsole_plugins-base_XSFeatureVSwitch.py |    9 ++++++---
> 2 files changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/xenserver/etc_xapi.d_plugins_vswitch-cfg-update b/xenserver/etc_xapi.d_plugins_vswitch-cfg-update
> index 6e38a80..4cebe85 100755
> --- a/xenserver/etc_xapi.d_plugins_vswitch-cfg-update
> +++ b/xenserver/etc_xapi.d_plugins_vswitch-cfg-update
> @@ -62,26 +62,27 @@ def update(session, args):
>         return "No change to configuration"
> 
> def vswitchCurrentController():
> -    controller = vswitchCfgQuery("get-controller")
> +    controller = vswitchCfgQuery("get Open_vSwitch . managers").strip('[]"')
>     if controller == "":
>         return controller
>     if len(controller) < 4 or controller[0:4] != "ssl:":
>         return controller
>     else:
> -        return controller[4:]
> +        return controller.split(':')[1]
> 
> def removeControllerCfg():
> -    vswitchCfgMod(["--", "del-controller",
> +    vswitchCfgMod(["--", "clear", "Open_vSwitch", ".", "managers",
>                    "--", "del-ssl"])
> 
> def setControllerCfg(controller):
> -    vswitchCfgMod(["--", "del-controller",
> +    vswitchCfgMod(["--", "clear", "Open_vSwitch", ".", "managers",
>                    "--", "del-ssl",
>                    "--", "--bootstrap", "set-ssl",
>                    "/etc/xensource/xapi-ssl.pem",
>                    "/etc/xensource/xapi-ssl.pem",
>                    "/etc/ovs-vswitchd.cacert",
> -                   "--", "set-controller", "ssl:" + controller])
> +                   "--", "set", "Open_vSwitch", ".",
> +                   'managers="ssl:' + controller + ':6632"'])
> 
> def vswitchCfgQuery(action):
>     cmd = [vsctl, "-vANY:console:emer", action]
> diff --git a/xenserver/usr_lib_xsconsole_plugins-base_XSFeatureVSwitch.py b/xenserver/usr_lib_xsconsole_plugins-base_XSFeatureVSwitch.py
> index 99dd15d..6ecf478 100644
> --- a/xenserver/usr_lib_xsconsole_plugins-base_XSFeatureVSwitch.py
> +++ b/xenserver/usr_lib_xsconsole_plugins-base_XSFeatureVSwitch.py
> @@ -79,7 +79,8 @@ class VSwitchConfig:
>     @staticmethod
>     def Get(action):
>         try:
> -            output = ShellPipe([vsctl, "-vANY:console:emer", action]).Stdout()
> +            arg = [vsctl, "-vANY:console:emer"] + action.split()
> +            output = ShellPipe(arg).Stdout()
>         except StandardError, e:
>             XSLogError("config retrieval error: " + str(e))
>             return "<unknown>"
> @@ -283,11 +284,13 @@ class XSFeatureVSwitch:
>         if dbController == "":
>             dbController = Lang("<None>")
>         inPane.AddStatusField(Lang("Controller (config)", 20), dbController)
> -        controller = VSwitchConfig.Get("get-controller")
> +        controller = VSwitchConfig.Get("get Open_vSwitch . managers")
> +        controller = controller.strip('[]"')
> +
>         if controller == "":
>             controller = Lang("<None>")
>         elif controller[0:4] == "ssl:":
> -            controller = controller[4:]
> +            controller = controller.split(':')[1]
>         inPane.AddStatusField(Lang("Controller (in-use)", 20), controller)
> 
>         inPane.NewLine()
> -- 
> 1.6.5.5
> 
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev_openvswitch.org





More information about the dev mailing list