use of org.ovirt.engine.core.common.businessentities.network.VnicProfile in project ovirt-engine by oVirt.
the class NetworkProfileListModel method newProfile.
public void newProfile() {
if (getWindow() != null) {
return;
}
NewVnicProfileModel model = new NewVnicProfileModel(this, getEntity().getDataCenterId());
setWindow(model);
VnicProfile profile = new VnicProfile();
profile.setNetworkId(getEntity().getId());
model.setProfile(profile);
}
use of org.ovirt.engine.core.common.businessentities.network.VnicProfile in project ovirt-engine by oVirt.
the class AddEmptyStoragePoolCommand method addDefaultNetworks.
private void addDefaultNetworks() {
Network net = new Network();
net.setId(Guid.newGuid());
net.setName(managementNetworkUtil.getDefaultManagementNetworkName());
NetworkUtils.setNetworkVdsmName(net);
net.setDescription(AddClusterCommand.DefaultNetworkDescription);
net.setDataCenterId(getStoragePool().getId());
net.setVmNetwork(true);
networkDao.save(net);
networkHelper.addPermissionsOnNetwork(getCurrentUser().getId(), net.getId());
VnicProfile profile = networkHelper.createVnicProfile(net);
vnicProfileDao.save(profile);
networkHelper.addPermissionsOnVnicProfile(getCurrentUser().getId(), profile.getId(), true);
}
use of org.ovirt.engine.core.common.businessentities.network.VnicProfile in project ovirt-engine by oVirt.
the class RemoveStoragePoolCommand method removeNetworks.
private void removeNetworks() {
final List<Network> networks = networkDao.getAllForDataCenter(getStoragePoolId());
for (Network network : networks) {
if (network.isExternal()) {
for (VmNic nic : vmNicDao.getAllForNetwork(network.getId())) {
externalNetworkManagerFactory.create(nic, network).deallocateIfExternal();
}
}
}
TransactionSupport.executeInNewTransaction(() -> {
for (final Network net : networks) {
List<VnicProfile> profiles = vnicProfileDao.getAllForNetwork(net.getId());
for (VnicProfile vnicProfile : profiles) {
getCompensationContext().snapshotEntity(vnicProfile);
vnicProfileDao.remove(vnicProfile.getId());
}
getCompensationContext().snapshotEntity(net);
networkDao.remove(net.getId());
}
getCompensationContext().stateChanged();
return null;
});
}
use of org.ovirt.engine.core.common.businessentities.network.VnicProfile in project ovirt-engine by oVirt.
the class VmValidatorTest method mockVnic.
private VmNetworkInterface mockVnic(boolean passthrough, boolean migratable, boolean plugged) {
VmNetworkInterface vnic = mock(VmNetworkInterface.class);
when(vnic.isPassthrough()).thenReturn(passthrough);
when(vnic.isPlugged()).thenReturn(plugged);
Guid vnicProfileId = Guid.newGuid();
when(vnic.getVnicProfileId()).thenReturn(vnicProfileId);
VnicProfile profile = mock(VnicProfile.class);
when(vnicProfileDao.get(vnicProfileId)).thenReturn(profile);
when(profile.isMigratable()).thenReturn(migratable);
return vnic;
}
use of org.ovirt.engine.core.common.businessentities.network.VnicProfile in project ovirt-engine by oVirt.
the class VnicProfileValidatorTest method passthroughNotChangedIfUsedByVmsTest.
private void passthroughNotChangedIfUsedByVmsTest(boolean passthoughOld, boolean pasthroughNew, boolean profileUsedByVms) {
VnicProfile updatedVnicProfile = mock(VnicProfile.class);
when(vnicProfile.isPassthrough()).thenReturn(passthoughOld);
when(updatedVnicProfile.isPassthrough()).thenReturn(pasthroughNew);
when(vnicProfileDao.get(any())).thenReturn(updatedVnicProfile);
mockVmsUsingVnicProfile(profileUsedByVms ? Collections.singletonList(mock(VM.class)) : Collections.emptyList());
}
Aggregations