)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"974c6181bb1ca87aab54e74fe0ef7a6d70433187","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     int32bit \u003ckrystism@gmail.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2018-02-03 11:44:41 +0000"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Refix disk size during live migration with disk over-commit"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Currently available disk of targer host is calculated based on"},{"line_number":10,"context_line":"local_gb, not available disk(free_disk_gb). This check can be"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"3f79a3b5_a9641723","line":7,"range":{"start_line":7,"start_character":0,"end_line":7,"end_character":5},"updated":"2018-08-13 17:35:55.000000000","message":"refix? should this just be fix?\n\ni assume refix was used because of a regression but with a reference to it later in the commit it reads incorrectly.","commit_id":"e2cc275063658b23ed88824100919a6dfccb760d"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"974c6181bb1ca87aab54e74fe0ef7a6d70433187","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Refix disk size during live migration with disk over-commit"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Currently available disk of targer host is calculated based on"},{"line_number":10,"context_line":"local_gb, not available disk(free_disk_gb). This check can be"},{"line_number":11,"context_line":"negative if the target host has no free disk."},{"line_number":12,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"3f79a3b5_098d0bd2","line":9,"range":{"start_line":9,"start_character":28,"end_line":9,"end_character":34},"updated":"2018-08-13 17:35:55.000000000","message":"target","commit_id":"e2cc275063658b23ed88824100919a6dfccb760d"}],"nova/tests/unit/virt/libvirt/test_driver.py":[{"author":{"_account_id":15888,"name":"Zhenyu Zheng","email":"zheng.zhenyu@outlook.com","username":"Kevin_Zheng"},"change_message_id":"d3de9592e6518cbb5617f263b532d6c9c0d4bb92","unresolved":false,"context_lines":[{"line_number":7406,"context_line":"        instance_ref.vcpu_model \u003d test_vcpu_model.fake_vcpumodel"},{"line_number":7407,"context_line":"        drvr \u003d libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), False)"},{"line_number":7408,"context_line":"        compute_info \u003d {\u0027disk_available_least\u0027: -1000,"},{"line_number":7409,"context_line":"                        \u0027local_gb\u0027: 100,"},{"line_number":7410,"context_line":"                        \u0027free_disk_gb\u0027: 50,"},{"line_number":7411,"context_line":"                        \u0027cpu_info\u0027: \u0027asdf\u0027,"},{"line_number":7412,"context_line":"                        }"}],"source_content_type":"text/x-python","patch_set":1,"id":"7f96bb07_9391a0f4","line":7409,"range":{"start_line":7409,"start_character":24,"end_line":7409,"end_character":40},"updated":"2018-01-23 08:21:23.000000000","message":"this seems useless","commit_id":"ab21be3a2c721c099bd91796f504c0b977d2994d"},{"author":{"_account_id":21479,"name":"int32bit","email":"krystism@gmail.com","username":"int32bit"},"change_message_id":"eafde37bc73bbf0ca8b88699ddce528fe89fd42d","unresolved":false,"context_lines":[{"line_number":7406,"context_line":"        instance_ref.vcpu_model \u003d test_vcpu_model.fake_vcpumodel"},{"line_number":7407,"context_line":"        drvr \u003d libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), False)"},{"line_number":7408,"context_line":"        compute_info \u003d {\u0027disk_available_least\u0027: -1000,"},{"line_number":7409,"context_line":"                        \u0027local_gb\u0027: 100,"},{"line_number":7410,"context_line":"                        \u0027free_disk_gb\u0027: 50,"},{"line_number":7411,"context_line":"                        \u0027cpu_info\u0027: \u0027asdf\u0027,"},{"line_number":7412,"context_line":"                        }"}],"source_content_type":"text/x-python","patch_set":1,"id":"7f96bb07_b57fd9a9","line":7409,"range":{"start_line":7409,"start_character":24,"end_line":7409,"end_character":40},"in_reply_to":"7f96bb07_9391a0f4","updated":"2018-01-23 23:41:49.000000000","message":"thanks.","commit_id":"ab21be3a2c721c099bd91796f504c0b977d2994d"}],"nova/virt/libvirt/driver.py":[{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"ca18d9e511a0d29713d8cc71f054a3196907005f","unresolved":false,"context_lines":[{"line_number":6331,"context_line":"        else:"},{"line_number":6332,"context_line":"            disk_available_gb \u003d dst_compute_info[\u0027disk_available_least\u0027]"},{"line_number":6333,"context_line":"        disk_available_mb \u003d ("},{"line_number":6334,"context_line":"            (disk_available_gb * units.Ki) - CONF.reserved_host_disk_mb)"},{"line_number":6335,"context_line":""},{"line_number":6336,"context_line":"        # Compare CPU"},{"line_number":6337,"context_line":"        if not instance.vcpu_model or not instance.vcpu_model.model:"}],"source_content_type":"text/x-python","patch_set":3,"id":"df7087c5_94516b65","line":6334,"updated":"2018-03-12 17:33:48.000000000","message":"But if we use free_disk_gb, I think we don\u0027t want to also subtract the reserved_host_disk_mb, seems like this bit should be indented now?","commit_id":"e2cc275063658b23ed88824100919a6dfccb760d"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"c1fc797adbf33cad655a8bedcc43552a320e82e3","unresolved":false,"context_lines":[{"line_number":6331,"context_line":"        else:"},{"line_number":6332,"context_line":"            disk_available_gb \u003d dst_compute_info[\u0027disk_available_least\u0027]"},{"line_number":6333,"context_line":"        disk_available_mb \u003d ("},{"line_number":6334,"context_line":"            (disk_available_gb * units.Ki) - CONF.reserved_host_disk_mb)"},{"line_number":6335,"context_line":""},{"line_number":6336,"context_line":"        # Compare CPU"},{"line_number":6337,"context_line":"        if not instance.vcpu_model or not instance.vcpu_model.model:"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_80ea3ed5","line":6334,"in_reply_to":"3f79a3b5_52be3cff","updated":"2018-08-14 09:45:49.000000000","message":"right so based on \nhttps://github.com/openstack/nova/blob/7125dcb9cb821faf3c68526ac34365a28141e480/nova/compute/resource_tracker.py#L807\nand our discussion on irc about where this is used here\n\nhttps://github.com/openstack/nova/blob/0502b0ffaf20ef3735e633715ba0f9dda976cb7a/nova/virt/libvirt/driver.py#L6745-L6782\n\nwhich is invoked from check_can_live_migrate_source\n\nthis change looks correct to me.\nthanks for explaining.","commit_id":"e2cc275063658b23ed88824100919a6dfccb760d"},{"author":{"_account_id":13692,"name":"Roman Dobosz","email":"gryf73@gmail.com","username":"gryf"},"change_message_id":"6eeaa4eb0e28d88c5f6e787f2221a51c8df0f6f1","unresolved":false,"context_lines":[{"line_number":6331,"context_line":"        else:"},{"line_number":6332,"context_line":"            disk_available_gb \u003d dst_compute_info[\u0027disk_available_least\u0027]"},{"line_number":6333,"context_line":"        disk_available_mb \u003d ("},{"line_number":6334,"context_line":"            (disk_available_gb * units.Ki) - CONF.reserved_host_disk_mb)"},{"line_number":6335,"context_line":""},{"line_number":6336,"context_line":"        # Compare CPU"},{"line_number":6337,"context_line":"        if not instance.vcpu_model or not instance.vcpu_model.model:"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_52be3cff","line":6334,"in_reply_to":"3f79a3b5_54cf1655","updated":"2018-08-14 08:00:14.000000000","message":"In Rocky diskfilter is deprecated, which doesn\u0027t mean, that it cannot be used, so the stable is affected by this bug.\n\nWhat is needed to be corrected is the disk_available_gb in case of overcommit, which currently is all wrong.","commit_id":"e2cc275063658b23ed88824100919a6dfccb760d"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"9ae8cbe8adb7747c93d1cc1605ba5d87b057ad00","unresolved":false,"context_lines":[{"line_number":6331,"context_line":"        else:"},{"line_number":6332,"context_line":"            disk_available_gb \u003d dst_compute_info[\u0027disk_available_least\u0027]"},{"line_number":6333,"context_line":"        disk_available_mb \u003d ("},{"line_number":6334,"context_line":"            (disk_available_gb * units.Ki) - CONF.reserved_host_disk_mb)"},{"line_number":6335,"context_line":""},{"line_number":6336,"context_line":"        # Compare CPU"},{"line_number":6337,"context_line":"        if not instance.vcpu_model or not instance.vcpu_model.model:"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_cfa713bd","line":6334,"in_reply_to":"3f79a3b5_54cf1655","updated":"2018-08-13 17:44:46.000000000","message":"actully perhaps that should be\navailable disk \u003d ((total diskspcae - reserved disk space) * disk allocation ratio) - used disk space\n\nwhere disk allocation ratio is 1 if over commit is false.\nagain not sure if we have to account of for the disk over commit ratio here or later.","commit_id":"e2cc275063658b23ed88824100919a6dfccb760d"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"9e1b849515022d9d0e7c85404f44b1b514c1bce2","unresolved":false,"context_lines":[{"line_number":6331,"context_line":"        else:"},{"line_number":6332,"context_line":"            disk_available_gb \u003d dst_compute_info[\u0027disk_available_least\u0027]"},{"line_number":6333,"context_line":"        disk_available_mb \u003d ("},{"line_number":6334,"context_line":"            (disk_available_gb * units.Ki) - CONF.reserved_host_disk_mb)"},{"line_number":6335,"context_line":""},{"line_number":6336,"context_line":"        # Compare CPU"},{"line_number":6337,"context_line":"        if not instance.vcpu_model or not instance.vcpu_model.model:"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_a2bd1eb8","line":6334,"in_reply_to":"3f79a3b5_80ea3ed5","updated":"2018-08-23 14:08:57.000000000","message":"sorry, been out of it, just re-read.\n\n+1 matthew here, not sure where I was coming from here.","commit_id":"e2cc275063658b23ed88824100919a6dfccb760d"},{"author":{"_account_id":13692,"name":"Roman Dobosz","email":"gryf73@gmail.com","username":"gryf"},"change_message_id":"6eeaa4eb0e28d88c5f6e787f2221a51c8df0f6f1","unresolved":false,"context_lines":[{"line_number":6331,"context_line":"        else:"},{"line_number":6332,"context_line":"            disk_available_gb \u003d dst_compute_info[\u0027disk_available_least\u0027]"},{"line_number":6333,"context_line":"        disk_available_mb \u003d ("},{"line_number":6334,"context_line":"            (disk_available_gb * units.Ki) - CONF.reserved_host_disk_mb)"},{"line_number":6335,"context_line":""},{"line_number":6336,"context_line":"        # Compare CPU"},{"line_number":6337,"context_line":"        if not instance.vcpu_model or not instance.vcpu_model.model:"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_0f4f4193","line":6334,"in_reply_to":"3f79a3b5_cfa713bd","updated":"2018-08-14 08:00:14.000000000","message":"I\u0027d leave it as it is. disc_allocation_ratio is used in resource tracker, while here it is driver check how we are with running out of disk space.","commit_id":"e2cc275063658b23ed88824100919a6dfccb760d"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"974c6181bb1ca87aab54e74fe0ef7a6d70433187","unresolved":false,"context_lines":[{"line_number":6331,"context_line":"        else:"},{"line_number":6332,"context_line":"            disk_available_gb \u003d dst_compute_info[\u0027disk_available_least\u0027]"},{"line_number":6333,"context_line":"        disk_available_mb \u003d ("},{"line_number":6334,"context_line":"            (disk_available_gb * units.Ki) - CONF.reserved_host_disk_mb)"},{"line_number":6335,"context_line":""},{"line_number":6336,"context_line":"        # Compare CPU"},{"line_number":6337,"context_line":"        if not instance.vcpu_model or not instance.vcpu_model.model:"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_54cf1655","line":6334,"in_reply_to":"5f7c97a3_d0202fb3","updated":"2018-08-13 17:35:55.000000000","message":"we do not enable the diskfilter anymore so it will not be checked there.\n\ni would tend to agree localgb is not correct but i also agree with mdbooth that reserved disk should be taken into account\n\n\n\ni think the psudo code for the correct calculation would be\n\navailable disk \u003d (total diskspcae - reserved disk space - used disk space) * disk allocation ratio. \n\nwhere used disk space is the sum of the virtual_size of all allocated disk for all instances on the host.\n\nat least i believe that is what placement would do  when it is filtering this host. im not sure if the multiplcation by the disk allocation ratio is required at this point of is done later\n\nthis function appears to be called form the conductors  _call_livem_checks_on_host call wich is invoked as part of\n_find_destination or directly form the live_migrate task execute fuction if a destiatnio is passed in. i do not see any check in the conductor before the live_migration down call to  the compute host that uses the value of disk_available_mb. do you know where this is actully used?","commit_id":"e2cc275063658b23ed88824100919a6dfccb760d"},{"author":{"_account_id":9555,"name":"Matthew Booth","email":"mbooth@redhat.com","username":"MatthewBooth"},"change_message_id":"05b4b8d24a5cc6836537f418ed7afbf74bb31efd","unresolved":false,"context_lines":[{"line_number":6331,"context_line":"        else:"},{"line_number":6332,"context_line":"            disk_available_gb \u003d dst_compute_info[\u0027disk_available_least\u0027]"},{"line_number":6333,"context_line":"        disk_available_mb \u003d ("},{"line_number":6334,"context_line":"            (disk_available_gb * units.Ki) - CONF.reserved_host_disk_mb)"},{"line_number":6335,"context_line":""},{"line_number":6336,"context_line":"        # Compare CPU"},{"line_number":6337,"context_line":"        if not instance.vcpu_model or not instance.vcpu_model.model:"}],"source_content_type":"text/x-python","patch_set":3,"id":"df7087c5_f9543c00","line":6334,"in_reply_to":"df7087c5_94516b65","updated":"2018-03-13 16:46:01.000000000","message":"free_disk_gb \u003d local_gb - local_gb_used (resource_tracker)\n             \u003d disk_info[\u0027total\u0027] - disk_info[\u0027used\u0027] (libvirt/driver)\n             \u003d ***FOR FILESYSTEM***\n               statvfs: frsize*blocks - frsize*(blocks-bfree) (libvirt/utils)\n\nFrom man statvfs\nfrsize: Fragment size\nblocks: Size of fs in f_frsize units\nbfree: Number of free blocks\n\nNote that bfree is explicitly distinguished from\nbavail: Number of free blocks for unprivileged users\n\nSo, by my reading free_disk_gb *does not* take into account reserved blocks.\n\nActually, re-reading your comment I\u0027m not sure that\u0027s what you were getting at, but I\u0027m going to leave it there anyway because it\u0027s so £$^%ing convoluted.\n\nEither way, I believe it is correct to subtract reserved_host_disk_mb here. The definition of this config variable is:\n\nAmount of disk resources in MB to make them always available to host. The\ndisk usage gets reported back to the scheduler from nova-compute running\non the compute nodes. To prevent the disk resources from being considered\nas available, this option can be used to reserve disk space for that host.\n\nTo me that means that there\u0027s reserved_host_disk_mb which we will never allocate, which means we need to subtract it here. I think you\u0027re saying that reserved_host_disk_mb means how much space we expect the base installation to take up? That\u0027s not what it means to me, it\u0027s about headroom.","commit_id":"e2cc275063658b23ed88824100919a6dfccb760d"},{"author":{"_account_id":2711,"name":"Zhang Hua","display_name":"Zhang Hua","email":"joshua.zhang@canonical.com","username":"zhhuabj"},"change_message_id":"0afdc984f52fc01a5c7fb15911ac129928c96511","unresolved":false,"context_lines":[{"line_number":6331,"context_line":"        else:"},{"line_number":6332,"context_line":"            disk_available_gb \u003d dst_compute_info[\u0027disk_available_least\u0027]"},{"line_number":6333,"context_line":"        disk_available_mb \u003d ("},{"line_number":6334,"context_line":"            (disk_available_gb * units.Ki) - CONF.reserved_host_disk_mb)"},{"line_number":6335,"context_line":""},{"line_number":6336,"context_line":"        # Compare CPU"},{"line_number":6337,"context_line":"        if not instance.vcpu_model or not instance.vcpu_model.model:"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_d0202fb3","line":6334,"in_reply_to":"df7087c5_f9543c00","updated":"2018-06-22 01:41:00.000000000","message":"After reading the code carefully, I think Matthew is right, so I will +1, below is my code analysis\n\n1, available_least is used for the case without disk_over_commit\n\nget_available_resource in nova/virt/libvirt/driver.py will get \u0027total\u0027 and \u0027used\u0027 disk for local disk by statvfs\n\nhddinfo \u003d os.statvfs(path)  \ntotal \u003d hddinfo.f_frsize * hddinfo.f_blocks  \nfree \u003d hddinfo.f_frsize * hddinfo.f_bavail  \nused \u003d hddinfo.f_frsize * (hddinfo.f_blocks - hddinfo.f_bfree)\n\nbut nova doesn\u0027t use above \u0027free\u0027 directly, it uses available_least instead\n\navailable_least \u003d disk_free_gb * units.Gi - disk_over_committed\n\nwhere disk_over_committed can be gotten by the following formula according to the output of \u0027qemu-img info /var/lib/nova/instances/xxx/disk\u0027\ndisk_over_committed \u003d virtual_size - disk_size\n\n2, When the case having disk_over_commit with disk_allocation_ratio (./nova/scheduler/filters/disk_filter.py):\n\ndisk_mb_limit \u003d total_usable_disk_mb * disk_allocation_ratio \nused_disk_mb \u003d total_usable_disk_mb - free_disk_mb\ndisk_mb_limit - used_disk_mb \u003c requested_disk\n\ndisk_available_mb \u003d (disk_available_gb * units.Ki) - CONF.reserved_host_disk_mb)\n\nSo for the case of live migration when having disk_over_commit with disk_allocation_ratio:\n\n./nova/compute/resource_tracker.py\nfree_disk_gb \u003d resources[\u0027local_gb\u0027] - resources[\u0027local_gb_used\u0027]\n             \u003d disk_info[\u0027total\u0027] - disk_info[\u0027used\u0027] (libvirt/driver)\n             \u003d ***FOR FILESYSTEM***\n               statvfs: frsize*blocks - frsize*(blocks-bfree) (libvirt/utils)","commit_id":"e2cc275063658b23ed88824100919a6dfccb760d"}]}
