Conversation
unakatsuo
left a comment
There was a problem hiding this comment.
model/store.go should not be a part of model class. This should be a private struct of scheduler or mesos package.
# Conflicts: # handlers/vm/esxi/esxi_test.go # vendor/vendor.json
handlers/vm/lxc/lxc_test.go
Outdated
| func TestTypes(t *testing.T) { | ||
| assert := assert.New(t) | ||
| assert.Implements((*handlers.ResourceHandler)(nil), &LxcHandler{}) | ||
| // assert.Implements((*handlers.InstanceResourceHandler)(nil), &LxcHandler{}) |
There was a problem hiding this comment.
A little time ago, InstanceResourceHandler was registered by each Handler. But now InstanceResourceHandler is not used by any handlers, because each Scheduler registering instanceSchedulerHandler to global variable of scheduler/schedule.go instead of InstanceResourceHandler. So each Hander need not implement InstanceResourceHandler. I deleted this comment.
handlers/vm/null/null_test.go
Outdated
| func TestTypes(t *testing.T) { | ||
| assert := assert.New(t) | ||
| assert.Implements((*handlers.ResourceHandler)(nil), &NullHandler{}) | ||
| // assert.Implements((*handlers.InstanceResourceHandler)(nil), &NullHandler{}) |
handlers/vm/qemu/qemu_test.go
Outdated
| func TestTypes(t *testing.T) { | ||
| assert := assert.New(t) | ||
| assert.Implements((*handlers.ResourceHandler)(nil), &QemuHandler{}) | ||
| // assert.Implements((*handlers.InstanceResourceHandler)(nil), &QemuHandler{}) |
scheduler/mesos_test.go
Outdated
| func init() { | ||
| mesosOffer = &mesos.Offer{ | ||
| Id: &mesos.OfferID{ | ||
| Value: sP("d39c0128-4822-49a0-9fab-640fba518d53-O590"), |
There was a problem hiding this comment.
golang/protobuf provides conversion utilities.
proto.String("xxxxxx")
There was a problem hiding this comment.
Modified to using proto library for convert to pointer.
scheduler/schedule.go
Outdated
| } | ||
|
|
||
| type Schedule struct { | ||
| *sync.Mutex |
There was a problem hiding this comment.
No need to expose Lock()/Unlock() methods. And also sync.RWMutex is better .
https://golang.org/pkg/sync/#RWMutex
m sync.RWMutex
There was a problem hiding this comment.
Modified mutex from sync.Mutex to sync.RWMutex and turn to private variable.
| schedule.storedOffers[offer.SlaveID] = offer | ||
| } | ||
|
|
||
| func (s *Schedule) Assign(inst *model.Instance) error { |
There was a problem hiding this comment.
Missing to take mutex lock.
There was a problem hiding this comment.
Added RLock/RUnlock next to schedule.storedOffers's "for range" function.
New openvdc scheduler storing offer of mesos slave noticed by mesos master.
When coming request from user, scheduler refer to stored offers and judging whether mesos slave satisfing request is exist.
When exist mesos slave satisfing request, accept the request. If it does not exist, scheduler informs the user that there are no slaves that satisfy the request.