TritonDataCenter / sdc-docker

Docker Engine for Triton
Mozilla Public License 2.0
182 stars 49 forks source link

Docker client not working after applying affinity filter #94

Closed sw00choi closed 7 years ago

sw00choi commented 7 years ago

As written in https://apidocs.joyent.com/docker/features/placement, I applied affinity filter like this:

$ docker run -d --name ubuntu01 ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done"
$ docker run -d -e 'affinity:container!=ubuntu0*' --name ubuntu02 ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done"

Whenever I use wildcard character(*) for affinity filter, the docker client always complains about error response:

$ docker ps -a
Error response from daemon: problem loading containers (b884fa50-a553-11e6-ab53-9966a7dac7ef)

The related fwapi log:

    NotIndexedError: fwapi_rules does not have indexes that support (fromtags=docker:label:com.docker.swarm.affinities=["container!=ubuntu0*"]=40)
        at _substr (/opt/smartdc/moray/lib/objects/common.js:170:23)
        at compileQuery (/opt/smartdc/moray/lib/objects/common.js:259:9)
        at /opt/smartdc/moray/lib/objects/common.js:227:17
        at Array.forEach (native)
        at compileQuery (/opt/smartdc/moray/lib/objects/common.js:226:19)
        at /opt/smartdc/moray/lib/objects/common.js:206:17
        at Array.forEach (native)
        at compileQuery (/opt/smartdc/moray/lib/objects/common.js:205:19)
        at buildWhereClause (/opt/smartdc/moray/lib/objects/common.js:583:17)
        at vasync.forEachPipeline.func (/opt/smartdc/moray/lib/control.js:127:13)

The error comes from moray:

        if (_f.initial) {
            _v = _value(s, _f.attribute, _f.initial, _f);
            if (_v.isArray)
                throw new NotIndexedError(b, _f.toString());   // <-- exception occurs
            if (_v.value === undefined)
                valid = false;
            _like_tmp += _v.value + '%';
        }

I'm not sure how to fix this error.

askfongjojo commented 7 years ago

This looks like a duplicate of https://github.com/joyent/sdc-fwapi/issues/2.

Adel-Magebinary commented 7 years ago

This still happens btw

askfongjojo commented 7 years ago

Fixed in https://github.com/joyent/sdc-fwapi/commit/d31ccc0b3680315411b86af11fb9dd7a46dbbb94.