Change in vdsm[master]: oop: Add an option to configure oop implementation
ykaplan at redhat.com
ykaplan at redhat.com
Tue Apr 8 16:55:28 UTC 2014
Yeela Kaplan has uploaded a new change for review.
Change subject: oop: Add an option to configure oop implementation
......................................................................
oop: Add an option to configure oop implementation
The final goal is to replace remoteFileHandler implementation
for outOfProcess with ioprocess.
We will do this in a series of steps
The first step is to add an option to manually configure
which one of the two implementations is to be used:
rfh or ioproc.
Change-Id: Ibd756afd43d23631dc7ed4bac64bec9a81b358b4
Signed-off-by: Yeela Kaplan <ykaplan at redhat.com>
---
M lib/vdsm/config.py.in
M vdsm/storage/hsm.py
M vdsm/storage/outOfProcess.py
3 files changed, 43 insertions(+), 9 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/76/26576/1
diff --git a/lib/vdsm/config.py.in b/lib/vdsm/config.py.in
index 591f268..437327b 100644
--- a/lib/vdsm/config.py.in
+++ b/lib/vdsm/config.py.in
@@ -293,6 +293,9 @@
('use_volume_leases', 'false',
'Whether to use the volume leases or not.'),
+
+ ('oop_impl', 'rfh',
+ 'Whether to use RFH or ioprocess implementation for oop.'),
]),
# Section: [addresses]
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 9040d79..5cca39a 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -360,6 +360,8 @@
self.__validateLvmLockingType()
+ oop.setDefaultImpl(config.get('irs', 'oop_impl'))
+
self.domainStateChangeCallbacks = set()
# cleanStorageRepoitory uses tasksDir value, this must be assigned
diff --git a/vdsm/storage/outOfProcess.py b/vdsm/storage/outOfProcess.py
index f3777a9..9897752 100644
--- a/vdsm/storage/outOfProcess.py
+++ b/vdsm/storage/outOfProcess.py
@@ -19,29 +19,45 @@
#
import types
+from ioprocess import IOProcess
+
from vdsm.config import config
import threading
from functools import partial
from remoteFileHandler import RemoteFileHandlerPool
+RFH = 'rfh'
+IOPROC = 'ioprocess'
+OOP_IMPL = RFH
+
DEFAULT_TIMEOUT = config.getint("irs", "process_pool_timeout")
HELPERS_PER_DOMAIN = config.getint("irs", "process_pool_max_slots_per_domain")
-_poolsLock = threading.Lock()
-_pools = {}
+_procLock = threading.Lock()
+_proc = {}
+
+
+def setDefaultImpl(impl):
+ global OOP_IMPL
+ OOP_IMPL = impl
def getProcessPool(clientName):
try:
- return _pools[clientName]
+ return _proc[clientName][OOP_IMPL]
except KeyError:
- with _poolsLock:
- if clientName not in _pools:
- _pools[clientName] = OopWrapper(
+ with _procLock:
+ if clientName not in _proc:
+ _proc[clientName][RFH] = OopWrapper(
RemoteFileHandlerPool(HELPERS_PER_DOMAIN))
+ if "Global" not in _proc:
+ _proc["Global"][IOPROC] = OopWrapper(
+ RemoteFileHandlerPool(HELPERS_PER_DOMAIN),
+ IOProcess(DEFAULT_TIMEOUT))
+ _proc[clientName][IOPROC] = _proc["Global"][IOPROC]
- return _pools[clientName]
+ return _proc[clientName][OOP_IMPL]
def getGlobalProcPool():
@@ -76,10 +92,23 @@
fullName)
-def OopWrapper(procPool):
- return _ModuleWrapper("oop", procPool, DEFAULT_TIMEOUT,
+class _IOProcWrapper(object):
+ def __init(self, _oop, ioproc):
+ self._oop = _oop
+ self._iop = ioproc
+
+ def __getattr__(self, name):
+ return self._oop.__getattr__(name)
+
+
+def OopWrapper(procPool, ioproc=None):
+ _oop = _ModuleWrapper("oop", procPool, DEFAULT_TIMEOUT,
(("os",
("path",)),
"glob",
"fileUtils",
"utils"))
+ if ioproc is None:
+ return _oop
+ else:
+ return _IOProcWrapper(_oop, ioproc)
--
To view, visit http://gerrit.ovirt.org/26576
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibd756afd43d23631dc7ed4bac64bec9a81b358b4
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yeela Kaplan <ykaplan at redhat.com>
More information about the vdsm-patches
mailing list