Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- As part of planned host maintenance, tried to play around how it could be
- #In Nova hostid is uniq identifier for host for a tenant/project (somebody else than admin):
- import hashlib
- projectid = str(instance.project_id)
- host = instance.host
- hostid = hashlib.sha224(projectid + host).hexdigest()
- #As other than admin is not allowed to know hostname, they should refer to it with other uniq identifier.
- #Nova has hostid for this. Here with some imaginery projectid and host:
- projectid = "8a3169016ed14558bf062b1a4ce21737"
- host = "compute.host.example.com"
- hostid = hashlib.sha224(projectid + host).hexdigest()
- print hostid
- fc9ec958261e33fb40e4ff08e3602797143817c15ee47a5bd3c048eb
- #In Craton admin can refer host by its name, where again other users should use hostid as they should not be aware about the hostname.
- #admin sets host_details to host as namespace:
- craton host-set-vars compute.host.example.com /host_details
- #admin sets maintenance_state variable to host_details namespace:
- craton host-set-vars compute.host.example.com /host_details/maintenance_state="PLANNED_MAINTENANCE"
- #Can one set multiple variables with one call? This would be important to not to trigger notification on each change?
- #There could be something more like:
- maintenance_reason="firmware update"
- maintenance_start="2016-03-22T00:46:25Z",
- maintenance_end="2016-03-22T04:46:25Z",
- #Notification would be triggered with payload from host_details namespace with host from host namespace included
- #Assuming this can be admin level as other user would not directly consume notification, but alarm
- #Based on Nova discussions and Nova spec: https://review.openstack.org/310510
- #in Nova you would set to nova-compute service a link to Craton:
- PUT /v2.1/{tenant_id}/os-services/host-details
- {
- "host": "compute.host.example.com",
- "binary": "nova-compute",
- "host_details": "http://${CRATON_IP}:8080/v1/hosts/host_details/compute.host.example.com",
- }
- 200 OK
- {
- "service": {
- "host": "my.host.example.com",
- "binary": "nova-compute",
- "host_details": "http://${CRATON_IP}:8080/v1/hosts/host_details/compute.host.example.com",
- }
- }
- #In Nova server API project could get link to Craton host data he is allowed to see.
- #Nova translates internally the url given to nova-compute service host_details
- #by replacing "hostname" with project specific hostid
- GET /v2.1/8a3169016ed14558bf062b1a4ce21737/servers/{server_id}
- 200 OK
- {
- "server": {
- ...
- "host_details": "http://${CRATON_IP}:8080/v1/hosts/host_details/fc9ec958261e33fb40e4ff08e3602797143817c15ee47a5bd3c048eb",
- ...
- }
- }
- How would this work for project: "GET http://${CRATON_IP}:8080/v1/hosts/host_details/fc9ec958261e33fb40e4ff08e3602797143817c15ee47a5bd3c048eb"
- Data should be same as
- "GET http://${CRATON_IP}:8080/v1/hosts/host_details"
- Unless admin would place some variable not to be seen by other users.
Advertisement
Add Comment
Please, Sign In to add comment