Thanks, it worked. On Fri, 16 Feb 2024 at 23:15, Dmitriy Rabotyagov <noonedeadpunk@gmail.com> wrote:
Hey,
You should be using conn.compute.services, not hypervisors:
https://docs.openstack.org/openstacksdk/latest/user/proxies/compute.html#ser...
Hope this helps.
On Fri, Feb 16, 2024, 20:38 Saeed <s.fazl73@gmail.com> wrote:
Hello,
I use this module to find if any hypervisors are disabled: https://github.com/openstack/openstacksdk
I can find and see if any hypervisor is disabled and see the reason, but I didn't find any docs about how to enable (or even disable) a hypervisor.
This is my code to find disabled hypervisors:
import openstack
regions = ['region1', 'region2', 'region3'] openstack.enable_logging(debug=False)disabled_hypervisors = [] for region in regions: conn = openstack.connect(cloud=region) # clouds.yaml for server in conn.compute.hypervisors(details=True): a = server.to_dict() if a['status'] == 'disabled' and a['service_details']['disabled_reason'] != None: disabled_hypervisors.append({'name': a['name'], 'ip': a['host_ip'], 'disabled_reason': a['service_details']['disabled_reason']})
Regards, Saeed