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: fix VM state directory deletion #97346

Merged
merged 1 commit into from Sep 10, 2020

Conversation

picnoir
Copy link
Member

@picnoir picnoir commented Sep 7, 2020

Motivation for this change

The previous version of the code would only kick in if the state
directory path pointed at a file, which never occurs.

Making that
codepath actually work reveals an ordering bug, which this patch fixes
as well.

Bug report:
#91046 (comment)

Things done

Fix this bug.

It also replaces the confusing, imperative case log message "delete VM
state directory" with "deleting VM state directory".

Finally, we hint the user about how to prevent this deletion. IE. by
passing the --keep-vm-state flag.

Credit goes to Edef for the rebase on top of a recent nixpkgs commit
and for writing most of this commit message.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

The previous version of the code would only kick in if the state
directory path pointed at a *file*, which never occurs. Making that
codepath actually work reveals an ordering bug, which this patch fixes
as well.

It also replaces the confusing, imperative case log message "delete VM
state directory" with "deleting VM state directory".

Finally, we hint the user about how to prevent this deletion. IE. by
passing the --keep-vm-state flag.

Bug report:
NixOS#91046 (comment)

Credit goes to Edef for the rebase on top of a recent nixpkgs commit
and for writing most of this commit message.

Co-authored-by: edef <edef@edef.eu>
@flokli flokli merged commit ee55841 into NixOS:master Sep 10, 2020
@flokli
Copy link
Contributor

flokli commented Sep 10, 2020

Backported to 20.09 in 5500dc8.

@vcunat
Copy link
Member

vcunat commented Sep 11, 2020

This merge breaks some basic tests (I checked a local revert). Unless we have a fix very soon (say, today), I suggest to revert it until the issue is resolved.

I'm starting to get annoyed that I now have to revert channel blockers on a daily basis.

picnoir added a commit to picnoir/nixpkgs that referenced this pull request Sep 11, 2020
ecb73fd introduced a new keepVmState
CLI flag for test-driver.py. This CLI flags gets forwarded to the
Machine class through create_machine.

It created a regression for the boot tests where __main__ end up not
being evaluated. See
NixOS#97346 (comment) for
bug report.

Defaulting keepVmState to false when __main__ ends up not being
evaluated.
@picnoir
Copy link
Member Author

picnoir commented Sep 11, 2020

Errrr, I did not know this script could be evaluated from outside of __main__, my bad.

See #97746 for a one liner fix.

@picnoir picnoir deleted the nin-fix-vm-rm-state branch September 11, 2020 09:00
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