Moti Asayag has posted comments on this change.

Change subject: core: Change NIC type from sPAPR VLAN to any other
......................................................................


Patch Set 1:

(2 comments)

Would you like to backport this fix into 3.4 as well ?

http://gerrit.ovirt.org/#/c/24014/1/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/vm/UpdateVmInterfaceCommand.java
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/vm/UpdateVmInterfaceCommand.java:

Line 90:                 macAddedToPool = addMacToPool(getMacAddress());
Line 91:             }
Line 92: 
Line 93:             if (mustChangeAddress(oldIface.getType(), 
getInterface().getType())) {
Line 94:                 
VmDeviceUtils.clearNicAddress(getInterface().getVmId(), getInterface().getId());
this method isn't needed, it can be replaced by a call to:  
  getVmDeviceDao().clearDeviceAddress(getInterface().getId());
Line 95:             }
Line 96: 
Line 97:             
getInterface().setSpeed(VmInterfaceType.forValue(getInterface().getType()).getSpeed());
Line 98: 


Line 289:      * @return
Line 290:      */
Line 291:     private boolean mustChangeAddress (int oldType, int newType) {
Line 292:         return (oldType == VmInterfaceType.spaprVlan.getValue()
Line 293:                 && newType != VmInterfaceType.spaprVlan.getValue())
this condition can be simplified by using XOR operator (^):
  return oldType == VmInterfaceType.spaprVlan.getValue() ^ newType == 
VmInterfaceType.spaprVlan.getValue();

Or shorten that line a bit (by adding a new one ;)  )
  int spaprVlanType = VmInterfaceType.spaprVlan.getValue() 
  return oldType == spaprVlanType ^ newType == spaprVlanType;
Line 294:                 || (oldType != VmInterfaceType.spaprVlan.getValue()
Line 295:                         && newType == 
VmInterfaceType.spaprVlan.getValue());
Line 296:     }
Line 297: 


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib7b6f182b90197f8552c3ae21bfc0a0e9b25be9f
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Leonardo Bianconi <leonardo.bianc...@eldorado.org.br>
Gerrit-Reviewer: Alona Kaplan <alkap...@redhat.com>
Gerrit-Reviewer: Arik Hadas <aha...@redhat.com>
Gerrit-Reviewer: Gustavo Frederico Temple Pedrosa 
<gustavo.pedr...@eldorado.org.br>
Gerrit-Reviewer: Itamar Heim <ih...@redhat.com>
Gerrit-Reviewer: Juan Hernandez <juan.hernan...@redhat.com>
Gerrit-Reviewer: Leonardo Bianconi <leonardo.bianc...@eldorado.org.br>
Gerrit-Reviewer: Moti Asayag <masa...@redhat.com>
Gerrit-Reviewer: Omer Frenkel <ofren...@redhat.com>
Gerrit-Reviewer: Roy Golan <rgo...@redhat.com>
Gerrit-Reviewer: Vitor de Lima <vitor.l...@eldorado.org.br>
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