@staticmethod
def _set_migration_status(migration, status):
    """Set the status, and guard against a None being passed in.

        This is useful as some of the compute RPC calls will not pass
        a migration object in older versions. The check can be removed when
        we move past 4.x major version of the RPC API.
        """
    if migration:
        migration.status = status
        migration.save()
