Query GUIVM session or GUID from client in GUIVM#217
Conversation
9e32536 to
4c2c78d
Compare
b953a27 to
081836a
Compare
df94a26 to
88935ab
Compare
|
PipelineRetryFailed |
| wait_client_guid(){ | ||
| qube="${1-}" | ||
| if test -z "$qube"; then | ||
| echo "QREXEC_REMOTE_DOMAIN variable needs to be set" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| prefix="/var/run/qubes" | ||
| if test "$in_dom0" = "true"; then | ||
| qrexec_name_sock="$prefix/qrexec.$qube" | ||
| if ! test -L "$qrexec_name_sock"; then | ||
| echo "$0: $qrexec_name_sock not found, domain might be dead" >&2 | ||
| exit 1 | ||
| fi | ||
| qrexec_id_sock="$(readlink -e "$qrexec_name_sock")" | ||
| if test -z "$qrexec_id_sock"; then | ||
| echo "$0: readlink failed for $qrexec_name_sock" >&2 | ||
| exit 1 | ||
| fi | ||
| xid="${qrexec_id_sock##*/qrexec.}" | ||
| guid_running="${qrexec_id_sock%/*}/guid-running.$xid" | ||
| else | ||
| xid="$(qvm-prefs -- "$qube" xid)" | ||
| guid_running="$(readlink -e "$prefix/guid-running.$xid")" | ||
| fi | ||
|
|
||
| while true; do | ||
| if test -f "$guid_running"; then | ||
| break | ||
| fi | ||
|
|
||
| if test "$in_dom0" = "true" && ! test -e "$qrexec_id_sock"; then | ||
| echo "$0: $qrexec_id_sock not found, domain might be dead" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| sleep 0.5 | ||
| done | ||
| exit 0 | ||
| } |
There was a problem hiding this comment.
Hm, VM knows this already, I don't think there is a need to as GUI domain (which may be dom0) about it.
I specifically introduced status file for it: QubesOS/qubes-gui-agent-linux@a981e36
There was a problem hiding this comment.
The code above allows querying GUID of any qube a GUI domain is responsible for. I guess there is no current use case for this (except if notification proxy is not running in GUIVM). For the case of notification-proxy where the service requires the client to have a session. It should be some loop on ExecStartPre= to wait for started, to not break preloaded disposables session startup.
There was a problem hiding this comment.
It should be some loop on
ExecStartPre=to wait forstarted, to not break preloaded disposables session startup.
If necessary at all, then yes, and ideally using inotify, not sleep (if going with shell, then inotifywait -e close_write might be the way to go).
But, there is QubesOS/qubes-notification-proxy#14, which makes the server side wait for the user login, so maybe that's enough already?
There was a problem hiding this comment.
It should be some loop on
ExecStartPre=to wait forstarted, to not break preloaded disposables session startup.If necessary at all, then yes, and ideally using inotify, not sleep (if going with shell, then
inotifywait -e close_writemight be the way to go).
Hum, I thought that for some reason it was necessary, but openqa is succeeding so I guess this is fine.
But, there is QubesOS/qubes-notification-proxy#14, which makes the server side wait for the user login, so maybe that's enough already?
Yes, seems enough. Latest openqa failed installing packages. but edits shows that preload tests were succeeding.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #217 +/- ##
==========================================
- Coverage 78.98% 78.86% -0.12%
==========================================
Files 55 55
Lines 10532 10530 -2
==========================================
- Hits 8319 8305 -14
- Misses 2213 2225 +12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
5dc1b28 to
223f3b5
Compare
|
PipelineRetryFailed |
|
Do you want me to make the version changes in a separate commit to be easily excluded from when you cherry pick? |
Yes, or even drop it completely and just add a note in PR description. |
Behavioral change, as it previously waited for GUID connection to the source qube. For: QubesOS/qubes-notification-proxy#13 For: QubesOS/qubes-gui-agent-linux#251 For: QubesOS/qubes-core-admin#757 For: QubesOS/qubes-issues#1512 For: QubesOS/qubes-issues#9940 Fixes: QubesOS/qubes-issues#10443
223f3b5 to
0dc9006
Compare
/etc/qubes-rpc/qubes.WaitForSession is migrating from core-agent-linux to this repository. See #217 for more details.
Read link to canonical path of GUID file
By default, it resolves the link path literally, which causes problem if other commands do not run on the same directory the link is at.
For: QubesOS/qubes-core-admin#757
For: QubesOS/qubes-notification-proxy#13
For: QubesOS/qubes-issues#9940
For: QubesOS/qubes-issues#1512
Allow GUIVM clients to know if GUIVM has session
Or if GUID of the client can be found on the server. This script will be
replicated to qubes-core-agent-linux.
For: QubesOS/qubes-notification-proxy#13
For: QubesOS/qubes-gui-agent-linux#251
For: QubesOS/qubes-core-admin#757
For: QubesOS/qubes-issues#1512
For: QubesOS/qubes-issues#9940
Fixes: QubesOS/qubes-issues#10443
Test case:
Please note that to avoid package conflicting (having the same file), it has to be handled with "less than version" compared to core-agent-linux
https://github.com/QubesOS/qubes-core-qrexec/compare/223f3b596259adf299988f1171df8572d0204a0c..0dc90060ad27e90487572f0609453b5c564f4be7
See required PR: