Skip to content

Commit 6803fcb

Browse files
committed
fix vmid scheduler
1 parent da550fa commit 6803fcb

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

cloud/scheduler/plugins/nextid/nextid.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func (pl *NextID) Name() string {
3333

3434
// select minimum id being not used and matching regex
3535
// regex is specified in ctx value (key=vmid.qemu-scheduler/regex)
36-
func (pl *NextID) Select(ctx context.Context, _ *framework.CycleState, _ api.VirtualMachineCreateOptions) (int, error) {
36+
func (pl *NextID) Select(ctx context.Context, _ *framework.CycleState, config api.VirtualMachineCreateOptions) (int, error) {
3737
nextid, err := pl.client.RESTClient().GetNextID(ctx)
3838
if err != nil {
3939
return 0, err

cloud/scheduler/scheduler.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,5 +187,8 @@ func selectHighestScoreNode(scoreList framework.NodeScoreList) (string, error) {
187187
}
188188

189189
func (s *VMIDScheduler) run(ctx context.Context, config api.VirtualMachineCreateOptions) (int, error) {
190+
if config.VMID != nil {
191+
return *config.VMID, nil
192+
}
190193
return s.plugin.Select(ctx, nil, config)
191194
}

0 commit comments

Comments
 (0)