@@ -42,7 +42,12 @@ PLUGIN_FILE = "/etc/docker/plugins/openvswitch.spec"
def call_popen(cmd):
- child = subprocess.Popen(cmd, stdout=subprocess.PIPE)
+ creationFlags = 0
+ if sys.platform == 'win32':
+ creationFlags = 0x08000000 # CREATE_NO_WINDOW
+ child = subprocess.Popen(cmd,
+ stdout=subprocess.PIPE,
+ creationflags=creationFlags)
output = child.communicate()
if child.returncode:
raise RuntimeError("Fatal error executing %s" % (cmd))
@@ -51,7 +51,12 @@ VIF_ID = ""
def call_popen(cmd):
- child = subprocess.Popen(cmd, stdout=subprocess.PIPE)
+ creationFlags = 0
+ if sys.platform == 'win32':
+ creationFlags = 0x08000000 # CREATE_NO_WINDOW
+ child = subprocess.Popen(cmd,
+ stdout=subprocess.PIPE,
+ creationflags=creationFlags)
output = child.communicate()
if child.returncode:
raise RuntimeError("Fatal error executing %s" % (cmd))
@@ -23,6 +23,7 @@ import select
import socket
import struct
import signal
+import sys
import subprocess
import re
@@ -81,10 +82,14 @@ def uname():
def start_process(args):
try:
+ creationFlags = 0
+ if sys.platform == 'win32':
+ creationFlags = 0x08000000 # CREATE_NO_WINDOW
p = subprocess.Popen(args,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
+ stderr=subprocess.PIPE,
+ creationflags=creationFlags)
out, err = p.communicate()
return (p.returncode, out, err)
except exceptions.OSError:
@@ -186,9 +191,13 @@ def start_local_server(port):
and blocks till the spawned ovs-test server is ready to accept XML RPC
connections.
"""
+ creationFlags = 0
+ if sys.platform == 'win32':
+ creationFlags = 0x08000000 # CREATE_NO_WINDOW
p = subprocess.Popen(["ovs-test", "-s", str(port)],
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
- preexec_fn=sigint_intercept)
+ preexec_fn=sigint_intercept,
+ creationflags=creationFlags)
fcntl.fcntl(p.stdout.fileno(), fcntl.F_SETFL,
fcntl.fcntl(p.stdout.fileno(), fcntl.F_GETFL) | os.O_NONBLOCK)
@@ -775,8 +775,12 @@ def module_info(cap):
def multipathd_topology(cap):
+ creationFlags = 0
+ if sys.platform == 'win32':
+ creationFlags = 0x08000000 # CREATE_NO_WINDOW
pipe = Popen([MULTIPATHD, '-k'], bufsize=1, stdin=PIPE,
- stdout=PIPE, stderr=dev_null)
+ stdout=PIPE, stderr=dev_null,
+ creationflags=creationFlags)
stdout, stderr = pipe.communicate('show topology')
return stdout
@@ -1236,9 +1240,13 @@ class ProcOutput(object):
try:
if ProcOutput.debug:
output_ts("Starting '%s'" % self.cmdAsStr())
+ creationFlags = 0
+ if sys.platform == 'win32':
+ creationFlags = 0x08000000 # CREATE_NO_WINDOW
self.proc = Popen(self.command, bufsize=self.bufsize,
stdin=dev_null, stdout=PIPE, stderr=dev_null,
- shell=isinstance(self.command, str))
+ shell=isinstance(self.command, str),
+ creationflags=creationFlags)
old = fcntl.fcntl(self.proc.stdout.fileno(), fcntl.F_GETFD)
fcntl.fcntl(self.proc.stdout.fileno(),
fcntl.F_SETFD, old | fcntl.FD_CLOEXEC)
@@ -45,7 +45,11 @@ def _sh(*args, **kwargs):
print("------> " + " ".join(args))
shell = len(args) == 1
if kwargs.get("capture", False):
- proc = subprocess.Popen(args, stdout=subprocess.PIPE, shell=shell)
+ creationFlags = 0
+ if sys.platform == 'win32':
+ creationFlags = 0x08000000 # CREATE_NO_WINDOW
+ proc = subprocess.Popen(args, stdout=subprocess.PIPE, shell=shell,
+ creationflags=creationFlags)
return proc.stdout.readlines()
elif kwargs.get("check", True):
subprocess.check_call(args, shell=shell)
@@ -336,8 +336,12 @@ def top_input_get(args):
cmd += ["ssh", args.host]
cmd += ["ovs-dpctl", "dump-flows"]
+ creationFlags = 0
+ if sys.platform == 'win32':
+ creationFlags = 0x08000000 # CREATE_NO_WINDOW
return subprocess.Popen(cmd, stderr=subprocess.STDOUT,
- stdout=subprocess.PIPE).stdout
+ stdout=subprocess.PIPE,
+ creationflags=creationFlags).stdout
def args_get():
@@ -35,8 +35,12 @@ def addr2line(binary, addr):
cmd = ["addr2line", "-f", "-s", "-e", binary, addr]
try:
+ creationFlags = 0
+ if sys.platform == 'win32':
+ creationFlags = 0x08000000 # CREATE_NO_WINDOW
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
+ stderr=subprocess.PIPE,
+ creationflags=creationFlags)
lines = proc.stdout.readlines()
failed = proc.returncode
except OSError:
@@ -43,8 +43,11 @@ def _doexec(*args, **kwargs):
"""Executes an application and returns a set of pipes"""
shell = len(args) == 1
+ creationFlags = 0
+ if sys.platform == 'win32':
+ creationFlags = 0x08000000 # CREATE_NO_WINDOW
proc = subprocess.Popen(args, stdout=subprocess.PIPE, shell=shell,
- bufsize=0)
+ bufsize=0, creationflags=creationFlags)
return proc
@@ -53,7 +53,11 @@ bfd_ref = {}
def call_prog(prog, args_list):
cmd = [prog, "-vconsole:off"] + args_list
- output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()
+ creationFlags = 0
+ if sys.platform == 'win32':
+ creationFlags = 0x08000000 # CREATE_NO_WINDOW
+ output = subprocess.Popen(cmd, stdout=subprocess.PIPE,
+ creationflags=creationFlags).communicate()
if len(output) == 0 or output[0] is None:
output = ""
else:
@@ -24,6 +24,7 @@
import XenAPIPlugin
import os
import subprocess
+import sys
import syslog
import re
@@ -230,7 +231,11 @@ def setControllerCfg(controller):
def vswitchCfgQuery(action_args):
cmd = [vsctl, '-vconsole:off'] + action_args
- output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()
+ creationFlags = 0
+ if sys.platform == 'win32':
+ creationFlags = 0x08000000 # CREATE_NO_WINDOW
+ output = subprocess.Popen(cmd, stdout=subprocess.PIPE,
+ creationflags=creationFlags).communicate()
if len(output) == 0 or output[0] is None:
output = ''
else:
@@ -15,6 +15,7 @@ from InterfaceReconfigure import *
import os
import re
import subprocess
+import sys
#
# Bare Network Devices -- network devices without IP configuration
@@ -722,7 +723,11 @@ class DatapathVswitch(Datapath):
def vswitchCfgQuery(action_args):
cmd = ['%s/usr/bin/ovs-vsctl' % root_prefix(),
'-vconsole:off'] + action_args
- output = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()
+ creationFlags = 0
+ if sys.platform == 'win32':
+ creationFlags = 0x08000000 # CREATE_NO_WINDOW
+ output = subprocess.Popen(cmd, stdout=subprocess.PIPE,
+ creationflags=creationFlags).communicate()
if len(output) == 0 or output[0] == None:
output = ""
else:
@@ -483,7 +483,11 @@ def action_rewrite():
def action_force_rewrite(bridge, config):
def getUUID():
import subprocess
- uuid,_ = subprocess.Popen(['uuidgen'], stdout = subprocess.PIPE).communicate()
+ creationFlags = 0
+ if sys.platform == 'win32':
+ creationFlags = 0x08000000 # CREATE_NO_WINDOW
+ uuid,_ = subprocess.Popen(['uuidgen'], stdout = subprocess.PIPE,
+ creationflags=creationFlags).communicate()
return uuid.strip()
# Notes:
On Windows if the flag CREATE_NO_WINDOW is not specified when using subprocess.Popen, a new window will appear with the new process. The window is not necessary for the tests. This patch addresses this issue by adding the flag CREATE_NO_WINDOW for all subprocess.Popen calls if the machine is running Windows. Signed-off-by: Alin-Gheorghe Balutoiu <abalutoiu@cloudbasesolutions.com> --- ovn/utilities/ovn-docker-overlay-driver | 7 ++++++- ovn/utilities/ovn-docker-underlay-driver | 7 ++++++- python/ovstest/util.py | 13 +++++++++++-- utilities/bugtool/ovs-bugtool.in | 12 ++++++++++-- utilities/ovs-dev.py | 6 +++++- utilities/ovs-dpctl-top.in | 6 +++++- utilities/ovs-parse-backtrace.in | 6 +++++- utilities/ovs-tcpdump.in | 5 ++++- vtep/ovs-vtep | 6 +++++- xenserver/etc_xapi.d_plugins_openvswitch-cfg-update | 7 ++++++- .../opt_xensource_libexec_InterfaceReconfigureVswitch.py | 7 ++++++- xenserver/opt_xensource_libexec_interface-reconfigure | 6 +++++- 12 files changed, 74 insertions(+), 14 deletions(-)