1

I have some doubts about the qcow2 swap files created by nova when launching instances.

I've launched two instances with respectively 1G and 8G of swap memory. So, I verified that four disks where created in the _bare dir:

$ ls -lh _base/swap*
-rw-r--r-- 1 libvirt-qemu kvm  1.0G Jun 16 18:18 swap_1024
-rw-r--r-- 2 nova         nova 1.0T Jun 16 18:18 swap_1024_1024
-rw-r--r-- 1 libvirt-qemu kvm  8.0G Jun 16 18:18 swap_8192
-rw-r--r-- 2 nova         nova 8.0T Jun 16 18:18 swap_8192_8192
$ du -h _base/swap*
4.0K    swap_1024
4.0K    swap_1024_1024
4.0K    swap_8192
4.0K    swap_8192_8192

And that two disk.swap files where created each one inside the instance dir:

$ ls -lh */disk.swap
-rw-r--r-- 1 libvirt-qemu kvm  246M Jun 17 13:18 7fc49638-ae40-4f69-ac48-cf4ed330b61d/disk.swap
-rw-r--r-- 1 libvirt-qemu kvm  2.3M Jun 12 23:54 f3dfa134-4f7a-4cb3-af40-b4d43a5c2942/disk.swap
$ du -h */disk.swap
246M    7fc49638-ae40-4f69-ac48-cf4ed330b61d/disk.swap
2.2M    f3dfa134-4f7a-4cb3-af40-b4d43a5c2942/disk.swap
$ qemu-img info 7fc49638-ae40-4f69-ac48-cf4ed330b61d/disk.swap
image: 7fc49638-ae40-4f69-ac48-cf4ed330b61d/disk.swap
file format: qcow2
virtual size: 1.0G (1073741824 bytes)
disk size: 245M
[...]
backing file: /var/nova-data/instances/_base/swap_1024
[...]
$ qemu-img info f3dfa134-4f7a-4cb3-af40-b4d43a5c2942/disk.swap
image: f3dfa134-4f7a-4cb3-af40-b4d43a5c2942/disk.swap
file format: qcow2
virtual size: 8.0G (8589934592 bytes)
disk size: 2.2M
[...]
backing file: /var/nova-data/instances/_base/swap_8192
[...]

So, I have the following doubts:

  • Why were the swap_1024 and swap_8192 files created as the qcow2 backing file of the disk.swap files?
    • Using qcow2 disks and CoW (copy-on-write) doesn't save space. It really seems that the CoW method for swap files doesn't give us any real advantage;
  • Why were the swap_1024_1024 and swap_8192_8192 created?
    • It makes any sense to create a 1T and 8T qcow2 files? Are they used in any moment by nova-compute?

0 Answers0