'Check if capabilities satisfy resource type requirements.
Check that the capabilities provided by the services satisfy
the extra specs associated with the resource type.'

def _satisfies_extra_specs(self, capabilities, resource_type):

    if (not resource_type):
        return True
    extra_specs = resource_type.get('extra_specs', [])
    if (not extra_specs):
        return True
    for (key, req) in extra_specs.items():
        scope = key.split(':')
        if ((len(scope) > 1) and (scope[0] != 'capabilities')):
            continue
        elif (scope[0] == 'capabilities'):
            del scope[0]
        cap = capabilities
        for index in range(len(scope)):
            try:
                cap = cap[scope[index]]
            except (TypeError, KeyError):
                LOG.debug("Backend    doesn't    provide    capability    '%(cap)s'    ", {'cap': scope[index]})
                return False
        cap_list = ([cap] if (not isinstance(cap, list)) else cap)
        for cap_value in cap_list:
            if extra_specs_ops.match(cap_value, req):
                break
        else:
            LOG.debug('Volume    type    extra    spec    requirement    "%(key)s=%(req)s"    does    not    match    reported    capability    "%(cap)s"', {'key': key, 'req': req, 'cap': cap})
            return False
    return True
