Fix poor volume creation performance from glance images

Fixed glance uploads on poor write performing systems: give other
greenthreads a chance to schedule.

Story: 2002893
Task: 22856

Change-Id: I70c192f1c72d8bb1a9f9b7a0fd2545c49c3acb46
Signed-off-by: Jack Ding <jack.ding@windriver.com>
This commit is contained in:
Elena Taivan 2018-06-06 12:03:44 +00:00 committed by Jack Ding
parent 7a8612dab8
commit 8a8aaeecde
3 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,32 @@
From fc9b9d397b503eeff6585310d8de177b051a11e9 Mon Sep 17 00:00:00 2001
From: Elena Taivan <elena.taivan@windriver.com>
Date: Wed, 6 Jun 2018 10:02:56 +0000
Subject: [PATCH 1/1] meta Add glance schedulre greenthreads
---
SPECS/python-glance-store.spec | 2 ++
1 file changed, 2 insertions(+)
diff --git a/SPECS/python-glance-store.spec b/SPECS/python-glance-store.spec
index 0c0d728..977b2bc 100644
--- a/SPECS/python-glance-store.spec
+++ b/SPECS/python-glance-store.spec
@@ -16,6 +16,7 @@ Source0: https://tarballs.openstack.org/%{upstream_name}/%{upstream_name}
# WRS
Patch0001: 0001-Check-ceph-cluster-free-space-before-creating-image.patch
Patch0002: 0002-Add-glance-driver.patch
+Patch0003: 0003-Add-glance-schedule-greenthreads.patch
BuildArch: noarch
@@ -90,6 +91,7 @@ Requires: python3-oslo-privsep >= 1.9.0
# Apply WRS patches
%patch0001 -p1
%patch0002 -p1
+%patch0003 -p1
%build
%py2_build
--
1.8.3.1

View File

@ -1,3 +1,4 @@
0001-Update-package-versioning-for-TIS-format.patch
0002-meta-patch-Check-ceph-cluster-free-space.patch
0003-meta-patch-Glance-Driver.patch
0004-meta-Add-glance-schedulre-greenthreads.patch

View File

@ -0,0 +1,33 @@
From 71f9d9555e0909cbc878d8852cd2c2243abd0b1c Mon Sep 17 00:00:00 2001
From: Elena Taivan <elena.taivan@windriver.com>
Date: Wed, 6 Jun 2018 09:41:42 +0000
Subject: [PATCH 1/1] Add glance schedule greenthreads
---
glance_store/_drivers/filesystem.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/glance_store/_drivers/filesystem.py b/glance_store/_drivers/filesystem.py
index 5de011d..4a26d10 100644
--- a/glance_store/_drivers/filesystem.py
+++ b/glance_store/_drivers/filesystem.py
@@ -23,6 +23,7 @@ import hashlib
import logging
import os
import stat
+import time
import jsonschema
from oslo_config import cfg
@@ -685,6 +686,8 @@ class Store(glance_store.driver.Store):
if verifier:
verifier.update(buf)
f.write(buf)
+ # Give other greenthreads a chance to schedule.
+ time.sleep(0)
except IOError as e:
if e.errno != errno.EACCES:
self._delete_partial(filepath, image_id)
--
1.8.3.1