Browse Source

Merge pull request #541 from smiclea/replication-count

Use correct replication count when recreat. migr. CORWEB-234
Nashwan Azhari 6 năm trước cách đây
mục cha
commit
4198cb7da1

+ 1 - 0
.vscode/settings.json

@@ -1,4 +1,5 @@
 {
   "flow.useNPMPackagedFlow": true,
   "javascript.validate.enable": false,
+  "files.eol": "\n",
 }

+ 1 - 1
src/components/App.jsx

@@ -80,7 +80,7 @@ const Wrapper = styled.div`
 type State = {
   isConfigReady: boolean,
 }
-const MIN_WAIT_MS = 2000
+const MIN_WAIT_MS = 0
 
 class App extends React.Component<{}, State> {
   state = {

+ 9 - 1
src/components/organisms/EditReplica/EditReplica.jsx

@@ -322,7 +322,15 @@ class EditReplica extends React.Component<Props, State> {
     } else {
       try {
         let replicaDefaultStorage = this.props.replica.storage_mappings && this.props.replica.storage_mappings.default
-        let migration: MainItem = await migrationStore.recreate(this.props.replica, this.props.sourceEndpoint, this.props.destinationEndpoint, updateData, replicaDefaultStorage, this.state.defaultStorage)
+        let migration: MainItem = await migrationStore.recreate(
+          this.props.replica,
+          this.props.sourceEndpoint,
+          this.props.destinationEndpoint,
+          updateData,
+          replicaDefaultStorage,
+          this.state.defaultStorage,
+          this.props.replica.replication_count
+        )
         migrationStore.clearDetails()
         this.props.onRequestClose()
         this.props.onUpdateComplete(`/migration/tasks/${migration.id}`)

+ 2 - 1
src/sources/MigrationSource.js

@@ -87,6 +87,7 @@ class MigrationSource {
     networkMappings: ?{ [string]: any },
     updatedNetworkMappings: ?NetworkMap[],
     defaultSkipOsMorphing: ?boolean,
+    replicationCount: ?number,
   }): Promise<MainItem> {
     const getValue = (fieldName: string): ?string => {
       let updatedDestEnv = opts.updatedDestEnv && opts.updatedDestEnv[fieldName]
@@ -106,7 +107,7 @@ class MigrationSource {
         ...destParser.getDestinationEnv(opts.updatedDestEnv),
       },
       shutdown_instances: Boolean(opts.updatedDestEnv && opts.updatedDestEnv.shutdown_instances),
-      replication_count: (opts.updatedDestEnv && opts.updatedDestEnv.replication_count) || 2,
+      replication_count: (opts.updatedDestEnv && opts.updatedDestEnv.replication_count) || opts.replicationCount || 2,
       instances: opts.instanceNames,
       notes: getValue('description') || '',
     }

+ 3 - 1
src/stores/MigrationStore.js

@@ -69,7 +69,8 @@ class MigrationStore {
     destEndpoint: Endpoint,
     updateData: UpdateData,
     defaultStorage: ?string,
-    updatedDefaultStorage: ?string
+    updatedDefaultStorage: ?string,
+    replicationCount: ?number
   ): Promise<MainItem> {
     let migrationResult = await MigrationSource.recreate({
       sourceEndpoint,
@@ -86,6 +87,7 @@ class MigrationStore {
       networkMappings: migration.network_map,
       updatedNetworkMappings: updateData.network,
       defaultSkipOsMorphing: this.getDefaultSkipOsMorphing(migration),
+      replicationCount,
     })
     return migrationResult
   }

+ 1 - 0
src/types/MainItem.js

@@ -55,6 +55,7 @@ export type MainItem = {
   destination_environment: { [string]: mixed },
   source_environment: { [string]: mixed },
   transfer_result: ?{ [string]: Instance },
+  replication_count?: number,
   storage_mappings?: ?{
     backend_mappings: ?{
       destination: string,