PATH:
usr
/
lib
/
python3.9
/
site-packages
/
sos
/
report
/
plugins
# Copyright (C) 2018 Mark Michelson <mmichels@redhat.com> # Copyright (C) 2024 Alan Baghumian <alan.baghumian@canonical.com> # This file is part of the sos project: https://github.com/sosreport/sos # # This copyrighted material is made available to anyone wishing to use, # modify, copy, or redistribute it subject to the terms and conditions of # version 2 of the GNU General Public License. # # See the LICENSE file in the source distribution for further information. import json import os import re from sos.report.plugins import ( Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin, ) class OVNCentral(Plugin): short_desc = 'OVN Northd' plugin_name = "ovn_central" profiles = ('network', 'virt') containers = ('ovn-dbs-bundle.*', 'ovn_cluster_north_db_server') container_name = "" ovn_nbdb_socket = "" ovn_sbdb_socket = "" ovn_socket = "" ovn_controller_sock_regex = "" ovn_northd_sock_regex = "" pfx = "" def _find_sock(self, path, regex_name): _sfile = self.path_join(path, regex_name) if self.container_name: res = self.exec_cmd(f"ls {path}", container=self.container_name) if res['status'] != 0 or '\n' not in res['output']: self._log_error( "Could not retrieve ovn_controller socket path " f"from container {self.container_name}" ) else: pattern = re.compile(regex_name) for filename in res['output'].split('\n'): if pattern.match(filename): return self.path_join(path, filename) # File not found, return the regex full path return _sfile def get_tables_from_schema(self, filename, skip=[]): """ Get tables from schema """ if self.container_name: cmd = f"cat {filename}" res = self.exec_cmd(cmd, timeout=None, foreground=True, container=self.container_name) if res['status'] != 0: self._log_error("Could not retrieve DB schema file from " f"container {self.container_name}") return None try: db_schema = json.loads(res['output']) except Exception: # pylint: disable=broad-except self._log_error(f"Cannot parse JSON file {filename}") return None else: try: fname = self.path_join(filename) with open(fname, 'r', encoding='UTF-8') as file: try: db_schema = json.load(file) except Exception: # pylint: disable=broad-except self._log_error(f"Cannot parse JSON file {filename}") return None except IOError as ex: self._log_error( f"Could not open DB schema file {filename}: {ex}") return None try: return [table for table in dict.keys( db_schema['tables']) if table not in skip] except AttributeError: self._log_error(f"DB schema {filename} has no 'tables' key") return None def add_database_output(self, tables, ovn_cmd): """ Collect OVN database output """ if tables: return [f"{ovn_cmd} list {table}" for table in tables] return None def setup(self): # check if env is a clustered or non-clustered one if self.container_exists(self.containers[1]): self.container_name = self.get_container_by_name( self.containers[1]) else: self.container_name = self.get_container_by_name( self.containers[0]) ovs_rundir = os.environ.get('OVS_RUNDIR') for pidfile in ['ovnnb_db.pid', 'ovnsb_db.pid', 'ovn-northd.pid']: self.add_copy_spec([ self.path_join('/var/lib/openvswitch/ovn', pidfile), self.path_join('/usr/local/var/run/openvswitch', pidfile), self.path_join('/run/openvswitch/', pidfile), self.path_join('/var/snap/microovn/common/run/ovn', pidfile), ]) if ovs_rundir: self.add_copy_spec(self.path_join(ovs_rundir, pidfile)) if self.get_option("all_logs"): self.add_copy_spec("/var/log/ovn/") else: self.add_copy_spec("/var/log/ovn/*.log") ovn_controller_socket = self._find_sock( self.ovn_socket, self.ovn_controller_sock_regex) northd_socket = self._find_sock(self.ovn_socket, self.ovn_northd_sock_regex) # ovsdb nb/sb cluster status commands cs = "cluster/status" cmds = [] pfx = self.pfx appctl_cmds = [ f"{pfx}ovs-appctl -t {self.ovn_nbdb_socket} {cs} OVN_Northbound", f"{pfx}ovs-appctl -t {self.ovn_sbdb_socket} {cs} OVN_Southbound", f"{pfx}ovn-appctl -t {northd_socket} status", f"{pfx}ovn-appctl -t {ovn_controller_socket} connection-status", ] self.add_cmd_output(appctl_cmds, foreground=True, container=self.container_name, timeout=30) # MicroOVN currently does not support this if not pfx: dfl = "debug/chassis-features-list" self.add_cmd_output(f"{pfx}ovn-appctl -t {northd_socket} {dfl}", foreground=True, container=self.container_name, timeout=30) # Some user-friendly versions of DB output nolo = "--no-leader-only" nbctl_cmds = [ f"{pfx}ovn-nbctl {nolo} show", f"{pfx}ovn-nbctl {nolo} get-ssl", f"{pfx}ovn-nbctl {nolo} get-connection", ] self.add_cmd_output(nbctl_cmds, foreground=True, container=self.container_name, timeout=30) sbctl_cmds = [ f"{pfx}ovn-sbctl {nolo} show", f"{pfx}ovn-sbctl {nolo} lflow-list", f"{pfx}ovn-sbctl {nolo} get-ssl", f"{pfx}ovn-sbctl {nolo} get-connection", ] self.add_cmd_output(sbctl_cmds, foreground=True, container=self.container_name, timeout=30) # backward compatibility for path in ['/usr/share/openvswitch', '/usr/share/ovn', '/snap/microovn/current/share/ovn']: if self.path_exists(self.path_join(path, 'ovn-nb.ovsschema')): nb_tables = self.get_tables_from_schema(self.path_join( path, 'ovn-nb.ovsschema')) cmds.extend(self.add_database_output(nb_tables, f"{pfx}ovn-nbctl {nolo}")) for path in ['/usr/share/openvswitch', '/usr/share/ovn', '/snap/microovn/current/share/ovn']: if self.path_exists(self.path_join(path, 'ovn-sb.ovsschema')): sb_tables = self.get_tables_from_schema(self.path_join( path, 'ovn-sb.ovsschema'), ['Logical_Flow']) cmds.extend(self.add_database_output(sb_tables, f"{pfx}ovn-sbctl {nolo}")) # If OVN is containerized, we need to run the above commands inside # the container. Removing duplicates (in case there are) to avoid # failing on collecting output to file on container running commands cmds = list(set(cmds)) self.add_cmd_output( cmds, foreground=True, container=self.container_name ) # Collect Certificate Validity Dates for path in ['/etc/ovn/ovn-central.crt', '/etc/ovn/cert_host']: if self.path_exists(path): self.add_cmd_output( f"openssl x509 -in {path} -noout -dates" ) self.add_copy_spec("/etc/sysconfig/ovn-northd") # Collect Northd DB Parameters self.add_copy_spec('/etc/ovn/ovn-northd-db-params.conf') ovs_dbdir = os.environ.get('OVS_DBDIR') for dbfile in ["ovnnb_db.db", "ovnsb_db.db"]: for path in [ "/var/lib/openvswitch/ovn", "/usr/local/etc/openvswitch", "/etc/openvswitch", "/var/lib/openvswitch", "/var/lib/ovn/etc", "/var/lib/ovn", "/var/snap/microovn/common/data/central/db", ]: dbfilepath = self.path_join(path, dbfile) if self.path_exists(dbfilepath): self.add_copy_spec(dbfilepath) self.add_dir_listing(dbfilepath) if ovs_dbdir: self.add_copy_spec(self.path_join(ovs_dbdir, dbfile)) self.add_journal(units="ovn-northd") class RedHatOVNCentral(OVNCentral, RedHatPlugin): packages = ('openvswitch-ovn-central', 'ovn.*-central', ) ovn_nbdb_socket = '/var/run/openvswitch/ovnnb_db.ctl' ovn_sbdb_socket = '/var/run/openvswitch/ovnsb_db.ctl' ovn_socket = '/var/run/openvswitch' ovn_controller_sock_regex = 'ovn-controller.*.ctl' ovn_northd_sock_regex = 'ovn-northd.*.ctl' class DebianOVNCentral(OVNCentral, DebianPlugin, UbuntuPlugin): packages = ('ovn-central', 'microovn', ) def setup(self): if self.path_exists('/snap/bin/microovn'): self.ovn_socket = '/var/snap/microovn/common/run/ovn' self.ovn_nbdb_socket = f"{self.ovn_socket}/ovnnb_db.ctl" self.ovn_sbdb_socket = f"{self.ovn_socket}/ovnsb_db.ctl" self.pfx = 'microovn.' else: self.ovn_socket = '/var/run/ovn' self.ovn_nbdb_socket = '/var/run/ovn/ovnnb_db.ctl' self.ovn_sbdb_socket = '/var/run/ovn/ovnsb_db.ctl' super().setup() ovn_controller_sock_regex = 'ovn-controller.*.ctl' ovn_northd_sock_regex = 'ovn-northd.*.ctl'
[+]
..
[-] freeipmi.py
[edit]
[-] chrony.py
[edit]
[-] crio.py
[edit]
[-] multipath.py
[edit]
[-] cman.py
[edit]
[-] lxd.py
[edit]
[-] xdp.py
[edit]
[-] monit.py
[edit]
[-] rabbitmq.py
[edit]
[-] ssh.py
[edit]
[-] cockpit.py
[edit]
[-] ctdb.py
[edit]
[-] omsa.py
[edit]
[-] named.py
[edit]
[-] ceph_mds.py
[edit]
[-] fibrechannel.py
[edit]
[-] openstack_database.py
[edit]
[-] oddjob.py
[edit]
[-] rhui_containerized.py
[edit]
[-] container_log.py
[edit]
[-] postgresql.py
[edit]
[-] tigervnc.py
[edit]
[-] krb5.py
[edit]
[-] drbd.py
[edit]
[-] procenv.py
[edit]
[-] zfs.py
[edit]
[-] kubernetes.py
[edit]
[-] rpmostree.py
[edit]
[-] wireless.py
[edit]
[-] veritas.py
[edit]
[-] s390.py
[edit]
[-] kvm.py
[edit]
[-] udev.py
[edit]
[-] nis.py
[edit]
[-] canonical_livepatch_onprem.py
[edit]
[-] hpssm.py
[edit]
[-] boom.py
[edit]
[-] foreman.py
[edit]
[-] firewalld.py
[edit]
[-] ovirt.py
[edit]
[-] ubuntu.py
[edit]
[-] redis.py
[edit]
[-] aap_containerized.py
[edit]
[-] openstack_masakarimonitors.py
[edit]
[-] console.py
[edit]
[-] sas3ircu.py
[edit]
[-] ebpf.py
[edit]
[-] kernel.py
[edit]
[-] openstack_ironic.py
[edit]
[-] ostree.py
[edit]
[-] charmed_mysql.py
[edit]
[-] system.py
[edit]
[-] salt.py
[edit]
[-] ceph_mon.py
[edit]
[-] validation_framework.py
[edit]
[-] ppp.py
[edit]
[-] md.py
[edit]
[-] docker.py
[edit]
[-] ldap.py
[edit]
[-] kpatch.py
[edit]
[-] valkey.py
[edit]
[-] gluster.py
[edit]
[-] microovn.py
[edit]
[-] nodejs.py
[edit]
[-] shmcli.py
[edit]
[-] openstack_heat.py
[edit]
[-] azure.py
[edit]
[-] teamd.py
[edit]
[-] mellanox_firmware.py
[edit]
[-] kdump.py
[edit]
[-] openstack_sahara.py
[edit]
[-] navicli.py
[edit]
[-] opendaylight.py
[edit]
[-] microcloud.py
[edit]
[-] udisks.py
[edit]
[-] ovirt_hosted_engine.py
[edit]
[-] dhcp.py
[edit]
[-] lustre.py
[edit]
[-] kimchi.py
[edit]
[-] tftpserver.py
[edit]
[-] dovecot.py
[edit]
[-] mvcli.py
[edit]
[-] foreman_installer.py
[edit]
[-] cobbler.py
[edit]
[-] microshift.py
[edit]
[-] opensearch.py
[edit]
[-] snapm.py
[edit]
[-] ceph_common.py
[edit]
[-] pulpcore.py
[edit]
[-] charmed_postgresql.py
[edit]
[-] etcd.py
[edit]
[-] openvswitch.py
[edit]
[-] rhui.py
[edit]
[-] openstack_horizon.py
[edit]
[-] skydive.py
[edit]
[-] nvmetcli.py
[edit]
[-] bird.py
[edit]
[-] oratab.py
[edit]
[-] rhcos.py
[edit]
[-] symcli.py
[edit]
[-] seagate_ses.py
[edit]
[-] openstack_instack.py
[edit]
[-] npm.py
[edit]
[-] ntb.py
[edit]
[-] openstack_edpm.py
[edit]
[-] smclient.py
[edit]
[-] ovn_host.py
[edit]
[-] cifs.py
[edit]
[-] boot.py
[edit]
[-] devices.py
[edit]
[-] unity.py
[edit]
[-] systemtap.py
[edit]
[-] rhc.py
[edit]
[-] firewall_tables.py
[edit]
[-] omnipath_manager.py
[edit]
[-] systemd.py
[edit]
[-] ovirt_imageio.py
[edit]
[-] dracut.py
[edit]
[-] snap.py
[edit]
[-] mysql.py
[edit]
[-] ultrapath.py
[edit]
[-] cs.py
[edit]
[-] autofs.py
[edit]
[-] date.py
[edit]
[-] ceph_osd.py
[edit]
[-] xen.py
[edit]
[-] stratis.py
[edit]
[-] slurm.py
[edit]
[-] sudo.py
[edit]
[-] pam.py
[edit]
[-] openstack_neutron.py
[edit]
[-] perccli2.py
[edit]
[-] vhostmd.py
[edit]
[-] perccli.py
[edit]
[-] rasdaemon.py
[edit]
[-] snapper.py
[edit]
[-] landscape.py
[edit]
[-] pci.py
[edit]
[-] libvirt.py
[edit]
[-] squid.py
[edit]
[-] activemq.py
[edit]
[-] apport.py
[edit]
[-] opencl.py
[edit]
[-] nfsganesha.py
[edit]
[-] rhv_analyzer.py
[edit]
[-] hts.py
[edit]
[-] ceph_mgr.py
[edit]
[-] grafana.py
[edit]
[-] manageiq.py
[edit]
[-] sos_extras.py
[edit]
[-] filesys.py
[edit]
[-] subscription_manager.py
[edit]
[-] mpt.py
[edit]
[-] aap_hub.py
[edit]
[-] microk8s.py
[edit]
[-] openstack_aodh.py
[edit]
[-] openstack_ansible.py
[edit]
[-] sunbeam.py
[edit]
[-] rpm.py
[edit]
[-] openstack_barbican.py
[edit]
[-] snmp.py
[edit]
[-] anaconda.py
[edit]
[-] unpackaged.py
[edit]
[-] ceph_ansible.py
[edit]
[-] telegraf.py
[edit]
[-] ruby.py
[edit]
[-] __init__.py
[edit]
[-] xinetd.py
[edit]
[-] smartcard.py
[edit]
[-] jars.py
[edit]
[-] watchdog.py
[edit]
[-] collectd.py
[edit]
[-] dlm.py
[edit]
[-] infinidat.py
[edit]
[-] apache.py
[edit]
[-] os_net_config.py
[edit]
[-] ipvs.py
[edit]
[-] arcconf.py
[edit]
[-] services.py
[edit]
[-] block.py
[edit]
[-] openssl.py
[edit]
[-] sar.py
[edit]
[-] nss.py
[edit]
[-] saltmaster.py
[edit]
[-] processor.py
[edit]
[-] megacli.py
[edit]
[-] ufw.py
[edit]
[-] curtin.py
[edit]
[-] foreman_proxy.py
[edit]
[-] ansible.py
[edit]
[-] vulkan.py
[edit]
[-] pulseaudio.py
[edit]
[-] distupgrade.py
[edit]
[-] powerpc.py
[edit]
[-] btrfs.py
[edit]
[-] composer.py
[edit]
[-] sunbeam_hypervisor.py
[edit]
[-] fail2ban.py
[edit]
[-] x11.py
[edit]
[-] convert2rhel.py
[edit]
[-] openstack_masakari.py
[edit]
[-] apparmor.py
[edit]
[-] mongodb.py
[edit]
[-] openstack_nova.py
[edit]
[-] openstack_cinder.py
[edit]
[-] spyre.py
[edit]
[-] collectl.py
[edit]
[-] anacron.py
[edit]
[-] tomcat.py
[edit]
[-] conntrack.py
[edit]
[-] juju.py
[edit]
[-] ovirt_node.py
[edit]
[-] sendmail.py
[edit]
[-] i18n.py
[edit]
[-] proxmox.py
[edit]
[-] nfs.py
[edit]
[-] login.py
[edit]
[-] postfix.py
[edit]
[-] containerd.py
[edit]
[-] lvm2.py
[edit]
[-] ptp.py
[edit]
[-] apt.py
[edit]
[-] aap_receptor.py
[edit]
[-] usbguard.py
[edit]
[-] python.py
[edit]
[-] ovirt_provider_ovn.py
[edit]
[-] grub2.py
[edit]
[-] iscsi.py
[edit]
[-] dbus.py
[edit]
[-] ceph_iscsi.py
[edit]
[-] radius.py
[edit]
[-] aide.py
[edit]
[-] cxl.py
[edit]
[-] ds.py
[edit]
[-] sanlock.py
[edit]
[-] openstack_octavia.py
[edit]
[-] loki.py
[edit]
[-] pcp.py
[edit]
[-] opencontrail.py
[edit]
[-] sysvipc.py
[edit]
[-] vdo.py
[edit]
[-] dnf.py
[edit]
[-] mssql.py
[edit]
[-] acpid.py
[edit]
[-] process.py
[edit]
[-] pmem.py
[edit]
[-] kafka.py
[edit]
[-] openhpi.py
[edit]
[-] dpkg.py
[edit]
[-] hpasm.py
[edit]
[-] podman.py
[edit]
[-] targetcli.py
[edit]
[-] omnipath_client.py
[edit]
[-] containers_common.py
[edit]
[-] lilo.py
[edit]
[-] hyperv.py
[edit]
[-] selinux.py
[edit]
[-] ntp.py
[edit]
[-] zvm.py
[edit]
[-] openstack_tripleo.py
[edit]
[-] lightdm.py
[edit]
[-] cgroups.py
[edit]
[-] opensvc.py
[edit]
[-] origin.py
[edit]
[-] kernelrt.py
[edit]
[-] cups.py
[edit]
[-] coredump.py
[edit]
[-] fwupd.py
[edit]
[-] auditd.py
[edit]
[-] peripety.py
[edit]
[-] grub.py
[edit]
[-] libreswan.py
[edit]
[-] saphana.py
[edit]
[-] nvme.py
[edit]
[-] gssproxy.py
[edit]
[-] nvidia.py
[edit]
[-] openstack_keystone.py
[edit]
[-] greenboot.py
[edit]
[-] bcache.py
[edit]
[-] host.py
[edit]
[-] canonical_livepatch.py
[edit]
[-] qt.py
[edit]
[-] haproxy.py
[edit]
[-] keepalived.py
[edit]
[-] nscd.py
[edit]
[-] dellrac.py
[edit]
[-] virtwho.py
[edit]
[-] flatpak.py
[edit]
[-] helm.py
[edit]
[-] java.py
[edit]
[-] rear.py
[edit]
[-] numa.py
[edit]
[-] ovirt_engine_backup.py
[edit]
[-] storageconsole.py
[edit]
[-] ipmitool.py
[edit]
[-] qpid_dispatch.py
[edit]
[-] gdm.py
[edit]
[-] microshift_ovn.py
[edit]
[-] libraries.py
[edit]
[-] kata_containers.py
[edit]
[-] gfs2.py
[edit]
[-] xfs.py
[edit]
[-] openstack_placement.py
[edit]
[-] hardware.py
[edit]
[-] dmraid.py
[edit]
[-] cloud_init.py
[edit]
[-] memory.py
[edit]
[-] fcoe.py
[edit]
[-] puppet.py
[edit]
[-] openstack_designate.py
[edit]
[-] elastic.py
[edit]
[-] ceph_rgw.py
[edit]
[-] psacct.py
[edit]
[-] migration_results.py
[edit]
[-] virsh.py
[edit]
[-] logrotate.py
[edit]
[-] devicemapper.py
[edit]
[-] release.py
[edit]
[-] storcli.py
[edit]
[-] openstack_manila.py
[edit]
[-] openshift_ovn.py
[edit]
[-] sssd.py
[edit]
[-] docker_distribution.py
[edit]
[-] quagga.py
[edit]
[-] openstack_ceilometer.py
[edit]
[-] vsftpd.py
[edit]
[-] maas.py
[edit]
[-] alternatives.py
[edit]
[-] instructlab.py
[edit]
[-] vmware.py
[edit]
[-] aap_gateway.py
[edit]
[-] foreman_openscap.py
[edit]
[-] qaucli.py
[edit]
[-] cron.py
[edit]
[-] logs.py
[edit]
[-] iscsitarget.py
[edit]
[-] candlepin.py
[edit]
[-] openstack_novajoin.py
[edit]
[-] pulp.py
[edit]
[-] infiniband.py
[edit]
[-] openshift.py
[edit]
[-] clear_containers.py
[edit]
[-] soundcard.py
[edit]
[-] openstack_gnocchi.py
[edit]
[-] ipa.py
[edit]
[-] perl.py
[edit]
[-] bootc.py
[edit]
[-] authd.py
[edit]
[-] ssmtp.py
[edit]
[-] openstack_mistral.py
[edit]
[+]
__pycache__
[-] qpid.py
[edit]
[-] openstack_swift.py
[edit]
[-] aws.py
[edit]
[-] memcached.py
[edit]
[-] vectordev.py
[edit]
[-] ata.py
[edit]
[-] iprconfig.py
[edit]
[-] networking.py
[edit]
[-] usb.py
[edit]
[-] insights.py
[edit]
[-] aap_controller.py
[edit]
[-] tuned.py
[edit]
[-] corosync.py
[edit]
[-] scsi.py
[edit]
[-] gluster_block.py
[edit]
[-] sapnw.py
[edit]
[-] samba.py
[edit]
[-] gcp.py
[edit]
[-] keyutils.py
[edit]
[-] vault.py
[edit]
[-] buildah.py
[edit]
[-] crypto.py
[edit]
[-] kea.py
[edit]
[-] openstack_glance.py
[edit]
[-] nginx.py
[edit]
[-] frr.py
[edit]
[-] aap_eda.py
[edit]
[-] sunrpc.py
[edit]
[-] fapolicyd.py
[edit]
[-] ovn_central.py
[edit]
[-] tpm2.py
[edit]
[-] sedutil.py
[edit]
[-] opengl.py
[edit]
[-] discovery.py
[edit]
[-] openstack_trove.py
[edit]
[-] lstopo.py
[edit]
[-] pacemaker.py
[edit]
[-] leapp.py
[edit]
[-] vdsm.py
[edit]
[-] unbound.py
[edit]
[-] networkmanager.py
[edit]
[-] powerpath.py
[edit]
[-] abrt.py
[edit]