From 3a6ea27da3570a4e0daf8178cc0f5585d57bdd4b Mon Sep 17 00:00:00 2001 From: Alexander Kharkov Date: Fri, 6 Oct 2017 01:14:52 +0000 Subject: [PATCH] Memory hog during image import from glance fixed In case when unified image format is used it is possible to pass file like object to pylxd API to import image to LXD. In that case image not read to memory and nova-compute does not utilize abnormal amount of RAM. requirements.txt bumped pylxd to 2.2.5 as the change requires pylxd change "Image import - memory hog fix" (8588c3afb316299f204ae502b1c35dd7d7e3420e) Change-Id: I4d47ab4e40b62925c0b63e7ac740f35709df1e3d Closes-Bug: 1714415 --- .gitignore | 2 +- nova/virt/lxd/driver.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 7aff60eb..52e80fc0 100644 --- a/.gitignore +++ b/.gitignore @@ -27,7 +27,7 @@ pip-log.txt .coverage .tox nosetests.xml -.testrepository +.stestr .venv # Translations diff --git a/nova/virt/lxd/driver.py b/nova/virt/lxd/driver.py index d1156ddf..8681d063 100644 --- a/nova/virt/lxd/driver.py +++ b/nova/virt/lxd/driver.py @@ -326,7 +326,7 @@ def _sync_glance_image_to_lxd(client, context, image_ref): 'skipping metadata injection...', {'alias': image_ref}) with open(image_file, 'rb') as image: - image = client.images.create(image.read(), wait=True) + image = client.images.create(image, wait=True) else: metadata = { 'architecture': image.get( @@ -347,7 +347,7 @@ def _sync_glance_image_to_lxd(client, context, image_ref): with open(manifest_file, 'rb') as manifest: with open(image_file, 'rb') as image: image = client.images.create( - image.read(), metadata=manifest.read(), + image, metadata=manifest, wait=True) image.add_alias(image_ref, '')