Skip to content

Creating a volume in a pool of type zfs requires the format to be specified #1199

@lod

Description

@lod

Using 0.9

Defining a volume that sits on a ZFS pool I get an error during the apply process.

resource "libvirt_volume" "worker_node" {
  name           = "worker_node_${count.index}"
  pool           = "zfs"  # defined manually
  capacity           = 8 * 1024 * 1024 * 1024  # 8G, 4G is too small for talos
  count = 1
}
│ Error: Provider returned invalid result object after apply
│
│ After the apply operation, the provider still indicated an unknown value for
│ libvirt_volume.control_node[0].format. All values must be known after apply, so this is always a bug in
│ the provider and should be reported in the provider's own repository. OpenTofu will still save the
│ other known object values in the state.
$ virsh pool-dumpxml zfs
<pool type='zfs'>
  <name>zfs</name>
  <uuid>0e7ba73b-a220-405e-9bd1-e3659be13ee3</uuid>
  <capacity unit='bytes'>8985071583232</capacity>
  <allocation unit='bytes'>6428156966912</allocation>
  <available unit='bytes'>2556914616320</available>
  <source>
    <name>tank</name>
  </source>
  <target>
    <path>/dev/zvol/tank</path>
  </target>
</pool>

The volume is created, I can see it in vol-list.

Setting the format explicitly to qcow2 works as expected.

This is a step forward from 0.8 where there were errors during the creation process and the only workaround I found was to use a different pool.

libvirt_pool does document that it supports limited pool types, not including zfs. However a manually defined pool should be expected to be usable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions