Pārlūkot izejas kodu

Merge pull request #634 from smiclea/revert-clone-disk-vmware

Enable VMWare target 'clone_disk' option
Nashwan Azhari 5 gadi atpakaļ
vecāks
revīzija
8030f9d55f

+ 0 - 9
config.ts

@@ -86,15 +86,6 @@ const conf: Config = {
     },
     },
   ],
   ],
 
 
-  providerMigrationOptions: {
-    vmware_vsphere: {
-      cloneDiskDisabledOptions: {
-        defaultValue: false,
-        description: 'Replica Deployments on VMware do not currently support Replica disk cloning',
-      },
-    },
-  },
-
   /*
   /*
   Lower number means that the provider will appear sooner in the list.
   Lower number means that the provider will appear sooner in the list.
   Equal number means alphabetical order within the same group number.
   Equal number means alphabetical order within the same group number.

+ 0 - 14
src/@types/Config.ts

@@ -1,5 +1,3 @@
-import { ProviderTypes } from './Providers'
-
 type Type = 'source' | 'destination'
 type Type = 'source' | 'destination'
 
 
 type ExtraOption = {
 type ExtraOption = {
@@ -22,17 +20,6 @@ export type Services = {
   coriolisLicensing: string,
   coriolisLicensing: string,
 }
 }
 
 
-export type ProviderMigrationCloneDiskDisabledOption = {
-  defaultValue: boolean
-  description: string
-}
-
-export type ProviderMigrationOptions = {
-  [provider in ProviderTypes]?: {
-    cloneDiskDisabledOptions: ProviderMigrationCloneDiskDisabledOption
-  }
-}
-
 export type Config = {
 export type Config = {
   disabledPages: string[],
   disabledPages: string[],
   showUserDomainInput: boolean,
   showUserDomainInput: boolean,
@@ -49,5 +36,4 @@ export type Config = {
   mainListItemsPerPage: number,
   mainListItemsPerPage: number,
   servicesUrls: Services,
   servicesUrls: Services,
   maxMinionPoolEventsPerPage: number,
   maxMinionPoolEventsPerPage: number,
-  providerMigrationOptions: ProviderMigrationOptions
 }
 }

+ 4 - 18
src/components/organisms/ReplicaMigrationOptions/ReplicaMigrationOptions.tsx

@@ -33,7 +33,6 @@ import type { Instance, InstanceScript } from '../../../@types/Instance'
 import { TransferItemDetails } from '../../../@types/MainItem'
 import { TransferItemDetails } from '../../../@types/MainItem'
 import { MinionPool } from '../../../@types/MinionPool'
 import { MinionPool } from '../../../@types/MinionPool'
 import { INSTANCE_OSMORPHING_MINION_POOL_MAPPINGS } from '../WizardOptions/WizardOptions'
 import { INSTANCE_OSMORPHING_MINION_POOL_MAPPINGS } from '../WizardOptions/WizardOptions'
-import { ProviderMigrationCloneDiskDisabledOption } from '../../../@types/Config'
 
 
 const Wrapper = styled.div<any>`
 const Wrapper = styled.div<any>`
   display: flex;
   display: flex;
@@ -84,7 +83,6 @@ type Props = {
   minionPools: MinionPool[]
   minionPools: MinionPool[]
   loadingInstances: boolean,
   loadingInstances: boolean,
   defaultSkipOsMorphing?: boolean | null,
   defaultSkipOsMorphing?: boolean | null,
-  disabledCloneDisk?: ProviderMigrationCloneDiskDisabledOption | null,
   onCancelClick: () => void,
   onCancelClick: () => void,
   onMigrateClick: (
   onMigrateClick: (
     fields: Field[],
     fields: Field[],
@@ -118,20 +116,9 @@ class ReplicaMigrationOptions extends React.Component<Props, State> {
     const mappings = this.props.transferItem?.instance_osmorphing_minion_pool_mappings || {}
     const mappings = this.props.transferItem?.instance_osmorphing_minion_pool_mappings || {}
 
 
     this.setState({
     this.setState({
-      fields: replicaMigrationFields.map(f => {
-        if (f.name === 'skip_os_morphing') {
-          return { ...f, value: this.props.defaultSkipOsMorphing || null }
-        }
-        if (f.name === 'clone_disks' && this.props.disabledCloneDisk) {
-          return {
-            ...f,
-            disabled: true,
-            value: this.props.disabledCloneDisk.defaultValue,
-            description: this.props.disabledCloneDisk.description,
-          }
-        }
-        return f
-      }),
+      fields: replicaMigrationFields.map(f => (f.name === 'skip_os_morphing' ? (
+        { ...f, value: this.props.defaultSkipOsMorphing || null }
+      ) : f)),
       minionPoolMappings: { ...mappings },
       minionPoolMappings: { ...mappings },
     })
     })
   }
   }
@@ -213,8 +200,7 @@ class ReplicaMigrationOptions extends React.Component<Props, State> {
         layout="page"
         layout="page"
         label={field.label || LabelDictionary.get(field.name)}
         label={field.label || LabelDictionary.get(field.name)}
         onChange={value => this.handleValueChange(field, value)}
         onChange={value => this.handleValueChange(field, value)}
-        description={field.description || LabelDictionary.getDescription(field.name)}
-        disabled={field.disabled}
+        description={LabelDictionary.getDescription(field.name)}
       />
       />
     )
     )
   }
   }

+ 0 - 2
src/components/pages/MigrationDetailsPage/MigrationDetailsPage.tsx

@@ -443,8 +443,6 @@ Note that this may lead to scheduled cleanup tasks being forcibly skipped, and t
               loadingInstances={instanceStore.loadingInstancesDetails}
               loadingInstances={instanceStore.loadingInstancesDetails}
               defaultSkipOsMorphing={migrationStore
               defaultSkipOsMorphing={migrationStore
                 .getDefaultSkipOsMorphing(migrationStore.migrationDetails)}
                 .getDefaultSkipOsMorphing(migrationStore.migrationDetails)}
-              disabledCloneDisk={migrationStore.getDisabledCloneDiskOptions(endpointStore.endpoints
-                .find(e => e.id === migrationStore.migrationDetails?.destination_endpoint_id)?.type)}
             />
             />
           </Modal>
           </Modal>
         ) : null}
         ) : null}

+ 0 - 2
src/components/pages/ReplicaDetailsPage/ReplicaDetailsPage.tsx

@@ -650,8 +650,6 @@ class ReplicaDetailsPage extends React.Component<Props, State> {
               instances={instanceStore.instancesDetails}
               instances={instanceStore.instancesDetails}
               onCancelClick={() => { this.handleCloseMigrationModal() }}
               onCancelClick={() => { this.handleCloseMigrationModal() }}
               onMigrateClick={(o, s, r, m) => { this.migrateReplica(o, s, r, m) }}
               onMigrateClick={(o, s, r, m) => { this.migrateReplica(o, s, r, m) }}
-              disabledCloneDisk={migrationStore.getDisabledCloneDiskOptions(endpointStore.endpoints
-                .find(e => e.id === replicaStore.replicaDetails?.destination_endpoint_id)?.type)}
             />
             />
           </Modal>
           </Modal>
         ) : null}
         ) : null}

+ 0 - 10
src/components/pages/ReplicasPage/ReplicasPage.tsx

@@ -46,7 +46,6 @@ import Palette from '../../styleUtils/Palette'
 import configLoader from '../../../utils/Config'
 import configLoader from '../../../utils/Config'
 import { ReplicaItem } from '../../../@types/MainItem'
 import { ReplicaItem } from '../../../@types/MainItem'
 import userStore from '../../../stores/UserStore'
 import userStore from '../../../stores/UserStore'
-import { ProviderMigrationCloneDiskDisabledOption } from '../../../@types/Config'
 
 
 const Wrapper = styled.div<any>``
 const Wrapper = styled.div<any>``
 
 
@@ -331,14 +330,6 @@ class ReplicasPage extends React.Component<{ history: any }, State> {
       action: () => { this.handleShowDeleteReplicas() },
       action: () => { this.handleShowDeleteReplicas() },
     }]
     }]
 
 
-    let disabledDiskOptions: ProviderMigrationCloneDiskDisabledOption | null = null
-    this.state.selectedReplicas.forEach(r => {
-      const options = migrationStore.getDisabledCloneDiskOptions(this.getEndpoint(r.destination_endpoint_id)?.type)
-      if (options) {
-        disabledDiskOptions = options
-      }
-    })
-
     return (
     return (
       <Wrapper>
       <Wrapper>
         <MainTemplate
         <MainTemplate
@@ -440,7 +431,6 @@ class ReplicasPage extends React.Component<{ history: any }, State> {
                 this.setState({ showCreateMigrationsModal: false, modalIsOpen: false })
                 this.setState({ showCreateMigrationsModal: false, modalIsOpen: false })
               }}
               }}
               onMigrateClick={(options, s) => { this.migrateSelectedReplicas(options, s) }}
               onMigrateClick={(options, s) => { this.migrateSelectedReplicas(options, s) }}
-              disabledCloneDisk={disabledDiskOptions}
             />
             />
           </Modal>
           </Modal>
         ) : null}
         ) : null}

+ 0 - 9
src/stores/MigrationStore.ts

@@ -21,8 +21,6 @@ import type { Field } from '../@types/Field'
 import type { Endpoint } from '../@types/Endpoint'
 import type { Endpoint } from '../@types/Endpoint'
 import type { InstanceScript } from '../@types/Instance'
 import type { InstanceScript } from '../@types/Instance'
 import MigrationSource from '../sources/MigrationSource'
 import MigrationSource from '../sources/MigrationSource'
-import configLoader from '../utils/Config'
-import { ProviderTypes } from '../@types/Providers'
 
 
 class MigrationStore {
 class MigrationStore {
   @observable migrations: MigrationItem[] = []
   @observable migrations: MigrationItem[] = []
@@ -61,13 +59,6 @@ class MigrationStore {
     return null
     return null
   }
   }
 
 
-  getDisabledCloneDiskOptions(provider: ProviderTypes | undefined) {
-    if (!provider) {
-      return null
-    }
-    return configLoader.config.providerMigrationOptions[provider]?.cloneDiskDisabledOptions || null
-  }
-
   @action async recreateFullCopy(migration: MigrationItemOptions) {
   @action async recreateFullCopy(migration: MigrationItemOptions) {
     return MigrationSource.recreateFullCopy(migration)
     return MigrationSource.recreateFullCopy(migration)
   }
   }