Merge "Using system call for downloading files"
This commit is contained in:
commit
8dbef5c9ef
@ -17,10 +17,12 @@
|
||||
|
||||
import functools
|
||||
import logging
|
||||
import shutil
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
import sendfile
|
||||
|
||||
from glanceclient import client
|
||||
import six.moves.urllib.parse as urlparse
|
||||
|
||||
@ -209,14 +211,8 @@ class BaseImageService(object):
|
||||
url = urlparse.urlparse(location)
|
||||
if url.scheme == "file":
|
||||
with open(url.path, "r") as f:
|
||||
#TODO(ghe): Use system call for downloading files.
|
||||
# Bug #1199522
|
||||
|
||||
# FIXME(jbresnah) a system call to cp could have
|
||||
# significant performance advantages, however we
|
||||
# do not have the path to files at this point in
|
||||
# the abstraction.
|
||||
shutil.copyfileobj(f, data)
|
||||
filesize = os.path.getsize(f.name)
|
||||
sendfile.sendfile(data.fileno(), f.fileno(), 0, filesize)
|
||||
return
|
||||
|
||||
image_chunks = self.call(method, image_id)
|
||||
|
@ -18,6 +18,7 @@ python-neutronclient>=2.3.4,<3
|
||||
python-glanceclient>=0.9.0
|
||||
python-keystoneclient>=0.8.0
|
||||
stevedore>=0.14
|
||||
pysendfile==2.0.0
|
||||
websockify>=0.5.1,<0.6
|
||||
oslo.config>=1.2.0
|
||||
oslo.rootwrap
|
||||
|
Loading…
x
Reference in New Issue
Block a user