|
9 | 9 | # @param upgrade_version
|
10 | 10 | # Optional version to upgrade to after migration is complete
|
11 | 11 | #
|
| 12 | +# |
12 | 13 | plan peadm::migrate (
|
13 | 14 | Peadm::SingleTargetSpec $old_primary_host,
|
14 | 15 | Peadm::SingleTargetSpec $new_primary_host,
|
15 | 16 | Optional[String] $upgrade_version = undef,
|
16 | 17 | Optional[Peadm::SingleTargetSpec] $replica_host = undef,
|
17 | 18 | ) {
|
| 19 | + # pre-migration checks |
18 | 20 | out::message('This plan is a work in progress and it is not recommended to be used until it is fully implemented and supported')
|
19 | 21 | peadm::assert_supported_bolt_version()
|
| 22 | + if $upgrade_version and $upgrade_version != '' and !empty($upgrade_version) { |
| 23 | + $permit_unsafe_versions = false |
| 24 | + peadm::assert_supported_pe_version($upgrade_version, $permit_unsafe_versions) |
| 25 | + } |
| 26 | + |
| 27 | + $all_hosts = peadm::flatten_compact([ |
| 28 | + $old_primary_host, |
| 29 | + $new_primary_host, |
| 30 | + $replica_host ? { undef => [], default => [$replica_host] } |
| 31 | + ].flatten) |
| 32 | + run_command('hostname', $all_hosts) # verify can connect to targets |
| 33 | + |
| 34 | + # verify the cluster we are migrating from is operational and is a supported architecture |
| 35 | + $cluster = run_task('peadm::get_peadm_config', $old_primary_host).first.value |
| 36 | + $error = getvar('cluster.error') |
| 37 | + if $error { |
| 38 | + fail_plan($error) |
| 39 | + } |
| 40 | + $arch = peadm::assert_supported_architecture( |
| 41 | + getvar('cluster.params.primary_host'), |
| 42 | + getvar('cluster.params.replica_host'), |
| 43 | + getvar('cluster.params.primary_postgresql_host'), |
| 44 | + getvar('cluster.params.replica_postgresql_host'), |
| 45 | + getvar('cluster.params.compiler_hosts'), |
| 46 | + ) |
20 | 47 |
|
21 | 48 | $backup_file = run_plan('peadm::backup', $old_primary_host, {
|
22 | 49 | backup_type => 'migration',
|
|
0 commit comments