Skip to content

Commit 4647764

Browse files
(PE-40375) - Phase 1 - Pre-migration checks (#558)
* Do the hostnames exist - if yes can they be connected to * does a replica host exist - if yes can it be connected to * is a valid PE version used - if it's being upgraded is the upgraded version valid * is original cluster operational, is it a supported PE architecture --------- Co-authored-by: David Mallon <[email protected]>
1 parent a8b5de4 commit 4647764

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

plans/migrate.pp

+27
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,41 @@
99
# @param upgrade_version
1010
# Optional version to upgrade to after migration is complete
1111
#
12+
#
1213
plan peadm::migrate (
1314
Peadm::SingleTargetSpec $old_primary_host,
1415
Peadm::SingleTargetSpec $new_primary_host,
1516
Optional[String] $upgrade_version = undef,
1617
Optional[Peadm::SingleTargetSpec] $replica_host = undef,
1718
) {
19+
# pre-migration checks
1820
out::message('This plan is a work in progress and it is not recommended to be used until it is fully implemented and supported')
1921
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+
)
2047

2148
$backup_file = run_plan('peadm::backup', $old_primary_host, {
2249
backup_type => 'migration',

0 commit comments

Comments
 (0)