Skip to content

Commit

Permalink
Merge pull request #379 from yaacov/disable-openstack-warm-migration-…
Browse files Browse the repository at this point in the history
…v420

Disable openstack warm migration
  • Loading branch information
yaacov authored Mar 30, 2023
2 parents 9f31dae + ff76b74 commit 229b4c8
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions packages/legacy/src/Plans/components/Wizard/TypeForm.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Alert, Button, List, ListItem, Radio, Stack, StackItem, WizardContext } from '@patternfly/react-core';
import { Alert, List, ListItem, Radio, Stack, StackItem } from '@patternfly/react-core';
import spacing from '@patternfly/react-styles/css/utilities/Spacing/spacing';
import { PlanWizardFormState } from './PlanWizard';
import { warmCriticalConcerns, someVMHasConcern } from './helpers';
Expand All @@ -23,15 +23,14 @@ export const TypeForm: React.FunctionComponent<ITypeFormProps> = ({
selectedVMs,
namespace,
}: ITypeFormProps) => {
const { goToStepById } = React.useContext(WizardContext);

const warmCriticalConcernsFound = warmCriticalConcerns.filter((label) =>
someVMHasConcern(selectedVMs, label)
);
const isAnalyzingVms = selectedVMs.some((vm) => vm.revisionValidated !== vm.revision);

const secretsQuery = useSecretsQuery([sourceProvider.object?.spec?.secret?.name], namespace);
const isSourceOvirtInsecure = checkIfOvirtInsecureProvider(sourceProvider, secretsQuery.data);
const isSourceOpenstack = sourceProvider?.type === 'openstack';

return (
<ResolvedQueries
Expand Down Expand Up @@ -59,11 +58,22 @@ export const TypeForm: React.FunctionComponent<ITypeFormProps> = ({
<Alert
variant="warning"
isInline
title="A warm migration is not currently available."
title="Warm migration is not currently available."
>
Warm migration from {PROVIDER_TYPE_NAMES.ovirt} source provider is only supported
with a verified secure connection.
</Alert>
</StackItem>
)}

{isSourceOpenstack && (
<StackItem>
<Alert
variant="warning"
isInline
title="Warm migration is not currently available."
>
A warm migration from a {PROVIDER_TYPE_NAMES.ovirt} source provider is only supported
with a verified secure connection. To enable a warm migration, first select a secure provider
on the <Button variant="link" isInline onClick={() => goToStepById(0)} >General step</Button>.
Warm migration from {PROVIDER_TYPE_NAMES.openstack} source provider is unsupported.
</Alert>
</StackItem>
)}
Expand All @@ -73,7 +83,7 @@ export const TypeForm: React.FunctionComponent<ITypeFormProps> = ({
id="migration-type-warm"
name="migration-type"
label="Warm migration"
isDisabled={isSourceOvirtInsecure}
isDisabled={isSourceOvirtInsecure || isSourceOpenstack}
description={
<List>
<ListItem>VM data is incrementally copied, leaving source VMs running.</ListItem>
Expand All @@ -83,7 +93,7 @@ export const TypeForm: React.FunctionComponent<ITypeFormProps> = ({
</ListItem>
</List>
}
body={
body={!(isSourceOvirtInsecure || isSourceOpenstack) &&
<>
{isAnalyzingVms && (
<div className={`${spacing.mtMd} ${spacing.mlXs}`}>
Expand Down

0 comments on commit 229b4c8

Please sign in to comment.