Skip to content
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

test-driver.py: don't leave vde1.ctl around #83598

Merged
merged 1 commit into from Mar 29, 2020

Conversation

mmilata
Copy link
Member

@mmilata mmilata commented Mar 28, 2020

Motivation for this change

When running tests interactively, VDE control sockets are left on the filesystem, which can prevent nix-build working. Example + reproducer: https://discourse.nixos.org/t/i-cant-figure-out-how-to-use-a-nix-file-from-a-module/6452

Perhaps we can create the sockets in temporary directory to not make the tree unbuildable while the test is running?

cc @tfc

@mmilata mmilata requested a review from tfc as a code owner March 28, 2020 14:37
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/i-cant-figure-out-how-to-use-a-nix-file-from-a-module/6452/3

@Ma27 Ma27 requested a review from flokli March 28, 2020 18:48
@flokli
Copy link
Contributor

flokli commented Mar 28, 2020 via email

@mmilata mmilata changed the title test-driver.py: don't leave vde1.ctl around [wip] test-driver.py: don't leave vde1.ctl around Mar 28, 2020
@mmilata mmilata changed the title [wip] test-driver.py: don't leave vde1.ctl around test-driver.py: don't leave vde1.ctl around Mar 28, 2020
@mmilata
Copy link
Member Author

mmilata commented Mar 28, 2020

Updated to use tempdir, PTAL. There's extra directory level because vde changes the permissions to 777 which feels wrong in /tmp (but probably doesn't matter).

Copy link
Contributor

@flokli flokli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update nixos/lib/qemu-flags.nix:12 to set the permissions of the vde socket, so we can get rid of the directory? There's a mode=octalmode parameter:

try:
shutil.rmtree(os.path.dirname(socket))
except Exception as e:
log.log("rmtree error: {}".format(str(e)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
log.log("rmtree error: {}".format(str(e)))
log.log("unable to rmtree socket: {}".format(str(e)))

Send SIGTERM instead of SIGKILL to vde_switch to give it chance to
delete the directories.
@mmilata
Copy link
Member Author

mmilata commented Mar 28, 2020

@flokli actually the mode can be set by vde_switch --dirmode, used that instead. Also if we kill vde_switch with SIGTERM instead of SIGKILL it deletes the directory for us, that might be even better. PTAL

@flokli
Copy link
Contributor

flokli commented Mar 29, 2020

Right, even better. Thanks!

@flokli flokli merged commit 50b48dd into NixOS:master Mar 29, 2020
@mmilata mmilata deleted the test-driver-delete-vdectl branch March 29, 2020 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants