How to enable or disable a hypervisor via openstack python module
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
participants (1)
-
Saeed