Change in vdsm[ovirt-3.5]: utils: faster albeit less general deepcopy

ybronhei at redhat.com ybronhei at redhat.com
Thu Nov 20 15:19:09 UTC 2014


Yaniv Bronhaim has submitted this change and it was merged.

Change subject: utils: faster albeit less general deepcopy
......................................................................


utils: faster albeit less general deepcopy

VDSM makes intense use of deepcopy() to ensure
correctness of the returned Vm data.
The usage of deepcopy can be reduced, but in order
to do so a significant amount of work is due
to clean up and refactor the affected flows.

For the short/medium term, deepcopy() will be needed;
unfortunately, deepcopy has a quite significant cost.
The function must guarantee to do the right thing
an to behave correctly with all the types and combinations
thereof, so it does quite some bookkeeping.

VDSM, however, does not need so much care for its
usage of deepcopy().
VDSM uses deepcopy with Vm.conf, which will contain
only python primitive types, arranged in a structure
only moderately nested and complex, without fancy
things like classes or generators.

Moreover, this data must be pickle-able, because
VDSM already uses pickle as checkpointing machinery.

So, for VDSM intents and purposes, both existing and
foreseeable, we can replace deepcopy with a much
simpler and faster function, leveraging
the pickle module, like the one suggested on:

http://stackoverflow.com/a/1411229

Change-Id: I936a977e9f41863bdff18b9343d252ab0996d554
Bug-Url: https://bugzilla.redhat.com/1155146
Signed-off-by: Francesco Romani <fromani at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/34989
Reviewed-by: Dan Kenigsberg <danken at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/35331
Reviewed-by: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Reviewed-by: Yaniv Bronhaim <ybronhei at redhat.com>
---
M lib/vdsm/utils.py
M tests/utilsTests.py
M tests/vmTestsData.py
M vdsm/API.py
M vdsm/virt/vm.py
M vdsm/virt/vmtune.py
6 files changed, 231 insertions(+), 11 deletions(-)

Approvals:
  Piotr Kliczewski: Looks good to me, but someone else must approve
  Yaniv Bronhaim: Looks good to me, approved
  Francesco Romani: Verified



-- 
To view, visit http://gerrit.ovirt.org/35331
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I936a977e9f41863bdff18b9343d252ab0996d554
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: automation at ovirt.org


More information about the vdsm-patches mailing list