summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-06-13 23:21:13 +0000
committerGerrit Code Review <review@openstack.org>2017-06-13 23:21:13 +0000
commit309162a58395e20e5c5faffcfdcdbb0642882768 (patch)
treedd1e84e485d503487439a11fe30f2768749dd5ee
parent2c65bf7f1a6e2dc0a17d321bb65ae7c2c2f80e19 (diff)
parentd16dff9a08d1104540182f3aa36758dc89603fc0 (diff)
downloadglance_store-309162a58395e20e5c5faffcfdcdbb0642882768.tar.gz
Merge "Initialize privsep root_helper command"
-rw-r--r--glance_store/_drivers/cinder.py4
-rw-r--r--glance_store/tests/unit/test_cinder_store.py4
-rw-r--r--setup.cfg1
3 files changed, 8 insertions, 1 deletions
diff --git a/glance_store/_drivers/cinder.py b/glance_store/_drivers/cinder.py
index f27e330..3b3f64e 100644
--- a/glance_store/_drivers/cinder.py
+++ b/glance_store/_drivers/cinder.py
@@ -18,6 +18,7 @@ import hashlib
import logging
import math
import os
+import shlex
import socket
import time
@@ -38,10 +39,12 @@ try:
from cinderclient import exceptions as cinder_exception
from cinderclient.v2 import client as cinderclient
from os_brick.initiator import connector
+ from oslo_privsep import priv_context
except ImportError:
cinder_exception = None
cinderclient = None
connector = None
+ priv_context = None
CONF = cfg.CONF
@@ -473,6 +476,7 @@ class Store(glance_store.driver.Store):
attach_mode = 'rw' if mode == 'wb' else 'ro'
device = None
root_helper = get_root_helper()
+ priv_context.init(root_helper=shlex.split(root_helper))
host = socket.gethostname()
properties = connector.get_connector_properties(root_helper, host,
False, False)
diff --git a/glance_store/tests/unit/test_cinder_store.py b/glance_store/tests/unit/test_cinder_store.py
index 9cbae7d..d40ec2f 100644
--- a/glance_store/tests/unit/test_cinder_store.py
+++ b/glance_store/tests/unit/test_cinder_store.py
@@ -158,12 +158,14 @@ class TestCinderStore(base.StoreBaseTest,
kwargs['conn'])
return fake_connector
+ root_helper = "sudo glance-rootwrap /etc/glance/rootwrap.conf"
with mock.patch.object(cinder.Store,
'_wait_volume_status',
return_value=fake_volume), \
mock.patch.object(cinder, 'temporary_chown',
side_effect=fake_chown), \
- mock.patch.object(cinder, 'get_root_helper'), \
+ mock.patch.object(cinder, 'get_root_helper',
+ return_value=root_helper), \
mock.patch.object(connector, 'get_connector_properties'), \
mock.patch.object(connector.InitiatorConnector, 'factory',
side_effect=fake_factory):
diff --git a/setup.cfg b/setup.cfg
index 16e0855..281fe63 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -62,6 +62,7 @@ cinder =
python-cinderclient>=2.0.1 # Apache-2.0
os-brick>=1.11.0 # Apache-2.0
oslo.rootwrap>=5.0.0 # Apache-2.0
+ oslo.privsep>=1.9.0 # Apache-2.0
[build_sphinx]
source-dir = doc/source