Change in vdsm[master]: virt: Don't expose GuestAgent.guestInfo directly
nsoffer at redhat.com
nsoffer at redhat.com
Mon Jan 18 00:44:45 UTC 2016
Nir Soffer has submitted this change and it was merged.
Change subject: virt: Don't expose GuestAgent.guestInfo directly
......................................................................
virt: Don't expose GuestAgent.guestInfo directly
GuestAgent.getGuestInfo() returns its guestInfo dict attribute directly,
so the callers may modify it. guestInfo is a public attribute so it
shouldn't be a problem in theory as it's possible to modify that
attribute anyway without calling getGuestInfo(). But guestInfo isn't
used anywhere outside GuestAgent and should be probably changed to a
private attribute.
The problem of modifiable internal structure is exposed in
Vm._getGuestStats where modifications to guestInfo cause incorrect
memUsage values reported in case of repeated invocations (see the
referenced bug).
The safest approach to the problem is to return a deep copy of guestInfo
from getGuestInfo(). However, making a deep copy can have performance
issues, e.g. when copying a list of thousands installed Windows
packages. For that reason we return just a shallow copy, which should
suffice for typical uses.
Change-Id: Ie48c697300e4feeb513dc662c2d1d3d8c21f0af9
Bug-Url: https://bugzilla.redhat.com/1295428
Signed-off-by: Milan Zamazal <mzamazal at redhat.com>
Reviewed-on: https://gerrit.ovirt.org/51508
Reviewed-by: Francesco Romani <fromani at redhat.com>
Reviewed-by: Nir Soffer <nsoffer at redhat.com>
Continuous-Integration: Jenkins CI
---
M tests/guestagentTests.py
M vdsm/virt/guestagent.py
2 files changed, 20 insertions(+), 1 deletion(-)
Approvals:
Nir Soffer: Looks good to me, but someone else must approve
Jenkins CI: Passed CI tests
Francesco Romani: Looks good to me, approved
Milan Zamazal: Verified
--
To view, visit https://gerrit.ovirt.org/51508
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie48c697300e4feeb513dc662c2d1d3d8c21f0af9
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Milan Zamazal <mzamazal at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Martin Polednik <mpolednik at redhat.com>
Gerrit-Reviewer: Milan Zamazal <mzamazal at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Vinzenz Feenstra <vfeenstr at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
More information about the vdsm-patches
mailing list