Vinzenz Feenstra has posted comments on this change.
Change subject: vdsm: Try to reconnect on vmchannel after errors
......................................................................
Patch Set 13: (5 inline comments)
....................................................
File vdsm/guestIF.py
Line 328: while not self._stopped:
Line 329: data = self._sock.recv(2 ** 16)
Line 330: # The connection is broken when recv returns no data
Line 331: # therefore we're going to set ourself to stopped
state
Line 332: if len(data) == 0:
Done
Line 333: self._stopped = True
Line 334: result = False
Line 335: else:
Line 336: self._handleData(data)
....................................................
File vdsm/vmChannels.py
Line 26: from storage.misc import NoIntrPoll
Line 27:
Line 28: # How many times a reconnect should be performed before a cooldown
will be
Line 29: # applied
Line 30: COOLDOWN_RECONNECT_TRESHOLD = 5
Done
Line 31:
Line 32:
Line 33: class Listener(threading.Thread):
Line 34: """
Line 130: """
Line 131: now = time.time()
Line 132: for (fileno, obj) in self._unconnected.items():
Line 133: self.log.debug("Trying to connect fileno %d.", fileno)
Line 134: if obj.get('cooldown', False):
Done
Line 135: if (now - obj['cooldown_time']) >= self._timeout:
Line 136: obj['cooldown'] = False
Line 137: self.log.log(logging.TRACE, "Reconnect attempt
fileno "
Line 138: "%d", fileno)
Line 131: now = time.time()
Line 132: for (fileno, obj) in self._unconnected.items():
Line 133: self.log.debug("Trying to connect fileno %d.", fileno)
Line 134: if obj.get('cooldown', False):
Line 135: if (now - obj['cooldown_time']) >= self._timeout:
It is for readability. I am not always trying to minimize the char count ;-)
Line 136: obj['cooldown'] = False
Line 137: self.log.log(logging.TRACE, "Reconnect attempt
fileno "
Line 138: "%d", fileno)
Line 139: else:
Line 150: del self._unconnected[fileno]
Line 151: self._channels[fileno] = obj
Line 152: obj['read_time'] = time.time()
Line 153: self._epoll.register(fileno, select.EPOLLIN)
Line 154: elif success is False:
Done
Line 155: obj['reconnects'] = obj.get('reconnects', 0) + 1
Line 156: if obj['reconnects'] >= COOLDOWN_RECONNECT_TRESHOLD:
Line 157: obj['cooldown_time'] = time.time()
Line 158: obj['cooldown'] = True
--
To view, visit http://gerrit.ovirt.org/11977
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I8b9b9418e39558d45c97e9545bc9ecc4935f004e
Gerrit-PatchSet: 13
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <[email protected]>
Gerrit-Reviewer: Antoni Segura Puimedon <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Federico Simoncelli <[email protected]>
Gerrit-Reviewer: Gal Hammer <[email protected]>
Gerrit-Reviewer: Igor Lvovsky <[email protected]>
Gerrit-Reviewer: Jason Dillaman <[email protected]>
Gerrit-Reviewer: Mark Wu <[email protected]>
Gerrit-Reviewer: Michal Skrivanek <[email protected]>
Gerrit-Reviewer: Peter V. Saveliev <[email protected]>
Gerrit-Reviewer: Vinzenz Feenstra <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches