Skip to content

Commit 691a00a

Browse files
committed
Archlinux support, libvirt zfs pool support
1 parent d77956d commit 691a00a

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,13 @@ Role Variables
7777
defined with the following dict:
7878
- `pool`: Name or UUID of the storage pool from which the volume should be
7979
allocated.
80+
- `zfs_pool`: Set this option to `True`, if your pool is based on zfs (`pool type="zfs"` in your libvirt host setup). Only works with `disk` type volumes. A fact set by role `stackhpc.libvirt-host` is required.
8081
- `name`: Name to associate with the volume being created; For `file` type volumes include extension if you would like volumes created with one.
8182
- `file_path`: Where the image of `file` type volumes should be placed; defaults to `libvirt_volume_default_images_path`
8283
- `device`: `disk` or `cdrom`
8384
- `capacity`: volume capacity (can be suffixed with M,G,T or MB,GB,TB, etc) (required when type is `disk`)
8485
- `format`: options include `raw`, `qcow2`, `vmdk`. See `man virsh` for the
85-
full range. Default is `qcow2`
86+
full range. Default is `qcow2`.
8687
- `image`: (optional) a URL to an image with which the volume is initalised (full copy).
8788
- `backing_image`: (optional) name of the backing volume which is assumed to already be the same pool (copy-on-write).
8889
- `image` and `backing_image` are mutually exclusive options.

templates/vm.xml.j2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
<driver name='qemu' type='{{ volume.format | default(libvirt_volume_default_format) }}'/>
3636
{% if volume.type | default(libvirt_volume_default_type) == 'file' %}
3737
<source file='{{ volume.file_path |default(libvirt_volume_default_images_path) }}/{{ volume.name}}'/>
38+
{% elif volume.zfs_pool is defined and volume.zfs_pool is sameas true %}
39+
<source dev='/dev/zvol/{{ ansible_local.libvirt.zfs_storage_pools[volume.pool] }}/{{ volume.name }}'/>
3840
{% else %}
3941
<source pool='{{ volume.pool }}' volume='{{ volume.name }}'/>
4042
{% endif %}

vars/Archlinux.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
3+
# Who owns the serial console logs in console_log_path
4+
libvirt_vm_log_owner: root
5+
6+
# The environment passed to virt_volume.sh
7+
libvirt_vm_script_env_arch: []
8+
# VOLUME_GROUP: qemu
9+
# VOLUME_OWNER: qemu
10+
11+
libvirt_vm_script_env: >-
12+
{{ libvirt_vm_script_env_arch | combine(libvirt_vm_virsh_default_env) }}
13+
14+
# Archlinux qemu comes with kvm support compiled in
15+
libvirt_vm_emulator: /usr/bin/qemu-system-x86_64

0 commit comments

Comments
 (0)