4 Check the status of libvirt, openstack-nova-compute, and
5 quantum-openvswitch-agent. If these services are enabled and have failed,
14 def get_systemd_status(service):
15 p=subprocess.Popen(["/bin/systemctl", "is-active", service], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
16 (out, err) = p.communicate()
20 libvirt_enabled = os.system("systemctl -q is-enabled libvirtd.service")==0
21 nova_compute_enabled = os.system("systemctl -q is-enabled openstack-nova-compute.service")==0
22 openvswitch_agent_enabled = os.system("systemctl -q is-enabled quantum-openvswitch-agent.service")==0
25 print " libvirtd=", libvirt_enabled
26 print " openstack-nova-compute=", nova_compute_enabled
27 print " quantum-openvswitch-agent=", openvswitch_agent_enabled
29 if (not libvirt_enabled) or (not nova_compute_enabled) or (not openvswitch_agent_enabled):
30 print "services are not enabled. exiting"
33 libvirt_status = get_systemd_status("libvirtd.service")
34 nova_compute_status = get_systemd_status("openstack-nova-compute.service")
35 openvswitch_agent_status = get_systemd_status("quantum-openvswitch-agent.service")
38 print " libvirtd=", libvirt_status
39 print " openstack-nova-compute=", nova_compute_status
40 print " quantum-openvswitch-agent=", openvswitch_agent_status
42 if (libvirt_status=="failed") or (nova_compute_status=="failed") or (openvswitch_agent_status=="failed"):
43 print "services have failed. doing the big restart"
44 os.system("systemctl stop openstack-nova-compute.service")
45 os.system("systemctl stop quantum-openvswitch-agent.service")
46 os.system("systemctl stop libvirtd.service")
48 os.system("systemctl start libvirtd.service")
50 os.system("systemctl start quantum-openvswitch-agent.service")
52 os.system("systemctl start openstack-nova-compute.service")