Skip to content

Commit

Permalink
Ensure pgrep only picks virt-launcher pid (#182)
Browse files Browse the repository at this point in the history
The must-gather will fails to collect nft rules of virt-launcher pods
 running in the same node where the must-gather is running because it
picks also the `oc exec virt-handler pgrep` pid. This patch ensures
that pgrep only picks virt-launcher pid.

Signed-off-by: Nijin Ashok <nashok@redhat.com>
  • Loading branch information
nijinashok committed Jun 13, 2023
1 parent b1dd8f1 commit c17c923
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion collection-scripts/gather_vms_details
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function get_vm_rule_tables() {

handler=$(/usr/bin/oc get pods -A -l kubevirt.io=virt-handler -o=custom-columns=NAME:.metadata.name --field-selector spec.nodeName="${vmnode}" --no-headers)

pid=$(/usr/bin/oc exec -n "${INSTALLATION_NAMESPACE}" "${handler}" -- /bin/bash -c "pgrep -f 'virt-launcher .*${vmuid}'")
pid=$(/usr/bin/oc exec -n "${INSTALLATION_NAMESPACE}" "${handler}" -- /bin/bash -c "pgrep -f '^/usr/bin/virt-launcher .*${vmuid}'")

if /usr/bin/oc exec -n "${INSTALLATION_NAMESPACE}" "${handler}" -- /bin/bash -c "nft -v" > /dev/null 2>&1; then
/usr/bin/oc exec -n "${INSTALLATION_NAMESPACE}" "${handler}" -- /bin/bash -c "nsenter -t ${pid} -n -- nft list ruleset" 2>/dev/null
Expand Down

0 comments on commit c17c923

Please sign in to comment.