mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07:00
* Use 'xfs_info' to query fs size, that doesn't always require the device be
mounted. Although still query mountpoint first for backward compatibility.
* Do not fail whith fstype=xfs and resizefs=yes if filesystem already fills
its underlying device.
* Include xfs in the tasks that test idempotency of resizefs option
* Add changelogs/fragments/1478-filesystem-fix-1457-resizefs-idempotency.yml
(cherry picked from commit aa95d8a5b7
)
Co-authored-by: quidame <quidame@poivron.org>
This commit is contained in:
parent
4bc44e4062
commit
24b1d92e84
9 changed files with 64 additions and 39 deletions
|
@ -1,3 +1,4 @@
|
|||
---
|
||||
tested_filesystems:
|
||||
# key: fstype
|
||||
# fssize: size (Mo)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
---
|
||||
dependencies:
|
||||
- setup_pkg_mgr
|
||||
- setup_remote_tmp_dir
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
---
|
||||
- name: 'Create a "disk" file'
|
||||
command: 'dd if=/dev/zero of={{ image_file }} bs=1M count={{ fssize }}'
|
||||
|
||||
|
|
|
@ -43,40 +43,45 @@
|
|||
- 'fs3_result is success'
|
||||
- 'uuid.stdout != uuid3.stdout'
|
||||
|
||||
- name: increase fake device
|
||||
shell: 'dd if=/dev/zero bs=1M count=1 >> {{ image_file }}'
|
||||
|
||||
- when: fstype == 'lvm'
|
||||
block:
|
||||
- name: Resize loop device for LVM
|
||||
command: losetup -c {{ dev }}
|
||||
|
||||
- when: 'grow|bool and (fstype != "vfat" or resize_vfat)'
|
||||
block:
|
||||
- name: Expand filesystem
|
||||
filesystem:
|
||||
dev: '{{ dev }}'
|
||||
fstype: '{{ fstype }}'
|
||||
resizefs: yes
|
||||
register: fs4_result
|
||||
- name: increase fake device
|
||||
shell: 'dd if=/dev/zero bs=1M count=1 >> {{ image_file }}'
|
||||
|
||||
- command: 'blkid -c /dev/null -o value -s UUID {{ dev }}'
|
||||
register: uuid4
|
||||
- name: Resize loop device for LVM
|
||||
command: losetup -c {{ dev }}
|
||||
when: fstype == 'lvm'
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'fs4_result is changed'
|
||||
- 'fs4_result is success'
|
||||
- 'uuid3.stdout == uuid4.stdout' # unchanged
|
||||
- name: Expand filesystem
|
||||
filesystem:
|
||||
dev: '{{ dev }}'
|
||||
fstype: '{{ fstype }}'
|
||||
resizefs: yes
|
||||
register: fs4_result
|
||||
|
||||
- name: Try to expand filesystem again
|
||||
filesystem:
|
||||
dev: '{{ dev }}'
|
||||
fstype: '{{ fstype }}'
|
||||
resizefs: yes
|
||||
register: fs5_result
|
||||
- command: 'blkid -c /dev/null -o value -s UUID {{ dev }}'
|
||||
register: uuid4
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'not (fs5_result is changed)'
|
||||
- 'fs5_result is successful'
|
||||
- assert:
|
||||
that:
|
||||
- 'fs4_result is changed'
|
||||
- 'fs4_result is success'
|
||||
- 'uuid3.stdout == uuid4.stdout' # unchanged
|
||||
|
||||
- when:
|
||||
- (grow | bool and (fstype != "vfat" or resize_vfat)) or
|
||||
(fstype == "xfs" and ansible_system == "Linux" and
|
||||
ansible_distribution not in ["CentOS", "Ubuntu"])
|
||||
block:
|
||||
- name: Check that resizefs does nothing if device size is not changed
|
||||
filesystem:
|
||||
dev: '{{ dev }}'
|
||||
fstype: '{{ fstype }}'
|
||||
resizefs: yes
|
||||
register: fs5_result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- 'fs5_result is not changed'
|
||||
- 'fs5_result is succeeded'
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
---
|
||||
####################################################################
|
||||
# WARNING: These are designed specifically for Ansible tests #
|
||||
# and should not be used as examples of how to write Ansible roles #
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
---
|
||||
- name: 'Recreate "disk" file'
|
||||
command: 'dd if=/dev/zero of={{ image_file }} bs=1M count={{ fssize }}'
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
---
|
||||
- name: install filesystem tools
|
||||
package:
|
||||
name: '{{ item }}'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue