Skip to content

Rancher Lifecycle improvement#149

Merged
tuxtof merged 1 commit intomasterfrom
rancher-improve
Jul 28, 2025
Merged

Rancher Lifecycle improvement#149
tuxtof merged 1 commit intomasterfrom
rancher-improve

Conversation

@tuxtof
Copy link
Copy Markdown
Collaborator

@tuxtof tuxtof commented Jul 28, 2025

This pull request introduces a configurable timeout for Nutanix operations, improving flexibility and error handling in the NutanixDriver. The changes include adding a new Timeout parameter, updating logic to use this parameter, and enhancing error handling during VM creation and deletion processes.

Timeout Configuration and Usage:

  • Added a new Timeout field to the NutanixDriver struct and updated the SetConfigFromFlags method to set its value from the nutanix-timeout flag. The default value is 300 seconds (machine/driver/driver.go, [1] [2] [3].
  • Updated all loops that previously had a fixed iteration count (60 iterations) to dynamically calculate iterations based on the Timeout value divided by 5 seconds (machine/driver/driver.go, [1] [2] [3] [4].

Improved Error Handling:

  • Enhanced the Remove method to handle cases where the VM ID is empty or the VM is already deleted. Added specific logging for these scenarios (machine/driver/driver.go, [1] [2].
  • Added logic to delete a VM if it times out while waiting for an IP address during creation (machine/driver/driver.go, machine/driver/driver.goL527-R505).

Code Cleanup:

  • Removed redundant code that waited for VM disks to be available, simplifying the VM creation process (machine/driver/driver.go, machine/driver/driver.goL484-R490).

@tuxtof tuxtof added the enhancement New feature or request label Jul 28, 2025
@tuxtof tuxtof requested a review from Copilot July 28, 2025 09:11
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the Nutanix driver by adding configurable timeout support and improving error handling for VM lifecycle operations. The changes replace hardcoded timeout values with a user-configurable parameter and add better error handling for edge cases.

Key Changes:

  • Added configurable timeout parameter to replace hardcoded 60-iteration loops
  • Enhanced error handling in VM removal to handle missing VMs gracefully
  • Added cleanup logic to delete VMs that timeout during IP address assignment

Comment thread machine/driver/driver.go
Comment thread machine/driver/driver.go
Comment thread machine/driver/driver.go
Comment thread machine/driver/driver.go
Comment thread machine/driver/driver.go
Comment thread machine/driver/driver.go
Comment thread machine/driver/driver.go Outdated
@tuxtof tuxtof force-pushed the rancher-improve branch from 6f1c1a2 to f8d6f06 Compare July 28, 2025 09:23
@tuxtof tuxtof force-pushed the rancher-improve branch from f8d6f06 to 2a3394f Compare July 28, 2025 09:25
@tuxtof tuxtof merged commit ff8a295 into master Jul 28, 2025
8 checks passed
@tuxtof tuxtof deleted the rancher-improve branch July 28, 2025 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants