Merge "Remove unused _get_file_size()"
diff --git a/tempest/services/image/v1/json/images_client.py b/tempest/services/image/v1/json/images_client.py
index b45ca22..c157996 100644
--- a/tempest/services/image/v1/json/images_client.py
+++ b/tempest/services/image/v1/json/images_client.py
@@ -14,9 +14,7 @@
# under the License.
import copy
-import errno
import functools
-import os
from oslo_log import log as logging
from oslo_serialization import jsonutils as json
@@ -68,35 +66,6 @@
headers['x-image-meta-%s' % key] = str(value)
return headers
- def _get_file_size(self, obj):
- """Analyze file-like object and attempt to determine its size.
-
- :param obj: file-like object, typically redirected from stdin.
- :retval The file's size or None if it cannot be determined.
- """
- # For large images, we need to supply the size of the
- # image file. See LP Bugs #827660 and #845788.
- if hasattr(obj, 'seek') and hasattr(obj, 'tell'):
- try:
- obj.seek(0, os.SEEK_END)
- obj_size = obj.tell()
- obj.seek(0)
- return obj_size
- except IOError as e:
- if e.errno == errno.ESPIPE:
- # Illegal seek. This means the user is trying
- # to pipe image data to the client, e.g.
- # echo testdata | bin/glance add blah..., or
- # that stdin is empty, or that a file-like
- # object which doesn't support 'seek/tell' has
- # been supplied.
- return None
- else:
- raise
- else:
- # Cannot determine size of input image
- return None
-
def _create_with_data(self, headers, data):
# We are going to do chunked transfert, so split the input data
# info fixed-sized chunks.