summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2020-06-15 00:09:58 +0200
committerChristian Pointner <equinox@spreadspace.org>2020-06-15 00:09:58 +0200
commit35cf0966c3a3ab5bd519bf7a0ecc2fb9b4efea9f (patch)
tree2e1f29fdcee85170b1a5d098f1c713f93d4de768
parentnextcloud/etherpad-lite imrpoved zfs property handling (diff)
zfs backed vm volumes: improved property handling
-rw-r--r--inventory/host_vars/ch-hroottest-vm1.yml9
-rw-r--r--inventory/host_vars/ch-hroottest.yml2
-rw-r--r--inventory/host_vars/sk-2019vm.yml2
-rw-r--r--inventory/host_vars/sk-tomnext-nc.yml2
-rw-r--r--inventory/host_vars/sk-tomnext.yml2
-rw-r--r--roles/containerd/tasks/zfs.yml7
-rw-r--r--roles/vm/host/tasks/zfs.yml11
-rw-r--r--roles/vm/install/tasks/main.yml3
8 files changed, 25 insertions, 13 deletions
diff --git a/inventory/host_vars/ch-hroottest-vm1.yml b/inventory/host_vars/ch-hroottest-vm1.yml
index d3276efb..39a2457c 100644
--- a/inventory/host_vars/ch-hroottest-vm1.yml
+++ b/inventory/host_vars/ch-hroottest-vm1.yml
@@ -14,6 +14,15 @@ install:
type: zfs
name: root
size: 20g
+ properties:
+ refreservation: none
+ sdb:
+ type: zfs
+ name: data
+ size: 100g
+ properties:
+ refreservation: none
+ compression: off
interfaces:
- bridge: br-public
name: primary0
diff --git a/inventory/host_vars/ch-hroottest.yml b/inventory/host_vars/ch-hroottest.yml
index 080f5306..c56845fa 100644
--- a/inventory/host_vars/ch-hroottest.yml
+++ b/inventory/host_vars/ch-hroottest.yml
@@ -49,3 +49,5 @@ vm_host:
default:
pool: storage
name: vm
+ properties:
+ compression: lz4
diff --git a/inventory/host_vars/sk-2019vm.yml b/inventory/host_vars/sk-2019vm.yml
index e989e951..503995ee 100644
--- a/inventory/host_vars/sk-2019vm.yml
+++ b/inventory/host_vars/sk-2019vm.yml
@@ -78,3 +78,5 @@ vm_host:
default:
pool: storage
name: vm
+ properties:
+ compression: lz4
diff --git a/inventory/host_vars/sk-tomnext-nc.yml b/inventory/host_vars/sk-tomnext-nc.yml
index 9df47214..48742dd4 100644
--- a/inventory/host_vars/sk-tomnext-nc.yml
+++ b/inventory/host_vars/sk-tomnext-nc.yml
@@ -18,6 +18,8 @@ install:
type: zfs
name: data
size: 800g
+ properties:
+ compression: off
interfaces:
- bridge: br-public
name: primary0
diff --git a/inventory/host_vars/sk-tomnext.yml b/inventory/host_vars/sk-tomnext.yml
index 331126ba..555d2f0a 100644
--- a/inventory/host_vars/sk-tomnext.yml
+++ b/inventory/host_vars/sk-tomnext.yml
@@ -70,3 +70,5 @@ vm_host:
default:
pool: storage
name: vm
+ properties:
+ compression: lz4
diff --git a/roles/containerd/tasks/zfs.yml b/roles/containerd/tasks/zfs.yml
index 2ebcae3c..1abf4d34 100644
--- a/roles/containerd/tasks/zfs.yml
+++ b/roles/containerd/tasks/zfs.yml
@@ -1,16 +1,11 @@
---
## containerd from ubuntu doesn't support zfs directly
## we need to create a volume and an ext4 fs on top of that...
-- name: verify that the zfs volsize property is set
- assert:
- msg: "contained does not support zfs directly - please set the volsize property to make it a volume"
- that: "'volsize' in containerd_zfs.properties"
-
- name: create zfs volume
zfs:
name: "{{ containerd_zfs.pool }}/{{ containerd_zfs.name }}"
state: present
- extra_zfs_properties: "{{ containerd_zfs.properties }}"
+ extra_zfs_properties: "{{ containerd_zfs.properties | default({}) | combine({'volsize': item.value.size}) }}"
- name: create and ext4 filesystem on the zfs volume
filesystem:
diff --git a/roles/vm/host/tasks/zfs.yml b/roles/vm/host/tasks/zfs.yml
index b88ee73e..b84f2d0d 100644
--- a/roles/vm/host/tasks/zfs.yml
+++ b/roles/vm/host/tasks/zfs.yml
@@ -2,14 +2,15 @@
- name: create zfs base datasets
loop: "{{ lookup('dict', vm_host.zfs, wantlist=True) }}"
loop_control:
- label: "{{ item.key }} -> {{ item.value.pool }}/{{ item.value.name }}{% if 'quota' in item.value %}={{ item.value.quota }}{% endif %}"
+ label: "{{ item.key }} -> {{ item.value.pool }}/{{ item.value.name }} ({{ (item.value.properties | default({})).items() | map('join', '=') | join(', ') }})"
+ vars:
+ default_properties:
+ canmount: no
+ mountpoint: none
zfs:
name: "{{ item.value.pool }}/{{ item.value.name }}"
state: present
- extra_zfs_properties:
- quota: "{{ item.value.quota | default(omit) }}"
- canmount: no
- mountpoint: none
+ extra_zfs_properties: "{{ default_properties | combine(item.value.properties | default({})) }}"
- name: configure lvm to ignore zfs volumes
lineinfile:
diff --git a/roles/vm/install/tasks/main.yml b/roles/vm/install/tasks/main.yml
index 13716559..6b8f9ca7 100644
--- a/roles/vm/install/tasks/main.yml
+++ b/roles/vm/install/tasks/main.yml
@@ -25,8 +25,7 @@
zfs:
name: "{{ vm_host_cooked.zfs[item.value.backend | default('default')].pool }}/{{ vm_host_cooked.zfs[item.value.backend | default('default')].name }}/{{ install_hostname }}/{{ item.value.name }}"
state: present
- extra_zfs_properties:
- volsize: "{{ item.value.size }}"
+ extra_zfs_properties: "{{ item.value.properties | default({}) | combine({'volsize': item.value.size}) }}"
- block: