Bug 1835719

Summary: [RFE] support showing parsed configuration
Product: [oVirt] ovirt-imageio Reporter: Yedidyah Bar David <didi>
Component: DaemonAssignee: Nir Soffer <nsoffer>
Status: CLOSED CURRENTRELEASE QA Contact: Petr Kubica <pkubica>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: ---CC: aefrat, bugs, nsoffer, royoung, tnisan
Target Milestone: ovirt-4.4.1Flags: sbonazzo: ovirt-4.4?
aefrat: planning_ack?
aefrat: devel_ack?
aefrat: testing_ack+
Target Release: 2.0.7   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovirt-imageio-2.0.7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-07-08 08:25:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Storage RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Yedidyah Bar David 2020-05-14 11:43:49 UTC
Description of problem:

With drop-in configuration directory support, it's useful to be able to see what the daemon actually uses, by adding an option to dump that after parsing.

See also bug 1826679.

Comment 1 Nir Soffer 2020-05-14 13:40:22 UTC
This is a great idea solving several problems at once:

- Debugging configuration on user machine - we can ask to provide the
  output of "ovirt-imageio --show-config".

- Other programs like vdsm and engine can have access to ovirt-imageio
  configuration without implementing configuration file lookup and parsing.

Here are some examples of the new feature:


## Output on host:

$ ovirt-imageio --show-config
{
    "control": {
        "port": -1,
        "socket": "/run/ovirt-imageio/sock",
        "transport": "unix"
    },
    "daemon": {
        "buffer_size": 8388608,
        "drop_privileges": true,
        "group_name": "ovirtimg",
        "poll_interval": 1.0,
        "run_dir": "/run/ovirt-imageio",
        "user_name": "ovirtimg"
    },
    "formatter_long": {
        "format": "%(asctime)s %(levelname)-7s (%(threadName)s) [%(name)s] %(message)s"
    },
    "formatters": {
        "keys": "long"
    },
    "handler_logfile": {
        "args": "(\"/var/log/ovirt-imageio/daemon.log\",)",
        "formatter": "long",
        "class": "logging.handlers.RotatingFileHandler",
        "kwargs": "{\"maxBytes\": 20971520, \"backupCount\": 10}",
        "level": "DEBUG"
    },
    "handler_stderr": {
        "formatter": "long",
        "class": "logging.StreamHandler",
        "level": "DEBUG"
    },
    "handlers": {
        "keys": "logfile"
    },
    "local": {
        "enable": true,
        "socket": "\u0000/org/ovirt/imageio"
    },
    "logger_root": {
        "handlers": "logfile",
        "level": "INFO",
        "propagate": 0
    },
    "loggers": {
        "keys": "root"
    },
    "profile": {
        "filename": "/run/ovirt-imageio/profile"
    },
    "remote": {
        "host": "",
        "port": 54322
    },
    "tls": {
        "ca_file": "/etc/pki/vdsm/certs/cacert.pem",
        "cert_file": "/etc/pki/vdsm/certs/vdsmcert.pem",
        "enable": true,
        "enable_tls1_1": false,
        "key_file": "/etc/pki/vdsm/keys/vdsmkey.pem"
    }
}


## Output on engine

