Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MGMT-19298: Disable CNV operator when user selects MTV operator #2717

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import {
PopoverIcon,
} from '../../../../common';
import CnvHostRequirements from './CnvHostRequirements';
import { getCnvIncompatibleWithLvmReason } from '../../featureSupportLevels/featureStateUtils';
import {
getCnvDisabledWithMtvReason,
getCnvIncompatibleWithLvmReason,
} from '../../featureSupportLevels/featureStateUtils';
import { OcmCheckboxField } from '../../ui/OcmFormFields';
import { useNewFeatureSupportLevel } from '../../../../common/components/newFeatureSupportLevels';
import NewFeatureSupportLevelBadge from '../../../../common/components/newFeatureSupportLevels/NewFeatureSupportLevelBadge';
Expand Down Expand Up @@ -83,6 +86,9 @@ const CnvCheckbox = ({
const lvmSupport = featureSupportLevel.getFeatureSupportLevel('LVM');
reason = getCnvIncompatibleWithLvmReason(values, lvmSupport);
}
if (!reason) {
reason = getCnvDisabledWithMtvReason(values);
}
setDisabledReason(reason);
}, [values, featureSupportLevel]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ const MtvCheckbox = ({ clusterId }: { clusterId: ClusterOperatorProps['clusterId
const fieldId = getFieldId(Mtv_FIELD_NAME, 'input');
const [disabledReason, setDisabledReason] = useState<string | undefined>();

const selectCNVOperator = (checked: boolean) =>
const selectCNVOperator = (checked: boolean) => {
setFieldValue('useContainerNativeVirtualization', checked);
};

React.useEffect(() => {
const disabledReason = featureSupportLevelContext.getFeatureDisabledReason('MTV');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const LVMS_OPERATOR_LABEL = 'Logical Volume Manager Storage';
const LVM_OPERATOR_LABEL = 'Logical Volume Manager';
const ODF_OPERATOR_LABEL = 'OpenShift Data Foundation';
const OPENSHIFT_AI_OPERATOR_LABEL = 'OpenShift AI';
const MTV_OPERATOR_LABEL = 'Migration Toolkit for Virtualization';

export const clusterExistsReason = 'This option is not editable after the draft cluster is created';

Expand Down Expand Up @@ -280,3 +281,12 @@ const getOpenShiftAIDisabledReason = (
}
return undefined;
};

export const getCnvDisabledWithMtvReason = (operatorValues: OperatorsValues) => {
const mustDisableCnv =
operatorValues.useContainerNativeVirtualization &&
operatorValues.useMigrationToolkitforVirtualization;
return mustDisableCnv
? `Currently, you need to install ${CNV_OPERATOR_LABEL} operator at the same time as ${MTV_OPERATOR_LABEL} operator.`
: undefined;
};
Loading