Arik Hadas has posted comments on this change.

Change subject: core: fix NPE for removing non existing template
......................................................................


Patch Set 3:

(1 comment)

There is still a potential NPE here so it is relevant. not only in case of 
engine recovery, also in case the user triggered removed operation for 
non-existing template from the UI (let's say the UI wasn't refreshed since the 
template was removed) or when the user specify non-existing template from the 
REST.

Omer, please consider my comment. putting -1 so that it will be noticeable.

....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmTemplateCommand.java
Line 212:                 
LockMessagesMatchUtil.makeLockingPair(LockingGroup.TEMPLATE, 
getTemplateExclusiveLockMessage()));
Line 213:     }
Line 214: 
Line 215:     private String getTemplateExclusiveLockMessage() {
Line 216:         if (getVmTemplate() != null) {
if the template is null, the can-do-action checks will fail the command. so it 
might be better to check whether the template is null or not in 
#getExclusiveLocks(), and in case it is null to return null there, so that we 
won't even build the engine lock and acquire it.
Line 217:             return new 
StringBuilder(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_IS_BEING_REMOVED.name())
Line 218:                     .append(String.format("$TemplateName %1$s", 
getVmTemplate().getName()))
Line 219:                     .toString();
Line 220:         }


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Id3eeb1d34d4e6320961ee8b360715b29003f1a68
Gerrit-PatchSet: 3
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Omer Frenkel <ofren...@redhat.com>
Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com>
Gerrit-Reviewer: Arik Hadas <aha...@redhat.com>
Gerrit-Reviewer: Omer Frenkel <ofren...@redhat.com>
Gerrit-Reviewer: Roy Golan <rgo...@redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to