Terraform-provider-libvirt: Unable to create a resized volume when using LVM as storage pool (terraform crashing)

Created on 21 Mar 2019  路  8Comments  路  Source: dmacvicar/terraform-provider-libvirt

System Information

Linux distribution

CentOS 7

Terraform version

v0.11.13

Provider and libvirt versions

Built from master (dmacvicar/terraform-provider-libvirt@46b0ba055a47587a8c0b4b2c76f5e47165b7c6c4) with go get as I wasn't able to find a recent RPM on the OBS server.

Compiled against library: libvirt 4.5.0
Using library: libvirt 4.5.0
Running hypervisor: QEMU 1.5.3
Running against daemon: 4.5.0

Description of Issue/Question

Setup

Scenario: creating a resized LVM volume from a small image.
As image was in qcow2 I had to convert it to raw and store it in default storage pool.
I've got an LVM guest_images_hddvg storage pool.

I've been looking at https://github.com/dmacvicar/terraform-provider-libvirt/issues/358 reported by @mjiao.

provider "libvirt" {
  uri = "qemu:///system"
}

variable "domain_name" {
  type    = "string"
  default = "test_resize"
}

# Create a LV from the raw ubuntu image as creating a LVM from the remote qcow2 fails
# https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img
# qemu-img convert /var/lib/libvirt/images/image-ubuntu-qcow2 /var/lib/libvirt/images/image-ubuntu-raw
resource "libvirt_volume" "base_vol" {
  name = "${var.domain_name}_base_vol"
  pool = "guest_images_hddvg"
  source = "/var/lib/libvirt/images/image-ubuntu-raw"
}

# Create a new resized LV from the base LV
resource "libvirt_volume" "resized_vol" {
  name = "${var.domain_name}_resized_vol"
  pool = "guest_images_hddvg"
  base_volume_id = "${libvirt_volume.base_vol.id}"
  base_volume_pool = "guest_images_hddvg"
  size = 21474836480
}

resource "libvirt_domain" "terraform_test" {
  name = "${var.domain_name}"
  disk {
    volume_id = "${libvirt_volume.resized_vol.id}"
    scsi = "true"
  }

  vcpu = "1"
  memory = "2048"

  network_interface = {
    hostname = "${var.domain_name}"
    network_name = "default"
    wait_for_lease = true
  }

  console {
    type        = "pty"
    target_port = "0"
    target_type = "serial"
  }

  console {
    type        = "pty"
    target_type = "virtio"
    target_port = "1"
  }

Steps to Reproduce Issue

terraform plan
terraform apply

Error: Error applying plan:

1 error(s) occurred:

* libvirt_volume.resized_vol: 1 error(s) occurred:

* libvirt_volume.resized_vol: unexpected EOF

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.
panic: runtime error: invalid memory address or nil pointer dereference
2019-03-20T19:14:16.956+0100 [DEBUG] plugin.terraform-provider-libvirt: [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0xc4bf71]
2019-03-20T19:14:16.956+0100 [DEBUG] plugin.terraform-provider-libvirt:
2019-03-20T19:14:16.956+0100 [DEBUG] plugin.terraform-provider-libvirt: goroutine 114 [running]:
2019-03-20T19:14:16.956+0100 [DEBUG] plugin.terraform-provider-libvirt: github.com/dmacvicar/terraform-provider-libvirt/libvirt.newDefBackingStoreFromLibvirt(0xc000312180, 0xc0002da960, 0x10, 0xe291e0, 0x115d
b10, 0x0, 0xc0003673c8)
2019-03-20T19:14:16.956+0100 [DEBUG] plugin.terraform-provider-libvirt:         /home/baptiste/go/src/github.com/dmacvicar/terraform-provider-libvirt/libvirt/volume_def.go:66 +0x281
2019-03-20T19:14:16.956+0100 [DEBUG] plugin.terraform-provider-libvirt: github.com/dmacvicar/terraform-provider-libvirt/libvirt.resourceLibvirtVolumeCreate(0xc000192a80, 0xdeb800, 0xc000459a90, 0x0, 0x0)
2019-03-20T19:14:16.956+0100 [DEBUG] plugin.terraform-provider-libvirt:         /home/baptiste/go/src/github.com/dmacvicar/terraform-provider-libvirt/libvirt/resource_libvirt_volume.go:200 +0x1631
2019-03-20T19:14:16.956+0100 [DEBUG] plugin.terraform-provider-libvirt: github.com/dmacvicar/terraform-provider-libvirt/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc0000f87e0, 0xc0
0045a050, 0xc0002da880, 0xdeb800, 0xc000459a90, 0x427401, 0xc000367b80, 0x4d839c)
2019-03-20T19:14:16.956+0100 [DEBUG] plugin.terraform-provider-libvirt:         /home/baptiste/go/src/github.com/dmacvicar/terraform-provider-libvirt/vendor/github.com/hashicorp/terraform/helper/schema/resour
ce.go:225 +0x351
2019-03-20T19:14:16.956+0100 [DEBUG] plugin.terraform-provider-libvirt: github.com/dmacvicar/terraform-provider-libvirt/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc0000f9030, 0xc0
0045a000, 0xc00045a050, 0xc0002da880, 0xc0002f2380, 0xc00030ccc0, 0x7f9a2fb49268)
2019-03-20T19:14:16.956+0100 [DEBUG] plugin.terraform-provider-libvirt:         /home/baptiste/go/src/github.com/dmacvicar/terraform-provider-libvirt/vendor/github.com/hashicorp/terraform/helper/schema/provid
er.go:283 +0x9c
2019-03-20T19:14:16.956+0100 [DEBUG] plugin.terraform-provider-libvirt: github.com/dmacvicar/terraform-provider-libvirt/vendor/github.com/hashicorp/terraform/plugin.(*ResourceProviderServer).Apply(0xc0004a3b0
0, 0xc0002da580, 0xc0004720f0, 0x0, 0x0)
2019-03-20T19:14:16.956+0100 [DEBUG] plugin.terraform-provider-libvirt:         /home/baptiste/go/src/github.com/dmacvicar/terraform-provider-libvirt/vendor/github.com/hashicorp/terraform/plugin/resource_prov
ider.go:527 +0x57
2019-03-20T19:14:16.956+0100 [DEBUG] plugin.terraform-provider-libvirt: reflect.Value.call(0xc00030aa80, 0xc000316058, 0x13, 0xfc9f08, 0x4, 0xc000367f18, 0x3, 0x3, 0xc000098040, 0x0, ...)
2019-03-20T19:14:16.956+0100 [DEBUG] plugin.terraform-provider-libvirt:         /usr/lib/golang/src/reflect/value.go:447 +0x454
2019-03-20T19:14:16.956+0100 [DEBUG] plugin.terraform-provider-libvirt: reflect.Value.Call(0xc00030aa80, 0xc000316058, 0x13, 0xc0004c0f18, 0x3, 0x3, 0x0, 0x0, 0x0)
2019-03-20T19:14:16.956+0100 [DEBUG] plugin.terraform-provider-libvirt:         /usr/lib/golang/src/reflect/value.go:308 +0xa4
2019-03-20T19:14:16.956+0100 [DEBUG] plugin.terraform-provider-libvirt: net/rpc.(*service).call(0xc00031e840, 0xc000324230, 0xc0002ce840, 0xc0002ce850, 0xc00031a000, 0xc0002da100, 0xdf0080, 0xc0002da580, 0x16
, 0xdf00c0, ...)
2019-03-20T19:14:16.956+0100 [DEBUG] plugin.terraform-provider-libvirt:         /usr/lib/golang/src/net/rpc/server.go:384 +0x14e
2019-03-20T19:14:16.956+0100 [DEBUG] plugin.terraform-provider-libvirt: created by net/rpc.(*Server).ServeCodec
2019-03-20T19:14:16.957+0100 [DEBUG] plugin.terraform-provider-libvirt:         /usr/lib/golang/src/net/rpc/server.go:481 +0x47e
2019/03/20 19:14:16 [TRACE] root: eval: *terraform.EvalWriteState
2019/03/20 19:14:16 [TRACE] root: eval: *terraform.EvalApplyProvisioners
2019/03/20 19:14:16 [TRACE] root: eval: *terraform.EvalIf
2019/03/20 19:14:16 [TRACE] root: eval: *terraform.EvalWriteState
2019/03/20 19:14:16 [TRACE] root: eval: *terraform.EvalWriteDiff
2019/03/20 19:14:16 [TRACE] root: eval: *terraform.EvalApplyPost
2019/03/20 19:14:16 [ERROR] root: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:

* libvirt_volume.resized_vol: unexpected EOF
2019/03/20 19:14:16 [ERROR] root: eval: *terraform.EvalSequence, err: 1 error(s) occurred:

* libvirt_volume.resized_vol: unexpected EOF
2019/03/20 19:14:16 [TRACE] [walkApply] Exiting eval tree: libvirt_volume.resized_vol
2019/03/20 19:14:16 [TRACE] dag/walk: upstream errored, not walking "libvirt_domain.terraform_test"
2019-03-20T19:14:16.959+0100 [DEBUG] plugin: plugin process exited: path=/home/baptiste/.terraform.d/plugins/terraform-provider-libvirt
2019/03/20 19:14:16 [TRACE] dag/walk: upstream errored, not walking "provider.libvirt (close)"
2019/03/20 19:14:16 [TRACE] dag/walk: upstream errored, not walking "meta.count-boundary (count boundary fixup)"
2019/03/20 19:14:16 [TRACE] dag/walk: upstream errored, not walking "root"
2019/03/20 19:14:16 [TRACE] Preserving existing state lineage "083dbc9b-b3fc-78af-5640-6fa2d7046b43"
2019/03/20 19:14:16 [TRACE] Preserving existing state lineage "083dbc9b-b3fc-78af-5640-6fa2d7046b43"
2019/03/20 19:14:16 [TRACE] Preserving existing state lineage "083dbc9b-b3fc-78af-5640-6fa2d7046b43"
2019/03/20 19:14:16 [DEBUG] plugin: waiting for all plugin processes to complete...
2019-03-20T19:14:16.961+0100 [WARN ] plugin: error closing client during Kill: err="connection is shut down"



!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Terraform crashed! This is always indicative of a bug within Terraform.
A crash log has been placed at "crash.log" relative to your current
working directory. It would be immensely helpful if you could please
report the crash with Terraform[1] so that we can fix this.

When reporting bugs, please include your terraform version. That
information is available on the first line of crash.log. You can also
get it by running 'terraform --version' on the command line.

[1]: https://github.com/hashicorp/terraform/issues

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Additional information:

I'am able to get a resized volume when using the defaut pool storage.

bug need investigation

Most helpful comment

ok thx i will put it in the backlog since I see the community need it.

All 8 comments

@gwarf thx for issue ! :+1: we will need to investiagate on it

@gwarf can you retry with the latest master branch? we did a fix in this direction

Hi @MalloZup,
Thanks for looking at this!
So I've tried to clean and reinstall it but now I've got a weird version report:

~/go/bin/terraform-provider-libvirt -version                                                                                                                                                                                                                                                                                       
/home/baptiste/go/bin/terraform-provider-libvirt was not built correctly
Compiled against library: libvirt 4.5.0
Using library: libvirt 4.5.0
Running hypervisor: QEMU 1.5.3
Running against daemon: 4.5.0

I've installed it on CentOS 7 (go1.11.5) using:

rm -rf ~/go
export CGO_ENABLED="1"
go get github.com/dmacvicar/terraform-provider-libvirt
export GO111MODULE=on
export GOFLAGS=-mod=vendor
cd ~/go/src/github.com/dmacvicar/terraform-provider-libvirt
make

I tried to run a deployment with a resize and I'm still getting unexpected EOF and SIGSEV:

Error: Error applying plan:

1 error(s) occurred:

* libvirt_volume.base_vol_resized: 1 error(s) occurred:

* libvirt_volume.base_vol_resized: unexpected EOF

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.


panic: runtime error: invalid memory address or nil pointer dereference
2019-04-04T10:40:24.382+0200 [DEBUG] plugin.terraform-provider-libvirt: [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0xc4ab31]
2019-04-04T10:40:24.382+0200 [DEBUG] plugin.terraform-provider-libvirt:
2019-04-04T10:40:24.382+0200 [DEBUG] plugin.terraform-provider-libvirt: goroutine 102 [running]:
2019-04-04T10:40:24.382+0200 [DEBUG] plugin.terraform-provider-libvirt: github.com/dmacvicar/terraform-provider-libvirt/libvirt.newDefBackingStoreFromLibvirt(0xc00031e330, 0xc00044ee20, 0x26, 0xc00031e330, 0x0, 0x0, 0xc0000853e8)
2019-04-04T10:40:24.382+0200 [DEBUG] plugin.terraform-provider-libvirt:         /home/baptiste/go/src/github.com/dmacvicar/terraform-provider-libvirt/libvirt/volume_def.go:66 +0x281
2019-04-04T10:40:24.382+0200 [DEBUG] plugin.terraform-provider-libvirt: github.com/dmacvicar/terraform-provider-libvirt/libvirt.resourceLibvirtVolumeCreate(0xc000196540, 0xdec500, 0xc00047d250, 0x0, 0x0)
2019-04-04T10:40:24.382+0200 [DEBUG] plugin.terraform-provider-libvirt:         /home/baptiste/go/src/github.com/dmacvicar/terraform-provider-libvirt/libvirt/resource_libvirt_volume.go:202 +0x17b0
2019-04-04T10:40:24.382+0200 [DEBUG] plugin.terraform-provider-libvirt: github.com/dmacvicar/terraform-provider-libvirt/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc0001845b0, 0xc0004d45a0, 0xc00044ed40, 0xdec500, 0xc00047d250, 0x427401, 0xc000085b80, 0x4d839c)
2019-04-04T10:40:24.382+0200 [DEBUG] plugin.terraform-provider-libvirt:         /home/baptiste/go/src/github.com/dmacvicar/terraform-provider-libvirt/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:225 +0x351
2019-04-04T10:40:24.382+0200 [DEBUG] plugin.terraform-provider-libvirt: github.com/dmacvicar/terraform-provider-libvirt/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc000184d90, 0xc0004d4550, 0xc0004d45a0, 0xc00044ed40, 0xc0000a8000, 0xc000085b78, 0x7f641d1066c0)
2019-04-04T10:40:24.382+0200 [DEBUG] plugin.terraform-provider-libvirt:         /home/baptiste/go/src/github.com/dmacvicar/terraform-provider-libvirt/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:283 +0x9c
2019-04-04T10:40:24.382+0200 [DEBUG] plugin.terraform-provider-libvirt: github.com/dmacvicar/terraform-provider-libvirt/vendor/github.com/hashicorp/terraform/plugin.(*ResourceProviderServer).Apply(0xc00030e040, 0xc00044ece0, 0xc0003c0020, 0x0, 0x0)
2019-04-04T10:40:24.382+0200 [DEBUG] plugin.terraform-provider-libvirt:         /home/baptiste/go/src/github.com/dmacvicar/terraform-provider-libvirt/vendor/github.com/hashicorp/terraform/plugin/resource_provider.go:527 +0x57
2019-04-04T10:40:24.382+0200 [DEBUG] plugin.terraform-provider-libvirt: reflect.Value.call(0xc00030a4e0, 0xc0003dd310, 0x13, 0xfcace8, 0x4, 0xc000085f18, 0x3, 0x3, 0xc0002272c0, 0x42ee67, ...)
2019-04-04T10:40:24.382+0200 [DEBUG] plugin.terraform-provider-libvirt:         /usr/lib/golang/src/reflect/value.go:447 +0x454
2019-04-04T10:40:24.382+0200 [DEBUG] plugin.terraform-provider-libvirt: reflect.Value.Call(0xc00030a4e0, 0xc0003dd310, 0x13, 0xc0003e1f18, 0x3, 0x3, 0x12a05f200, 0xc0003e1f10, 0xc0003e1fb8)
2019-04-04T10:40:24.382+0200 [DEBUG] plugin.terraform-provider-libvirt:         /usr/lib/golang/src/reflect/value.go:308 +0xa4
2019-04-04T10:40:24.382+0200 [DEBUG] plugin.terraform-provider-libvirt: net/rpc.(*service).call(0xc000309340, 0xc0000ca690, 0xc0002ce798, 0xc0002ce7b0, 0xc0003d4080, 0xc0003c9280, 0xdf0d80, 0xc00044ece0, 0x16, 0xdf0dc0, ...)
2019-04-04T10:40:24.382+0200 [DEBUG] plugin.terraform-provider-libvirt:         /usr/lib/golang/src/net/rpc/server.go:384 +0x14e
2019-04-04T10:40:24.382+0200 [DEBUG] plugin.terraform-provider-libvirt: created by net/rpc.(*Server).ServeCodec
2019-04-04T10:40:24.382+0200 [DEBUG] plugin.terraform-provider-libvirt:         /usr/lib/golang/src/net/rpc/server.go:481 +0x47e
2019/04/04 10:40:24 [TRACE] root: eval: *terraform.EvalWriteState
2019-04-04T10:40:24.386+0200 [DEBUG] plugin: plugin process exited: path=/home/baptiste/.terraform.d/plugins/terraform-provider-libvirt
2019/04/04 10:40:24 [TRACE] root: eval: *terraform.EvalApplyProvisioners
2019/04/04 10:40:24 [TRACE] root: eval: *terraform.EvalIf
2019/04/04 10:40:24 [TRACE] root: eval: *terraform.EvalWriteState
2019/04/04 10:40:24 [TRACE] root: eval: *terraform.EvalWriteDiff
2019/04/04 10:40:24 [TRACE] root: eval: *terraform.EvalApplyPost
2019/04/04 10:40:24 [ERROR] root: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:

* libvirt_volume.base_vol_resized: unexpected EOF
2019/04/04 10:40:24 [ERROR] root: eval: *terraform.EvalSequence, err: 1 error(s) occurred:

* libvirt_volume.base_vol_resized: unexpected EOF
2019/04/04 10:40:24 [TRACE] [walkApply] Exiting eval tree: libvirt_volume.base_vol_resized
2019/04/04 10:40:24 [TRACE] dag/walk: upstream errored, not walking "libvirt_domain.terraform_test"
2019/04/04 10:40:24 [TRACE] dag/walk: upstream errored, not walking "meta.count-boundary (count boundary fixup)"
2019/04/04 10:40:24 [TRACE] dag/walk: upstream errored, not walking "provider.libvirt (close)"
2019/04/04 10:40:24 [TRACE] dag/walk: upstream errored, not walking "root"
2019/04/04 10:40:24 [TRACE] Preserving existing state lineage "9fba15a8-985f-9514-3b38-4dbf7e0dc466"
2019/04/04 10:40:24 [TRACE] Preserving existing state lineage "9fba15a8-985f-9514-3b38-4dbf7e0dc466"
2019/04/04 10:40:24 [TRACE] Preserving existing state lineage "9fba15a8-985f-9514-3b38-4dbf7e0dc466"
2019/04/04 10:40:24 [DEBUG] plugin: waiting for all plugin processes to complete...
2019-04-04T10:40:24.389+0200 [WARN ] plugin: error closing client during Kill: err="connection is shut down"
2019-04-04T10:40:24.390+0200 [DEBUG] plugin.terraform-provider-template_v2.1.0_x4: 2019/04/04 10:40:24 [ERR] plugin: plugin server: accept unix /tmp/plugin454517233: use of closed network connection
2019-04-04T10:40:24.392+0200 [DEBUG] plugin: plugin process exited: path=/home/baptiste/repos/Ops-Hacks/Deployment/Ops-server/Terraform/resize_ubuntu_lvm/.terraform/plugins/linux_amd64/terraform-provider-template_v2.1.0_x4



!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Terraform crashed! This is always indicative of a bug within Terraform.
A crash log has been placed at "crash.log" relative to your current
working directory. It would be immensely helpful if you could please
report the crash with Terraform[1] so that we can fix this.

When reporting bugs, please include your terraform version. That
information is available on the first line of crash.log. You can also
get it by running 'terraform --version' on the command line.

[1]: https://github.com/hashicorp/terraform/issues

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

@gwarf thx for reply.

OK i suspect that we don't recognize the type. in src code

Could you give me a step by step guide for how-to-reproduce? i'm not familiar with lvm but i can learn :) thx for your help :cupid:

E.g:

give more context here :

```
Setup

Scenario: creating a resized LVM volume from a small image.
As image was in qcow2 I had to convert it to raw and store it in default storage pool.
I've got an LVM guest_images_hddvg storage pool.```

OK, so for LVM this CentOS7 LVM tutorial may provide some guidance/support if needed.
LVM resizing is documented in this RedHat documentation about LVM and lvextend

