zfs list
zfs create ${POOL_NAME}/${MOUNT_POINT}
zpool status
ls -lsah /dev/disk/by-id/
zpool replace ${POOL_NAME} ${OLD_DISK_ID} ${NEW_DISK_ID}
zpool attach ${POOL_NAME} ${EXISTING_DISK_ID} ${NEW_DISK_ID}
zpool add ${POOL_NAME} [${NEW_DISK_ID}, ...]
First make sure autoexpand is set to on
zpool set autoexpand=on ${POOL_NAME}
Propagate changes to drives. Run the script for every drive of the pool
zpool online -e ${POOL_NAME} ${DRIVE_ID}
zpool add ${POOL_NAME} cache ${DRIVE_ID}
zfs set atime=off ${POOL_NAME}
qm create 5000 --memory 4096 --core 2 --name ubuntu-cloud --net0 virtio,bridge=vmbr0
cd /var/lib/vz/template/iso/
qm importdisk 5000 ${UBUNTU_VERSION}-server-cloudimg-amd64-disk-kvm.img ${STORAGE:-local-zfs}
qm set 5000 --scsihw virtio-scsi-pci --scsi0 ${STORAGE:-local-zfs}:vm-5000-disk-0
qm set 5000 --ide2 ${STORAGE:-local-zfs}:cloudinit
qm set 5000 --boot c --bootdisk scsi0
qm set 5000 --serial0 socket --vga serial0
Then change cpu stuff, disable memory balooning, set cloud init credentials and finally create template