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]
@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>"
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()