Adam Litke has uploaded a new change for review.
Change subject: cleanup: Remove dead code from storageServer.py
......................................................................
cleanup: Remove dead code from storageServer.py
While reviewing some schema fixes I noticed that we have a lot of dead
code in storageServer.py which was misleading how parameters are
structured when connecting storage. Remove this unused code.
Change-Id: I7c442e73c6eca16384c3cdd53478b182affe1097
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M vdsm/storage/storageServer.py
1 file changed, 0 insertions(+), 64 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/71/65071/1
diff --git a/vdsm/storage/storageServer.py b/vdsm/storage/storageServer.py
index 1c2bc11..4bc5de9 100644
--- a/vdsm/storage/storageServer.py
+++ b/vdsm/storage/storageServer.py
@@ -24,7 +24,6 @@
import os
import socket
from collections import namedtuple
-from functools import partial
import six
import sys
@@ -44,10 +43,6 @@
import gluster.cli
-class UnsupportedAuthenticationMethod(RuntimeError):
- pass
-
-
IscsiConnectionParameters = namedtuple("IscsiConnectionParameters",
"target, iface, credentials")
@@ -65,65 +60,6 @@
FcpConnectionParameters = namedtuple("FcpConnectionParameters", "")
ConnectionInfo = namedtuple("ConnectionInfo", "type, params")
-
-
-def _credentialAssembly(credInfo):
- authMethod = credInfo.get('type', 'chap').lower()
- if authMethod != 'chap':
- raise UnsupportedAuthenticationMethod(authMethod)
-
- params = credInfo.get('params', {})
- username = params.get('username', None)
- password = params.get('password', None)
- return iscsi.ChapCredentials(username, password)
-
-
-def _iscsiParameterAssembly(d):
- port = d['portal'].get('port', iscsi.ISCSI_DEFAULT_PORT)
- host = d['portal']['host']
- portal = iscsi.IscsiPortal(host, port)
- iqn = d['iqn']
- tpgt = d.get('tpgt', 1)
- target = iscsi.IscsiTarget(portal, tpgt, iqn)
- iface = iscsi.IscsiInterface(d.get('iface', 'default'))
- credInfo = d.get('credentials', None)
- cred = None
- if credInfo:
- cred = _credentialAssembly(credInfo)
-
- return IscsiConnectionParameters(target, iface, cred)
-
-
-def _namedtupleAssembly(nt, d):
- d = d.copy()
- for field in nt._fields:
- if field not in d:
- d[field] = None
-
- return nt(**d)
-
-_posixFsParameterAssembly = partial(_namedtupleAssembly,
- PosixFsConnectionParameters)
-_glusterFsParameterAssembly = partial(_namedtupleAssembly,
- GlusterFsConnectionParameters)
-_nfsParamerterAssembly = partial(_namedtupleAssembly, NfsConnectionParameters)
-_localFsParameterAssembly = partial(_namedtupleAssembly,
- LocaFsConnectionParameters)
-
-
-_TYPE_NT_MAPPING = {
- 'iscsi': _iscsiParameterAssembly,
- 'sharedfs': _posixFsParameterAssembly,
- 'posixfs': _posixFsParameterAssembly,
- 'glusterfs': _glusterFsParameterAssembly,
- 'nfs': _nfsParamerterAssembly,
- 'localfs': _localFsParameterAssembly}
-
-
-def dict2conInfo(d):
- conType = d['type']
- params = _TYPE_NT_MAPPING[conType](d.get('params', {}))
- return ConnectionInfo(conType, params)
class ExampleConnection(object):
--
To view, visit
https://gerrit.ovirt.org/65071
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7c442e73c6eca16384c3cdd53478b182affe1097
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>