def bdm_update_or_create_at_top(self, message, bdm, create):
        if not self._at_the_top():
            return
        items_to_remove = ['id']
        for key in items_to_remove:
            bdm.pop(key, None)
        if create is None:
            LOG.debug('Calling db.block_device_mapping_update_or_create from '
                      'API cell with values: %s', bdm)
            self.db.block_device_mapping_update_or_create(message.ctxt,
                                                          bdm,
                                                          legacy=False)
            return
        elif create is True:
            LOG.debug('Calling db.block_device_mapping_create from API '
                      'cell with values: %s', bdm)
            self.db.block_device_mapping_create(message.ctxt, bdm,
                                                legacy=False)
            return
        # Unfortunately this update call wants BDM ID... but we don't know
        # what it is in this cell.  Search for it.. try matching either
        # device_name or volume_id.
        dev_name = bdm['device_name']
        vol_id = bdm['volume_id']
        instance_bdms = self.db.block_device_mapping_get_all_by_instance(
                message.ctxt, bdm['instance_uuid'])
        for instance_bdm in instance_bdms:
            if dev_name and instance_bdm['device_name'] == dev_name:
                break
            if vol_id and instance_bdm['volume_id'] == vol_id:
                break
        else:
            LOG.warning(_LW("No match when trying to update BDM: %(bdm)s"),
                        dict(bdm=bdm))
            return
        LOG.debug('Calling db.block_device_mapping_update from API cell with '
                  'bdm id %s and values: %s', instance_bdm['id'], bdm)
        self.db.block_device_mapping_update(message.ctxt,
                                            instance_bdm['id'], bdm,
                                            legacy=False)
Soft-delete an instance in its cell.
dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/cells/messaging.py/_BroadcastMessageMethods.bdm_update_or_create_at_top--crossover with--dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/cells/manager.py/CellsManager.soft_delete_instance