Launcher: add image import-timeout
This adds the import-timeout option for image uploads. Change-Id: Ia5935c4c58f6a9eea060e8fd4dec2b4c3c3d6f5c
This commit is contained in:
@@ -634,8 +634,8 @@ class AwsProviderEndpoint(BaseProviderEndpoint):
|
||||
return quota
|
||||
|
||||
def uploadImage(self, provider_image, image_name, filename,
|
||||
image_format, metadata, md5, sha256, bucket_name,
|
||||
timeout):
|
||||
image_format, metadata, md5, sha256, bucket_name):
|
||||
timeout = provider_image.import_timeout
|
||||
self.log.debug(f"Uploading image {image_name} "
|
||||
f"via {provider_image.import_method}")
|
||||
|
||||
|
||||
@@ -406,13 +406,10 @@ class AwsProvider(BaseProvider, subclass_id='aws'):
|
||||
# TODO this needs to move to the section or connection config
|
||||
# since it's used by endpoints.
|
||||
bucket_name = self.object_storage.get('bucket-name')
|
||||
# TODO make this configurable
|
||||
# timeout = self.image_import_timeout
|
||||
timeout = 300
|
||||
return self.endpoint.uploadImage(
|
||||
provider_image, image_name,
|
||||
filename, image_format, metadata, md5, sha256,
|
||||
bucket_name, timeout)
|
||||
bucket_name)
|
||||
|
||||
def deleteImage(self, external_id):
|
||||
self.endpoint.deleteImage(external_id)
|
||||
|
||||
@@ -507,7 +507,7 @@ class OpenstackProviderEndpoint(BaseProviderEndpoint):
|
||||
return True
|
||||
|
||||
def uploadImage(self, provider_image, image_name, filename,
|
||||
image_format, metadata, md5, sha256, timeout):
|
||||
image_format, metadata, md5, sha256):
|
||||
# configure glance and upload image. Note the meta flags
|
||||
# are provided as custom glance properties
|
||||
# NOTE: we have wait=True set here. This is not how we normally
|
||||
@@ -518,6 +518,7 @@ class OpenstackProviderEndpoint(BaseProviderEndpoint):
|
||||
# block for our v1 clouds anyway, so we might as well
|
||||
# have the interface be the same and treat faking-out
|
||||
# a openstacksdk-level fake-async interface later
|
||||
timeout = provider_image.import_timeout
|
||||
if not metadata:
|
||||
metadata = {}
|
||||
if image_format:
|
||||
|
||||
@@ -265,13 +265,9 @@ class OpenstackProvider(BaseProvider, subclass_id='openstack'):
|
||||
|
||||
def uploadImage(self, provider_image, image_name,
|
||||
filename, image_format, metadata, md5, sha256):
|
||||
# TODO make this configurable
|
||||
# timeout = self.image_import_timeout
|
||||
timeout = 300
|
||||
return self.endpoint.uploadImage(
|
||||
provider_image, image_name,
|
||||
filename, image_format, metadata, md5, sha256,
|
||||
timeout)
|
||||
filename, image_format, metadata, md5, sha256)
|
||||
|
||||
def deleteImage(self, external_id):
|
||||
self.endpoint.deleteImage(external_id)
|
||||
|
||||
@@ -60,6 +60,7 @@ common_image = vs.Schema({
|
||||
Optional('connection-port'): Nullable(int),
|
||||
Optional('python-path'): Nullable(str),
|
||||
Optional('shell-type'): Nullable(str),
|
||||
Optional('import-timeout', default=300): int,
|
||||
})
|
||||
|
||||
# Same as above, but only for cloud providers.
|
||||
|
||||
Reference in New Issue
Block a user