$ ovirt-imageio --show-config
{
    "control": {
        "port": 54324,
        "socket": "/run/ovirt-imageio/sock",
        "transport": "tcp"
    },
    "daemon": {
        "buffer_size": 8388608,
        "drop_privileges": true,
        "group_name": "ovirtimg",
        "poll_interval": 1.0,
        "run_dir": "/run/ovirt-imageio",
        "user_name": "ovirtimg"
    },
    "formatter_long": {
        "format": "%(asctime)s %(levelname)-7s (%(threadName)s) [%(name)s] %(message)s"
    },
    "formatters": {
        "keys": "long"
    },
    "handler_logfile": {
        "args": "(\"/var/log/ovirt-imageio/daemon.log\",)",
        "formatter": "long",
        "class": "logging.handlers.RotatingFileHandler",
        "kwargs": "{\"maxBytes\": 20971520, \"backupCount\": 10}",
        "level": "DEBUG"
    },
    "handler_stderr": {
        "formatter": "long",
        "class": "logging.StreamHandler",
        "level": "DEBUG"
    },
    "handlers": {
        "keys": "logfile"
    },
    "local": {
        "enable": false,
        "socket": "\u0000/org/ovirt/imageio"
    },
    "logger_root": {
        "handlers": "logfile",
        "level": "INFO",
        "propagate": 0
    },
    "loggers": {
        "keys": "root"
    },
    "profile": {
        "filename": "/run/ovirt-imageio/profile"
    },
    "remote": {
        "host": "",
        "port": 54323
    },
    "tls": {
        "ca_file": "/etc/pki/ovirt-engine/apache-ca.pem",
        "cert_file": "/etc/pki/ovirt-engine/certs/apache.cer",
        "enable": true,
        "enable_tls1_1": false,
        "key_file": "/etc/pki/ovirt-engine/keys/apache.key.nopass"
    }
}


## Fetching specific sections or options

$ sudo dnf install jq

$ ovirt-imageio --show-config | jq .control
{
  "port": 54324,
  "socket": "/run/ovirt-imageio/sock",
  "transport": "tcp"
}

$ ovirt-imageio --show-config | jq .control.port
54324

Comment 2 Nir Soffer 2020-05-18 11:42:42 UTC
This is not included in current imageio release (2.0.6). We should move
this to ON_QA when we release 2.0.7.

Comment 3 Petr Kubica 2020-06-25 08:46:29 UTC
Verified in ovirt-imageio-daemon-2.0.8-1.el8ev.x86_64
also checked changing configuration which is correctly reflected in the output

# ovirt-imageio --show-config
{
    "control": {
        "port": 54324,
        "socket": "/run/ovirt-imageio/sock",
        "transport": "tcp"
    },
    "daemon": {
        "buffer_size": 8388608,
        "drop_privileges": true,
        "group_name": "ovirtimg",
        "max_connections": 8,
        "poll_interval": 1.0,
        "run_dir": "/run/ovirt-imageio",
        "user_name": "ovirtimg"
    },
    "formatter_long": {
        "format": "%(asctime)s %(levelname)-7s (%(threadName)s) [%(name)s] %(message)s"
    },
    "formatters": {
        "keys": "long"
    },
    "handler_logfile": {
        "args": "(\"/var/log/ovirt-imageio/daemon.log\",)",
        "formatter": "long",
        "class": "logging.handlers.RotatingFileHandler",
        "kwargs": "{\"maxBytes\": 20971520, \"backupCount\": 10}",
        "level": "DEBUG"
    },
    "handler_stderr": {
        "formatter": "long",
        "class": "logging.StreamHandler",
        "level": "DEBUG"
    },
    "handlers": {
        "keys": "logfile"
    },
    "local": {
        "enable": false,
        "socket": "\u0000/org/ovirt/imageio"
    },
    "logger_root": {
        "handlers": "logfile",
        "level": "INFO",
        "propagate": 0
    },
    "loggers": {
        "keys": "root"
    },
    "profile": {
        "filename": "/run/ovirt-imageio/profile"
    },
    "remote": {
        "host": "::",
        "port": 54323
    },
    "tls": {
        "ca_file": "/etc/pki/ovirt-engine/apache-ca.pem",
        "cert_file": "/etc/pki/ovirt-engine/certs/apache.cer",
        "enable": true,
        "enable_tls1_1": false,
        "key_file": "/etc/pki/ovirt-engine/keys/apache.key.nopass"
    }
}

Comment 4 Sandro Bonazzola 2020-07-08 08:25:56 UTC
This bugzilla is included in oVirt 4.4.1 release, published on July 8th 2020.

Since the problem described in this bug report should be resolved in oVirt 4.4.1 release, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.