Closed ncryptid closed 4 years ago
I had a similar issue on Ubuntu. It was caused by a size-limited user runtime directory, which usually resides under /run/user/
.
As you can see, the size of directory /run/user/1001
is only 3.2G for my case (My machine has 32GB memory in total.)
$ df -h -t tmpfs
Filesystem Size Used Avail Use% Mounted on
tmpfs 3.2G 1.6M 3.2G 1% /run
tmpfs 16G 53M 16G 1% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 16G 0 16G 0% /sys/fs/cgroup
tmpfs 3.2G 40K 3.2G 1% /run/user/1001
Since libvirtd backend stores temporary disk images under this directory, it can be out of disk during the deployment if we have a bigger images to build.
A workaround is to reserve a bigger size for the user runtime directory. The configuration on Ubuntu (or systemd-based Linux OS) is as below:
$ cat /etc/systemd/logind.conf
[Login]
RuntimeDirectorySize=30% # default is 10%
Hope this can fix your issue.
virt-admin daemon-log-filters ""
virt-admin daemon-log-outputs "1:file:/var/log/libvirt/libvirtd.log"
and replicating the error got me:
2020-06-01 18:30:56.481+0000: 18598: error : virNetSocketReadWire:1829 : End of file while reading data: Input/output error
2020-06-01 18:31:23.491+0000: 18598: error : virFDStreamWrite:782 : cannot write to stream: No space left on device
except, this is NOT an OS error:
qemu-img reports the wrong file size if the underlying storage system has compression:
[nix-shell:~/projects/github.com/grahamc/tinkerbell-nixos]$ qemu-img info --output json /nix/store/fcq2qdlh31snwdlipwv6b97banrd4z9q-libvirtd-ssh-image/nixos.qcow2 | jq '."actual-size"'
558619648
[nix-shell:~/projects/github.com/grahamc/tinkerbell-nixos]$ du /nix/store/fcq2qdlh31snwdlipwv6b97banrd4z9q-libvirtd-ssh-image/nixos.qcow2
545527 /nix/store/fcq2qdlh31snwdlipwv6b97banrd4z9q-libvirtd-ssh-image/nixos.qcow2
[nix-shell:~/projects/github.com/grahamc/tinkerbell-nixos]$ echo $((558619648 / 545527))
1024
[nix-shell:~/projects/github.com/grahamc/tinkerbell-nixos]$ du -h --apparent-size /nix/store/fcq2qdlh31snwdlipwv6b97banrd4z9q-libvirtd-ssh-image/nixos.qcow2
1.3G /nix/store/fcq2qdlh31snwdlipwv6b97banrd4z9q-libvirtd-ssh-image/nixos.qcow2
Reported upstream https://bugs.launchpad.net/qemu/+bug/1881648
and with my diff I've moved past:
diff --git a/nixops_virtd/backends/libvirtd.py b/nixops_virtd/backends/libvirtd.py
index 43476b4..ed41a8c 100644
--- a/nixops_virtd/backends/libvirtd.py
+++ b/nixops_virtd/backends/libvirtd.py
@@ -267,7 +267,14 @@ class LibvirtdState(MachineState[LibvirtdDefinition]):
output = self._logged_exec(
["qemu-img", "info", "--output", "json", filename], capture_stdout=True
)
- return json.loads(output)
+
+ du_output = self._logged_exec(
+ ["du", "--bytes", "--apparent-size", filename], capture_stdout=True
+ ).split()
+
+ mid = json.loads(output)
+ mid['actual-size'] = int(du_output[0])
+ return mid
def _create_volume(self, virtual_size, actual_size):
xml = """
ok that seemed tricky. Congrats !
After manually creating a libvirt pool to work around #7 for the purposes of testing, I'm currently able to create a trivial nixops libvirt deployment. However, I'm running into this error after the VM finishes installing and reboots:
I've got 2TB of storage on this pool, and according to virsh it's not using anywhere close to the total amount of space that's been allocated for the VM image:
Thanks