[ovs-dev] ov-vsctl: /var/run/ovs-vswitchd.*.ctl isa Unix domain socket
Ian Campbell
Ian.Campbell at citrix.com
Tue Sep 15 10:32:12 UTC 2009
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 -r e38a42b82cec utilities/ovs-vsctl.in
--- a/utilities/ovs-vsctl.in Mon Sep 14 18:11:01 2009 +0100
+++ b/utilities/ovs-vsctl.in Tue Sep 15 11:30:53 2009 +0100
@@ -21,6 +21,7 @@
import re
import stat
import sys
+import socket
argv0 = sys.argv[0]
@@ -123,7 +124,9 @@
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()
More information about the dev
mailing list