Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtual machine is rebooted when a new SCSI Controller is added to the machine #2224

Open
4 tasks done
edwin-bruurs opened this issue Jun 20, 2024 · 1 comment
Open
4 tasks done
Labels
bug Type: Bug needs-triage Status: Issue Needs Triage

Comments

@edwin-bruurs
Copy link

Community Guidelines

  • I have read and agree to the HashiCorp Community Guidelines .
  • Vote on this issue by adding a 👍 reaction to the original issue initial description to help the maintainers prioritize.
  • Do not leave "+1" or other comments that do not add relevant information or questions.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Terraform

1.8.4

Terraform Provider

2.8.1, 2.7.0, 2.6.1

VMware vSphere

8.0.1

Description

If the scsi_controller_count is updated a virtual machine receives a reboot. This only happens if scsi_controller_count > the actual scsi controllers on the virtual machine.

Some test cases we performed on an existing virtual machine with two disks, both on the first scsi controller. (unit number 0,1 and scsi_controller_count 1)

  • Add new disk on unit number 15, the following plan is applied
      ~ resource "vsphere_virtual_machine" "virtual_machine" {
          id                                      = "42300f4a-a93e-f22f-e1d7-48e9522eea83"
          name                                    = "..."
        ~ scsi_controller_count                   = 1 -> 2
         
          # (71 unchanged attributes hidden)
    
        + disk {
            + attach           = false
            + controller_type  = "scsi"
            + datastore_id     = "<computed>"
            + disk_mode        = "persistent"
            + disk_sharing     = "sharingNone"
            + eagerly_scrub    = false
            + io_limit         = -1
            + io_reservation   = 0
            + io_share_count   = 0
            + io_share_level   = "normal"
            + keep_on_remove   = false
            + key              = 0
            + label            = "data0"
            + size             = 200
            + thin_provisioned = true
            + unit_number      = 15
            + write_through    = false
          }
    
    This reboots the virtual machine.
  • Removing previously added disk, apply and add it again produces the same plan, but doesn't reboot the machine. Main difference is, is that the actual scsi controller on the virtual machine is not removed.
  • Removing previously added disk, remove the scsi controller in vSphere manually, and adding the disk again, produces again the same plan as above. But now the virtual machine is rebooted again.
  • Adding an additional disk to an existing scsi controller no reboot is done.

Affected Resources or Data Sources

resource/vsphere_virtual_machine

Terraform Configuration

resource "vsphere_virtual_machine" "virtual_machine" {
  
  # Make a new list of all the scsi_controller_id numbers, to retrieve the biggest number.
  # Increment by 1 to have always at least one scsi controller.
  scsi_controller_count = var.scsi_controller_count
  
  disk {
      label       = "label0"
      size        = 200
      unit_number = 1
  }


}

Debug Output

[INFO]  Starting apply for module.module.virtual_machines["..."].module.vsphere_virtual_machine.vsphere_virtual_machine.virtual_machine
[DEBUG] module.module.virtual_machines["..."].module.vsphere_virtual_machine.vsphere_virtual_machine.virtual_machine: applying the planned Update change
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] vsphere_virtual_machine (ID = 42300f4a-a93e-f22f-e1d7-48e9522eea83): Performing update: timestamp="2024-06-20T11:07:35.070+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] tagsClientIfDefined: Loading tagging client: timestamp="2024-06-20T11:07:35.070+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] Locating virtual machine with UUID "42300f4a-a93e-f22f-e1d7-48e9522eea83": timestamp="2024-06-20T11:07:35.070+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] Using SearchIndex to look up UUID "42300f4a-a93e-f22f-e1d7-48e9522eea83": timestamp="2024-06-20T11:07:35.070+0200"
[INFO]  provider.terraform-provider-github_v6.2.2:  [INFO] Setting write_delay_ms to 1000: timestamp="2024-06-20T11:07:35.092+0200"
[INFO]  provider.terraform-provider-github_v6.2.2:  [DEBUG] Setting read_delay_ms to 0: timestamp="2024-06-20T11:07:35.092+0200"
[INFO]  provider.terraform-provider-github_v6.2.2:  [DEBUG] Setting retry_delay_ms to 0: timestamp="2024-06-20T11:07:35.092+0200"
[INFO]  provider.terraform-provider-github_v6.2.2:  [DEBUG] Setting max_retries to 3: timestamp="2024-06-20T11:07:35.092+0200"
[INFO]  provider.terraform-provider-github_v6.2.2:  [DEBUG] Setting retriableErrors to map[500:true 502:true 503:true 504:true]: timestamp="2024-06-20T11:07:35.092+0200"
[INFO]  provider.terraform-provider-github_v6.2.2:  [DEBUG] Setting parallel_requests to false: timestamp="2024-06-20T11:07:35.092+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] VM "/.../vm/.../.../.............." found for UUID "42300f4a-a93e-f22f-e1d7-48e9522eea83": timestamp="2024-06-20T11:07:35.102+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] Processing tags for object "vm-215626": timestamp="2024-06-20T11:07:35.102+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] Fetching properties for VM "/.../vm/.../.../..............": timestamp="2024-06-20T11:07:35.102+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] vsphere_virtual_machine (ID = 42300f4a-a93e-f22f-e1d7-48e9522eea83): Expanding old config. Ignore reboot_required messages: timestamp="2024-06-20T11:07:35.169+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] vsphere_virtual_machine (ID = 42300f4a-a93e-f22f-e1d7-48e9522eea83): Building config spec: timestamp="2024-06-20T11:07:35.169+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] vsphere_virtual_machine (ID = 42300f4a-a93e-f22f-e1d7-48e9522eea83): Expanding of old config complete: timestamp="2024-06-20T11:07:35.170+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] vsphere_virtual_machine (ID = 42300f4a-a93e-f22f-e1d7-48e9522eea83): Building config spec: timestamp="2024-06-20T11:07:35.170+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] NormalizeBus: Normalizing first 2 controllers on SCSI bus to device type pvscsi: timestamp="2024-06-20T11:07:35.170+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] NormalizeBus: Normalizing first 0 controllers on SATA bus: timestamp="2024-06-20T11:07:35.170+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] NormalizeBus: Normalizing first 2 controllers on IDE bus: timestamp="2024-06-20T11:07:35.170+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] NormalizeBus: Current SCSI bus contents: pvscsi-1000,<nil>: timestamp="2024-06-20T11:07:35.170+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] NormalizeBus: Creating SCSI controller of type pvscsi at bus number 1: timestamp="2024-06-20T11:07:35.170+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] applyDeviceChange: Applying changes: (add: *types.ParaVirtualSCSIController at key -201): timestamp="2024-06-20T11:07:35.170+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] applyDeviceChange: Device list before changes: ide-200,ide-201,ps2-300,pci-100,sio-400,keyboard-600,pointing-700,video-500,vmci-12000,pvscsi-1000,disk-1000-0,disk-1000-1,ethernet-0: timestamp="2024-06-20T11:07:35.170+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] applyDeviceChange: Device list after changes: ide-200,ide-201,ps2-300,pci-100,sio-400,keyboard-600,pointing-700,video-500,vmci-12000,pvscsi-1000,disk-1000-0,disk-1000-1,ethernet-0,pvscsi--201: timestamp="2024-06-20T11:07:35.170+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] NormalizeBus: Current SATA bus contents:: timestamp="2024-06-20T11:07:35.170+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] NormalizeBus: Current IDE bus contents: device-200,device-201: timestamp="2024-06-20T11:07:35.170+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] NormalizeBus: Outgoing device list: ide-200,ide-201,ps2-300,pci-100,sio-400,keyboard-600,pointing-700,video-500,vmci-12000,pvscsi-1000,disk-1000-0,disk-1000-1,ethernet-0,pvscsi--201: timestamp="2024-06-20T11:07:35.170+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] NormalizeBus: Outgoing device config spec: (add: *types.ParaVirtualSCSIController at key -201): timestamp="2024-06-20T11:07:35.170+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] vsphere_virtual_machine (ID = 42300f4a-a93e-f22f-e1d7-48e9522eea83): SCSI bus has changed and requires a VM restart: timestamp="2024-06-20T11:07:35.170+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] DiskApplyOperation: Beginning apply operation: timestamp="2024-06-20T11:07:35.170+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] DiskApplyOperation: Looking for resources to delete: timestamp="2024-06-20T11:07:35.170+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] DiskApplyOperation: Looking for resources to create or update: timestamp="2024-06-20T11:07:35.170+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] DiskApplyOperation: Resources not being changed:: timestamp="2024-06-20T11:07:35.170+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] disk.2 (key 0 at <new device>) (<unknown>): Creating disk: timestamp="2024-06-20T11:07:35.170+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] Locating datastore with ID "datastore-17292": timestamp="2024-06-20T11:07:35.170+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] Datastore with ID "datastore-17292" found: timestamp="2024-06-20T11:07:35.188+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] ControllerForCreateUpdate: Looking for controller type scsi: timestamp="2024-06-20T11:07:35.188+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] pickController: Looking for scsi controller at bus number 1: timestamp="2024-06-20T11:07:35.188+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] pickSCSIController: Found controller: pvscsi--201: timestamp="2024-06-20T11:07:35.188+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] ControllerForCreateUpdate: Found controller: pvscsi--201: timestamp="2024-06-20T11:07:35.188+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] disk.2 (key -202 at scsi:1:0) (<unknown>): Device config operations from create: (add: *types.VirtualDisk at key -202): timestamp="2024-06-20T11:07:35.188+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] disk.2 (key -202 at scsi:1:0) (<unknown>): Create finished: timestamp="2024-06-20T11:07:35.188+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] applyDeviceChange: Applying changes: (add: *types.VirtualDisk at key -202): timestamp="2024-06-20T11:07:35.188+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] applyDeviceChange: Device list before changes: ide-200,ide-201,ps2-300,pci-100,sio-400,keyboard-600,pointing-700,video-500,vmci-12000,pvscsi-1000,disk-1000-0,disk-1000-1,ethernet-0,pvscsi--201: timestamp="2024-06-20T11:07:35.188+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] applyDeviceChange: Device list after changes: ide-200,ide-201,ps2-300,pci-100,sio-400,keyboard-600,pointing-700,video-500,vmci-12000,pvscsi-1000,disk-1000-0,disk-1000-1,ethernet-0,pvscsi--201,disk--201-0: timestamp="2024-06-20T11:07:35.188+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] DiskApplyOperation: Post-apply final resource list: (key 2000 at scsi:0:0),(key 2001 at scsi:0:1),(key -202 at scsi:1:0): timestamp="2024-06-20T11:07:35.188+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] DiskApplyOperation: Device list at end of operation: ide-200,ide-201,ps2-300,pci-100,sio-400,keyboard-600,pointing-700,video-500,vmci-12000,pvscsi-1000,disk-1000-0,disk-1000-1,ethernet-0,pvscsi--201,disk--201-0: timestamp="2024-06-20T11:07:35.188+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] DiskApplyOperation: Device config operations from apply: (add: *types.VirtualDisk at key -202): timestamp="2024-06-20T11:07:35.188+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] DiskApplyOperation: Apply complete, returning updated spec: timestamp="2024-06-20T11:07:35.188+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] NetworkInterfaceApplyOperation: Beginning apply operation: timestamp="2024-06-20T11:07:35.189+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] NetworkInterfaceApplyOperation: Looking for resources to delete: timestamp="2024-06-20T11:07:35.189+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] NetworkInterfaceApplyOperation: Looking for resources to create or update: timestamp="2024-06-20T11:07:35.189+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] NetworkInterfaceApplyOperation: No-op resource: key 4000: timestamp="2024-06-20T11:07:35.189+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] NetworkInterfaceApplyOperation: Post-apply final resource list: (key 4000 at pci:0:7): timestamp="2024-06-20T11:07:35.189+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] NetworkInterfaceApplyOperation: Device list at end of operation: ide-200,ide-201,ps2-300,pci-100,sio-400,keyboard-600,pointing-700,video-500,vmci-12000,pvscsi-1000,disk-1000-0,disk-1000-1,ethernet-0,pvscsi--201,disk--201-0: timestamp="2024-06-20T11:07:35.189+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] NetworkInterfaceApplyOperation: Device config operations from apply:: timestamp="2024-06-20T11:07:35.189+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] NetworkInterfaceApplyOperation: Apply complete, returning updated spec: timestamp="2024-06-20T11:07:35.189+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] CdromApplyOperation: Beginning apply operation: timestamp="2024-06-20T11:07:35.189+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] CdromApplyOperation: Looking for resources to delete: timestamp="2024-06-20T11:07:35.189+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] CdromApplyOperation: Looking for resources to create or update: timestamp="2024-06-20T11:07:35.189+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] CdromApplyOperation: Post-apply final resource list:: timestamp="2024-06-20T11:07:35.189+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] CdromApplyOperation: Device list at end of operation: ide-200,ide-201,ps2-300,pci-100,sio-400,keyboard-600,pointing-700,video-500,vmci-12000,pvscsi-1000,disk-1000-0,disk-1000-1,ethernet-0,pvscsi--201,disk--201-0: timestamp="2024-06-20T11:07:35.189+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] CdromApplyOperation: Device config operations from apply:: timestamp="2024-06-20T11:07:35.189+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] CdromApplyOperation: Apply complete, returning updated spec: timestamp="2024-06-20T11:07:35.189+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] vsphere_virtual_machine (ID = 42300f4a-a93e-f22f-e1d7-48e9522eea83): Final device list: ide-200,ide-201,ps2-300,pci-100,sio-400,keyboard-600,pointing-700,video-500,vmci-12000,pvscsi-1000,disk-1000-0,disk-1000-1,ethernet-0,pvscsi--201,disk--201-0: timestamp="2024-06-20T11:07:35.189+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] vsphere_virtual_machine (ID = 42300f4a-a93e-f22f-e1d7-48e9522eea83): Final device change spec: (add: *types.ParaVirtualSCSIController at key -201),(add: *types.VirtualDisk at key -202): timestamp="2024-06-20T11:07:35.189+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] Fetching properties for VM "/.../vm/.../.../..............": timestamp="2024-06-20T11:07:35.189+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] Attempting guest shutdown of virtual machine "/.../vm/.../.../..............": timestamp="2024-06-20T11:07:35.244+0200"
module.module.virtual_machines["..."].module.vsphere_virtual_machine.vsphere_virtual_machine.virtual_machine: Still modifying... [id=42300f4a-a93e-f22f-e1d7-48e9522eea83, 10s elapsed]
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] Reconfiguring virtual machine "/.../vm/.../.../..............": timestamp="2024-06-20T11:07:46.495+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] Fetching properties for VM "/.../vm/.../.../..............": timestamp="2024-06-20T11:07:47.015+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] Fetching configuration options for VM "/.../vm/.../.../..............": timestamp="2024-06-20T11:07:47.066+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] Found current hardware version: 19: timestamp="2024-06-20T11:07:47.392+0200"
module.module.virtual_machines["..."].module.vsphere_virtual_machine.vsphere_virtual_machine.virtual_machine: Still modifying... [id=42300f4a-a93e-f22f-e1d7-48e9522eea83, 20s elapsed]
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] Fetching properties for VM "/.../vm/.../.../..............": timestamp="2024-06-20T11:07:56.501+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] Powering on virtual machine "/.../vm/.../.../..............": timestamp="2024-06-20T11:07:56.551+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] blockUntilReadyForMethod: Going to block until "PowerOnVM_Task" is no longer in the Disabled Methods list for vm vm-215626: timestamp="2024-06-20T11:07:56.551+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] Fetching properties for VM "/.../vm/.../.../..............": timestamp="2024-06-20T11:07:56.551+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] blockUntilReadyForMethod: "PowerOnVM_Task" no longer disabled for vm vm-215626: timestamp="2024-06-20T11:07:56.596+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] Fetching properties for VM "/.../vm/.../.../..............": timestamp="2024-06-20T11:07:57.097+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] VM "/.../vm/.../.../.............." is powered off, attempting to power on.: timestamp="2024-06-20T11:07:57.142+0200"
[INFO]  provider.terraform-provider-vsphere_v2.6.1_x5:  [DEBUG] PowerOn task for VM "/.../vm/.../.../.............." was successful.: timestamp="2024-06-20T11:07:58.052+0200"

Panic Output

No response

Expected Behavior

According the provider documentation no reboot is performed on scsi_controller_count changes. Also adding a scsi controller via the UI of the machine, no reboot is required.

Actual Behavior

The virtual machine is rebooted if a new scsi controller is created.

Steps to Reproduce

  • Create a virtual machine
  • Add a new disk on a new scsi controller (for example unit_number 15 and scsi_controller_count 2)

Environment Details

No response

Screenshots

No response

References

No response

@edwin-bruurs edwin-bruurs added bug Type: Bug needs-triage Status: Issue Needs Triage labels Jun 20, 2024
Copy link

Hello, edwin-bruurs! 🖐

Thank you for submitting an issue for this provider. The issue will now enter into the issue lifecycle.

If you want to contribute to this project, please review the contributing guidelines and information on submitting pull requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Type: Bug needs-triage Status: Issue Needs Triage
Projects
None yet
Development

No branches or pull requests

1 participant