def _calc_properties(self, cs_data, cs_properties):
        property_mapping = common.property_mapping_to_dict(cs_data)

        properties = {}

        for key, value in cs_properties.iteritems():
            if key in property_mapping:
                targets = property_mapping[key]
                for target in targets:
                    properties[target] = value
                continue

            LOG.debug(_("Ignoring key %s because it's not in property mapping.") % key)

        return properties
    def _calc_properties(self, cs_data, cs_properties):
        property_mapping = common.property_mapping_to_dict(cs_data)

        result = self._expand_multi_mapping(property_mapping, cs_properties)
        property_mapping, exp_keys, compressed_targets = result
        properties = {}

        for key, value in cs_properties.iteritems():
            if key in property_mapping:
                targets = property_mapping.pop(key)
                expanded = key in exp_keys
                prop_info = dict(value=value, required=True, expanded=expanded)
                for target in targets:
                    properties[target] = prop_info

                continue

            # key is not in property mapping.
            if key.startswith('server.metadata.'):
                LOG.warn(_("Didn't find meta key %s in mapping, adding it") %
                         key)
                new_key = key.replace('server.metadata.', '', 1)
                properties[new_key] = dict(value=value, required=False,
                                           expanded=False)
                continue

            LOG.debug(
                _("Ignoring key %s because it's not in property mapping.") %
                key)

        if property_mapping:
            LOG.warn(_('Some property mapping items were not used because '
                       'source key was neither a known OpenStack property nor'
                       ' passed as server metadata. These are the unmapped '
                       'keys: %s') % property_mapping.keys())

        return properties, compressed_targets