From e47ea7364f4e2a60c82435576e9046b9ba85bcb6 Mon Sep 17 00:00:00 2001 From: Maor Lipchuk Date: Wed, 18 Jul 2018 13:49:14 +0300 Subject: [PATCH 1/2] print the log file at the end of the execute Print the log file name and location at the end of the execution of the ovirt-dr command --- files/ovirt-dr | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/files/ovirt-dr b/files/ovirt-dr index e12de36..eab430b 100755 --- a/files/ovirt-dr +++ b/files/ovirt-dr @@ -37,22 +37,24 @@ def main(argv): sys.exit(2) create_log_dir(log_file) - if log_file is not None and log_file != '': - print("Log file: '%s'" % log_file) + _print_log_file_name(log_file) if action == 'validate': validator.ValidateMappingFile().run(conf_file) elif action == 'generate': generate_vars.GenerateMappingFile().run(conf_file, log_file, logg.getLevelName(log_level)) + _print_log_file_name(log_file) elif action == 'failover': fail_over.FailOver().run(conf_file, log_file, logg.getLevelName(log_level)) + _print_log_file_name(log_file) elif action == 'failback': fail_back.FailBack().run(conf_file, log_file, logg.getLevelName(log_level)) + _print_log_file_name(log_file) elif action == '--help': help_log() else: @@ -60,6 +62,10 @@ def main(argv): help_log() +def _print_log_file_name(log_file): + if log_file is not None and log_file != '': + print("Log file: '%s'" % log_file) + def _init_vars(argv): conf_file = DEF_CONF_FILE log_file = '' From a88f4124e1e2e40f6e64f3987a4cbd4ae54b0a60 Mon Sep 17 00:00:00 2001 From: Maor Lipchuk Date: Wed, 18 Jul 2018 13:55:39 +0300 Subject: [PATCH 2/2] Fix task names --- tasks/recover/add_nfs_domain.yml | 4 ++-- tasks/recover/print_info.yml | 3 ++- tasks/recover/register_vm.yml | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tasks/recover/add_nfs_domain.yml b/tasks/recover/add_nfs_domain.yml index 3cbb6e6..ce1f6f4 100644 --- a/tasks/recover/add_nfs_domain.yml +++ b/tasks/recover/add_nfs_domain.yml @@ -12,12 +12,12 @@ nfs: path: "{{ nfs_storage['dr_' + dr_target_host + '_path'] }}" address: "{{ nfs_storage['dr_' + dr_target_host + '_address'] }}" - - name: Log append to failed storage domains + - name: Log append to successful storage domains set_fact: succeed_storage_domains: "{{ succeed_storage_domains }} + [ \"{{ nfs_storage['dr_' + dr_target_host + '_name'] }}\" ]" rescue: - - name: Log append to failed_storage_domains + - name: Log append to failed storage domains set_fact: failed_storage_domains: "{{ failed_storage_domains }} + [ \"{{ nfs_storage['dr_' + dr_target_host + '_name'] }}\" ]" ignore_errors: "{{ dr_ignore_error_recover }}" diff --git a/tasks/recover/print_info.yml b/tasks/recover/print_info.yml index d8912db..e004511 100644 --- a/tasks/recover/print_info.yml +++ b/tasks/recover/print_info.yml @@ -8,7 +8,8 @@ shell: cat /tmp/{{ dr_report_file }} register: content - - debug: msg="{{ content.stdout_lines | quote }}" + - name: Pring report file to stdout + debug: msg="{{ content.stdout_lines | quote }}" tags: - fail_over - fail_back diff --git a/tasks/recover/register_vm.yml b/tasks/recover/register_vm.yml index 8e08848..b28b6ca 100644 --- a/tasks/recover/register_vm.yml +++ b/tasks/recover/register_vm.yml @@ -1,5 +1,5 @@ - block: - - name: register VMs + - name: Register VMs ovirt_vms: state: registered storage_domain: "{{ storage.name }}"