Change in ovirt-engine[master]: core: lock vm name for the whole vm import operation

ofrenkel at redhat.com ofrenkel at redhat.com
Wed Jul 17 12:59:52 UTC 2013


Omer Frenkel has submitted this change and it was merged.

Change subject: core: lock vm name for the whole vm import operation
......................................................................


core: lock vm name for the whole vm import operation

The name of the VM is being locked when importing VM, since we want to
prevent creation of another vm with the same name in parallel. the lock
for the VM name was taken until we were adding the VM to the DB, since
once it is in the DB, every command that creates VM can find whether
VM with such name already exists or not by checking the DB, so the lock
is no longer required.

The granularity of the locks scope definition is per class, which means
that either all the acquired locks are released at the end of the
execute method or all of them remains until the whole execution of the
command ends. Since we need to add locks which remain for the whole
execution in ImportVmCommand, we need the VM name lock to remain for the
whole execution as well.

This patch changes the scope of the VM name lock that is taken as part
of the import vm operation to be for the whole execution. The message
which is attached to the log is also changed to reflect the error better
(so from the user's perspective, it makes no difference whether other
commands fail because of the lock in memory or due to detection that
there is already another VM with the same name in the DB).

Change-Id: I8e04a40f46389da77b67b997931377d8e1193935
Bug-Url: https://bugzilla.redhat.com/733917
Signed-off-by: Arik Hadas <ahadas at redhat.com>
---
M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java
1 file changed, 2 insertions(+), 3 deletions(-)

Approvals:
  Omer Frenkel: Verified; Looks good to me, approved


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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8e04a40f46389da77b67b997931377d8e1193935
Gerrit-PatchSet: 4
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: Omer Frenkel <ofrenkel at redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server



More information about the Engine-commits mailing list