From: Ian Campbell Date: Tue, 15 Sep 2009 16:24:46 +0000 (-0700) Subject: ovs-vsctl: /var/run/ovs-vswitchd.*.ctl is a Unix domain socket X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d6122026ba5bdd3e6a911699be79c821b6a348c;p=openvswitch ovs-vsctl: /var/run/ovs-vswitchd.*.ctl is a Unix domain socket Currently ov-vsctl tries to treat /var/run/ovs-vswitchd.*.ctl as a file/pipe when it is actually a Unix domain socket: # ovs-vsctl add-br TEST Traceback (most recent call last): File "/usr/bin/ovs-vsctl", line 498, in ? main() File "/usr/bin/ovs-vsctl", line 493, in main function(*args) File "/usr/bin/ovs-vsctl", line 345, in cmd_add_br cfg_save(cfg, VSWITCHD_CONF) File "/usr/bin/ovs-vsctl", line 142, in cfg_save cfg_reload() File "/usr/bin/ovs-vsctl", line 126, in cfg_reload f = open(target, "r+") IOError: [Errno 6] No such device or address: ' ' # ls -l /var/run/ovs-vswitchd.4173.ctl srw------- 1 root root 0 Sep 14 12:25 /var/run/ovs-vswitchd.4173.ctl From strace: open("/var/run/ovs-vswitchd.4173.ctl", O_RDWR|O_LARGEFILE) = -1 ENXIO (No such device or address) --- diff --git a/utilities/ovs-vsctl.in b/utilities/ovs-vsctl.in index 438b978b..675f9dd4 100755 --- a/utilities/ovs-vsctl.in +++ b/utilities/ovs-vsctl.in @@ -19,6 +19,7 @@ import fnmatch import getopt import os import re +import socket import stat import sys @@ -125,7 +126,9 @@ def cfg_reload(): s = os.stat(target) if not stat.S_ISSOCK(s.st_mode): raise Error("%s is not a Unix domain socket, cannot reload" % target) - f = open(target, "r+") + skt = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + skt.connect(target) + f = os.fdopen(skt.fileno(), "r+") f.write("vswitchd/reload\n") f.flush() f.readline()