Skip to content

Commit 4386c58

Browse files
committed
Preserve exported VM hostname information
This patch will make sure that the `hostname` property value of the export_info is preserved while the instance loses that source information (e.g. due to a shutdown). This will help in keeping the hostname information when retrying deployment executions.
1 parent 97e4d8d commit 4386c58

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

coriolis/tasks/replica_tasks.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,15 @@ def _get_nic(nics_info, nic_id):
9292
new_info['ip_addresses'] = old_ips
9393

9494

95+
def _preserve_hostname_info(old_export_info, new_export_info):
96+
old_hostname = old_export_info.get("hostname", "")
97+
new_hostname = new_export_info.get("hostname", "")
98+
if not new_hostname:
99+
new_export_info['hostname'] = old_hostname
100+
101+
95102
def _update_export_info(old_export_info, result_export_info):
103+
_preserve_hostname_info(old_export_info, result_export_info)
96104
_preserve_old_export_info_nic_ips(old_export_info, result_export_info)
97105

98106

0 commit comments

Comments
 (0)