Merge "stop image downloads to memory"
This commit is contained in:
commit
ea358057f8
@ -478,7 +478,11 @@ class SaveImage(command.Command):
|
|||||||
image_client = self.app.client_manager.image
|
image_client = self.app.client_manager.image
|
||||||
image = image_client.find_image(parsed_args.image)
|
image = image_client.find_image(parsed_args.image)
|
||||||
|
|
||||||
image_client.download_image(image.id, output=parsed_args.file)
|
output_file = parsed_args.file
|
||||||
|
if output_file is None:
|
||||||
|
output_file = getattr(sys.stdout, "buffer", sys.stdout)
|
||||||
|
|
||||||
|
image_client.download_image(image.id, stream=True, output=output_file)
|
||||||
|
|
||||||
|
|
||||||
class SetImage(command.Command):
|
class SetImage(command.Command):
|
||||||
|
@ -803,7 +803,11 @@ class SaveImage(command.Command):
|
|||||||
image_client = self.app.client_manager.image
|
image_client = self.app.client_manager.image
|
||||||
image = image_client.find_image(parsed_args.image)
|
image = image_client.find_image(parsed_args.image)
|
||||||
|
|
||||||
image_client.download_image(image.id, output=parsed_args.file)
|
output_file = parsed_args.file
|
||||||
|
if output_file is None:
|
||||||
|
output_file = getattr(sys.stdout, "buffer", sys.stdout)
|
||||||
|
|
||||||
|
image_client.download_image(image.id, stream=True, output=output_file)
|
||||||
|
|
||||||
|
|
||||||
class SetImage(command.Command):
|
class SetImage(command.Command):
|
||||||
|
@ -1618,7 +1618,7 @@ class TestImageSave(TestImage):
|
|||||||
|
|
||||||
verifylist = [
|
verifylist = [
|
||||||
('file', '/path/to/file'),
|
('file', '/path/to/file'),
|
||||||
('image', self.image.id)
|
('image', self.image.id),
|
||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
|
||||||
@ -1626,6 +1626,7 @@ class TestImageSave(TestImage):
|
|||||||
|
|
||||||
self.client.download_image.assert_called_once_with(
|
self.client.download_image.assert_called_once_with(
|
||||||
self.image.id,
|
self.image.id,
|
||||||
|
stream=True,
|
||||||
output='/path/to/file')
|
output='/path/to/file')
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- Stream image download to avoid buffering data in memory which rapidly
|
||||||
|
exhausts memory resulting in OOM kill or system crash for all but the
|
||||||
|
smallest of images. Fixes https://storyboard.openstack.org/#!/story/2007672
|
||||||
|
- Restore default behavior of 'openstack image save' to send data to stdout
|
||||||
|
Relates to https://storyboard.openstack.org/#!/story/2007672.
|
Loading…
Reference in New Issue
Block a user