'Update usage for a single migration.  The record may
represent an incoming or outbound migration.'

def _update_usage_from_migration(self, context, instance, migration, nodename):

    if (not _is_trackable_migration(migration)):
        return
    uuid = migration.instance_uuid
    LOG.info('Updating    from    migration    %s', uuid)
    incoming = ((migration.dest_compute == self.host) and (migration.dest_node == nodename))
    outbound = ((migration.source_compute == self.host) and (migration.source_node == nodename))
    same_node = (incoming and outbound)
    record = self.tracked_instances.get(uuid, None)
    itype = None
    numa_topology = None
    sign = 0
    if same_node:
        if (instance['instance_type_id'] == migration.old_instance_type_id):
            itype = self._get_instance_type(context, instance, 'new_', migration)
            numa_topology = self._get_migration_context_resource('numa_topology', instance)
            sign = 1
        else:
            itype = self._get_instance_type(context, instance, 'old_', migration)
            numa_topology = self._get_migration_context_resource('numa_topology', instance, prefix='old_')
    elif (incoming and (not record)):
        itype = self._get_instance_type(context, instance, 'new_', migration)
        numa_topology = self._get_migration_context_resource('numa_topology', instance)
        sign = 1
    elif (outbound and (not record)):
        itype = self._get_instance_type(context, instance, 'old_', migration)
        numa_topology = self._get_migration_context_resource('numa_topology', instance, prefix='old_')
    if itype:
        cn = self.compute_nodes[nodename]
        usage = self._get_usage_dict(itype, numa_topology=numa_topology)
        if (self.pci_tracker and sign):
            self.pci_tracker.update_pci_for_instance(context, instance, sign=sign)
        self._update_usage(usage, nodename)
        if self.pci_tracker:
            obj = self.pci_tracker.stats.to_device_pools_obj()
            cn.pci_device_pools = obj
        else:
            obj = objects.PciDevicePoolList()
            cn.pci_device_pools = obj
        self.tracked_migrations[uuid] = migration
