Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if QM is installed #532

Closed
wants to merge 4 commits into from
Closed

Check if QM is installed #532

wants to merge 4 commits into from

Conversation

nsednev
Copy link
Collaborator

@nsednev nsednev commented Sep 2, 2024

This is a patch for set-ffi-env-e2e forth to #521 .
It checks if the QM rpm package was installed on host.

@@ -261,13 +261,15 @@ fi
echo
info_message "Checking if QM already installed"
info_message "=============================="
QM_INST="$(rpm -qa qm)"
QM_STATUS="$(systemctl is-enabled qm 2>&1)"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When qm is not installed in the environment, error will occur when running to this line

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you like to add only an error message here or also to exit the tool if the QM is not installed
?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When qm is not installed, set-ffi-env-e2e should run to install it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rpm -qa will provide details of package which may not what we want in this case, let's go simple, just use -q.
How about, test the following:

# Check if qm package is installed
if rpm -q qm &>/dev/null; then
    # Check the status of the qm service
    QM_STATUS="$(systemctl is-enabled qm 2>&1)"

Copy link
Collaborator Author

@nsednev nsednev Sep 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took the VM without QM, running auto-osbuild-qemu-autosd9-minimal-ostree-x86_64-1437090712.02176fac image.
Tried to run one of my tests that requires set-ffi-env-e2e and I saw that its fine now:

First I validated that on the tested VM there is no QM installed:
[root@localhost ~]# rpm -q qm
package qm is not installed

As the result, there was no podman package as well on the DUT (device under test).

Then I ran one of the tests using tmt before suggested change (with current patch):
tmt run -a -vvv --debug execute provision --how connect -u root -g tests --name qm_nested
multihost name: default-0
arch: x86_64
distro: Automotive Stream Distribution 9
kernel: 5.14.0-500.450.el9iv.x86_64
package manager: rpm-ostree
selinux: yes
is superuser: yes

    summary: 1 guest provisioned
prepare
workdir: /var/tmp/tmt/run-001/plans/e2e/ffi/prepare
    queued push task #1: push to default-0
    
    push task #1: push to default-0
Push workdir to guest '18.191.21.105'.

    queued prepare task #1: Install podman on default-0
    queued prepare task #2: requires on default-0
    
    prepare task #1: Install podman on default-0
    how: install
    name: Install podman
    order: 20
    Execute command 'export CONTROL_CONTAINER_NAME=host; export TMT_PLAN_DATA=/var/tmp/tmt/run-001/plans/e2e/ffi/data; export TMT_PLAN_ENVIRONMENT_FILE=/var/tmp/tmt/run-001/plans/e2e/ffi/data/variables.env; export TMT_TREE=/var/tmp/tmt/run-001/plans/e2e/ffi/tree; export TMT_VERSION=1.35.0; rpm -q --whatprovides podman' on guest '18.191.21.105'.
        cmd: rpm -q --whatprovides podman
        out: no package provides podman
    package: 1 package requested
        podman
    Execute command 'export CONTROL_CONTAINER_NAME=host; export TMT_PLAN_DATA=/var/tmp/tmt/run-001/plans/e2e/ffi/data; export TMT_PLAN_ENVIRONMENT_FILE=/var/tmp/tmt/run-001/plans/e2e/ffi/data/variables.env; export TMT_TREE=/var/tmp/tmt/run-001/plans/e2e/ffi/tree; export TMT_VERSION=1.35.0; rpm -q --whatprovides podman || rpm-ostree install --apply-live --idempotent --allow-inactive  podman' on guest '18.191.21.105'.
        cmd: rpm -q --whatprovides podman || rpm-ostree install --apply-live --idempotent --allow-inactive  podman
        out: no package provides podman
        err: notice: auto-inferring -y/--assumeyes when not run interactively; this will change in the future
        out: Checking out tree 218334c...done
        out: Enabled rpm-md repositories: baseos appstream autosd extras-common
        out: Updating metadata for 'baseos'...done
        out: Updating metadata for 'appstream'...done
        out: Updating metadata for 'autosd'...done
        out: Updating metadata for 'extras-common'...done
        out: Importing rpm-md...done
        out: rpm-md repo 'baseos'; generated: 2024-09-02T14:56:42Z solvables: 4455
        out: rpm-md repo 'appstream'; generated: 2024-09-02T14:59:05Z solvables: 16992
        out: rpm-md repo 'autosd'; generated: 2024-09-03T02:37:15Z solvables: 6788
        out: rpm-md repo 'extras-common'; generated: 2024-08-06T11:03:43Z solvables: 93
        out: Resolving dependencies...done
        out: Will download: 20 packages (24.3?MB)
        out: Downloading from 'autosd'...done
        out: Importing packages...done
        out: Checking out packages...done
        out: Running pre scripts...done
        out: Running post scripts...done
        out: Running posttrans scripts...done
        out: Writing rpmdb...done
        out: Writing OSTree commit...done
        out: Staging deployment...done
        out: Computing /etc diff to preserve...done
        out: Updating /usr...done
        err: error: Changed directories are not supported yet
    fail: Command 'rpm -q --whatprovides podman || rpm-ostree install --apply-live --idempotent --allow-inactive  podman' returned 1.
finish
workdir: /var/tmp/tmt/run-001/plans/e2e/ffi/finish

    Doing nothing to remove guest '18.191.21.105'.
Prune '/plans/e2e/ffi' plan workdir '/var/tmp/tmt/run-001/plans/e2e/ffi'.
    Workdir '/var/tmp/tmt/run-001/plans/e2e/ffi/provision/default-0' already exists.
    Workdir '/var/tmp/tmt/run-001/plans/e2e/ffi/prepare/Install-podman' created.
    Workdir '/var/tmp/tmt/run-001/plans/e2e/ffi/prepare/requires' created.
    Workdir '/var/tmp/tmt/run-001/plans/e2e/ffi/execute/default-0' created.
    Workdir '/var/tmp/tmt/run-001/plans/e2e/ffi/report/default-0' created.
    summary: 0 tasks completed

plan failed

I clearly saw that one of the messages was:
cmd: rpm -q --whatprovides podman
out: no package provides podman
package: 1 package requested
podman
So QM=podman and if no podman then no QM too.

In the end it failed.
On DUT I see that package failed to get installed:
[root@localhost ~]# rpm -q qm
package qm is not installed
[root@localhost ~]# rpm -q podman
package podman is not installed
[root@localhost ~]#

I assume that this is caused by the image auto-osbuild-qemu-autosd9-minimal-ostree-x86_64-1437090712.02176fac being an OStree.
I'm not sure that this will happen or regular image.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plan failed

The exception was caused by 1 earlier exceptions

Cause number 1:

prepare step failed

The exception was caused by 1 earlier exceptions

Cause number 1:

    Command 'rpm -q --whatprovides podman || rpm-ostree install --apply-live --idempotent --allow-inactive  podman' returned 1.

    stdout (25 lines)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    no package provides podman
    Checking out tree 218334c...done
    Enabled rpm-md repositories: baseos appstream autosd extras-common
    Updating metadata for 'baseos'...done
    Updating metadata for 'appstream'...done
    Updating metadata for 'autosd'...done
    Updating metadata for 'extras-common'...done
    Importing rpm-md...done
    rpm-md repo 'baseos'; generated: 2024-09-02T14:56:42Z solvables: 4455
    rpm-md repo 'appstream'; generated: 2024-09-02T14:59:05Z solvables: 16992
    rpm-md repo 'autosd'; generated: 2024-09-03T02:37:15Z solvables: 6788
    rpm-md repo 'extras-common'; generated: 2024-08-06T11:03:43Z solvables: 93
    Resolving dependencies...done
    Will download: 20 packages (24.3?MB)
    Downloading from 'autosd'...done
    Importing packages...done
    Checking out packages...done
    Running pre scripts...done
    Running post scripts...done
    Running posttrans scripts...done
    Writing rpmdb...done
    Writing OSTree commit...done
    Staging deployment...done
    Computing /etc diff to preserve...done
    Updating /usr...done
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    stderr (2 lines)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    notice: auto-inferring -y/--assumeyes when not run interactively; this will change in the future
    error: Changed directories are not supported yet
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@nsednev
Copy link
Collaborator Author

nsednev commented Sep 4, 2024

Just for the notice, I still see the original issue on TC if tested against an OStree image, after running one of my tests, using modified set-ffi-env-e2e:
I've tested it against auto-osbuild-qemu-rhivos9-qa-ostree-aarch64-9303125.f01a7a84 image.

   + info_message ==============================
    + '[' -z ============================== ']'
    + BLUE='\033[94m'
    + ENDCOLOR='\033[0m'
    + echo -e '[ \033[94mINFO\033[0m  ] =============================='
    ++ rpm -qa qm
    + QM_INST=
    ++ systemctl is-enabled qm
    + QM_STATUS='Failed to get unit file state for qm.service: No such file or directory'
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---^---^---^---^---^---

testing-farm:centos-stream-9-x86_64:e2e-ffi still shows:
/tests/ffi/qm-oom-score-adj

WARN[0010] StopSignal SIGTERM failed to stop container ffi-qm in 10 seconds, resorting to SIGKILL
Deleted: 2477d71ac8f1ce834221178bbe0a3526ef93dbc7d89518d6a6ce757cb8e2ca39
Trying to pull quay.io/centos-sig-automotive/ffi-tools:latest...
Getting image source signatures
Copying blob sha256:364b7f4a78417c35ed3d5f4785cbe2b34f4f1f552a7e01655c1c9c5f7b6e5f61
Copying blob sha256:4ca947be8ae2828258086eb666acaac2516cdbca60a8107cb6badb276a65e981
Copying config sha256:2477d71ac8f1ce834221178bbe0a3526ef93dbc7d89518d6a6ce757cb8e2ca39
Writing manifest to image destination
2477d71ac8f1ce834221178bbe0a3526ef93dbc7d89518d6a6ce757cb8e2ca39
Getting image source signatures
Copying blob sha256:7555554ffea12f2e51f0dcf41e89523f58f790697442872907f9c2b6955e9ea2
Copying blob sha256:313b79904146885ddf6ce5104fc71cc7e081bfec070a48e3618fac00b6671127
Copying config sha256:2477d71ac8f1ce834221178bbe0a3526ef93dbc7d89518d6a6ce757cb8e2ca39
Writing manifest to image destination
Untagged: quay.io/centos-sig-automotive/ffi-tools:latest
Deleted: 2477d71ac8f1ce834221178bbe0a3526ef93dbc7d89518d6a6ce757cb8e2ca39
Getting image source signatures
Writing manifest to image destination
Error: OCI runtime error: crun: the requested cgroup controller pids is not available
Retrieved QM_PID: 26154
Retrieved QM_FFI_PID: 0
Retrieved QM_OOM_SCORE_ADJ: '500'
Retrieved QM_FFI_OOM_SCORE_ADJ: '/bin/bash: line 1: /proc/0/oom_score_adj: No such file or directory
'
PASS: qm.container oom_score_adj value == 500
./test.sh: line 91: [[: /bin/bash: line 1: /proc/0/oom_score_adj: No such file or directory
: syntax error: operand expected (error token is "/bin/bash: line 1: /proc/0/oom_score_adj: No such file or directory
")
FAIL: qm containers oom_score_adj != 750. Current value is '/bin/bash: line 1: /proc/0/oom_score_adj: No such file or directory
'
Shared connection to 18.117.235.104 closed.

@dougsland
Copy link
Collaborator

dougsland commented Sep 4, 2024

Can you close this one and open again in a fresh rebase? You will have a clean and green CI/CD.
@nsednev

@nsednev nsednev closed this Sep 5, 2024
@nsednev
Copy link
Collaborator Author

nsednev commented Sep 5, 2024

Rebased to #537

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants