'Optimized metadata delete method.
This provides a more efficient way to delete a single metadata
key, instead of just calling instance.save(). This should be called
with the key still present in self.metadata, which it will update
after completion.'

@base.remotable
def delete_metadata_key(self, key):

    db.instance_metadata_delete(self._context, self.uuid, key)
    md_was_changed = ('metadata' in self.obj_what_changed())
    del self.metadata[key]
    self._orig_metadata.pop(key, None)
    notifications.send_update(self._context, self, self)
    if (not md_was_changed):
        self.obj_reset_changes(['metadata'])
