From 691a00a460a5c8279af33bfceec2d716d95121cf Mon Sep 17 00:00:00 2001 From: Marat Bakeev Date: Sat, 28 Dec 2019 15:16:17 +1300 Subject: [PATCH 1/8] Archlinux support, libvirt zfs pool support --- README.md | 3 ++- templates/vm.xml.j2 | 2 ++ vars/Archlinux.yml | 15 +++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 vars/Archlinux.yml diff --git a/README.md b/README.md index cdc0764..19c5c38 100644 --- a/README.md +++ b/README.md @@ -77,12 +77,13 @@ Role Variables defined with the following dict: - `pool`: Name or UUID of the storage pool from which the volume should be allocated. + - `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. - `name`: Name to associate with the volume being created; For `file` type volumes include extension if you would like volumes created with one. - `file_path`: Where the image of `file` type volumes should be placed; defaults to `libvirt_volume_default_images_path` - `device`: `disk` or `cdrom` - `capacity`: volume capacity (can be suffixed with M,G,T or MB,GB,TB, etc) (required when type is `disk`) - `format`: options include `raw`, `qcow2`, `vmdk`. See `man virsh` for the - full range. Default is `qcow2` + full range. Default is `qcow2`. - `image`: (optional) a URL to an image with which the volume is initalised (full copy). - `backing_image`: (optional) name of the backing volume which is assumed to already be the same pool (copy-on-write). - `image` and `backing_image` are mutually exclusive options. diff --git a/templates/vm.xml.j2 b/templates/vm.xml.j2 index 05a99dd..80e11b0 100644 --- a/templates/vm.xml.j2 +++ b/templates/vm.xml.j2 @@ -35,6 +35,8 @@ {% if volume.type | default(libvirt_volume_default_type) == 'file' %} + {% elif volume.zfs_pool is defined and volume.zfs_pool is sameas true %} + {% else %} {% endif %} diff --git a/vars/Archlinux.yml b/vars/Archlinux.yml new file mode 100644 index 0000000..a801265 --- /dev/null +++ b/vars/Archlinux.yml @@ -0,0 +1,15 @@ +--- + +# Who owns the serial console logs in console_log_path +libvirt_vm_log_owner: root + +# The environment passed to virt_volume.sh +libvirt_vm_script_env_arch: [] +# VOLUME_GROUP: qemu +# VOLUME_OWNER: qemu + +libvirt_vm_script_env: >- + {{ libvirt_vm_script_env_arch | combine(libvirt_vm_virsh_default_env) }} + +# Archlinux qemu comes with kvm support compiled in +libvirt_vm_emulator: /usr/bin/qemu-system-x86_64 From 9ac1563e780712aa1ba7a9275e729a597ebc5fc9 Mon Sep 17 00:00:00 2001 From: Marat Bakeev Date: Sat, 28 Dec 2019 15:22:35 +1300 Subject: [PATCH 2/8] forgotten meta --- meta/main.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/meta/main.yml b/meta/main.yml index c7b18f3..42a4d8d 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -17,6 +17,9 @@ galaxy_info: - name: Debian versions: - all + - name: ArchLinux + versions: + - all galaxy_tags: - cloud - kvm From 38d903607ea74e65031a543eee0e0fc78309b84c Mon Sep 17 00:00:00 2001 From: Marat Bakeev Date: Sat, 28 Dec 2019 15:54:40 +1300 Subject: [PATCH 3/8] cdrom type devices cannot use 'virtio' bus --- templates/vm.xml.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/vm.xml.j2 b/templates/vm.xml.j2 index 80e11b0..b33bb18 100644 --- a/templates/vm.xml.j2 +++ b/templates/vm.xml.j2 @@ -41,9 +41,9 @@ {% endif %} {% if volume.target is undefined %} - + {% else %} - + {% endif %} {% endfor %} From a877746191b67686c5ccff7b6c1f875cb168a611 Mon Sep 17 00:00:00 2001 From: Marat Bakeev Date: Sun, 29 Dec 2019 02:02:21 +1300 Subject: [PATCH 4/8] Syntax fix --- templates/vm.xml.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/vm.xml.j2 b/templates/vm.xml.j2 index b33bb18..494ca3f 100644 --- a/templates/vm.xml.j2 +++ b/templates/vm.xml.j2 @@ -41,9 +41,9 @@ {% endif %} {% if volume.target is undefined %} - + {% else %} - + {% endif %} {% endfor %} From 617e07bafa4232a2d9a1f722d2afb3f858b3e3b7 Mon Sep 17 00:00:00 2001 From: Marat Bakeev Date: Sun, 29 Dec 2019 02:42:59 +1300 Subject: [PATCH 5/8] typo --- templates/vm.xml.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/vm.xml.j2 b/templates/vm.xml.j2 index 494ca3f..e2249db 100644 --- a/templates/vm.xml.j2 +++ b/templates/vm.xml.j2 @@ -41,7 +41,7 @@ {% endif %} {% if volume.target is undefined %} - + {% else %} {% endif %} From 59c13b78e9f1b1491e43219e72c193ce89b3d715 Mon Sep 17 00:00:00 2001 From: Marat Bakeev Date: Sun, 19 Jan 2020 20:04:04 +1300 Subject: [PATCH 6/8] Update to use standard libvirt pools --- templates/vm.xml.j2 | 4 +--- vars/Archlinux.yml | 5 +---- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/templates/vm.xml.j2 b/templates/vm.xml.j2 index e2249db..66a838c 100644 --- a/templates/vm.xml.j2 +++ b/templates/vm.xml.j2 @@ -35,13 +35,11 @@ {% if volume.type | default(libvirt_volume_default_type) == 'file' %} - {% elif volume.zfs_pool is defined and volume.zfs_pool is sameas true %} - {% else %} {% endif %} {% if volume.target is undefined %} - + {% else %} {% endif %} diff --git a/vars/Archlinux.yml b/vars/Archlinux.yml index a801265..c4e07ba 100644 --- a/vars/Archlinux.yml +++ b/vars/Archlinux.yml @@ -1,12 +1,9 @@ --- - # Who owns the serial console logs in console_log_path libvirt_vm_log_owner: root # The environment passed to virt_volume.sh -libvirt_vm_script_env_arch: [] -# VOLUME_GROUP: qemu -# VOLUME_OWNER: qemu +libvirt_vm_script_env_arch: {} libvirt_vm_script_env: >- {{ libvirt_vm_script_env_arch | combine(libvirt_vm_virsh_default_env) }} From c91fc832e56930162cd125580cef68a5bf1882dd Mon Sep 17 00:00:00 2001 From: Marat Bakeev Date: Thu, 23 Jan 2020 18:09:32 +1300 Subject: [PATCH 7/8] Update README.md remove unneded fact --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 19c5c38..9f778b8 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,6 @@ Role Variables defined with the following dict: - `pool`: Name or UUID of the storage pool from which the volume should be allocated. - - `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. - `name`: Name to associate with the volume being created; For `file` type volumes include extension if you would like volumes created with one. - `file_path`: Where the image of `file` type volumes should be placed; defaults to `libvirt_volume_default_images_path` - `device`: `disk` or `cdrom` From 2c803f16b8cb1de0578313a43d2853168c9dc16d Mon Sep 17 00:00:00 2001 From: Marat Bakeev Date: Fri, 24 Jan 2020 01:35:44 +1300 Subject: [PATCH 8/8] Define only 'sata' bus explicitly --- templates/vm.xml.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/vm.xml.j2 b/templates/vm.xml.j2 index 66a838c..ff0d8a6 100644 --- a/templates/vm.xml.j2 +++ b/templates/vm.xml.j2 @@ -39,7 +39,7 @@ {% endif %} {% if volume.target is undefined %} - + {% else %} {% endif %}