From dd5dccbe0e3640ed05ce22bfb709f54d95255166 Mon Sep 17 00:00:00 2001 From: David Lehman Date: Tue, 22 Oct 2019 17:15:07 -0400 Subject: [PATCH 1/5] Fix passing of fs create options to blivet. --- library/blivet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/blivet.py b/library/blivet.py index 858ca2f9..da47cc15 100644 --- a/library/blivet.py +++ b/library/blivet.py @@ -167,7 +167,7 @@ def _get_format(self): fmt = get_format(self._volume['fs_type'], mountpoint=self._volume.get('mount_point'), label=self._volume['fs_label'], - options=self._volume['fs_create_options']) + create_options=self._volume['fs_create_options']) if not fmt.supported or not fmt.formattable: raise BlivetAnsibleError("required tools for file system '%s' are missing" % self._volume['fs_type']) From 7f2def604c0f3c8d93ed475065b4a8b6c1987c2c Mon Sep 17 00:00:00 2001 From: David Lehman Date: Tue, 22 Oct 2019 17:15:43 -0400 Subject: [PATCH 2/5] Fail on request to resize unresizable fs. --- library/blivet.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/blivet.py b/library/blivet.py index da47cc15..60235179 100644 --- a/library/blivet.py +++ b/library/blivet.py @@ -209,6 +209,8 @@ def _resize(self): raise BlivetAnsibleError("volume '%s' cannot be resized from %s to %s: %s" % (self._device.name, self._device.size, size, str(e))) + elif size and self._device.size != size and not self._device.resizable: + raise BlivetAnsibleError("volume '%s' cannot be resized from %s to %s" % (self._device.name, self._device.size, size)) def _reformat(self): """ Schedule actions as needed to ensure the volume is formatted as specified. """ From 062b5a34910fbc7f18546e8c3c46192bfd999d87 Mon Sep 17 00:00:00 2001 From: David Lehman Date: Mon, 28 Oct 2019 17:05:35 -0400 Subject: [PATCH 3/5] Remove partitions etc as needed when setting up disk volume. --- library/blivet.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/blivet.py b/library/blivet.py index 60235179..f2e22aca 100644 --- a/library/blivet.py +++ b/library/blivet.py @@ -226,6 +226,8 @@ def _reformat(self): if self._device.format.status and not packages_only: self._device.format.teardown() + if not self._device.isleaf: + self._blivet.devicetree.recursive_remove(self._device, remove_device=False) self._blivet.format_device(self._device, fmt) def manage(self): From c795ce643dddd4e54ee6807f9a43d4268f0b9d7a Mon Sep 17 00:00:00 2001 From: David Lehman Date: Mon, 28 Oct 2019 17:06:13 -0400 Subject: [PATCH 4/5] Fail w/ error if mount specified w/o mountable fs. --- library/blivet.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/blivet.py b/library/blivet.py index f2e22aca..d288f8ea 100644 --- a/library/blivet.py +++ b/library/blivet.py @@ -251,6 +251,9 @@ def manage(self): if self._device.exists: self._reformat() + if self.ultimately_present and self._volume['mount_point'] and not self._device.format.mountable: + raise BlivetAnsibleError("volume '%s' has a mount point but no mountable file system" % self._volume['name']) + # schedule resize if appropriate if self._device.exists and self._volume['size']: self._resize() From d6a8b5b33eaca83d8e6c6438c05ad071c3fd4610 Mon Sep 17 00:00:00 2001 From: David Lehman Date: Mon, 28 Oct 2019 18:04:49 -0400 Subject: [PATCH 5/5] Add a default empty volume list to pools. --- defaults/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/defaults/main.yml b/defaults/main.yml index 476616b9..743bbbb9 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -8,6 +8,7 @@ storage_safe_mode: true # fail instead of implicitly/automatically removing dev storage_pool_defaults: state: "present" type: lvm + volumes: [] storage_volume_defaults: state: "present"