Merge pull request #82258 from erikarvstedt/fix-xchg-caching

fix inconsistent caching of VM xchg dirs
This commit is contained in:
Florian Klink 2020-06-01 22:34:48 +02:00 committed by GitHub
commit 8a388c8296
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 3 additions and 9 deletions

View File

@ -598,11 +598,8 @@ class Machine:
shutil.copytree(host_src, host_intermediate)
else:
shutil.copy(host_src, host_intermediate)
self.succeed("sync")
self.succeed(make_command(["mkdir", "-p", vm_target.parent]))
self.succeed(make_command(["cp", "-r", vm_intermediate, vm_target]))
# Make sure the cleanup is synced into VM
self.succeed("sync")
def copy_from_vm(self, source: str, target_dir: str = "") -> None:
"""Copy a file from the VM (specified by an in-VM source path) to a path
@ -620,7 +617,6 @@ class Machine:
# Copy the file to the shared directory inside VM
self.succeed(make_command(["mkdir", "-p", vm_shared_temp]))
self.succeed(make_command(["cp", "-r", vm_src, vm_intermediate]))
self.succeed("sync")
abs_target = out_dir / target_dir / vm_src.name
abs_target.parent.mkdir(exist_ok=True, parents=True)
# Copy the file from the shared directory outside VM
@ -628,8 +624,6 @@ class Machine:
shutil.copytree(intermediate, abs_target)
else:
shutil.copy(intermediate, abs_target)
# Make sure the cleanup is synced into VM
self.succeed("sync")
def dump_tty_contents(self, tty: str) -> None:
"""Debugging: Dump the contents of the TTY<n>

View File

@ -576,7 +576,7 @@ in
"/tmp/xchg" =
{ device = "xchg";
fsType = "9p";
options = [ "trans=virtio" "version=9p2000.L" "cache=loose" ];
options = [ "trans=virtio" "version=9p2000.L" ];
neededForBoot = true;
};
"/tmp/shared" =

View File

@ -115,7 +115,7 @@ rec {
echo "mounting host's temporary directory..."
mkdir -p /fs/tmp/xchg
mount -t 9p xchg /fs/tmp/xchg -o trans=virtio,version=9p2000.L,cache=loose
mount -t 9p xchg /fs/tmp/xchg -o trans=virtio,version=9p2000.L
mkdir -p /fs/proc
mount -t proc none /fs/proc

View File

@ -53,7 +53,7 @@ let
store /fs/nix/store
mount -t 9p \
-o trans=virtio,version=9p2000.L,cache=loose \
-o trans=virtio,version=9p2000.L \
xchg /fs/xchg
echo root:x:0:0::/root:/bin/false > /fs/etc/passwd