terraform-provider-lxd icon indicating copy to clipboard operation
terraform-provider-lxd copied to clipboard

zfs.block_mode or initial.zfs.block_mode broken?

Open ExpatUK opened this issue 5 months ago • 28 comments

Hi,

I've been trying to implement this for a couple of containers that will be hosting docker swarm services to try and eliminate the IO bottleneck on ZFS, however using this device block:

  device {
    name = "root"
    type = "disk"
    properties = {
      "path"           = "/"
      "pool"           = "local"
      #"size"           = "200GiB"
      "initial.zfs.block_mode" = true
    }
  }

Results in the following errors:

╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to lxd_instance.int-dev-zvol["int-dev-zvol01"], provider "provider[\"registry.terraform.io/terraform-lxd/lxd\"]"
│ produced an unexpected new value: .device: actual set element cty.ObjectVal(map[string]cty.Value{"name":cty.StringVal("root"),
│ "properties":cty.MapVal(map[string]cty.Value{"initial.zfs.block_mode":cty.StringVal("true"), "path":cty.StringVal("/"),
│ "pool":cty.StringVal("local")}), "type":cty.StringVal("disk")}) does not correlate with any element in plan.
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to lxd_instance.int-dev-zvol["int-dev-zvol01"], provider "provider[\"registry.terraform.io/terraform-lxd/lxd\"]"
│ produced an unexpected new value: .device: block set length changed from 1 to 2.
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵

This does appear to create the zvol block devices as desired, however:

rpool/lxd/containers/int-dev-swarm01                                                       946M  2.08T     1.74G  legacy
rpool/lxd/containers/int-dev-swarm02                                                       947M  2.08T     1.74G  legacy
rpool/lxd/containers/int-dev-worker01                                                      947M  2.08T     1.74G  legacy
rpool/lxd/containers/int-dev-zvol01                                                       1.03G  2.08T     1.03G  -
rpool/lxd/virtual-machines/int-dev-lab04.block                                            3.76G  2.08T     4.52G  -

(The 'legacy' ones are normal datasets, and lab04 has a manually created, attached and functional ext4 block device)

Am I omitting something basic? Essentially I just need the provider to create zvol block devices for specific container instances rather than zfs datasets when specified.

If I manually set the pool to use zfs.block_mode this works without issue, without the disk device being specified.

Versions: lxd 5.19 lxd provider 2.3.0 terraform 1.5.3

ExpatUK avatar Sep 19 '24 10:09 ExpatUK