def remove_instances_by_prefix(nova_api, prefix):
    """Remove all the instances on which their name start by a prefix."""
    for server in nova_api.servers.list():
        if server.name.startswith(prefix):
            LOG.info("Remove instance '%s'" % server.name)
            server.delete()
Remove all the instances on which their name start by a prefix.