Skip to content

Commit 166f66c

Browse files
committed
Allow pool type to be 'logical', deprecate 'lvm2'
The correct type in libvirt is logical, and we should use the same name.
1 parent fd15189 commit 166f66c

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,18 @@ Role Variables
1515
`libvirt_host_pools` is a list of pools to define and start. Each item
1616
should be a dict containing the following items:
1717
- `name` The name of the pool.
18-
- `type` The type of the pool, currently only `dir` and `lvm2` are supported.
18+
- `type` The type of the pool, currently only `dir` and `logical` are
19+
supported. `lvm2` is supported as an alias for `logical`, but this alias is
20+
deprecated and will be removed in a future release.
1921
- `capacity` The capacity, in bytes, of the pool. (optional)
2022
- `path` The absolute path to the pool's backing directory.
2123
- `mode` The access mode of the pool. N.B.: This should be specified as an
2224
integer **without** a leading zero; for example: `mode: 755`. (only `dir`)
2325
- `owner` The owner of the pool. (only `dir`)
2426
- `group` The group of the pool. (only `dir`)
25-
- `source` The name of the volume group. (only `lvm2`)
26-
- `pvs` A list of physical volumes the volume group consists of. (only `lvm2`)
27+
- `source` The name of the volume group. (only when type is `logical`)
28+
- `pvs` A list of physical volumes the volume group consists of. (only when
29+
type is `logical`)
2730

2831
`libvirt_host_networks` is a list of networks to define and start. Each item
2932
should be a dict containing the following items:
@@ -100,7 +103,7 @@ Example Playbook
100103
owner: my-user
101104
group: my-group
102105
- name: lvm_pool
103-
type: lvm2
106+
type: logical
104107
source: vg1
105108
target: /dev/vg1
106109
pvs:

defaults/main.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
# List of pools to define and start.
33
# Each item should be a dict containing the following items:
44
# name: The name of the pool.
5-
# type: The type of the pool, currently only 'dir', 'lvm2' or 'zfs' are supported.
5+
# type: The type of the pool, currently only 'dir', 'logical' or 'zfs' are
6+
# supported. 'lvm2' is supported as an alias for 'logical', but this
7+
# alias is deprecated and will be removed in a future release.
68
# capacity: The capacity, in bytes, of the pool.
79
# path: The absolute path to the pool's backing directory.
810
# mode: The access mode of the pool.

tasks/pools.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
with_items: "{{ libvirt_host_pools }}"
1111
become: True
1212

13-
- name: Ensure libvirt lvm2 storage pool directories exist
13+
- name: Ensure libvirt LVM storage pool directories exist
1414
lvg:
1515
vg: "{{ item.source }}"
1616
pvs: "{{ item.pvs }}"
17-
when: item.type == "lvm2"
17+
when: item.type in ["lvm2", "logical"]
1818
with_items: "{{ libvirt_host_pools }}"
1919
become: True
2020

@@ -41,4 +41,4 @@
4141
autostart: yes
4242
uri: "{{ libvirt_host_uri | default(omit, true) }}"
4343
with_items: "{{ libvirt_host_pools }}"
44-
become: True
44+
become: True

templates/pool.xml.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
{% if 'capacity' in item %}
88
<capacity>{{ item.capacity }}</capacity>
99
{% endif %}
10-
{% if item.type == 'lvm2' or item.type == 'zfs' %}
10+
{% if item.type in ['logical', 'lvm2', 'zfs'] %}
1111
<source>
1212
<name>{{ item.source }}</name>
13-
{% if item.type == 'lvm2' %}
13+
{% if item.type in ['logical', 'lvm2'] %}
1414
<format type='lvm2'/>
1515
{% endif %}
1616
</source>

0 commit comments

Comments
 (0)