Moti Asayag has uploaded a new change for review. Change subject: engine: Vnic live update should be blocked if pm enabled ......................................................................
engine: Vnic live update should be blocked if pm enabled Any vnic live update action should be blocked either if the new profile is marked for port mirroring or if the existing profile is configured with port mirroring. Such change requires unplugging and plugging the vnic. Change-Id: I5101e769d33db8b1fa2cfcd0ab0bd766fd9ac13f Bug-Url: https://bugzilla.redhat.com/1045079 Signed-off-by: Moti Asayag <masa...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/vm/UpdateVmInterfaceCommand.java 1 file changed, 7 insertions(+), 13 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/60/22660/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/vm/UpdateVmInterfaceCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/vm/UpdateVmInterfaceCommand.java index 67066f1..d9d4a2c 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/vm/UpdateVmInterfaceCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/vm/UpdateVmInterfaceCommand.java @@ -43,7 +43,6 @@ private VmNic oldIface; private VmDevice oldVmDevice; - private VnicProfile vnicProfile; private boolean macShouldBeChanged; private RequiredAction requiredAction = null; @@ -278,17 +277,6 @@ return permissionList; } - private VnicProfile getVnicProfile() { - if (getInterface().getVnicProfileId() == null) { - return null; - } - - if (vnicProfile == null) { - vnicProfile = getVnicProfileDao().get(getInterface().getVnicProfileId()); - } - return vnicProfile; - } - private boolean isVnicProfileChanged(VmNic oldNic, VmNic newNic) { return !ObjectUtils.equals(oldNic.getVnicProfileId(), newNic.getVnicProfileId()); } @@ -333,7 +321,8 @@ if (!FeatureSupported.networkLinking(version)) { return new ValidationResult(VdcBllMessages.HOT_VM_INTERFACE_UPDATE_IS_NOT_SUPPORTED, clusterVersion()); - } else if (getVnicProfile() != null && getVnicProfile().isPortMirroring()) { + } else if (portMirroringEnabled(getInterface().getVnicProfileId()) + || portMirroringEnabled(oldIface.getVnicProfileId())) { return new ValidationResult(VdcBllMessages.CANNOT_PERFORM_HOT_UPDATE_WITH_PORT_MIRRORING); } } @@ -341,6 +330,11 @@ return ValidationResult.VALID; } + private boolean portMirroringEnabled(Guid profileId) { + VnicProfile vnicProfile = profileId == null ? null : getVnicProfileDao().get(profileId); + return vnicProfile != null && vnicProfile.isPortMirroring(); + } + /** * @return An error if live action is required and the properties requiring the NIC to be unplugged and then * plugged again have changed. -- To view, visit http://gerrit.ovirt.org/22660 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5101e769d33db8b1fa2cfcd0ab0bd766fd9ac13f Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Moti Asayag <masa...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches