dmacvicar / terraform-provider-libvirt

Terraform provider to provision infrastructure with Linux's KVM using libvirt
Apache License 2.0
1.54k stars 457 forks source link

libvirt_volume serial/wwn number #847

Open rgl opened 3 years ago

rgl commented 3 years ago

It would be very useful to have direct support for setting a libvirt_volume serial/wwn number. This would allow us to better find/identify the volume while in the guest OS (e.g in Windows, its as simple as Get-Disk -SerialNumber 123).

From https://libvirt.org/formatdomain.html#hard-drives-floppy-disks-cdroms:

serial if present, this specify serial number of virtual hard drive. For example, it may look like WD-WMAP9A966149. Not supported for scsi-block devices, that is those using disk type 'block' using device 'lun' on bus 'scsi'. Since 0.7.1

wwn if present, this element specifies the WWN (World Wide Name) of a virtual hard disk or CD-ROM drive. It must be composed of 16 hexadecimal digits. Since 0.10.1

Does this make sense?

If so, I can try to make a PR with:

resource "libvirt_volume" "example_boot" {
  serial = "123"
}
dmacvicar commented 3 years ago

I have nothing against adding the attribute, but I don't see obvious where to put it, as this belongs to the disk element in libvirt, not to the volume, and we don't have a disk element.