Bug 1495545

Summary: Wrong setting etcd_backup_tag variable when create etcd backup file
Product: OpenShift Container Platform Reporter: liujia <jiajliu>
Component: Cluster Version OperatorAssignee: Jan Chaloupka <jchaloup>
Status: CLOSED ERRATA QA Contact: liujia <jiajliu>
Severity: low Docs Contact:
Priority: low    
Version: 3.7.0CC: aos-bugs, jokerman, mmccomas
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-11-28 22:13:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description liujia 2017-09-26 09:36:00 UTC
Description of problem:
When backup etcd files during upgrade etcd, there are two etcd backup files generated before and after etcd upgrade as following.

# ls -la /var/lib/etcd/
total 4
drwxr-xr-x.  6 etcd etcd  145 Sep 26 02:51 .
drwxr-xr-x. 39 root root 4096 Sep 26 02:14 ..
drwxr-xr-x.  3 root root   17 Sep 26 01:19 etcd.etcd
drwx------.  4 etcd etcd   29 Sep 26 01:19 member
drwx------.  3 root root   20 Sep 26 02:50 openshift-backup-etcd_backup_tag20170926024958
drwx------.  3 root root   20 Sep 26 02:51 openshift-backup-etcd_backup_tag20170926025100

However,they are should be named by different "etcd_backup_tag" for distinguishing from each other with "pre-upgrade-" and "post-3.0-".

pre backup in $playbooks/common/openshift-cluster/upgrades/etcd/main.yml
- name: Backup etcd before upgrading anything
  include: backup.yml
  vars:
    etcd_backup_tag: "pre-upgrade-"
  when: openshift_etcd_backup | default(true) | bool

post backup in $playbooks/common/openshift-cluster/upgrades/etcd/upgrade.yml
- name: Backup etcd
  include: backup.yml
  vars:
    etcd_backup_tag: "post-3.0-"
  when: openshift_etcd_backup | default(true) | bool

It is because in backup.yml, set variable wrongly.
---
- name: Backup etcd
  hosts: oo_etcd_hosts_to_backup
  roles:
  - role: openshift_etcd_facts
  - role: etcd_common
    r_etcd_common_action: backup
    r_etcd_common_backup_tag: etcd_backup_tag
...

Version-Release number of the following components:
atomic-openshift-utils-3.7.0-0.127.0.git.0.b9941e4.el7.noarch

How reproducible:
always

Steps to Reproduce:
1. Install ocp
2. Do etcd upgrade
3.

Actual results:
etcd_backup_tag variable did not take effect when create etcd backup file

Expected results:
ETCD backup file should named with "pre-upgrade-" and "post-3.0-" prefix.

Additional info:
Please attach logs from ansible-playbook with the -vvv flag

Comment 1 Jan Chaloupka 2017-09-27 11:44:29 UTC
Upstream PR: https://github.com/openshift/openshift-ansible/pull/5549

Comment 2 openshift-github-bot 2017-09-28 06:11:22 UTC
Commit pushed to master at https://github.com/openshift/openshift-ansible

https://github.com/openshift/openshift-ansible/commit/dcdf09e0aaae055cad8e01e07aa07a951a81f798
Merge pull request #5549 from ingvagabund/fix-etcd-backup-tag

Automatic merge from submit-queue

evaluate etcd_backup_tag variable

Bug: 1495545

Comment 4 liujia 2017-11-02 07:29:30 UTC
Verified on openshift-ansible-3.7.0-0.189.0.git.0.d497c5e.el7.noarch

# ls -la /var/lib/etcd/
total 4
drwx------.  6 etcd etcd  136 Nov  2 02:40 .
drwxr-xr-x. 31 root root 4096 Nov  2 01:18 ..
drwxr-xr-x.  3 root root   17 Nov  2 01:18 etcd.etcd
drwx------.  4 root root   29 Nov  2 01:19 member
drwx------.  3 root root   20 Nov  2 02:40 openshift-backup-post-3.0-20171102024042
drwx------.  3 root root   20 Nov  2 02:39 openshift-backup-pre-upgrade-20171102023921

Comment 8 errata-xmlrpc 2017-11-28 22:13:02 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:3188