Open sachittiwari opened 3 years ago
This is a RHEL 8.2 VM that we are trying to clone.
Hi @sachittiwari, do you continue to have the same issue with the latest version of the provider - v2.0.2? You mentioned v1.12 was in use.
Ryan
@tenthirtyam I'm testing on the latest version. If you specify a disk w/ its unit_number
set to 16, 17, or 18, then you get the error saying that unit number of SCSI bus 1 is in use.
EDIT
This is the disk layout I'm trying to replicate to a new VM:
While there is a controller_type
parameter I don't see any option to set a disk to be on a certain SCSI controller. I'm guessing you are creating 4 SCSI controllers but no disks are being assigned to that second one, maybe that's where the error for SCSI bus 1 is. I'd be curious if you had 4 disks and set controller_type = "scsi"
for each if they would be 0:0 through 0:4 or if they would be 0:0 through 4:0 and just be the first and only disk on each SCSI channel. You say in your Steps to Reproduce that you're putting disks on those SCSI controllers but nowhere in the code is that mapping specified.
This is my terraform file's disk section:
which successfully cloned and created this disk layout:
It's not exactly a matching layout to the VM template.
unit_number
should make it disk 7This is still a problem, the disks despite being in the correct order in the Terraform configuration, get randomly assigned if they go to the same controller.
For example:
disk0 > 0:0 > Hard Disk 1 disk1 > 1:0 > Hard Disk 5 (swapped with Hard Disk 2 because they both go onto the same controller) disk2 > 2:0 > Hard Disk 3 disk3 > 3:0 > Hard disk 4 disk4 > 1:1 > Hard Disk 2
Terraform Version
Terraform 0.13.5 and Terraform 1.0.7
vSphere Provider Version
1.12
Affected Resource(s)
vsphere_virtual_machine
Terraform Configuration Files
Debug Output
https://gist.github.com/sachittiwari/a1142ddfd4a3d03034f9ca14f857c023
Panic Output
Expected Behavior
A new VM must have been created.
Actual Behavior
Error: error reconfiguring virtual machine: error processing disk changes post-clone: disk.2: cannot assign disk: unit number 1 on SCSI bus 1 is in use │ │ with vsphere_virtual_machine.vm, │ on main.tf line 49, in resource "vsphere_virtual_machine" "vm": │ 49: resource "vsphere_virtual_machine" "vm" {
Steps to Reproduce
Create a vSphere template with 4 SCSi Controllers and 13 disks. Disks are: 0:0, 1:0,1:1, 1:2, 1:3 , 2:0, 2:1, 2:2, 2:3, 3:0, 3:1 ,3:2, 3:3 terraform apply
Important Factoids
When I try to clone a VM from the vSphere GUI using the customization spec Linux file, it works. Same thing when trying to reproduce through terraform doesn't work. The template has 13 disks in it.
This issue related to disk sorting and seems to be fixed already but still getting the same error. Please check debug output, sorting does not seem to be working.
References
https://github.com/hashicorp/terraform-provider-vsphere/issues/997
0000
Community Note