mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-09-21 12:38:41 +03:00
qemu-vm: fix inconsistent caching of xchg dirs
xchg is advertised as a bidirectional exchange dir, but file content transfer from host to VM fails due to caching: If a file is read in the VM and then modified on the host, subsequent re-reads in the VM can yield old, cached data. This is caused by the use of 9p's cache=loose mode that is explicitly meant for read-only mounts. 9p doesn't provide any suitable cache modes, so fix this by disabling caching. Also, remove a now unnecessary sync in the test driver.
This commit is contained in:
parent
dfa743e49e
commit
d85dc4f690
@ -615,7 +615,6 @@ class Machine:
|
|||||||
# Copy the file to the shared directory inside VM
|
# Copy the file to the shared directory inside VM
|
||||||
self.succeed(make_command(["mkdir", "-p", vm_shared_temp]))
|
self.succeed(make_command(["mkdir", "-p", vm_shared_temp]))
|
||||||
self.succeed(make_command(["cp", "-r", vm_src, vm_intermediate]))
|
self.succeed(make_command(["cp", "-r", vm_src, vm_intermediate]))
|
||||||
self.succeed("sync")
|
|
||||||
abs_target = out_dir / target_dir / vm_src.name
|
abs_target = out_dir / target_dir / vm_src.name
|
||||||
abs_target.parent.mkdir(exist_ok=True, parents=True)
|
abs_target.parent.mkdir(exist_ok=True, parents=True)
|
||||||
# Copy the file from the shared directory outside VM
|
# Copy the file from the shared directory outside VM
|
||||||
|
@ -567,7 +567,7 @@ in
|
|||||||
"/tmp/xchg" =
|
"/tmp/xchg" =
|
||||||
{ device = "xchg";
|
{ device = "xchg";
|
||||||
fsType = "9p";
|
fsType = "9p";
|
||||||
options = [ "trans=virtio" "version=9p2000.L" "cache=loose" ];
|
options = [ "trans=virtio" "version=9p2000.L" ];
|
||||||
neededForBoot = true;
|
neededForBoot = true;
|
||||||
};
|
};
|
||||||
"/tmp/shared" =
|
"/tmp/shared" =
|
||||||
|
@ -115,7 +115,7 @@ rec {
|
|||||||
|
|
||||||
echo "mounting host's temporary directory..."
|
echo "mounting host's temporary directory..."
|
||||||
mkdir -p /fs/tmp/xchg
|
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
|
mkdir -p /fs/proc
|
||||||
mount -t proc none /fs/proc
|
mount -t proc none /fs/proc
|
||||||
|
@ -53,7 +53,7 @@ let
|
|||||||
store /fs/nix/store
|
store /fs/nix/store
|
||||||
|
|
||||||
mount -t 9p \
|
mount -t 9p \
|
||||||
-o trans=virtio,version=9p2000.L,cache=loose \
|
-o trans=virtio,version=9p2000.L \
|
||||||
xchg /fs/xchg
|
xchg /fs/xchg
|
||||||
|
|
||||||
echo root:x:0:0::/root:/bin/false > /fs/etc/passwd
|
echo root:x:0:0::/root:/bin/false > /fs/etc/passwd
|
||||||
|
Loading…
Reference in New Issue
Block a user