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

Fix scsinumber #179

Merged
merged 18 commits into from
Feb 26, 2025
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/support/clone_vm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,10 @@ def vm_customization
# Storage Controller and ID mapping
controller = vm.config.hardware.device.select { |device| device.is_a? RbVmomi::VIM::VirtualSCSIController }.first

# Move these variables outside the loop so they aren't overwritten
highest_id = vm.disks.map(&:unitNumber).max
next_id = highest_id

add_disks.each_with_index do |disk_config, idx|
# Default to Thin Provisioning and 10GB disk size
disk_config[:type] ||= :thin
Expand Down Expand Up @@ -405,8 +409,7 @@ def vm_customization

disk_spec.device.controllerKey = controller.key

highest_id = vm.disks.map(&:unitNumber).max
next_id = highest_id + idx + 1
next_id += 1

# Avoid the SCSI controller ID
next_id += 1 if next_id == controller.scsiCtlrUnitNumber
Expand Down