My setup is the following:

  • a Volume Group named hddvg (running on a Physical Volume that is a single partition /dev/sdb1)
  • a guest_images_hddvg storage pool form that Volume Group (you can check redhat documentation for some info on how to manage it using virt-manager or this doc that I used about managing LVM storage pool with virsh
  • a default directory storage pool in /var/lib/libvirt/images to contain OS images

So you should have a LVM physical volume, a LVM volume group and a storage pool, using something like this:

# Create a partition for LVM
sudo gdisk /dev/sdb
sudo gdisk -l /dev/sdb
# Create a LVM physical volume with the disk partition
sudo pvcreate /dev/sdb1
sudo pvdisplay
sudo pvs
# No existing Volume Groups yet
sudo vgdisplay
sudo vgs
# Create storage pool using a volume group
sudo virsh pool-define-as guest_images_hddvg logical - - /dev/sdb1 hddvg /dev/hddvg
sudo vgcreate hddvg /dev/sdb1
sudo virsh pool-start guest_images_hddvg
sudo virsh pool-autostart guest_images_hddvg
# Check what we have
sudo virsh pool-list --all
sudo virsh pool-info guest_images_hddvg
sudo vgdisplay
sudo vgs

Then you can create volumes in the storage pool:

# Create a volume
sudo virsh vol-create-as guest_images_hddvg volume_hdd_1 8G
# Check volumes
sudo virsh vol-list guest_images_hddvg
sudo lvdisplay
sudo lvscan
sudo lvs
# Clean volume
sudo virsh vol-delete volume_hdd_1 guest_images_hddvg

As I'm not able to create a volume from a qcow2 (it wants to know the image size), I had to convert an image to raw:

cd /var/lib/libvirt/images
wget https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2
qemu-img convert -f qcow2 -O raw CentOS-7-x86_64-GenericCloud.qcow2 CentOS-7-x86_64-GenericCloud.raw

And with this I'm able to use the raw image from the default pool to create volume on the guest_images_hddvg pool. The VMs work as expected.

resource "libvirt_volume" "volume-root-deploy" {
  name = "root-deploy"
  pool = "guest_images_hddvg"
  source = "/var/lib/libvirt/images/CentOS-7-x86_64-GenericCloud.raw"
}

And to break everything I try to do this:

resource "libvirt_volume" "base_vol" {
  name = "lvm-centos"
  pool = "guest_images_hddvg"
  source = "/var/lib/libvirt/images/CentOS-7-x86_64-GenericCloud.raw"
}

resource "libvirt_volume" "base_vol_resized" {
  name = "lvm-centos-resized"
  base_volume_id = "${libvirt_volume.base_vol.id}"
  pool = "guest_images_hddvg"
  # Size in bytes (20 GB)
  size = 21474836480
}

Let me know if something is missing/unclear.
Thanks!

Just as a quick note: This also happens on Debian 9 & 10!

Is there any update on this?
As far as I understood libvirt/volume_def.go:66 crashes trying to access baseVolumeDef.Target.Format.Type because Format is nil.
According to libvirt documentation, lvm volumes does not use format type element.

This is my example volume the plugin fails to use as base volume

<volume type='block'>
  <name>debian-buster-201908131525-amd64</name>
  <key>Ms9YcN-LWqh-MSOb-uiJQ-HQaq-ueTU-3Cbjir</key>
  <source>
    <device path='/dev/sda3'>
      <extent start='129922760704' end='132070244352'/>
    </device>
  </source>
  <capacity unit='bytes'>2147483648</capacity>
  <allocation unit='bytes'>2147483648</allocation>
  <physical unit='bytes'>2147483648</physical>
  <target>
    <path>/dev/kvm-vg/debian-buster-201908131525-amd64</path>
    <permissions>
      <mode>0660</mode>
      <owner>0</owner>
      <group>6</group>
    </permissions>
    <timestamps>
      <atime>1565770634.242217437</atime>
      <mtime>1565770634.242217437</mtime>
      <ctime>1565770634.242217437</ctime>
    </timestamps>
  </target>
</volume>

This is an example of valid lvm snapshot

<volume type='block'>
  <name>debian-buster-201908131525-amd64-s</name>
  <key>L2gseq-g9L6-1GE4-OoZj-0NDY-BrbI-GT2lqY</key>
  <source>
    <device path='/dev/sda3'>
      <extent start='146028888064' end='148188954624'/>
    </device>
  </source>
  <capacity unit='bytes'>2147483648</capacity>
  <allocation unit='bytes'>2160066560</allocation>
  <physical unit='bytes'>2147483648</physical>
  <target>
    <path>/dev/kvm-vg/debian-buster-201908131525-amd64-s</path>
    <permissions>
      <mode>0660</mode>
      <owner>0</owner>
      <group>6</group>
    </permissions>
    <timestamps>
      <atime>1565786914.351383181</atime>
      <mtime>1565786914.351383181</mtime>
      <ctime>1565786914.351383181</ctime>
    </timestamps>
  </target>
  <backingStore>
    <path>/dev/kvm-vg/debian-buster-201908131525-amd64</path>
    <permissions>
      <mode>0660</mode>
      <owner>0</owner>
      <group>6</group>
    </permissions>
    <timestamps>
      <atime>1565786914.319383462</atime>
      <mtime>1565786914.319383462</mtime>
      <ctime>1565786914.319383462</ctime>
    </timestamps>
  </backingStore>
</volume>

ok thx i will put it in the backlog since I see the community need it.

Was this page helpful?
0 / 5 - 0 ratings