Message ID | 1467808691-17280-4-git-send-email-pboca@cloudbasesolutions.com |
---|---|
State | Superseded |
Delegated to: | Guru Shetty |
Headers | show |
> -----Mesaj original----- > De la: dev [mailto:dev-bounces@openvswitch.org] În numele Paul Boca > Trimis: Wednesday, July 6, 2016 3:38 PM > Către: dev@openvswitch.org > Subiect: [ovs-dev] [PATCH V6 03/17] python tests: Fixed ctl file name for > Windows > > On Windows the CTL file doesn't contain the pid of the process. [Alin Gabriel Serdean: ] *filename > > Signed-off-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com> > - if target.startswith("/"): > + if target.startswith('/') or target.find(':') > -1: [Alin Gabriel Serdean: ] Please add a comment so people understand why it is needed. > return 0, target > > + """ Leave it to read the pid file on Windows also, the tests expect this > + error in case of failure. """ > pidfile_name = "%s/%s.pid" % (ovs.dirs.RUNDIR, target) > pid = ovs.daemon.read_pidfile(pidfile_name) > if pid < 0: > return -pid, "cannot read pidfile \"%s\"" % pidfile_name > > - return 0, "%s/%s.%d.ctl" % (ovs.dirs.RUNDIR, target, pid) > + if sys.platform == "win32": > + return 0, "%s/%s.ctl" % (ovs.dirs.RUNDIR, target) > + else: > + return 0, "%s/%s.%d.ctl" % (ovs.dirs.RUNDIR, target, pid) [Alin Gabriel Serdean: ] From what I see from the server code: https://github.com/openvswitch/ovs/blob/master/python/ovs/unixctl/server.py#L188-L192 the PID is used in the path. Unless I am missing something, I think the problem is from somewhere else. > > command_register("help", "", 0, 0, _unixctl_help, None) > -- > 2.7.2.windows.1 > _______________________________________________ > dev mailing list > dev@openvswitch.org > http://openvswitch.org/mailman/listinfo/dev
Hi Alin! Comments inlined. Thanks, Paul > -----Original Message----- > From: Alin Serdean > Sent: Wednesday, July 6, 2016 8:18 PM > To: Paul Boca; dev@openvswitch.org > Subject: RE: [ovs-dev] [PATCH V6 03/17] python tests: Fixed ctl file name for > Windows > > > -----Mesaj original----- > > De la: dev [mailto:dev-bounces@openvswitch.org] În numele Paul Boca > > Trimis: Wednesday, July 6, 2016 3:38 PM > > Către: dev@openvswitch.org > > Subiect: [ovs-dev] [PATCH V6 03/17] python tests: Fixed ctl file name for > > Windows > > > > On Windows the CTL file doesn't contain the pid of the process. > [Alin Gabriel Serdean: ] *filename [Paul Boca] Right :) > > > > Signed-off-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com> > > - if target.startswith("/"): > > + if target.startswith('/') or target.find(':') > -1: > [Alin Gabriel Serdean: ] Please add a comment so people understand why it > is needed. [Paul Boca] Will do. > > return 0, target > > > > + """ Leave it to read the pid file on Windows also, the tests expect this > > + error in case of failure. """ > > pidfile_name = "%s/%s.pid" % (ovs.dirs.RUNDIR, target) > > pid = ovs.daemon.read_pidfile(pidfile_name) > > if pid < 0: > > return -pid, "cannot read pidfile \"%s\"" % pidfile_name > > > > - return 0, "%s/%s.%d.ctl" % (ovs.dirs.RUNDIR, target, pid) > > + if sys.platform == "win32": > > + return 0, "%s/%s.ctl" % (ovs.dirs.RUNDIR, target) > > + else: > > + return 0, "%s/%s.%d.ctl" % (ovs.dirs.RUNDIR, target, pid) > [Alin Gabriel Serdean: ] From what I see from the server code: > https://github.com/openvswitch/ovs/blob/master/python/ovs/unixctl/serve > r.py#L188-L192 > the PID is used in the path. Unless I am missing something, I think the > problem is from somewhere else. [Paul Boca] I fixed the CTL path for server in patch 11/17 " Ported UNIX sockets to Windows" so it won't contain the PID in filename to be compatible with the Windows apps. I will put both changes in this patch. > > > > command_register("help", "", 0, 0, _unixctl_help, None) > > -- > > 2.7.2.windows.1 > > _______________________________________________ > > dev mailing list > > dev@openvswitch.org > > http://openvswitch.org/mailman/listinfo/dev
diff --git a/python/ovs/unixctl/__init__.py b/python/ovs/unixctl/__init__.py index d3d3556..6bbcbaa 100644 --- a/python/ovs/unixctl/__init__.py +++ b/python/ovs/unixctl/__init__.py @@ -13,6 +13,7 @@ # limitations under the License. import six +import sys import ovs.util @@ -71,14 +72,19 @@ def command_register(name, usage, min_args, max_args, callback, aux): def socket_name_from_target(target): assert isinstance(target, strtypes) - if target.startswith("/"): + if target.startswith('/') or target.find(':') > -1: return 0, target + """ Leave it to read the pid file on Windows also, the tests expect this + error in case of failure. """ pidfile_name = "%s/%s.pid" % (ovs.dirs.RUNDIR, target) pid = ovs.daemon.read_pidfile(pidfile_name) if pid < 0: return -pid, "cannot read pidfile \"%s\"" % pidfile_name - return 0, "%s/%s.%d.ctl" % (ovs.dirs.RUNDIR, target, pid) + if sys.platform == "win32": + return 0, "%s/%s.ctl" % (ovs.dirs.RUNDIR, target) + else: + return 0, "%s/%s.%d.ctl" % (ovs.dirs.RUNDIR, target, pid) command_register("help", "", 0, 0, _unixctl_help, None)
On Windows the CTL file doesn't contain the pid of the process. Signed-off-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com> --- V2: No changes V3: No changes V4: No changes V5: No changes V6: No changes --- python/ovs/unixctl/__init__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)