resource provider

Install CLI client

pip install openstack-placement

resource provider allocation

# list hypervisor
openstack resource provider list --sort-column name
 
# show
openstack resource provider allocation show ${SERVER_ID}
 
# delete
openstack resource provider allocation delete ${SERVER_ID}

Check multiple / broken resource provider allocation

for SERVER_ID in $(openstack server list --all -c ID -f value); do
    HYPERVISOR_HOSTNAME=$(openstack server show ${SERVER_ID} -c OS-EXT-SRV-ATTR:hypervisor_hostname -f value)
    RESOURCE_PROVIDER=$(openstack resource provider allocation show ${SERVER_ID} -c resource_provider -f value)
 
    # openstack resource provider list -c uuid -c name -f value
    case ${RESOURCE_PROVIDER} in
        bcf1cfcc-0b97-43e1-bb09-1bfd64ebc4fa) RESOURCE_PROVIDER_NAME=com1-stage.example.com;;
        231bd9d5-be18-4466-9865-923f463cd378) RESOURCE_PROVIDER_NAME=com2-stage.example.com;;
        b9e37e4a-28cf-4f63-bcdd-6463a7828b04) RESOURCE_PROVIDER_NAME=com3-stage.example.com;;
    esac
 
    if [ "${HYPERVISOR_HOSTNAME}" != "${RESOURCE_PROVIDER_NAME}" ]; then
        echo "SERVER_ID: ${SERVER_ID}"
        echo "HYPERVISOR_HOSTNAME: ${HYPERVISOR_HOSTNAME}"
        echo "RESOURCE_PROVIDER_NAME: ${RESOURCE_PROVIDER_NAME}"
        echo
    fi
done

Remove double allocation

# get RESOURCE_PROVIDER_ID
openstack resource provider allocation show ${SERVER_ID} -c resource_provider
 
# delete double RESOURCE_PROVIDER_ID
openstack resource provider allocation unset --provider ${RESOURCE_PROVIDER_ID} ${SERVER_ID} --os-placement-api-version 1.12

Links
https://docs.openstack.org/osc-placement/latest/cli/index.html