X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=xenserver%2Fusr_lib_xsconsole_plugins-base_XSFeatureVSwitch.py;h=8adb93609d4c88507a600ca0db32f9da7a6e228d;hb=c6278d208924bb04c41266ddca276712f95533bc;hp=31a48c37dc47ac0586efdcabb2986a31c73c9f43;hpb=3f355f47f8e7343e909ccfa854454d667baf3c38;p=openvswitch diff --git a/xenserver/usr_lib_xsconsole_plugins-base_XSFeatureVSwitch.py b/xenserver/usr_lib_xsconsole_plugins-base_XSFeatureVSwitch.py index 31a48c37..8adb9360 100644 --- a/xenserver/usr_lib_xsconsole_plugins-base_XSFeatureVSwitch.py +++ b/xenserver/usr_lib_xsconsole_plugins-base_XSFeatureVSwitch.py @@ -5,7 +5,7 @@ # trademarks of Citrix Systems, Inc., in the United States and other # countries. -# Copyright (c) 2009 Nicira Networks. +# Copyright (c) 2009, 2010 Nicira Networks. from XSConsoleLog import * @@ -13,8 +13,7 @@ import os import socket import subprocess -cfg_mod="/usr/bin/ovs-cfg-mod" -vswitchd_cfg_filename="/etc/ovs-vswitchd.conf" +vsctl="/usr/bin/ovs-vsctl" if __name__ == "__main__": raise Exception("This script is a plugin for xsconsole and cannot run independently") @@ -78,10 +77,10 @@ class VSwitchService: class VSwitchConfig: @staticmethod - def Get(key): + def Get(action): try: - output = ShellPipe([cfg_mod, "-vANY:console:emer", "-F", - vswitchd_cfg_filename, "-q", key]).Stdout() + arg = [vsctl, "-vANY:console:emer"] + action.split() + output = ShellPipe(arg).Stdout() except StandardError, e: XSLogError("config retrieval error: " + str(e)) return "" @@ -118,13 +117,13 @@ class VSwitchControllerDialogue(Dialogue): # ChoiceDef(Lang("Restart ovs-brcompatd"), # lambda: self.restartService("vswitch-brcompatd")) ] - self.menu = Menu(self, None, Lang("Configure vSwitch"), choiceDefs) + self.menu = Menu(self, None, Lang("Configure Open vSwitch"), choiceDefs) self.ChangeState("INITIAL") def BuildPane(self): pane = self.NewPane(DialoguePane(self.parent)) - pane.TitleSet(Lang("Configure vSwitch")) + pane.TitleSet(Lang("Configure Open vSwitch")) pane.AddBox() def ChangeState(self, inState): @@ -252,13 +251,13 @@ class VSwitchControllerDialogue(Dialogue): for host in hosts: Layout.Inst().TransientBanner("Updating host %d out of %d" % (self.hostsUpdated + 1, self.hostsInPool)) - session.xenapi.host.call_plugin(host, "vswitch-cfg-update", "update", {}) + session.xenapi.host.call_plugin(host, "openvswitch-cfg-update", "update", {}) self.hostsUpdated = self.hostsUpdated + 1 def _updateThisServer(self, session): data = Data.Inst() host = data.host.opaqueref() - session.xenapi.host.call_plugin(host, "vswitch-cfg-update", "update", {}) + session.xenapi.host.call_plugin(host, "openvswitch-cfg-update", "update", {}) class XSFeatureVSwitch: @@ -267,12 +266,12 @@ class XSFeatureVSwitch: def StatusUpdateHandler(cls, inPane): data = Data.Inst() - inPane.AddTitleField(Lang("vSwitch")) + inPane.AddTitleField(Lang("Open vSwitch")) inPane.NewLine() inPane.AddStatusField(Lang("Version", 20), - VSwitchService.Inst("vswitch", "ovs-vswitchd").version()) + VSwitchService.Inst("openvswitch", "ovs-vswitchd").version()) inPane.NewLine() @@ -285,18 +284,26 @@ class XSFeatureVSwitch: if dbController == "": dbController = Lang("") inPane.AddStatusField(Lang("Controller (config)", 20), dbController) - controller = VSwitchConfig.Get("mgmt.controller") + controller = VSwitchConfig.Get("get Open_vSwitch . managers") + controller = controller.strip('[]"') + if controller == "": controller = Lang("") elif controller[0:4] == "ssl:": - controller = controller[4:] + controller = controller.split(':')[1] inPane.AddStatusField(Lang("Controller (in-use)", 20), controller) inPane.NewLine() inPane.AddStatusField(Lang("ovs-vswitchd status", 20), - VSwitchService.Inst("vswitch", "ovs-vswitchd").status()) - inPane.AddStatusField(Lang("ovs-brcompatd status", 20), - VSwitchService.Inst("vswitch", "ovs-brcompatd").status()) + VSwitchService.Inst("openvswitch", "ovs-vswitchd").status()) + inPane.AddStatusField(Lang("ovsdb-server status", 20), + VSwitchService.Inst("openvswitch", "ovsdb-server").status()) + + # Only XenServer 5.5.0 runs ovs-brcompatd + xs_version = data.host.software_version.product_version('') + if (xs_version == "5.5.0"): + inPane.AddStatusField(Lang("ovs-brcompatd status", 20), + VSwitchService.Inst("openvswitch", "ovs-brcompatd").status()) inPane.AddKeyHelpField( { Lang("") : Lang("Reconfigure"), @@ -314,7 +321,7 @@ class XSFeatureVSwitch: { 'menuname' : 'MENU_NETWORK', 'menupriority' : 800, - 'menutext' : Lang('vSwitch') , + 'menutext' : Lang('Open vSwitch') , 'statusupdatehandler' : self.StatusUpdateHandler, 'activatehandler' : self.ActivateHandler }