Change in ovirt-engine[master]: core: mark fields that vdsm cannot change with annotation

ofrenkel at redhat.com ofrenkel at redhat.com
Tue Jan 28 08:33:37 UTC 2014


Omer Frenkel has submitted this change and it was merged.

Change subject: core: mark fields that vdsm cannot change with annotation
......................................................................


core: mark fields that vdsm cannot change with annotation

We used to have the names of the fields in VmDynamic that cannot be
changed by VDSM hard-coded in VdsUpdateRunTimeInfo (so that if we detect
when we compare the VmDynamic we hold in the DB and the VmDynamic we get
from VDSM that only such kind of fields are different, we will not
update the DB).
But holding the field names hard-coded in VdsUpdateRunTimeInfo is
problematic because:
* It means that the fields are renamed, we need to remember to rename
  them in VdsUpdateRunTimeInfo as well
* When new fields that should not be change by VDSM are added to
  VmDynamic, we tend to forget to add them to the list that resides in
  VdsUpdateRunTimeInfo and it cause the number of unneeded writes to the
  DB to increase.

The solution is to mark those fields in VmDynamic with an annotation
which indicates that they cannot be changed by VDSM, and then retrieve
all the fields with that annotation in VdsUpdateRunTimeInfo instead of
using hard-coded list of field names.

In addition, the block of code that maps pause status to audit log type
in VdsUpdateRunTimeInfo#updateRepository is extracted to separate method
to make it a bit shorter and more readable.

Change-Id: I8c1981a7adaa6b4ff3ba4012fbe7318f6488e2ab
Signed-off-by: Arik Hadas <ahadas at redhat.com>
---
A backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/UnchangeableByVdsm.java
M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmDynamic.java
M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
3 files changed, 77 insertions(+), 40 deletions(-)

Approvals:
  Omer Frenkel: Looks good to me, approved
  Arik Hadas: Verified



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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8c1981a7adaa6b4ff3ba4012fbe7318f6488e2ab
Gerrit-PatchSet: 18
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Arik Hadas <ahadas at redhat.com>
Gerrit-Reviewer: Arik Hadas <ahadas at redhat.com>
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek at redhat.com>
Gerrit-Reviewer: Omer Frenkel <ofrenkel at redhat.com>
Gerrit-Reviewer: Roy Golan <rgolan at redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server



More information about the Engine-commits mailing list