Search in sources :

Example 6 with VnicProfileView

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());
        }
    }
}
Also used : VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) VnicProfileView(org.ovirt.engine.core.common.businessentities.network.VnicProfileView)

Example 7 with VnicProfileView

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);
}
Also used : ArrayList(java.util.ArrayList) VnicProfileView(org.ovirt.engine.core.common.businessentities.network.VnicProfileView) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 8 with VnicProfileView

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");
}
Also used : ImportNetworkData(org.ovirt.engine.ui.uicommonweb.models.vms.ImportNetworkData) CustomSelectionCell(org.ovirt.engine.ui.webadmin.widget.table.cell.CustomSelectionCell) VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) AbstractSafeHtmlColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractSafeHtmlColumn) VmTypeColumn(org.ovirt.engine.ui.webadmin.widget.table.column.VmTypeColumn) AbstractCheckboxColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractCheckboxColumn) AbstractDiskSizeColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn) AbstractEnumColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn) AbstractImageResourceColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractImageResourceColumn) Column(com.google.gwt.user.cellview.client.Column) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) ArrayList(java.util.ArrayList) VnicProfileView(org.ovirt.engine.core.common.businessentities.network.VnicProfileView)

Example 9 with VnicProfileView

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()));
    }
}
Also used : VnicProfileView(org.ovirt.engine.core.common.businessentities.network.VnicProfileView) Guid(org.ovirt.engine.core.compat.Guid) Test(org.junit.Test)

Example 10 with VnicProfileView

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());
}
Also used : VnicProfileView(org.ovirt.engine.core.common.businessentities.network.VnicProfileView) Test(org.junit.Test)

Aggregations

VnicProfileView (org.ovirt.engine.core.common.businessentities.network.VnicProfileView)22 ArrayList (java.util.ArrayList)5 Test (org.junit.Test)5 VmNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)4 Network (org.ovirt.engine.core.common.businessentities.network.Network)2 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)2 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)2 Column (com.google.gwt.user.cellview.client.Column)1 List (java.util.List)1 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)1 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 NetworkQoS (org.ovirt.engine.core.common.businessentities.network.NetworkQoS)1 QueryParametersBase (org.ovirt.engine.core.common.queries.QueryParametersBase)1 QueryType (org.ovirt.engine.core.common.queries.QueryType)1 Guid (org.ovirt.engine.core.compat.Guid)1 AbstractCheckboxColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractCheckboxColumn)1 AbstractDiskSizeColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn)1 AbstractEnumColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn)1 AbstractImageResourceColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractImageResourceColumn)1 AbstractSafeHtmlColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractSafeHtmlColumn)1