conn.reply(reply)
-def _unixctl_version(conn, unused_argv, unused_aux):
+def _unixctl_version(conn, unused_argv, version):
assert isinstance(conn, UnixctlConnection)
- version = "%s (Open vSwitch) %s" % (ovs.util.PROGRAM_NAME,
- ovs.version.VERSION)
+ version = "%s (Open vSwitch) %s" % (ovs.util.PROGRAM_NAME, version)
conn.reply(version)
self._listener = None
@staticmethod
- def create(path):
+ def create(path, version=None):
+ """Creates a new UnixctlServer which listens on a unixctl socket
+ created at 'path'. If 'path' is None, the default path is chosen.
+ 'version' contains the version of the server as reported by the unixctl
+ version command. If None, ovs.version.VERSION is used."""
+
assert path is None or isinstance(path, strtypes)
if path is not None:
path = "punix:%s/%s.%d.ctl" % (ovs.dirs.RUNDIR,
ovs.util.PROGRAM_NAME, os.getpid())
+ if version is None:
+ version = ovs.version.VERSION
+
error, listener = ovs.stream.PassiveStream.open(path)
if error:
ovs.util.ovs_error(error, "could not initialize control socket %s"
return error, None
command_register("help", "", 0, 0, _unixctl_help, None)
- command_register("version", "", 0, 0, _unixctl_version, None)
+ command_register("version", "", 0, 0, _unixctl_version, version)
return 0, UnixctlServer(listener)