Bug 2208023

Summary: When adding a swap lv on a host built from image builder, the pre-existing rootvg gets removed from the lvm devices
Product: Red Hat Enterprise Linux 9 Reporter: Gianfranco Sigrisi <gsigrisi>
Component: rhel-system-rolesAssignee: Vojtech Trefny <vtrefny>
Status: CLOSED MIGRATED QA Contact: CS System Management SST QE <rhel-cs-system-management-subsystem-qe>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 9.2CC: briasmit, rmeggins, spetrosi, vtrefny
Target Milestone: rcKeywords: MigratedToJIRA
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: role:storage
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-09-12 09:58:15 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 Gianfranco Sigrisi 2023-05-17 17:21:11 UTC
Description of problem:

On a host with the following rootvg:

```
[root@rhel9 rex]# vgs
  VG     #PV #LV #SN Attr   VSize  VFree
  rootvg   1   7   0 wz--n- 21.00g    0
``

When running this playbook:
```
---
- name: configure swap
  hosts: "{{ targeted_host }}"

  vars:
    storage_pools:
    - name: swapvg
      disks:
        - /dev/sdb
      volumes:
        - name: swap
          size: 80%
          fs_type: swap
          state: present

  roles:
    - name: redhat.rhel_system_roles.storage

```

The pre-existing rootvg disappears from the lvm devices list. 

The data is kept. 

```
[root@rhel9 rex]# vgs
  VG     #PV #LV #SN Attr   VSize  VFree
  swapvg   1   1   0 wz--n- <2.00g 408.00m
[root@rhel9 rex]#
```


Version-Release number of selected component (if applicable):

redhat.rhel_system_roles.storage 1.21.1

How reproducible:

Always

Steps to Reproduce:
1.
2.
3.

Actual results:

The rootvg disappears

Expected results:

The swapvg is added together with rootvg

Additional info:

The file /etc/lvm/devices/system.devices is missing. 

Workaround: 

Adding a pre_task to create the system.devices file with: vgimportdevices --all - fixes the issue.

Output after re-running the playbook:

```
# vgs
  VG     #PV #LV #SN Attr   VSize  VFree
  rootvg   1   7   0 wz--n- 21.00g      0
  swapvg   1   1   0 wz--n- <2.00g 408.00m
```

Comment 2 RHEL Program Management 2023-09-12 09:53:56 UTC
Issue migration from Bugzilla to Jira is in process at this time. This will be the last message in Jira copied from the Bugzilla bug.

Comment 3 RHEL Program Management 2023-09-12 09:58:15 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "RHEL-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.