Hello, I've hit a problem described by @enool here:
There is actually a flaw in the cloudinit update operation too. The device target needs to be the same as it was when the domain update is applied. I'll have a look.
I have a bunch of production VMs created with terraform-provider-libvirt version before 0.5.2, after upgrading to 0.5.2 (actually, to master with 0.12 support) I've got lots of messages like this
Error: Error while changing the cloudinit volume: virError(Code=8, Domain=10, Message='invalid argument: target hdd doesn't exist.')
on ../modules/libvirt/generic-vm/main.tf line 97, in resource "libvirt_domain" "generic-vm":
97: resource "libvirt_domain" "generic-vm" {
I haven't found a quick and accurate solution for this, so, as a workaround, I've built my own terraform-provider-libvirt version changing hdd to hda in domain.go, but the issue has to be fixed before 0.6.0 release, FYI @MalloZup
_Originally posted by @thundertaker in https://github.com/dmacvicar/terraform-provider-libvirt/pull/563#issuecomment-509626533_
this issue need to be investigated
@enool cc
I'll take a look
It's an incompatibility between 0.5.1 and 0.5.2
To reproduce,
Cloud init resource is recreated (destroy and then create replacement)
-/+ libvirt_cloudinit_disk.commoninit (new resource required)
id: "/pool/commoninit.iso;5d24e269-9825-5341-a716-5884d2dfcad7" => <computed> (forces new resource)
Domain is not (update in-place)
~ libvirt_domain.domain-ubuntu
cloudinit: "/pool/commoninit.iso;5d24e269-9825-5341-a716-5884d2dfcad7" => "${libvirt_cloudinit_disk.commoninit.id}"
graphics.0.listen_address: "" => "127.0.0.1"
The upgrade goes smoothly if domain gets recreated on apply
Workaround for a running domain with "virsh edit"
VISUAL="sed -i \"s@target dev='hda'@target dev='hdd'@\" " virsh edit domain
To be clear, if users are upgrading from 0.5.2->0.6.0, this would not be an issue for them.
@enool many thx for your info and research. :clap:
IMHO I dunno personally if we should create some upgrade doc/info.. I mean if it will gone then.. what do you think? Maybe we could add something in the release notes of 6.0 for this. (this sound to me the only usefull doc which we don't need to remove after)
A mention in release notes sounds good.
done thx
VISUAL="sed -i \"s@target dev='hda'@target dev='hdd'@\" " virsh edit domain doesn't work without the VM reboot, this is not acceptible in our case