Skip to content

Commit 694b135

Browse files
Atomswikkyk
authored andcommitted
Remove function as it's not needed there
1 parent 9b57a0e commit 694b135

File tree

1 file changed

+7
-15
lines changed
  • internal/service/vmservice

1 file changed

+7
-15
lines changed

internal/service/vmservice/vm.go

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,13 @@ func createVM(ctx context.Context, scope *scope.MachineScope) (proxmox.VMCloneRe
398398
templateMap := scope.ProxmoxMachine.GetTemplateMap()
399399

400400
// set allowedNodes (we need to use this in scheduler and template search)
401-
allowedNodes := setAllowedNodes(scope)
401+
// defaults to ProxmoxCluster allowedNodes
402+
allowedNodes := scope.InfraCluster.ProxmoxCluster.Spec.AllowedNodes
403+
404+
// if ProxmoxMachine defines allowedNodes use them instead
405+
if len(scope.ProxmoxMachine.Spec.AllowedNodes) > 0 {
406+
allowedNodes = scope.ProxmoxMachine.Spec.AllowedNodes
407+
}
402408

403409
// TemplateSelector should be used
404410
if templateMap == nil {
@@ -465,20 +471,6 @@ func createVM(ctx context.Context, scope *scope.MachineScope) (proxmox.VMCloneRe
465471
return res, scope.InfraCluster.PatchObject()
466472
}
467473

468-
// use ProxmoxCluster allowedNodes if ProxmoxMachine does not define them
469-
func setAllowedNodes(scope *scope.MachineScope) []string {
470-
471-
// defaults to ProxmoxCluster allowedNodes
472-
allowedNodes := scope.InfraCluster.ProxmoxCluster.Spec.AllowedNodes
473-
474-
// if ProxmoxMachine defines allowedNodes use them instead
475-
if len(scope.ProxmoxMachine.Spec.AllowedNodes) > 0 {
476-
allowedNodes = scope.ProxmoxMachine.Spec.AllowedNodes
477-
}
478-
479-
return allowedNodes
480-
}
481-
482474
func getVMID(ctx context.Context, scope *scope.MachineScope) (int64, error) {
483475
if scope.ProxmoxMachine.Spec.VMIDRange != nil {
484476
vmIDRangeStart := scope.ProxmoxMachine.Spec.VMIDRange.Start

0 commit comments

Comments
 (0)