Change in vdsm[master]: netlink: Introduce socket pool
asegurap at redhat.com
asegurap at redhat.com
Tue Feb 18 13:31:40 UTC 2014
Antoni Segura Puimedon has posted comments on this change.
Change subject: netlink: Introduce socket pool
......................................................................
Patch Set 2:
(4 comments)
http://gerrit.ovirt.org/#/c/24603/2/lib/vdsm/netlink.py
File lib/vdsm/netlink.py:
Line 84:
Line 85:
Line 86: class NLSocketPool(object):
Line 87: """Pool of netlink sockets."""
Line 88: def __init__(self, size=3):
> We don't need a default value, the caller should specify this.
Done
Line 89: assert size > 0
Line 90: self._size = size
Line 91: self._nl_sockets = set()
Line 92: self._semaphore = BoundedSemaphore(size)
Line 87: """Pool of netlink sockets."""
Line 88: def __init__(self, size=3):
Line 89: assert size > 0
Line 90: self._size = size
Line 91: self._nl_sockets = set()
> Since we have only one type of sockets, lets rename it to _sockets
Done
Line 92: self._semaphore = BoundedSemaphore(size)
Line 93: self._population_lock = Lock()
Line 94: self._populated = False
Line 95:
Line 106: for sock in allocated:
Line 107: _nl_handle_destroy(sock) # Free handles so caller can retry
Line 108: raise
Line 109:
Line 110: self._nl_sockets.update(allocated)
> Lets simplify and keep the original error when cleaning up after an error:
_close_nl_socket is of void return type, it does not raise.
Line 111: self._populated = True
Line 112:
Line 113: @contextmanager
Line 114: def socket(self):
Line 167: name)
Line 168: return _link_info(cache, link)
Line 169:
Line 170:
Line 171: def _get_nl_socket():
> _get_nl_socket is not correct name; this create a socket, and should be nam
Done
Line 172: """Returns an open netlink socket."""
Line 173: handle = _nl_handle_alloc()
Line 174: if handle is None:
Line 175: raise IOError(get_errno(), 'Failed to allocate netlink handle')
--
To view, visit http://gerrit.ovirt.org/24603
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I657ac3d3e0c2661ce73bdef9aa807ead888a42eb
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap at redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
More information about the vdsm-patches
mailing list