From b948051ec6590b42494d4280c7d9fbfc25e5e30c Mon Sep 17 00:00:00 2001 From: Chang-Hong Hsu Date: Wed, 4 Mar 2020 21:03:32 -0800 Subject: [PATCH 1/2] fix token marshalling error --- .../nodes/task/resourcemanager/redis_resourcemanager.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/controller/nodes/task/resourcemanager/redis_resourcemanager.go b/pkg/controller/nodes/task/resourcemanager/redis_resourcemanager.go index 6c049be367..c973b42f20 100644 --- a/pkg/controller/nodes/task/resourcemanager/redis_resourcemanager.go +++ b/pkg/controller/nodes/task/resourcemanager/redis_resourcemanager.go @@ -220,7 +220,7 @@ func (r *RedisResourceManager) AllocateResource(ctx context.Context, namespace p return pluginCore.AllocationUndefined, err } // Check to see if the allocation token is already in the set - found, err := r.client.SIsMember(string(namespace), allocationToken) + found, err := r.client.SIsMember(string(namespace), string(allocationToken)) if err != nil { logger.Errorf(ctx, "Error getting size of Redis set %v", err) return pluginCore.AllocationUndefined, err @@ -259,7 +259,7 @@ func (r *RedisResourceManager) AllocateResource(ctx context.Context, namespace p return pluginCore.AllocationStatusExhausted, nil } - countAdded, err := r.client.SAdd(string(namespace), allocationToken) + countAdded, err := r.client.SAdd(string(namespace), string(allocationToken)) if err != nil { logger.Errorf(ctx, "Error adding token [%s:%s] %v", namespace, allocationToken, err) return pluginCore.AllocationUndefined, err @@ -272,7 +272,7 @@ func (r *RedisResourceManager) AllocateResource(ctx context.Context, namespace p } func (r *RedisResourceManager) ReleaseResource(ctx context.Context, namespace pluginCore.ResourceNamespace, allocationToken Token) error { - countRemoved, err := r.client.SRem(string(namespace), allocationToken) + countRemoved, err := r.client.SRem(string(namespace), string(allocationToken)) if err != nil { logger.Errorf(ctx, "Error removing token [%v:%s] %v", namespace, allocationToken, err) return err From fe6fb0acfcf855e9688911fa25f2cdc382f98cb4 Mon Sep 17 00:00:00 2001 From: Chang-Hong Hsu Date: Wed, 4 Mar 2020 21:09:16 -0800 Subject: [PATCH 2/2] rename a file --- ...ullyqualifiedresourceconstraints.go => resourceconstraints.go} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename pkg/controller/nodes/task/resourcemanager/{fullyqualifiedresourceconstraints.go => resourceconstraints.go} (100%) diff --git a/pkg/controller/nodes/task/resourcemanager/fullyqualifiedresourceconstraints.go b/pkg/controller/nodes/task/resourcemanager/resourceconstraints.go similarity index 100% rename from pkg/controller/nodes/task/resourcemanager/fullyqualifiedresourceconstraints.go rename to pkg/controller/nodes/task/resourcemanager/resourceconstraints.go