use of org.ovirt.engine.core.common.businessentities.network.VnicProfileView in project ovirt-engine by oVirt.
the class ImportVmFromExternalProviderModel method updateNetworkInterfacesForVm.
protected void updateNetworkInterfacesForVm(VM vm) {
for (VmNetworkInterface iface : vm.getInterfaces()) {
ImportNetworkData importNetworkData = getNetworkImportData(iface);
VnicProfileView profile = importNetworkData.getSelectedNetworkProfile();
if (profile != null) {
iface.setNetworkName(profile.getNetworkName());
iface.setVnicProfileName(profile.getName());
}
}
}
use of org.ovirt.engine.core.common.businessentities.network.VnicProfileView in project ovirt-engine by oVirt.
the class RemoveVnicProfileModel method onRemove.
private void onRemove() {
if (getProgress() != null) {
return;
}
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (VnicProfileView profile : getProfiles()) {
ActionParametersBase parameters = getRemoveVnicProfileParams(profile);
list.add(parameters);
}
startProgress();
Frontend.getInstance().runMultipleAction(ActionType.RemoveVnicProfile, list, result -> {
stopProgress();
cancel();
}, null);
}
use of org.ovirt.engine.core.common.businessentities.network.VnicProfileView in project ovirt-engine by oVirt.
the class ImportVmFromExternalProviderPopupView method addNetworkProfileColumn.
private void addNetworkProfileColumn() {
customSelectionCellNetwork = new CustomSelectionCell(new ArrayList<String>());
customSelectionCellNetwork.setStyle(style.cellSelectBox());
Column<VmNetworkInterface, String> profileColumn = new Column<VmNetworkInterface, String>(customSelectionCellNetwork) {
@Override
public String getValue(VmNetworkInterface iface) {
ImportNetworkData importNetworkData = importModel.getNetworkImportData(iface);
List<String> networkProfileNames = new ArrayList<>();
for (VnicProfileView networkProfile : importNetworkData.getFilteredNetworkProfiles()) {
networkProfileNames.add(networkProfile.getName());
}
((CustomSelectionCell) getCell()).setOptions(networkProfileNames);
if (networkProfileNames.isEmpty()) {
// $NON-NLS-1$
return "";
}
VnicProfileView selectedNetworkProfile = importModel.getNetworkImportData(iface).getSelectedNetworkProfile();
return selectedNetworkProfile != null ? selectedNetworkProfile.getName() : networkProfileNames.get(0);
}
};
profileColumn.setFieldUpdater((index, iface, value) -> importModel.getNetworkImportData(iface).setSelectedNetworkProfile(value));
// $NON-NLS-1$
nicTable.addColumn(profileColumn, constants.profileNameInterface(), "150px");
}
use of org.ovirt.engine.core.common.businessentities.network.VnicProfileView in project ovirt-engine by oVirt.
the class VnicProfileViewDaoTest method testGetAllForCluster.
/**
* Ensures the right set of vnic profiles is returned for the given cluster id.
*/
@Test
public void testGetAllForCluster() {
List<VnicProfileView> result = dao.getAllForCluster(FixturesTool.CLUSTER);
assertNotNull(result);
assertFalse(result.isEmpty());
final Set<Guid> clusterNetworkIds = findClusterNetworkIds(FixturesTool.CLUSTER);
for (VnicProfileView profile : result) {
assertTrue(clusterNetworkIds.contains(profile.getNetworkId()));
}
}
use of org.ovirt.engine.core.common.businessentities.network.VnicProfileView in project ovirt-engine by oVirt.
the class VnicProfileViewDaoTest method testGetForUserWithPermission.
/**
* Ensures that the network interface profile is returned.
*/
@Test
public void testGetForUserWithPermission() {
// This user has permissions on the network, hence he has permissions on the associated profiles
VnicProfileView result = dao.get(FixturesTool.VM_NETWORK_INTERFACE_PROFILE, PRIVILEGED_USER_ID, true);
assertNotNull(result);
assertEquals(FixturesTool.VM_NETWORK_INTERFACE_PROFILE, result.getId());
}
Aggregations