update gpu start to match rq-worker
@@ -6,7 +6,7 @@ import shlex
from ast import literal_eval
from os import chdir, getcwd, walk
from os.path import join
-from subprocess import check_output, STDOUT
+from subprocess import check_output, Popen, PIPE, STDOUT
from vent.api.templates import Template
from vent.helpers.logs import Logger
@@ -461,9 +461,16 @@ class PluginHelper:
# otherwise queue it up until it's
# available
# !! TODO check for device settings in vent.template
- nd_url = 'http://localhost:3476/v1.0/docker/cli'
- nd_url += '?dev=0+1\&vol=nvidia_driver'
- r = requests.get(nd_url)
+ cmd = "/sbin/ip route"
+ route = Popen(('/sbin/ip', 'route'), stdout=PIPE)
+ h = check_output(('awk', '/default/ {print $3}'),
+ stdin=route.stdout)
+ route.wait()
+ host = h.strip()
+ nd_url = 'http://' + host + ':3476/v1.0/docker/cli'
+ params = {'vol': 'nvidia_driver'}
+
+ r = requests.get(nd_url, params=params)
if r.status_code == 200:
options = r.text.split()
for option in options:
