use of org.ovirt.engine.core.common.businessentities.network.NetworkCluster in project ovirt-engine by oVirt.
the class HostSetupNetworksCommand method getAttachmentsWithMissingUpdatedDefaultRoute.
private List<NetworkAttachment> getAttachmentsWithMissingUpdatedDefaultRoute() {
NetworkCluster currentDefaultRouteNetworkCluster = findCurrentDefaultRouteNetworkForCluster();
NetworkAttachment currentDefaultRouteNetworkAttachment = currentDefaultRouteNetworkCluster == null ? null : findNetworkAttachmentBy(networkIdAttachmentPredicate(currentDefaultRouteNetworkCluster.getNetworkId()), getExistingAttachments());
VdsNetworkInterface previousDefaultRouteNic = findPreviousDefaultRouteNic();
NetworkAttachment previousDefaultRouteNetworkAttachment = previousDefaultRouteNic == null ? null : findNetworkAttachmentBy(networkNameAttachmentPredicate(previousDefaultRouteNic.getNetworkName()), getExistingAttachments());
if (currentDefaultRouteNetworkAttachment != null && previousDefaultRouteNetworkAttachment != null && currentDefaultRouteNetworkAttachment.getId().equals(previousDefaultRouteNetworkAttachment.getId())) {
return getParameters().getNetworkAttachments();
}
List<NetworkAttachment> extendedAttachments = getParameters().getNetworkAttachments();
NetworkAttachment potentialyMissingAttachment = getPotentialyMissingAttachment(currentDefaultRouteNetworkCluster == null ? null : currentDefaultRouteNetworkCluster.getNetworkId(), currentDefaultRouteNetworkAttachment, previousDefaultRouteNetworkAttachment);
addAttachmentIfMissing(potentialyMissingAttachment, extendedAttachments);
return extendedAttachments;
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkCluster in project ovirt-engine by oVirt.
the class NetworkAttachmentValidatorTest method testNetworkAttachedToClusterWhenAttached.
@Test
public void testNetworkAttachedToClusterWhenAttached() {
Network network = new Network();
network.setId(Guid.newGuid());
NetworkAttachment attachment = new NetworkAttachment();
attachment.setNetworkId(network.getId());
NetworkClusterId networkClusterId = new NetworkClusterId(host.getClusterId(), attachment.getNetworkId());
when(networkClusterDaoMock.get(eq(networkClusterId))).thenReturn(new NetworkCluster());
assertThat(createNetworkAttachmentValidator(attachment).networkAttachedToCluster(), isValid());
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkCluster in project ovirt-engine by oVirt.
the class NetworkAttachmentValidatorTest method doTestBootProtocolSetForRoleNetworkWhenNullValuedIpConfiguration.
private void doTestBootProtocolSetForRoleNetworkWhenNullValuedIpConfiguration(boolean displayNetwork, boolean migrationNetwork, boolean glusterNetwork, Matcher<ValidationResult> matcher, Network network, NetworkAttachment attachment) {
NetworkCluster networkCluster = new NetworkCluster();
networkCluster.setDisplay(displayNetwork);
networkCluster.setMigration(migrationNetwork);
networkCluster.setGluster(glusterNetwork);
NetworkClusterId networkClusterId = new NetworkClusterId(host.getClusterId(), attachment.getNetworkId());
when(networkClusterDaoMock.get(eq(networkClusterId))).thenReturn(networkCluster);
when(networkDaoMock.get(eq(network.getId()))).thenReturn(network);
assertThat(createNetworkAttachmentValidator(attachment).bootProtocolSetForRoleNetwork(), matcher);
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkCluster in project ovirt-engine by oVirt.
the class UpdateNetworkCommand method executeCommand.
@Override
protected void executeCommand() {
NetworkUtils.setNetworkVdsmName(getNetwork());
TransactionSupport.executeInNewTransaction(() -> {
networkDao.update(getNetwork());
for (NetworkCluster clusterAttachment : networkClusterDao.getAllForNetwork(getNetwork().getId())) {
networkClusterHelper.setStatus(clusterAttachment.getClusterId(), getNetwork());
}
if (networkChangedToNonVmNetwork()) {
removeVnicProfiles();
}
if (networkNameChanged()) {
updateDefaultVnicProfileName(getOldNetwork().getName());
}
return null;
});
if (!getNetwork().isExternal()) {
applyNetworkChangesToHosts();
}
setSucceeded(true);
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkCluster in project ovirt-engine by oVirt.
the class MapVnicFlowTestUtils method networkClusterOf.
static NetworkCluster networkClusterOf(Guid networkId) {
NetworkCluster nc = new NetworkCluster();
nc.setNetworkId(networkId);
return nc;
}
Aggregations