feat(ds-identify): Don't run unnecessary systemd-detect-virt#4633
Conversation
a371e6e to
4a57716
Compare
| fp.write("\n".join(head + mocklines + endlines) + "\n") | ||
|
|
||
| detect_virt = None | ||
| for mock in [*mocks, *default_mocks]: |
There was a problem hiding this comment.
aside:
a dict of dicts would have been the perfect data structure for a collection of unique mocks, but instead this test uses a list of dicts so here we are iterating over the list (like a bunch of other places in the code). I'm not going to refactor this giant test suite, so for now I just complain <rant/>
Thanks for the review - addressed!
Oops, fixed.
It was annoying to write, since this function was previously mocked, but I got us some test coverage by un-mocking in cases that systemd-detect-virt won't get called. |
TheRealFalcon
left a comment
There was a problem hiding this comment.
LGTM. I re-kicked the integration test job as it appeared to fail for unrelated reasons.
|
Hello! Thank you for this proposed change to cloud-init. This pull request is now marked as stale as it has not seen any activity in 14 days. If no activity occurs within the next 7 days, this pull request will automatically close. If you are waiting for code review and you are seeing this message, apologies! Please reply, tagging TheRealFalcon, and he will ensure that someone takes a look soon. (If the pull request is closed and you would like to continue working on it, please do tag TheRealFalcon to reopen it.) |
21d8979 to
45d8633
Compare
45d8633 to
5c0ff57
Compare
|
I noticed some more recent activity. Is this ready for review now? |
Not quite. Integration tests fail and I was having trouble reproducing failure locally so I just rebased on other ds-identify changes to keep it current with plans to debug it later. |
|
Hello! Thank you for this proposed change to cloud-init. This pull request is now marked as stale as it has not seen any activity in 14 days. If no activity occurs within the next 7 days, this pull request will automatically close. If you are waiting for code review and you are seeing this message, apologies! Please reply, tagging TheRealFalcon, and he will ensure that someone takes a look soon. (If the pull request is closed and you would like to continue working on it, please do tag TheRealFalcon to reopen it.) |
|
Hello! Thank you for this proposed change to cloud-init. This pull request is now marked as stale as it has not seen any activity in 14 days. If no activity occurs within the next 7 days, this pull request will automatically close. If you are waiting for code review and you are seeing this message, apologies! Please reply, tagging TheRealFalcon, and he will ensure that someone takes a look soon. (If the pull request is closed and you would like to continue working on it, please do tag TheRealFalcon to reopen it.) |
Running systemd-detect-virt is expensive and, on systemd >=251, unnecessary. The environment variable SYSTEMD_VIRTUALIZATION contains the virtualization type that we currently manually get from systemd-detect-virt. Update tests to exercise this code path. https://www.freedesktop.org/software/systemd/man/latest/systemd.generator.html#Environment
5c0ff57 to
c44d938
Compare
|
@TheRealFalcon this one is ready for review now |
TheRealFalcon
left a comment
There was a problem hiding this comment.
LGTM! I don't envy the work you had to do on test_ds_identify.
…al#4633) Running systemd-detect-virt is expensive and on systemd >=251 it is unnecessary. The environment variable SYSTEMD_VIRTUALIZATION contains the virtualization type that we currently manually get from systemd-detect-virt[1]. Also fix a minor FreeBSD virtualization bug. [1] https://www.freedesktop.org/software/systemd/man/latest/systemd.generator.html#Environment
Additional Context
Test Steps
shell stuff
$ /bin/sh -c 'VALUE="container:lxc";echo ${VALUE#*:}' lxcthis branch: focal (systemd 245)
this branch: mantic (systemd 253)
compared to main branch: mantic (systemd 253)
Merge type