-
-
Notifications
You must be signed in to change notification settings - Fork 82
Check dummy disp properties vs probable template #398
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
Conversation
|
Generally, I don't want more uses of qubes.VMShell instead of qubes.VMExec. The former has a ton of pitfalls related to quoting, newlines, policy, logging etc. qubes.VMShell is used if the command is a single string (which possibly is a shell command) for compatibility but otherwise qubes.VMExec should be preferred. |
|
The issue is This is what It doesn't yet know the template of |
9f78984 to
30566cc
Compare
|
There is another issue: % time qvm-run -p -v --dispvm=default-dvma -- echo hi
Traceback (most recent call last):
File "/usr/bin/qvm-run", line 5, in <module>
sys.exit(main())
~~~~^^
File "/usr/lib/python3.13/site-packages/qubesadmin/tools/qvm_run.py", line 367, in main
else args.app.domains[args.dispvm]
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/usr/lib/python3.13/site-packages/qubesadmin/app.py", line 108, in __getitem__
raise KeyError(item)
KeyError: 'default-dvma'
zsh: exit 1 qvm-run -p -v --dispvm=default-dvma -- echo hiBecause the check is too early, I will move to |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #398 +/- ##
==========================================
+ Coverage 76.16% 76.22% +0.06%
==========================================
Files 53 53
Lines 9304 9352 +48
==========================================
+ Hits 7086 7129 +43
- Misses 2218 2223 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This means that the disposable has to be created when using any method, vmexec or not, so it is possible to check |
This one looks like a typo: |
|
It is a typo on purpose, to show that it raises an exception on absent qube
rather than printing a decent message.
With the latest commit, this is fixed.
…On Thu, Dec 25, 2025, 7:16 PM Marek Marczykowski-Górecki < ***@***.***> wrote:
*marmarek* left a comment (QubesOS/qubes-core-admin-client#398)
<#398 (comment)>
% time qvm-run -p -v --dispvm=default-dvma -- echo hi
This one looks like a typo: default-dvma != default-dvm. Checking
relevant features on default-dvm (or other selected disposable template)
should be enough.
—
Reply to this email directly, view it on GitHub
<#398 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BCE2O4LVGJ7AVQXGZJGLK3T4DQSZHAVCNFSM6AAAAACN67BMZ2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTMOJRGY2TAOBZGA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
But with the latest commit you again beaks usage of standard |
Ugh, right. Another try, overriding the destination on diff --git a/qubesadmin/base.py b/qubesadmin/base.py
index 05e3027..3dd6687 100644
--- a/qubesadmin/base.py
+++ b/qubesadmin/base.py
@@ -73,6 +73,11 @@ class PropertyHolder(object):
dest = self._method_dest
# have the actual implementation at Qubes() instance
if self.app:
+ if dest.startswith("@dispvm"):
+ if dest.startswith("@dispvm:"):
+ dest = dest[len("@dispvm:") :]
+ else:
+ dest = getattr(self.app, "default_dispvm", None)
return self.app.qubesd_call(dest, method, arg, payload,
payload_stream)
raise NotImplementedError
diff --git a/qubesadmin/tools/qvm_run.py b/qubesadmin/tools/qvm_run.py
index 064bc75..449493f 100644
--- a/qubesadmin/tools/qvm_run.py
+++ b/qubesadmin/tools/qvm_run.py
@@ -257,8 +257,6 @@ def run_command_single(args, vm):
args.cmd_args.insert(0, args.cmd)
args.cmd = args.VMNAME
args.VMNAME = None
- if args.dispvm:
- vm.create_disposable()
use_exec = len(args.cmd_args) > 0 or args.no_shell
Running the tests shows that two admin calls that will need to be allowed: For the second call, I tested without a global default_dispvm and the error message is okayish on The first call is getting the Is this ok? |
Not ok, for the dom0 call also.
It may not reflect the truth when redirecting target per service via policy... Out of ideas if the |
|
Note
Well, preloaded disposables are not supposed to be modified, so IMO it's okay to assume they have the same configuration as freshly created disposable. |
Now it is truthful for properties: I don't think features are relevant because:
|
Yes, but also the feature might be checking the wrong template as the policy is not checked if it would redirect the target. From our discussion, the decision was to make something for
Lacking This is why it cannot be the default in |
Yes, probable, we can't know for sure until the policy evaluates the call to @disvpm, which is unfortunately, too late for some things, such as querying properties and features to know how to best approach the call, with GUI or without, with VMExec or VMShell. The check is only done if the disposable class is instantiated asking for such override. By fixing this issue, it is possible to have multiple arguments in qvm-run that target disposables, which will use VMShell. Another bug fixed is an exception raised when attempting to get the GUI settings of the disposable, in case the disposable template name was typed erroneously, introduced in cc9c5f5. $ time qvm-run -p -v --dispvm=unexistent -- echo hi Traceback (most recent call last): File "/usr/bin/qvm-run", line 5, in <module> sys.exit(main()) ~~~~^^ File "/usr/lib/python3.13/site-packages/qubesadmin/tools/qvm_run.py", line 367, in main else args.app.domains[args.dispvm] ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^ File "/usr/lib/python3.13/site-packages/qubesadmin/app.py", line 108, in __getitem__ raise KeyError(item) KeyError: 'unexistent' Fixes: QubesOS/qubes-issues#10383 For: QubesOS/qubes-issues#1512
|
PipelineRetry |
Yes, probable, we can't know for sure until the policy evaluates the
call to @disvpm, which is unfortunately, too late for some things, such
as querying properties and features to know how to best approach the
call, with GUI or without, with VMExec or VMShell.
The check is only done if the disposable class is instantiated asking
for such override. By fixing this issue, it is possible to have multiple
arguments in qvm-run that target disposables, which will use VMShell.
Another bug fixed is an exception raised when attempting to get the GUI
settings of the disposable, in case the disposable template name was
typed erroneously, introduced in
cc9c5f5.
$ time qvm-run -p -v --dispvm=unexistent -- echo hi
Traceback (most recent call last):
File "/usr/bin/qvm-run", line 5, in
sys.exit(main())
~~~~^^
File "/usr/lib/python3.13/site-packages/qubesadmin/tools/qvm_run.py", line 367, in main
else args.app.domains[args.dispvm]
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/usr/lib/python3.13/site-packages/qubesadmin/app.py", line 108, in getitem
raise KeyError(item)
KeyError: 'unexistent'
Fixes: QubesOS/qubes-issues#10383
For: QubesOS/qubes-issues#1512