Skip to content

Commit

Permalink
add comments describing reflect
Browse files Browse the repository at this point in the history
  • Loading branch information
mpywell authored and lbajolet-hashicorp committed May 28, 2024
1 parent 7f0766e commit 6436c9b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions builder/proxmox/common/step_start_vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ func generateProxmoxDisks(disks []diskConfig) *proxmox.QemuStorages {
EmulateSSD: disks[idx].SSD,
},
}
// set value of &ideDisks.Disk_<ideCount value> to contents of &dev
reflect.ValueOf(&ideDisks).Elem().FieldByIndex([]int{ideCount}).Set(reflect.ValueOf(&dev))
ideCount++
case "scsi":
Expand All @@ -331,6 +332,7 @@ func generateProxmoxDisks(disks []diskConfig) *proxmox.QemuStorages {
IOThread: disks[idx].IOThread,
},
}
// set value of &scsiDisks.Disk_<ideCount value> to contents of &dev
reflect.ValueOf(&scsiDisks).Elem().FieldByIndex([]int{scsiCount}).Set(reflect.ValueOf(&dev))
scsiCount++
case "sata":
Expand All @@ -344,6 +346,7 @@ func generateProxmoxDisks(disks []diskConfig) *proxmox.QemuStorages {
EmulateSSD: disks[idx].SSD,
},
}
// set value of &sataDisks.Disk_<ideCount value> to contents of &dev
reflect.ValueOf(&sataDisks).Elem().FieldByIndex([]int{sataCount}).Set(reflect.ValueOf(&dev))
sataCount++
case "virtio":
Expand All @@ -357,6 +360,7 @@ func generateProxmoxDisks(disks []diskConfig) *proxmox.QemuStorages {
IOThread: disks[idx].IOThread,
},
}
// set value of &virtIODisks.Disk_<ideCount value> to contents of &dev
reflect.ValueOf(&virtIODisks).Elem().FieldByIndex([]int{virtIOCount}).Set(reflect.ValueOf(&dev))
virtIOCount++
}
Expand Down

0 comments on commit 6436c9b

Please sign in to comment.