Skip to content

Commit 031f364

Browse files
authored
Merge pull request #30 from prisma01/master
use logical instead of lvm2 for pool type inside xml template
2 parents 91d21e4 + 166f66c commit 031f364

File tree

4 files changed

+19
-10
lines changed

4 files changed

+19
-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: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1+
{% if item.type == 'lvm2' %}
2+
<pool type='logical'>
3+
{% else %}
14
<pool type='{{ item.type }}'>
5+
{% endif %}
26
<name>{{ item.name }}</name>
37
{% if 'capacity' in item %}
48
<capacity>{{ item.capacity }}</capacity>
59
{% endif %}
6-
{% if item.type == 'lvm2' or item.type == 'zfs' %}
10+
{% if item.type in ['logical', 'lvm2', 'zfs'] %}
711
<source>
812
<name>{{ item.source }}</name>
9-
{% if item.type == 'lvm2' %}
13+
{% if item.type in ['logical', 'lvm2'] %}
1014
<format type='lvm2'/>
1115
{% endif %}
1216
</source>

0 commit comments

Comments
 (0)