Dan Kenigsberg has posted comments on this change.
Change subject: Improvement of the GuestAgent class memory usage
......................................................................
Patch Set 9: I would prefer that you didn't submit this
(3 inline comments)
....................................................
File vdsm/guestIF.py
Line 58:
Line 59: class GuestAgent ():
Line 60: def __init__(self, socketName, channelListener, log,
user='Unknown',
Line 61: ips='', connect=True):
Line 62: self.MAX_MESSAGE_SIZE = \
Saggi is going to be angry for reading config below the clientIF level.
Note how the "connect" arg is passed from libvirtvm.
I do not see the urgent importance of having this as a configurable. Giving the
holiday period, I may put a hard-coded constant here.
Line 63: config.getint('vars',
'guest_agent_max_allowed_message_size')
Line 64: self.log = log
Line 65: self._sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
Line 66: # Save the socket's fileno because a call to fileno() fails if
the
Line 288: line = ''.join(self._buffer) + line
Line 289: self._clearReadBuffer()
Line 290: if self._messageState is MessageState.TOO_BIG:
Line 291: self._messageState = MessageState.NORMAL
Line 292: self.log.warning("[GuestAgent._handleData] Not
processing "
due to our formatter, the method name is going to show up anyway; no need to
include it in the message explicitly.
Line 293: "current message because it was too
big")
Line 294: else:
Line 295: self._processMessage(line)
Line 296:
Line 300: if self._bufferSize >= self.MAX_MESSAGE_SIZE:
Line 301: self.log.warning("[GuestAgent._handleData] Discarding
buffer with "
Line 302: "size: %d because the message reached
maximum "
Line 303: "size of %d bytes before message end was
reached."
Line 304: % (self._bufferSize,
self.MAX_MESSAGE_SIZE))
string format operator (%) should not be used in log.warning() and friend.
this is considered nicer:
self.log.warning("bla %d %s", 3, 'ff')
Line 305: self._messageState = MessageState.TOO_BIG
Line 306: self._clearReadBuffer()
Line 307:
Line 308: @staticmethod
--
To view, visit http://gerrit.ovirt.org/9239
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ibf6274bb10c9e3b80962b69c5df316f03ee21214
Gerrit-PatchSet: 9
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: Gal Hammer <[email protected]>
Gerrit-Reviewer: Igor Lvovsky <[email protected]>
Gerrit-Reviewer: Peter V. Saveliev <[email protected]>
Gerrit-Reviewer: Saggi Mizrahi <[email protected]>
Gerrit-Reviewer: ShaoHe Feng <[email protected]>
Gerrit-Reviewer: Vinzenz Feenstra <[email protected]>
Gerrit-Reviewer: Zhou Zheng Sheng <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches