- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 115
Easy dependency switch if only preload is in chain #733
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
base: main
Are you sure you want to change the base?
Conversation
        
          
                qubes/app.py
              
                Outdated
          
        
      | and getattr(obj, prop.__name__) == vm | ||
| ): | ||
| if getattr(obj, "is_preload") and ( | ||
| prop.__name__ in ["default_dispvm", "template"] | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You sure about default_dispvm here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, see logs from qubesmanager tests:
'This qube cannot be removed. It is used as: <br> - <b>default_dispvm</b> for qube <b>anon-whonix</b>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it's really used as default_dispvm for anon-whonix the removal should be blocked... the only thing that shouldn't be blocked is being a template (only) for preloaded disposables, that you are going to kill/remove below anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum, then I need to do it another way because a disposable qube has the default_dispvm property set to its template, so it must be only if those two properties matches.
        
          
                qubes/vm/mix/dvmtemplate.py
              
                Outdated
          
        
      | if newvalue: | ||
| return | ||
| if any(self.dispvms): | ||
| if any(True for disp in self.dispvms if not disp.is_preload): | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if any(True for disp in self.dispvms if not disp.is_preload): | |
| if any(not disp.is_preload for disp in self.dispvms): | 
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better
e427a69    to
    0947f51      
    Compare
  
    | CI says typo:  | 
0947f51    to
    a30519b      
    Compare
  
    | Codecov Report❌ Patch coverage is  
 Additional details and impacted files@@            Coverage Diff             @@
##             main     #733      +/-   ##
==========================================
+ Coverage   70.43%   70.73%   +0.29%     
==========================================
  Files          61       61              
  Lines       13755    13803      +48     
==========================================
+ Hits         9689     9763      +74     
+ Misses       4066     4040      -26     
 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
 | 
28276e3    to
    0e2a25d      
    Compare
  
    | ) | ||
|  | ||
| @qubes.events.handler("domain-pre-delete") | ||
| def on_domain_pre_deleted(self, event, vm): | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the code duplication.
Especially the part some lines below "see 'journalctl'" because not everything is returned to the caller. The preloads are introducing one extra discrepancy on top of device assignment only seen from dom0 journal.
I think there should be an API method to check if the qube is deletale and if not, the (vm, prop) is returned via exception. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's done this way because the caller may not see the whole system (it can be for example a GUIVM with access to a subset of qubes). Returning the whole list may leak info about other qubes that the caller should not see.
The utility function in core-admin-client is supposed to find where the qube is used - based on what the caller actually can see.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sense, thanks for the explanation.
c202c55    to
    c2093bf      
    Compare
  
    | Are integration tests necessary seen that coverage is high? | 
c2093bf    to
    b52c6c7      
    Compare
  
    | "Cannot remove %s as it is used by %s", | ||
| vm, | ||
| ", ".join( | ||
| ":".join(str(i) for i in tup) for tup in dependencies | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the client tools, qvm-remove and qube-manager show a nice view of dependencies, the journal/logs were not showing them. Discovered that qube names can end with a . dot... I guess and hope : will never be allowed in qube names.
| if isinstance(obj, qubes.app.Qubes): | ||
| dependencies.append(('"GLOBAL"', prop.__name__)) | ||
| elif not obj.property_is_default(prop): | ||
| dependencies.append((obj.name, prop.__name__)) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't find a better name than "GLOBAL" for the global property, it is using quotes to distinguish from a qube name. It prints as such:
ERROR: Cannot remove default-dvm as it is used by disp-test:template, sys-firewall:template, sys-usb:template, "GLOBAL":default_dispvm
b52c6c7    to
    ed344a6      
    Compare
  
    04d170e    to
    8181764      
    Compare
  
    | mypy is not happy | 
8181764    to
    ff0fa1e      
    Compare
  
    ff0fa1e    to
    36008ef      
    Compare
  
    | OpenQA test summaryComplete test suite and dependencies: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.3&build=2025103005-4.3&flavor=pull-requests Test run included the following: 
 New failures, excluding unstableCompared to: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.3&build=2025081011-4.3&flavor=update 
 Failed tests22 failures
 Fixed failuresCompared to: https://openqa.qubes-os.org/tests/149225#dependencies 82 fixed
 Unstable testsPerformance TestsPerformance degradation:13 performance degradations
 Remaining performance tests:165 tests
 | 
| Didn't identify any related failure on openqa. | 
Fixes: QubesOS/qubes-issues#10227
For: QubesOS/qubes-issues#1512
Missing some tests.