Skip to content

Commit

Permalink
Hotfix mtn (#155)
Browse files Browse the repository at this point in the history
* fix try mtn alloc when spool application without mtn

* add check length mtn ident before try allocating
  • Loading branch information
dkarpukhin authored and noxiouz committed Jul 11, 2018
1 parent db2ac5d commit d207017
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions isolate/mtn.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ func (c *MtnState) RequestAllocs(ctx context.Context, netid string) (map[string]
}

func (c *MtnState) BindAllocs(ctx context.Context, netId string) error {
if len(netId) == 0 {
return fmt.Errorf("Len(netId) is zero.")
}
c.Lock()
log.G(ctx).Debugf("BindAllocs() called with netId %s.", netId)
defer c.Unlock()
Expand Down
2 changes: 1 addition & 1 deletion isolate/porto/box.go
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ func (b *Box) Spool(ctx context.Context, name string, opts isolate.RawProfile) (
// NOTE: Not so fast, but it's important for debug
journalContent.Set(b.journal.String())

if b.GlobalState.Mtn.Cfg.Enable {
if b.GlobalState.Mtn.Cfg.Enable && profile.Network["mtn"] == "enable" {
err := b.GlobalState.Mtn.BindAllocs(ctx, profile.Network["netid"])
if err != nil {
return fmt.Errorf("Cant bind mtn alllocaton at spool with profile: %s, and with state: %s, and error: %s", profile, b.GlobalState.Mtn, err)
Expand Down

0 comments on commit d207017

Please sign in to comment.