Yevgeny Zaspitsky has uploaded a new change for review. Change subject: engine: Ensure a role network has an IP ......................................................................
engine: Ensure a role network has an IP Add validation that ensures that a role bearing network has IP on all NICs it's attached to. Change-Id: I6ba52ba7d60307c40584a1b3e5e55be6cef43350 Bug-Url: https://bugzilla.redhat.com/1163365 Signed-off-by: Yevgeny Zaspitsky <yzasp...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsGroupCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/AddClusterNetworkClusterValidator.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworkClusterValidator.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworkToClusterInternalCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkClusterCommandBase.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkClusterValidatorBase.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/UpdateClusterNetworkClusterValidator.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/UpdateNetworkClusterValidator.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/UpdateNetworkOnClusterCommand.java M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/cluster/AddClusterNetworkClusterValidatorTest.java M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworkClusterValidatorTest.java M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/cluster/NetworkClusterValidatorTestBase.java M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/cluster/UpdateClusterNetworkClusterValidatorTest.java M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/cluster/UpdateNetworkClusterValidatorTest.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java M backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties M frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties M frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties 19 files changed, 193 insertions(+), 23 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/49/42049/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsGroupCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsGroupCommand.java index 1e091b5..d89593a 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsGroupCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsGroupCommand.java @@ -26,6 +26,7 @@ import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.dao.ClusterFeatureDao; import org.ovirt.engine.core.dao.VdsGroupDAO; +import org.ovirt.engine.core.dao.network.InterfaceDao; import org.ovirt.engine.core.dao.network.NetworkClusterDao; import org.ovirt.engine.core.dao.network.NetworkDao; @@ -48,6 +49,9 @@ @Inject private ClusterFeatureDao clusterFeatureDao; + + @Inject + private InterfaceDao interfaceDao; private Network managementNetwork; @@ -170,7 +174,11 @@ private AddClusterNetworkClusterValidator createNetworkClusterValidator() { final NetworkCluster networkCluster = createManagementNetworkCluster(); - return new AddClusterNetworkClusterValidator(networkCluster, getVdsGroup().getCompatibilityVersion()); + return new AddClusterNetworkClusterValidator( + interfaceDao, + networkDao, + networkCluster, + getVdsGroup().getCompatibilityVersion()); } private NetworkCluster createManagementNetworkCluster() { diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommand.java index e26fef4..c3a2e4c 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommand.java @@ -49,6 +49,7 @@ import org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase; import org.ovirt.engine.core.dao.ClusterFeatureDao; import org.ovirt.engine.core.dao.SupportedHostFeatureDao; +import org.ovirt.engine.core.dao.network.InterfaceDao; import org.ovirt.engine.core.dao.network.NetworkDao; public class UpdateVdsGroupCommand<T extends ManagementNetworkOnClusterOperationParameters> extends @@ -62,6 +63,12 @@ @Inject private ClusterFeatureDao clusterFeatureDao; + + @Inject + private InterfaceDao interfaceDao; + + @Inject + private NetworkDao networkDao; private List<VDS> allForVdsGroup; private VDSGroup oldGroup; @@ -605,7 +612,10 @@ } UpdateClusterNetworkClusterValidator createManagementNetworkClusterValidator() { - return new UpdateClusterNetworkClusterValidator(managementNetworkCluster, + return new UpdateClusterNetworkClusterValidator( + interfaceDao, + networkDao, + managementNetworkCluster, getVdsGroup().getCompatibilityVersion()); } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/AddClusterNetworkClusterValidator.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/AddClusterNetworkClusterValidator.java index 584c177..319bf64 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/AddClusterNetworkClusterValidator.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/AddClusterNetworkClusterValidator.java @@ -1,12 +1,18 @@ package org.ovirt.engine.core.bll.network.cluster; +import org.ovirt.engine.core.bll.ValidationResult; import org.ovirt.engine.core.common.businessentities.network.NetworkCluster; import org.ovirt.engine.core.compat.Version; +import org.ovirt.engine.core.dao.network.InterfaceDao; +import org.ovirt.engine.core.dao.network.NetworkDao; public class AddClusterNetworkClusterValidator extends NetworkClusterValidatorBase { - public AddClusterNetworkClusterValidator(NetworkCluster networkCluster, Version version) { - super(networkCluster, version); + public AddClusterNetworkClusterValidator(InterfaceDao interfaceDao, + NetworkDao networkDao, + NetworkCluster networkCluster, + Version version) { + super(interfaceDao, networkDao, networkCluster, version); } @Override @@ -19,4 +25,8 @@ return false; } + @Override + public ValidationResult roleNetworkHasIp() { + return ValidationResult.VALID; + } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworkClusterValidator.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworkClusterValidator.java index c7263d0..91c4fd6 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworkClusterValidator.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworkClusterValidator.java @@ -1,15 +1,26 @@ package org.ovirt.engine.core.bll.network.cluster; +import org.ovirt.engine.core.bll.ValidationResult; import org.ovirt.engine.core.common.businessentities.network.NetworkCluster; import org.ovirt.engine.core.compat.Version; +import org.ovirt.engine.core.dao.network.InterfaceDao; +import org.ovirt.engine.core.dao.network.NetworkDao; public class AttachNetworkClusterValidator extends NetworkClusterValidatorBase { - public AttachNetworkClusterValidator(NetworkCluster networkCluster, Version version) { - super(networkCluster, version); + public AttachNetworkClusterValidator(InterfaceDao interfaceDao, + NetworkDao networkDao, + NetworkCluster networkCluster, + Version version) { + super(interfaceDao, networkDao, networkCluster, version); } protected boolean isManagementNetworkChanged() { return networkCluster.isManagement(); } + + @Override + protected ValidationResult roleNetworkHasIpOnAttachedNics(String networkName) { + return ValidationResult.VALID; + } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworkToClusterInternalCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworkToClusterInternalCommand.java index ad4037a..5c4c5a4 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworkToClusterInternalCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworkToClusterInternalCommand.java @@ -56,7 +56,7 @@ } private AttachNetworkClusterValidator createNetworkClusterValidator() { - return new AttachNetworkClusterValidator(getNetworkCluster(), getClusterVersion()); + return new AttachNetworkClusterValidator(interfaceDao, networkDao, getNetworkCluster(), getClusterVersion()); } private Version getClusterVersion() { diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkClusterCommandBase.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkClusterCommandBase.java index af5de79..a893823 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkClusterCommandBase.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkClusterCommandBase.java @@ -1,12 +1,22 @@ package org.ovirt.engine.core.bll.network.cluster; +import javax.inject.Inject; + import org.ovirt.engine.core.bll.VdsGroupCommandBase; import org.ovirt.engine.core.bll.context.CommandContext; import org.ovirt.engine.core.common.action.NetworkClusterParameters; import org.ovirt.engine.core.common.businessentities.network.Network; import org.ovirt.engine.core.common.businessentities.network.NetworkCluster; +import org.ovirt.engine.core.dao.network.InterfaceDao; +import org.ovirt.engine.core.dao.network.NetworkDao; public abstract class NetworkClusterCommandBase<T extends NetworkClusterParameters> extends VdsGroupCommandBase<T> { + + @Inject + protected InterfaceDao interfaceDao; + + @Inject + protected NetworkDao networkDao; private Network persistedNetwork; @@ -47,6 +57,7 @@ result = result && validate(validator.managementNetworkChange()); result = result && validate(validator.migrationPropertySupported()); result = result && validate(validator.glusterNetworkSupported()); + result = result && validate(validator.roleNetworkHasIp()); result = result && (!getPersistedNetwork().isExternal() || validateExternalNetwork(validator)); return result; diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkClusterValidatorBase.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkClusterValidatorBase.java index 525e816..def5eda 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkClusterValidatorBase.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/NetworkClusterValidatorBase.java @@ -1,27 +1,127 @@ package org.ovirt.engine.core.bll.network.cluster; +import java.util.List; +import java.util.Objects; + +import org.apache.commons.lang.StringUtils; import org.ovirt.engine.core.bll.ValidationResult; import org.ovirt.engine.core.common.FeatureSupported; import org.ovirt.engine.core.common.businessentities.VDSGroup; import org.ovirt.engine.core.common.businessentities.network.Network; import org.ovirt.engine.core.common.businessentities.network.NetworkCluster; +import org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface; import org.ovirt.engine.core.common.errors.VdcBllMessages; import org.ovirt.engine.core.common.gluster.GlusterFeatureSupported; import org.ovirt.engine.core.compat.Version; import org.ovirt.engine.core.dal.dbbroker.DbFacade; import org.ovirt.engine.core.dao.VdsDAO; +import org.ovirt.engine.core.dao.network.InterfaceDao; +import org.ovirt.engine.core.dao.network.NetworkDao; +import org.ovirt.engine.core.utils.linq.LinqUtils; +import org.ovirt.engine.core.utils.linq.Predicate; /** * Validator class for {@link NetworkCluster} instances. */ public abstract class NetworkClusterValidatorBase { + protected static final String NETWORK_NAME_REPLACEMENT = "$NetworkName %s"; + private static final String NIC_NAME_REPLACEMENT = "$NicName %s"; + private static final String HOST_NAME_REPLACEMENT = "$HostName %s"; + protected final NetworkCluster networkCluster; private final Version version; - public NetworkClusterValidatorBase(NetworkCluster networkCluster, Version version) { + private final InterfaceDao interfaceDao; + private final NetworkDao networkDao; + + public NetworkClusterValidatorBase(InterfaceDao interfaceDao, + NetworkDao networkDao, + NetworkCluster networkCluster, + Version version) { + Objects.requireNonNull(interfaceDao, "interfaceDao cannot be null"); + Objects.requireNonNull(networkDao, "networkDao cannot be null"); + + this.interfaceDao = interfaceDao; + this.networkDao = networkDao; this.networkCluster = networkCluster; this.version = version; + } + + public ValidationResult roleNetworkHasIp() { + if (isRoleNetwork()) { + final Network network = networkDao.get(networkCluster.getNetworkId()); + final String networkName = network.getName(); + final ValidationResult roleNetworkHasIpOnAttachedNics = roleNetworkHasIpOnAttachedNics(networkName); + if (!roleNetworkHasIpOnAttachedNics.isValid()) { + return roleNetworkHasIpOnAttachedNics; + } + final ValidationResult roleNetworkHasIpOnLabeledNics = roleNetworkHasIpOnLabeledNics(network); + if (!roleNetworkHasIpOnLabeledNics.isValid()) { + return roleNetworkHasIpOnLabeledNics; + } + } + return ValidationResult.VALID; + } + + protected ValidationResult roleNetworkHasIpOnAttachedNics(String networkName) { + final VdsNetworkInterface missingIpNic = findMissingIpNic(networkName); + if (missingIpNic != null) { + return createMissingIpValidationResult(missingIpNic, networkName); + } + return ValidationResult.VALID; + } + + protected ValidationResult roleNetworkHasIpOnLabeledNics(Network network) { + final String networkLabel = network.getLabel(); + if (StringUtils.isNotEmpty(networkLabel)) { + final VdsNetworkInterface missingIpLabeledNic = findMissingIpLabeledNic(networkLabel); + if (missingIpLabeledNic != null) { + return createMissingIpValidationResult(missingIpLabeledNic, network.getName()); + } + } + return ValidationResult.VALID; + } + + private ValidationResult createMissingIpValidationResult( + VdsNetworkInterface missingIpLabeledNic, + String networkName) { + + return new ValidationResult(VdcBllMessages.NETWORK_ADDR_MANDATORY_FOR_ROLE_NETWORK, + String.format(NETWORK_NAME_REPLACEMENT, networkName), + String.format(NIC_NAME_REPLACEMENT, missingIpLabeledNic.getName()), + String.format(HOST_NAME_REPLACEMENT, missingIpLabeledNic.getVdsName())); + } + + private VdsNetworkInterface findMissingIpLabeledNic(final String networkLabel) { + final List<VdsNetworkInterface> labeledNics = interfaceDao.getAllInterfacesByLabelForCluster( + networkCluster.getClusterId(), + networkLabel); + return LinqUtils.firstOrNull(labeledNics, new Predicate<VdsNetworkInterface>() { + @Override + public boolean eval(VdsNetworkInterface nic) { + return StringUtils.isNotEmpty(nic.getAddress()); + } + }); + } + + private VdsNetworkInterface findMissingIpNic(final String networkName) { + final List<VdsNetworkInterface> interfacesByClusterId = + interfaceDao.getAllInterfacesByClusterId(networkCluster.getClusterId()); + final VdsNetworkInterface missingIpNic = + LinqUtils.firstOrNull(interfacesByClusterId, new Predicate<VdsNetworkInterface>() { + @Override + public boolean eval(VdsNetworkInterface nic) { + return networkName.equals(nic.getNetworkName()) && + StringUtils.isNotEmpty(nic.getAddress()); + } + }); + + return missingIpNic; + } + + private boolean isRoleNetwork() { + return networkCluster.isDisplay() || networkCluster.isMigration() || networkCluster.isGluster(); } /** @@ -134,7 +234,6 @@ /** * Make sure the gluster network is supported for the cluster version * - * @param cluster * @return error if gluster network role is not supported for the compatibility version */ public ValidationResult glusterNetworkSupported() { diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/UpdateClusterNetworkClusterValidator.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/UpdateClusterNetworkClusterValidator.java index c7c1ef1..db5195f 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/UpdateClusterNetworkClusterValidator.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/UpdateClusterNetworkClusterValidator.java @@ -2,11 +2,16 @@ import org.ovirt.engine.core.common.businessentities.network.NetworkCluster; import org.ovirt.engine.core.compat.Version; +import org.ovirt.engine.core.dao.network.InterfaceDao; +import org.ovirt.engine.core.dao.network.NetworkDao; public class UpdateClusterNetworkClusterValidator extends NetworkClusterValidatorBase { - public UpdateClusterNetworkClusterValidator(NetworkCluster networkCluster, Version version) { - super(networkCluster, version); + public UpdateClusterNetworkClusterValidator(InterfaceDao interfaceDao, + NetworkDao networkDao, + NetworkCluster networkCluster, + Version version) { + super(interfaceDao, networkDao, networkCluster, version); } @Override diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/UpdateNetworkClusterValidator.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/UpdateNetworkClusterValidator.java index 42a10af..c666273 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/UpdateNetworkClusterValidator.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/UpdateNetworkClusterValidator.java @@ -7,15 +7,19 @@ import org.ovirt.engine.core.compat.Version; import org.ovirt.engine.core.dal.dbbroker.DbFacade; import org.ovirt.engine.core.dao.gluster.GlusterBrickDao; +import org.ovirt.engine.core.dao.network.InterfaceDao; +import org.ovirt.engine.core.dao.network.NetworkDao; public class UpdateNetworkClusterValidator extends NetworkClusterValidatorBase { private final NetworkCluster oldNetworkCluster; - public UpdateNetworkClusterValidator(NetworkCluster networkCluster, - NetworkCluster oldNetworkCluster, - Version version) { - super(networkCluster, version); + public UpdateNetworkClusterValidator(InterfaceDao interfaceDao, + NetworkDao networkDao, + NetworkCluster networkCluster, + NetworkCluster oldNetworkCluster, + Version version) { + super(interfaceDao, networkDao, networkCluster, version); this.oldNetworkCluster = oldNetworkCluster; } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/UpdateNetworkOnClusterCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/UpdateNetworkOnClusterCommand.java index 3fcd668..fd84e5e 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/UpdateNetworkOnClusterCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/cluster/UpdateNetworkOnClusterCommand.java @@ -106,7 +106,7 @@ final UpdateNetworkClusterValidator networkClusterValidator = createNetworkClusterValidator(); return validate(networkClusterValidator.managementNetworkUnset()) && validate(networkClusterValidator.glusterNetworkInUseAndUnset(getVdsGroup())) && - validateAttachment(networkClusterValidator); + validateAttachment(networkClusterValidator); } private ValidationResult networkClusterAttachmentExists() { @@ -138,6 +138,11 @@ } private UpdateNetworkClusterValidator createNetworkClusterValidator() { - return new UpdateNetworkClusterValidator(getNetworkCluster(), getOldNetworkCluster(), getClusterVersion()); + return new UpdateNetworkClusterValidator( + interfaceDao, + networkDao, + getNetworkCluster(), + getOldNetworkCluster(), + getClusterVersion()); } } diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/cluster/AddClusterNetworkClusterValidatorTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/cluster/AddClusterNetworkClusterValidatorTest.java index 77accbb..9bbf89e 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/cluster/AddClusterNetworkClusterValidatorTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/cluster/AddClusterNetworkClusterValidatorTest.java @@ -9,6 +9,6 @@ @Override protected AddClusterNetworkClusterValidator createValidator() { - return new AddClusterNetworkClusterValidator(networkCluster, version); + return new AddClusterNetworkClusterValidator(interfaceDao, networkDao, networkCluster, version); } } diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworkClusterValidatorTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworkClusterValidatorTest.java index d223f0e..045f81f 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworkClusterValidatorTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/cluster/AttachNetworkClusterValidatorTest.java @@ -26,7 +26,7 @@ @Override protected AttachNetworkClusterValidator createValidator() { - return new AttachNetworkClusterValidator(networkCluster, version); + return new AttachNetworkClusterValidator(interfaceDao, networkDao, networkCluster, version); } @Test diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/cluster/NetworkClusterValidatorTestBase.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/cluster/NetworkClusterValidatorTestBase.java index 4ff5381..1c015b7 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/cluster/NetworkClusterValidatorTestBase.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/cluster/NetworkClusterValidatorTestBase.java @@ -23,8 +23,9 @@ import org.ovirt.engine.core.common.errors.VdcBllMessages; import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.compat.Version; -import org.ovirt.engine.core.dal.dbbroker.DbFacade; import org.ovirt.engine.core.dao.VdsDAO; +import org.ovirt.engine.core.dao.network.InterfaceDao; +import org.ovirt.engine.core.dao.network.NetworkDao; import org.ovirt.engine.core.utils.MockConfigRule; import org.ovirt.engine.core.utils.RandomUtils; @@ -46,7 +47,9 @@ @Mock protected VdsDAO vdsDao; @Mock - private DbFacade dbFacade; + protected InterfaceDao interfaceDao; + @Mock + protected NetworkDao networkDao; @Mock protected NetworkCluster networkCluster; @Mock diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/cluster/UpdateClusterNetworkClusterValidatorTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/cluster/UpdateClusterNetworkClusterValidatorTest.java index f01e081..9f89cb8 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/cluster/UpdateClusterNetworkClusterValidatorTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/cluster/UpdateClusterNetworkClusterValidatorTest.java @@ -21,7 +21,7 @@ @Override protected UpdateClusterNetworkClusterValidator createValidator() { - return new UpdateClusterNetworkClusterValidator(networkCluster, version); + return new UpdateClusterNetworkClusterValidator(interfaceDao, networkDao, networkCluster, version); } @Test diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/cluster/UpdateNetworkClusterValidatorTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/cluster/UpdateNetworkClusterValidatorTest.java index 32f70b1..f65d4b9 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/cluster/UpdateNetworkClusterValidatorTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/network/cluster/UpdateNetworkClusterValidatorTest.java @@ -35,7 +35,7 @@ @Override protected UpdateNetworkClusterValidator createValidator() { - return new UpdateNetworkClusterValidator(networkCluster, oldNetworkCluster, version); + return new UpdateNetworkClusterValidator(interfaceDao, networkDao, networkCluster, oldNetworkCluster, version); } @Test diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java index 56a1832..99a601a 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java @@ -552,6 +552,7 @@ ACTION_TYPE_FAILED_NETWORK_LABEL_RENAMING_NOT_SUPPORTED(ErrorType.NOT_SUPPORTED), NETWORK_VLAN_IN_USE(ErrorType.CONFLICT), NETWORK_ADDR_MANDATORY_IN_STATIC_IP(ErrorType.BAD_PARAMETERS), + NETWORK_ADDR_MANDATORY_FOR_ROLE_NETWORK(ErrorType.CONSTRAINT_VIOLATION), NETWORK_MAC_ADDRESS_IN_USE(ErrorType.CONFLICT), HOST_NETWORK_INTERFACE_NOT_EXIST(ErrorType.BAD_PARAMETERS), NIC_NOT_EXISTS_ON_HOST(ErrorType.BAD_PARAMETERS), diff --git a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties index f89494b..b283e52 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties @@ -743,6 +743,7 @@ ACTION_TYPE_FAILED_GIVEN_VERSION_NOT_SUPPORTED=Cannot ${action} ${type}. Selected Compatibility Version is not supported. ACTION_TYPE_FAILED_DATA_CENTER_VERSION_DOESNT_SUPPORT_LIVE_SNAPSHOT=Cannot ${action} ${type}. Selected data center compatibility version does not support live snapshot. NETWORK_ADDR_MANDATORY_IN_STATIC_IP=Network address must be specified when using static IP +NETWORK_ADDR_MANDATORY_FOR_ROLE_NETWORK=Cannot ${action} ${type}. IP address has to be set for the NIC that bears a role network. Network: ${NetworkName}, Nic: ${nicName} on host ${hostName} violates that rule. ACTION_TYPE_FAILED_OBJECT_LOCKED=Cannot ${action} ${type}. Related operation is currently in progress. Please try again later. ACTION_TYPE_FAILED_NETWORK_IS_USED=Cannot ${action} ${type}. The network is currently in use. Please wait and try again later. ACTION_TYPE_FAILED_TEMPLATE_IS_USED_FOR_CREATE_VM=Cannot ${action} ${type}. This template is currently in use to create VM ${VmName}. diff --git a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties index 0dcac70..d9fa3b8 100644 --- a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties +++ b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties @@ -655,6 +655,7 @@ ACTION_TYPE_FAILED_GIVEN_VERSION_NOT_SUPPORTED=Cannot ${action} ${type}. Selected Compatibility Version is not supported. ACTION_TYPE_FAILED_DATA_CENTER_VERSION_DOESNT_SUPPORT_LIVE_SNAPSHOT=Cannot ${action} ${type}. Selected data center compatibility version does not support live snapshot. NETWORK_ADDR_MANDATORY_IN_STATIC_IP=Network address must be specified when using static ip +NETWORK_ADDR_MANDATORY_FOR_ROLE_NETWORK=Cannot ${action} ${type}. IP address has to be set for the NIC that bears a role network. Network: ${NetworkName}, Nic: ${nicName} on host ${hostName} violates that rule. ACTION_TYPE_FAILED_OBJECT_LOCKED=Cannot ${action} ${type}. Related operation is currently in progress. Please try again later. ACTION_TYPE_FAILED_NETWORK_IS_USED=Cannot ${action} ${type}. The network is currently in use. Please wait and try again later. ACTION_TYPE_FAILED_TEMPLATE_IS_USED_FOR_CREATE_VM=Cannot ${action} ${type}. This template is currently in use to create VM ${VmName}. diff --git a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties index 4a5b892..7344740 100644 --- a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties +++ b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties @@ -746,6 +746,7 @@ ACTION_TYPE_FAILED_GIVEN_VERSION_NOT_SUPPORTED=Cannot ${action} ${type}. Selected Compatibility Version is not supported. ACTION_TYPE_FAILED_DATA_CENTER_VERSION_DOESNT_SUPPORT_LIVE_SNAPSHOT=Cannot ${action} ${type}. Selected data center compatibility version does not support live snapshot. NETWORK_ADDR_MANDATORY_IN_STATIC_IP=Network address must be specified when using static ip +NETWORK_ADDR_MANDATORY_FOR_ROLE_NETWORK=Cannot ${action} ${type}. IP address has to be set for the NIC that bears a role network. Network: ${NetworkName}, Nic: ${nicName} on host ${hostName} violates that rule. ACTION_TYPE_FAILED_OBJECT_LOCKED=Cannot ${action} ${type}. Related operation is currently in progress. Please try again later. ACTION_TYPE_FAILED_NETWORK_IS_USED=Cannot ${action} ${type}. The network is currently in use. Please wait and try again later. ACTION_TYPE_FAILED_TEMPLATE_IS_USED_FOR_CREATE_VM=Cannot ${action} ${type}. This template is currently in use to create VM ${VmName}. -- To view, visit https://gerrit.ovirt.org/42049 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6ba52ba7d60307c40584a1b3e5e55be6cef43350 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Yevgeny Zaspitsky <yzasp...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches