)]}'
{"nova/virt/disk/api.py":[{"author":{"_account_id":10135,"name":"Lee Yarwood","display_name":"Lee Yarwood","email":"lyarwood@redhat.com","username":"lyarwood"},"change_message_id":"eb5f46e034262c2bc9a13a264e3663c3c5137757","unresolved":false,"context_lines":[{"line_number":104,"context_line":""},{"line_number":105,"context_line":"    :param path: Path to the disk image"},{"line_number":106,"context_line":"    :returns: Size (in bytes) of the given disk image as allocated on the"},{"line_number":107,"context_line":"              filesystem"},{"line_number":108,"context_line":"    \"\"\""},{"line_number":109,"context_line":"    return images.qemu_img_info(path).disk_size"},{"line_number":110,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"9f6a8fd7_b09e4505","line":107,"range":{"start_line":107,"start_character":14,"end_line":107,"end_character":24},"updated":"2018-04-17 09:45:31.000000000","message":"nit - disk","commit_id":"23bd8f62634707fc9896a38ff4dae606c89c6c4b"},{"author":{"_account_id":9555,"name":"Matthew Booth","email":"mbooth@redhat.com","username":"MatthewBooth"},"change_message_id":"1f502e2db515c0868099c3e0a49540a62681c847","unresolved":false,"context_lines":[{"line_number":104,"context_line":""},{"line_number":105,"context_line":"    :param path: Path to the disk image"},{"line_number":106,"context_line":"    :returns: Size (in bytes) of the given disk image as allocated on the"},{"line_number":107,"context_line":"              filesystem"},{"line_number":108,"context_line":"    \"\"\""},{"line_number":109,"context_line":"    return images.qemu_img_info(path).disk_size"},{"line_number":110,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"9f6a8fd7_613ea12a","line":107,"range":{"start_line":107,"start_character":14,"end_line":107,"end_character":24},"in_reply_to":"9f6a8fd7_b09e4505","updated":"2018-04-17 11:23:34.000000000","message":"Disk is no better imho. Host? Host filesystem. I think the important bit is the hostyness of it.\n\nIt is a nit, though.","commit_id":"23bd8f62634707fc9896a38ff4dae606c89c6c4b"}],"nova/virt/libvirt/driver.py":[{"author":{"_account_id":9555,"name":"Matthew Booth","email":"mbooth@redhat.com","username":"MatthewBooth"},"change_message_id":"1f502e2db515c0868099c3e0a49540a62681c847","unresolved":false,"context_lines":[{"line_number":7974,"context_line":"            if driver_type in (\"qcow2\", \"ploop\"):"},{"line_number":7975,"context_line":"                backing_file \u003d libvirt_utils.get_disk_backing_file(path)"},{"line_number":7976,"context_line":"                virt_size \u003d disk_api.get_disk_size(path)"},{"line_number":7977,"context_line":"                over_commit_size \u003d int(virt_size) - dk_size"},{"line_number":7978,"context_line":"            else:"},{"line_number":7979,"context_line":"                backing_file \u003d \"\""},{"line_number":7980,"context_line":"                virt_size \u003d dk_size"}],"source_content_type":"text/x-python","patch_set":1,"id":"9f6a8fd7_817ad521","line":7977,"updated":"2018-04-17 11:23:34.000000000","message":"For reviewer reference, the problem is here. Say we have a 1G qcow2 disk currently containing no data:\n\n$ qemu-img create -f qcow2 foo.qcow2 1G\nFormatting \u0027foo.qcow2\u0027, fmt\u003dqcow2 size\u003d1073741824 cluster_size\u003d65536 lazy_refcounts\u003doff refcount_bits\u003d16\n\n$ ls -l foo.qcow2\n-rw-r--r--. 1 mbooth mbooth 196624 Apr 17 12:06 foo.qcow2\n\n$ qemu-img info foo.qcow2\nimage: foo.qcow2\nfile format: qcow2\nvirtual size: 1.0G (1073741824 bytes)\ndisk size: 196K\ncluster_size: 65536\n\nNow fallocate 1G of space for the file without increasing its reported size:\n\n$ fallocate -n -l 1G foo.qcow2; ls -l foo.qcow2\n-rw-r--r--. 1 mbooth mbooth 196624 Apr 17 12:06 foo.qcow2\n\n$ qemu-img info foo.qcow2\nimage: foo.qcow2\nfile format: qcow2\nvirtual size: 1.0G (1073741824 bytes)\ndisk size: 1.0G\ncluster_size: 65536\n\nNote that the size reported by ls (and os.path.getsize) has not increased, but disk size reported by qemu-img info is still correct.\n\nAs a result, on this line we were reporting that the disk is overcommitted by almost 1G (actually 1G - 196K), i.e. we\u0027re saying that the disk could potentially use an additional 1G of space, which is not correct.\n\nIf instead we use qemu-img info\u0027s reported disk size we get 1G-1G \u003d 0 overcommit, i.e. the disk is already using all the space it can possibly use, which is correct.","commit_id":"23bd8f62634707fc9896a38ff4dae606c89c6c4b"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"4f8fc3dd313bc7713f9ba6bb8c46bb152f6ac059","unresolved":false,"context_lines":[{"line_number":7974,"context_line":"            if driver_type in (\"qcow2\", \"ploop\"):"},{"line_number":7975,"context_line":"                backing_file \u003d libvirt_utils.get_disk_backing_file(path)"},{"line_number":7976,"context_line":"                virt_size \u003d disk_api.get_disk_size(path)"},{"line_number":7977,"context_line":"                over_commit_size \u003d int(virt_size) - dk_size"},{"line_number":7978,"context_line":"            else:"},{"line_number":7979,"context_line":"                backing_file \u003d \"\""},{"line_number":7980,"context_line":"                virt_size \u003d dk_size"}],"source_content_type":"text/x-python","patch_set":1,"id":"9f6a8fd7_a2d02df9","line":7977,"in_reply_to":"9f6a8fd7_817ad521","updated":"2018-04-17 19:02:10.000000000","message":"And specifically this is what I wanted to check for the non-fallocate case, which also checks out:\n\n dan@eagle:~$ dd if\u003d/dev/zero of\u003dtestsparse.img bs\u003d1M seek\u003d1024 count\u003d1\n 1+0 records in\n 1+0 records out\n 1048576 bytes (1.0 MB, 1.0 MiB) copied, 0.0198706 s, 52.8 MB/s\n dan@eagle:~$ qemu-img info -f raw  testsparse.img\n image: testsparse.img\n file format: raw \n virtual size: 1.0G (1074790400 bytes)\n disk size: 1.0M\n\nIn that qemu-img will show the proper allocated amount regardless of the qcow2-ness of the file, and even in normal sparse scenarios, which it does. So yeah, I expect this os.getsize() usage was just naïveté about sparse files.","commit_id":"23bd8f62634707fc9896a38ff4dae606c89c6c4b"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"9ec70a2a4359bce60e7a8c8668c0da4bcadbcd35","unresolved":false,"context_lines":[{"line_number":7974,"context_line":"            if driver_type in (\"qcow2\", \"ploop\"):"},{"line_number":7975,"context_line":"                backing_file \u003d libvirt_utils.get_disk_backing_file(path)"},{"line_number":7976,"context_line":"                virt_size \u003d disk_api.get_disk_size(path)"},{"line_number":7977,"context_line":"                over_commit_size \u003d int(virt_size) - dk_size"},{"line_number":7978,"context_line":"            else:"},{"line_number":7979,"context_line":"                backing_file \u003d \"\""},{"line_number":7980,"context_line":"                virt_size \u003d dk_size"}],"source_content_type":"text/x-python","patch_set":1,"id":"9f6a8fd7_7d6074cf","line":7977,"in_reply_to":"9f6a8fd7_a2d02df9","updated":"2018-04-17 19:24:48.000000000","message":"I\u0027m not entirely sure why anyone would want to do:\n\n qemu-img create -f qcow2 foo.qcow2 1G\n\nand then:\n\n fallocate -n -l 1G foo.qcow2; ls -l foo.qcow2\n\nbut I suppose someone has indeed done this and therefore this patch is needed :)","commit_id":"23bd8f62634707fc9896a38ff4dae606c89c6c4b"}]}
