)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":17920,"name":"Jianghua Wang","email":"jianghua.wang@citrix.com","username":"wjhfresh"},"change_message_id":"2517517178b00c56356c22467839cb02fdeb75dc","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Bob Ball \u003cbob.ball@citrix.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2016-11-28 11:15:02 +0000"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Use physical utilisation for cached images"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Since glance images are downloaded and snapshotted before they are used."},{"line_number":10,"context_line":"Only a small proportion of its VDI will be in use and it will never grow."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":18,"id":"da4df55a_9ae02898","line":7,"updated":"2016-12-28 03:49:46.000000000","message":"It seems need update the description. Per the code change, it looks like. Before this change, it always use physical utilisation: \"used \u003d int(sr_rec[\"physical_utilisation\"])\". I think this change is attempting to calculate the used size to be the sum of virtualization size of normal plugged VDIs plus the physical utilization size of cached images.","commit_id":"5436131cee5dcd4a43d40f07133f1ee17262876e"}],"nova/tests/unit/virt/xenapi/test_vm_utils.py":[{"author":{"_account_id":6735,"name":"Bob Ball","email":"bob.ball@citrix.com","username":"bob-ball"},"change_message_id":"5f3992aef3dbe3b3d4160208ea2f01fad9c1194b","unresolved":false,"context_lines":[{"line_number":1812,"context_line":""},{"line_number":1813,"context_line":"class GetDiskUsedVMTestCase(VMUtilsTestBase):"},{"line_number":1814,"context_line":"    @mock.patch.object(vm_utils, \u0027scan_default_sr\u0027)"},{"line_number":1815,"context_line":"    def test_get_disk_used(self, mock_scan_default_sr):"},{"line_number":1816,"context_line":"        mock_scan_default_sr.return_value \u003d \"sr_ref\""},{"line_number":1817,"context_line":"        data \u003d {"},{"line_number":1818,"context_line":"            \"VBD.get_all\": [\"vbd\"],"}],"source_content_type":"text/x-python","patch_set":7,"id":"3ac371cc_67c4fa5e","line":1815,"updated":"2016-08-16 09:04:48.000000000","message":"I think we need more than one test case.\nFor example, we need a case where a VM has two VDIs on different SRs\nWe should also have a case with all physical or all virtual,\n\nYour test is also not ensuring that we get the virtual size of the used VDI and physical size of the unused one.","commit_id":"8ece532dca957cd28b3c93665c78f4537965fb3e"},{"author":{"_account_id":17169,"name":"John Hua","email":"ihuazhihao@gmail.com","username":"johnhua"},"change_message_id":"38c3fc74cc4801b4205b9e2ffe1ce47738f985f1","unresolved":false,"context_lines":[{"line_number":1812,"context_line":""},{"line_number":1813,"context_line":"class GetDiskUsedVMTestCase(VMUtilsTestBase):"},{"line_number":1814,"context_line":"    @mock.patch.object(vm_utils, \u0027scan_default_sr\u0027)"},{"line_number":1815,"context_line":"    def test_get_disk_used(self, mock_scan_default_sr):"},{"line_number":1816,"context_line":"        mock_scan_default_sr.return_value \u003d \"sr_ref\""},{"line_number":1817,"context_line":"        data \u003d {"},{"line_number":1818,"context_line":"            \"VBD.get_all\": [\"vbd\"],"}],"source_content_type":"text/x-python","patch_set":7,"id":"3ac371cc_8d80f4c1","line":1815,"in_reply_to":"3ac371cc_67c4fa5e","updated":"2016-08-17 10:43:28.000000000","message":"Done","commit_id":"8ece532dca957cd28b3c93665c78f4537965fb3e"}],"nova/tests/unit/virt/xenapi/test_xenapi.py":[{"author":{"_account_id":6735,"name":"Bob Ball","email":"bob.ball@citrix.com","username":"bob-ball"},"change_message_id":"04b6a339a0da5ac860b7662ce1bae9675faeb4f8","unresolved":false,"context_lines":[{"line_number":2279,"context_line":"    def _test_get_disk_used(self, vbds, vdis):"},{"line_number":2280,"context_line":"        sr_ref \u003d \"sr_ref\""},{"line_number":2281,"context_line":""},{"line_number":2282,"context_line":"        self.mox.StubOutWithMock(vm_utils, \u0027scan_default_sr\u0027)"},{"line_number":2283,"context_line":"        self.mox.StubOutWithMock(self.conn._session.VBD, \u0027get_all\u0027)"},{"line_number":2284,"context_line":"        self.mox.StubOutWithMock(self.conn._session.VBD, \u0027get_VDI\u0027)"},{"line_number":2285,"context_line":"        self.mox.StubOutWithMock(self.conn._session.SR, \u0027get_VDIs\u0027)"}],"source_content_type":"text/x-python","patch_set":11,"id":"3ac371cc_866b6a1d","line":2282,"updated":"2016-08-18 10:54:48.000000000","message":"New tests must be written with mock, not mox.","commit_id":"dcec842f115f5a3b2831b15e13cb0170ea87657a"},{"author":{"_account_id":17169,"name":"John Hua","email":"ihuazhihao@gmail.com","username":"johnhua"},"change_message_id":"5b63d643154d41928d67009a0b194d595319ec3b","unresolved":false,"context_lines":[{"line_number":2279,"context_line":"    def _test_get_disk_used(self, vbds, vdis):"},{"line_number":2280,"context_line":"        sr_ref \u003d \"sr_ref\""},{"line_number":2281,"context_line":""},{"line_number":2282,"context_line":"        self.mox.StubOutWithMock(vm_utils, \u0027scan_default_sr\u0027)"},{"line_number":2283,"context_line":"        self.mox.StubOutWithMock(self.conn._session.VBD, \u0027get_all\u0027)"},{"line_number":2284,"context_line":"        self.mox.StubOutWithMock(self.conn._session.VBD, \u0027get_VDI\u0027)"},{"line_number":2285,"context_line":"        self.mox.StubOutWithMock(self.conn._session.SR, \u0027get_VDIs\u0027)"}],"source_content_type":"text/x-python","patch_set":11,"id":"3ac371cc_5210c5a8","line":2282,"in_reply_to":"3ac371cc_866b6a1d","updated":"2016-08-19 09:48:58.000000000","message":"Done","commit_id":"dcec842f115f5a3b2831b15e13cb0170ea87657a"},{"author":{"_account_id":6735,"name":"Bob Ball","email":"bob.ball@citrix.com","username":"bob-ball"},"change_message_id":"8aa88cb2d1d861a1ef7a00ea47be8c602897d879","unresolved":false,"context_lines":[{"line_number":2116,"context_line":"        stats \u003d self.conn.host_state.get_host_stats(False)"},{"line_number":2117,"context_line":"        # Values from fake.create_local_srs (ext SR)"},{"line_number":2118,"context_line":"        self.assertEqual(stats[\u0027disk_total\u0027], 40000)"},{"line_number":2119,"context_line":"        self.assertEqual(stats[\u0027disk_used\u0027], 20000)"},{"line_number":2120,"context_line":"        # Values from fake._plugin_xenhost_host_data"},{"line_number":2121,"context_line":"        self.assertEqual(stats[\u0027host_memory_total\u0027], 10)"},{"line_number":2122,"context_line":"        self.assertEqual(stats[\u0027host_memory_overhead\u0027], 20)"}],"source_content_type":"text/x-python","patch_set":15,"id":"1ac06dbe_1f6e24c9","side":"PARENT","line":2119,"updated":"2016-08-25 13:53:57.000000000","message":"This may no longer be 20000, but isn\u0027t there a value here we should be testing for?\nSeems strange to remove this assert rather than update it...","commit_id":"15e536518ae1a366c8a8b15d9183072050e4b6f2"},{"author":{"_account_id":17169,"name":"John Hua","email":"ihuazhihao@gmail.com","username":"johnhua"},"change_message_id":"86cd2c1cd0a2eef4e9aada66c03213fd1e58ee74","unresolved":false,"context_lines":[{"line_number":2116,"context_line":"        stats \u003d self.conn.host_state.get_host_stats(False)"},{"line_number":2117,"context_line":"        # Values from fake.create_local_srs (ext SR)"},{"line_number":2118,"context_line":"        self.assertEqual(stats[\u0027disk_total\u0027], 40000)"},{"line_number":2119,"context_line":"        self.assertEqual(stats[\u0027disk_used\u0027], 20000)"},{"line_number":2120,"context_line":"        # Values from fake._plugin_xenhost_host_data"},{"line_number":2121,"context_line":"        self.assertEqual(stats[\u0027host_memory_total\u0027], 10)"},{"line_number":2122,"context_line":"        self.assertEqual(stats[\u0027host_memory_overhead\u0027], 20)"}],"source_content_type":"text/x-python","patch_set":15,"id":"fa7ab95a_d325ebae","side":"PARENT","line":2119,"in_reply_to":"1ac06dbe_1f6e24c9","updated":"2016-08-26 02:05:59.000000000","message":"Done","commit_id":"15e536518ae1a366c8a8b15d9183072050e4b6f2"}],"nova/virt/xenapi/host.py":[{"author":{"_account_id":6735,"name":"Bob Ball","email":"bob.ball@citrix.com","username":"bob-ball"},"change_message_id":"5f3992aef3dbe3b3d4160208ea2f01fad9c1194b","unresolved":false,"context_lines":[{"line_number":237,"context_line":"            sr_ref \u003d vm_utils.scan_default_sr(self._session)"},{"line_number":238,"context_line":"            sr_rec \u003d self._session.SR.get_record(sr_ref)"},{"line_number":239,"context_line":"            total \u003d int(sr_rec[\"physical_size\"])"},{"line_number":240,"context_line":"            used \u003d vm_utils.get_disk_used(self._session)"},{"line_number":241,"context_line":"            data[\"disk_total\"] \u003d total"},{"line_number":242,"context_line":"            data[\"disk_used\"] \u003d used"},{"line_number":243,"context_line":"            data[\"disk_allocated\"] \u003d int(sr_rec[\"virtual_allocation\"])"}],"source_content_type":"text/x-python","patch_set":7,"id":"3ac371cc_27f5e2ca","line":240,"updated":"2016-08-16 09:04:48.000000000","message":"Why should the function be in vm_utils.py rather than host.py?","commit_id":"8ece532dca957cd28b3c93665c78f4537965fb3e"},{"author":{"_account_id":17169,"name":"John Hua","email":"ihuazhihao@gmail.com","username":"johnhua"},"change_message_id":"38c3fc74cc4801b4205b9e2ffe1ce47738f985f1","unresolved":false,"context_lines":[{"line_number":237,"context_line":"            sr_ref \u003d vm_utils.scan_default_sr(self._session)"},{"line_number":238,"context_line":"            sr_rec \u003d self._session.SR.get_record(sr_ref)"},{"line_number":239,"context_line":"            total \u003d int(sr_rec[\"physical_size\"])"},{"line_number":240,"context_line":"            used \u003d vm_utils.get_disk_used(self._session)"},{"line_number":241,"context_line":"            data[\"disk_total\"] \u003d total"},{"line_number":242,"context_line":"            data[\"disk_used\"] \u003d used"},{"line_number":243,"context_line":"            data[\"disk_allocated\"] \u003d int(sr_rec[\"virtual_allocation\"])"}],"source_content_type":"text/x-python","patch_set":7,"id":"3ac371cc_4d1c3cc1","line":240,"in_reply_to":"3ac371cc_27f5e2ca","updated":"2016-08-17 10:43:28.000000000","message":"get_disk_used looks like a util function. And in host.py update_status will be called in the init function, thus breaking a lot of existing test cases. If we move it to vm_utils.py, it will be less context-specific and easier for unit testing.","commit_id":"8ece532dca957cd28b3c93665c78f4537965fb3e"},{"author":{"_account_id":17920,"name":"Jianghua Wang","email":"jianghua.wang@citrix.com","username":"wjhfresh"},"change_message_id":"2517517178b00c56356c22467839cb02fdeb75dc","unresolved":false,"context_lines":[{"line_number":228,"context_line":"        return self._stats"},{"line_number":229,"context_line":""},{"line_number":230,"context_line":"    def get_disk_used(self, sr_ref):"},{"line_number":231,"context_line":"        \"\"\"Since glance images are downloaded and snapshotted before they are"},{"line_number":232,"context_line":"        used. Only a small proportion of its VDI will be in use and it will"},{"line_number":233,"context_line":"        never grow. So the real disk usage for VDIs varies with their"},{"line_number":234,"context_line":"        capability to expand. It applies to other scenarios that uses snapshot"}],"source_content_type":"text/x-python","patch_set":18,"id":"da4df55a_9fef3a86","line":231,"range":{"start_line":231,"start_character":34,"end_line":231,"end_character":61},"updated":"2016-12-28 03:49:46.000000000","message":"Is this true only when enabled image cache. If yes, suggest mention it at here.","commit_id":"5436131cee5dcd4a43d40f07133f1ee17262876e"},{"author":{"_account_id":17920,"name":"Jianghua Wang","email":"jianghua.wang@citrix.com","username":"wjhfresh"},"change_message_id":"2517517178b00c56356c22467839cb02fdeb75dc","unresolved":false,"context_lines":[{"line_number":236,"context_line":"        \"\"\""},{"line_number":237,"context_line":""},{"line_number":238,"context_line":"        vbds \u003d self._session.VBD.get_all()"},{"line_number":239,"context_line":"        attached_vdis \u003d [self._session.VBD.get_VDI(vbd_ref)"},{"line_number":240,"context_line":"                         for vbd_ref in vbds]"},{"line_number":241,"context_line":"        # Filter out unplugged VBDs"},{"line_number":242,"context_line":"        attached_vdis \u003d [vdi for vdi in attached_vdis"}],"source_content_type":"text/x-python","patch_set":18,"id":"da4df55a_7a5384e2","line":239,"updated":"2016-12-28 03:49:46.000000000","message":"So it looks like the used_size \u003d sum(virtual_size(plugged VDIs)) + sum(physical_utilisation(others VDIs which having vbd)). \n\nWill it cause to over allocation for some cases e.g. \n1. vdi hotplug is in progress? VDI not plugged to VM\n2. Even in normal disk generation, it also has the possibilities that VDI created but not having VBD created or not attached.\nhttps://github.com/openstack/nova/blob/master/nova/virt/xenapi/vm_utils.py#L986","commit_id":"5436131cee5dcd4a43d40f07133f1ee17262876e"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"4eb805b496e0b57f801e282a3ea9ca4e6fbb2215","unresolved":false,"context_lines":[{"line_number":240,"context_line":"                         for vbd_ref in vbds]"},{"line_number":241,"context_line":"        # Filter out unplugged VBDs"},{"line_number":242,"context_line":"        attached_vdis \u003d [vdi for vdi in attached_vdis"},{"line_number":243,"context_line":"                         if vdi !\u003d \u0027Opaqueref:NULL\u0027]"},{"line_number":244,"context_line":"        all_vdis \u003d self._session.SR.get_VDIs(sr_ref)"},{"line_number":245,"context_line":"        fixedsize_vdis \u003d [vdi for vdi in all_vdis if vdi not in attached_vdis]"},{"line_number":246,"context_line":"        # Make sure all of the VDIs we are counting are on this SR"}],"source_content_type":"text/x-python","patch_set":18,"id":"5a74a57a_46388e3d","line":243,"range":{"start_line":243,"start_character":35,"end_line":243,"end_character":51},"updated":"2016-11-28 11:47:32.000000000","message":"This feels nasty somehow. Maybe we want a constant for that, like XENAPI_NULL_REF or something?","commit_id":"5436131cee5dcd4a43d40f07133f1ee17262876e"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"4eb805b496e0b57f801e282a3ea9ca4e6fbb2215","unresolved":false,"context_lines":[{"line_number":235,"context_line":"        too."},{"line_number":236,"context_line":"        \"\"\""},{"line_number":237,"context_line":""},{"line_number":238,"context_line":"        vbds \u003d self._session.VBD.get_all()"},{"line_number":239,"context_line":"        attached_vdis \u003d [self._session.VBD.get_VDI(vbd_ref)"},{"line_number":240,"context_line":"                         for vbd_ref in vbds]"},{"line_number":241,"context_line":"        # Filter out unplugged VBDs"},{"line_number":242,"context_line":"        attached_vdis \u003d [vdi for vdi in attached_vdis"},{"line_number":243,"context_line":"                         if vdi !\u003d \u0027Opaqueref:NULL\u0027]"},{"line_number":244,"context_line":"        all_vdis \u003d self._session.SR.get_VDIs(sr_ref)"},{"line_number":245,"context_line":"        fixedsize_vdis \u003d [vdi for vdi in all_vdis if vdi not in attached_vdis]"},{"line_number":246,"context_line":"        # Make sure all of the VDIs we are counting are on this SR"},{"line_number":247,"context_line":"        attached_vdis \u003d [vdi for vdi in attached_vdis if vdi in all_vdis]"},{"line_number":248,"context_line":"        virtual_used \u003d sum(["},{"line_number":249,"context_line":"            int(self._session.VDI.get_virtual_size(vdi_ref))"},{"line_number":250,"context_line":"            for vdi_ref in attached_vdis])"},{"line_number":251,"context_line":"        physical_used \u003d sum(["},{"line_number":252,"context_line":"            int(self._session.VDI.get_physical_utilisation(vdi_ref))"},{"line_number":253,"context_line":"            for vdi_ref in fixedsize_vdis])"},{"line_number":254,"context_line":"        return virtual_used + physical_used"},{"line_number":255,"context_line":""},{"line_number":256,"context_line":"    def update_status(self):"},{"line_number":257,"context_line":"        \"\"\"Since under Xenserver, a compute node runs on a given host,"}],"source_content_type":"text/x-python","patch_set":18,"id":"5a74a57a_c6d65ef0","line":254,"range":{"start_line":238,"start_character":0,"end_line":254,"end_character":43},"updated":"2016-11-28 11:47:32.000000000","message":"So we need to take more care here around things that change while this method is being executed.\n\nWe need to make sure we handle when the VBD or VDI is removed while we are running through this. I don\u0027t remember what happens with those get_xxx class when the vdi has been deleted, I guess it raises an exception.\n\nSee what is being done here:\nhttps://github.com/openstack/nova/blob/master/nova/virt/xenapi/vm_utils.py\nTraditionally we get the full record for all the VDIs, rather than calling methods individually. Thats an easy, if in efficient, fix for the problem. I am curious what bob things is the best approach here.\n\nMinor Nit: I think this probably belongs in the vm_utils next to all the similar kinds of functions. But I am OK with it staying here too.","commit_id":"5436131cee5dcd4a43d40f07133f1ee17262876e"},{"author":{"_account_id":6735,"name":"Bob Ball","email":"bob.ball@citrix.com","username":"bob-ball"},"change_message_id":"a1fc4190f1495c4e2ae7b7609a8b6ee76ad2242f","unresolved":false,"context_lines":[{"line_number":235,"context_line":"        too."},{"line_number":236,"context_line":"        \"\"\""},{"line_number":237,"context_line":""},{"line_number":238,"context_line":"        vbds \u003d self._session.VBD.get_all()"},{"line_number":239,"context_line":"        attached_vdis \u003d [self._session.VBD.get_VDI(vbd_ref)"},{"line_number":240,"context_line":"                         for vbd_ref in vbds]"},{"line_number":241,"context_line":"        # Filter out unplugged VBDs"},{"line_number":242,"context_line":"        attached_vdis \u003d [vdi for vdi in attached_vdis"},{"line_number":243,"context_line":"                         if vdi !\u003d \u0027Opaqueref:NULL\u0027]"},{"line_number":244,"context_line":"        all_vdis \u003d self._session.SR.get_VDIs(sr_ref)"},{"line_number":245,"context_line":"        fixedsize_vdis \u003d [vdi for vdi in all_vdis if vdi not in attached_vdis]"},{"line_number":246,"context_line":"        # Make sure all of the VDIs we are counting are on this SR"},{"line_number":247,"context_line":"        attached_vdis \u003d [vdi for vdi in attached_vdis if vdi in all_vdis]"},{"line_number":248,"context_line":"        virtual_used \u003d sum(["},{"line_number":249,"context_line":"            int(self._session.VDI.get_virtual_size(vdi_ref))"},{"line_number":250,"context_line":"            for vdi_ref in attached_vdis])"},{"line_number":251,"context_line":"        physical_used \u003d sum(["},{"line_number":252,"context_line":"            int(self._session.VDI.get_physical_utilisation(vdi_ref))"},{"line_number":253,"context_line":"            for vdi_ref in fixedsize_vdis])"},{"line_number":254,"context_line":"        return virtual_used + physical_used"},{"line_number":255,"context_line":""},{"line_number":256,"context_line":"    def update_status(self):"},{"line_number":257,"context_line":"        \"\"\"Since under Xenserver, a compute node runs on a given host,"}],"source_content_type":"text/x-python","patch_set":18,"id":"3a71b18c_20c5833b","line":254,"range":{"start_line":238,"start_character":0,"end_line":254,"end_character":43},"in_reply_to":"5a74a57a_c6d65ef0","updated":"2016-12-09 11:40:54.000000000","message":"Getting the record is quite expensive particularly in comparison to a single value.\nI suggest we have a helper function which will return a default if the requested call returns there is no matching VDI, e.g.:\ntry:\n  self._session.VDI.get_virtual_size(vdi_ref)\nexcept session.XenAPI.Failure as exc:\n  if exc.details[0] \u003d\u003d \u0027UUID_INVALID\u0027:\n    return default\n  raise","commit_id":"5436131cee5dcd4a43d40f07133f1ee17262876e"},{"author":{"_account_id":7634,"name":"Takashi Natsume","email":"takanattie@gmail.com","username":"natsumet"},"change_message_id":"1d9bf153b391e5e599070c4ed5da5d02cf6a9b89","unresolved":false,"context_lines":[{"line_number":258,"context_line":"                else:"},{"line_number":259,"context_line":"                    allocated +\u003d vdi_physical"},{"line_number":260,"context_line":"                physical_used +\u003d vdi_physical"},{"line_number":261,"context_line":"            except ValueError:"},{"line_number":262,"context_line":"                LOG.exception(_LE(\u0027Unable to get size for vdi %s\u0027), vdi_ref)"},{"line_number":263,"context_line":"            except self._session.XenAPI.Failure:"},{"line_number":264,"context_line":"                LOG.exception(_LE(\u0027Unable to get size for vdi %s\u0027), vdi_ref)"},{"line_number":265,"context_line":""},{"line_number":266,"context_line":"        return (allocated, physical_used)"},{"line_number":267,"context_line":""}],"source_content_type":"text/x-python","patch_set":22,"id":"bff0334d_8b94158d","line":264,"range":{"start_line":261,"start_character":0,"end_line":264,"end_character":76},"updated":"2017-04-06 07:53:50.000000000","message":"It is redundant. The following would be better.\n\n    except (ValueError, self._session.XenAPI.Failure):\n        LOG.exception(_LE(\u0027Unable to get size for vdi %s\u0027), vdi_ref)","commit_id":"24e7648b0d77f7ee8ac0767c1790de4e5b3d1bf1"}],"nova/virt/xenapi/vm_utils.py":[{"author":{"_account_id":6735,"name":"Bob Ball","email":"bob.ball@citrix.com","username":"bob-ball"},"change_message_id":"5f3992aef3dbe3b3d4160208ea2f01fad9c1194b","unresolved":false,"context_lines":[{"line_number":1922,"context_line":""},{"line_number":1923,"context_line":""},{"line_number":1924,"context_line":"def get_disk_used(session):"},{"line_number":1925,"context_line":"    \"\"\"Since the VHD has a virtual size of 40GB when uploaded to glance"},{"line_number":1926,"context_line":"    although the physical utilisation will only be the size of its"},{"line_number":1927,"context_line":"    snapshot. So the used disk space should be the virtual_allocation for"},{"line_number":1928,"context_line":"    all VDIs attached to a VM plus physical_utilization for all other VDIs"}],"source_content_type":"text/x-python","patch_set":7,"id":"3ac371cc_642b5895","line":1925,"range":{"start_line":1925,"start_character":27,"end_line":1925,"end_character":47},"updated":"2016-08-16 09:04:48.000000000","message":"\"virtual size larger than the physical\" - the 40GB is just one specific case.","commit_id":"8ece532dca957cd28b3c93665c78f4537965fb3e"},{"author":{"_account_id":17169,"name":"John Hua","email":"ihuazhihao@gmail.com","username":"johnhua"},"change_message_id":"38c3fc74cc4801b4205b9e2ffe1ce47738f985f1","unresolved":false,"context_lines":[{"line_number":1922,"context_line":""},{"line_number":1923,"context_line":""},{"line_number":1924,"context_line":"def get_disk_used(session):"},{"line_number":1925,"context_line":"    \"\"\"Since the VHD has a virtual size of 40GB when uploaded to glance"},{"line_number":1926,"context_line":"    although the physical utilisation will only be the size of its"},{"line_number":1927,"context_line":"    snapshot. So the used disk space should be the virtual_allocation for"},{"line_number":1928,"context_line":"    all VDIs attached to a VM plus physical_utilization for all other VDIs"}],"source_content_type":"text/x-python","patch_set":7,"id":"3ac371cc_0ddb64ed","line":1925,"range":{"start_line":1925,"start_character":27,"end_line":1925,"end_character":47},"in_reply_to":"3ac371cc_642b5895","updated":"2016-08-17 10:43:28.000000000","message":"Done","commit_id":"8ece532dca957cd28b3c93665c78f4537965fb3e"},{"author":{"_account_id":6735,"name":"Bob Ball","email":"bob.ball@citrix.com","username":"bob-ball"},"change_message_id":"5f3992aef3dbe3b3d4160208ea2f01fad9c1194b","unresolved":false,"context_lines":[{"line_number":1924,"context_line":"def get_disk_used(session):"},{"line_number":1925,"context_line":"    \"\"\"Since the VHD has a virtual size of 40GB when uploaded to glance"},{"line_number":1926,"context_line":"    although the physical utilisation will only be the size of its"},{"line_number":1927,"context_line":"    snapshot. So the used disk space should be the virtual_allocation for"},{"line_number":1928,"context_line":"    all VDIs attached to a VM plus physical_utilization for all other VDIs"},{"line_number":1929,"context_line":"    as they cannot expand"},{"line_number":1930,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":7,"id":"3ac371cc_e723caa5","line":1927,"range":{"start_line":1927,"start_character":4,"end_line":1927,"end_character":12},"updated":"2016-08-16 09:04:48.000000000","message":"The point is that glance images are downloaded and snapshotted before they are used.\nWe might only use 1GB out of a 60GB VDI.  Virtual utilisation will be 60GB but it will never grow more than 1GB because the disk is snapshotted rather than used directly.\n\nCan you re-work the comment to make this clearer?","commit_id":"8ece532dca957cd28b3c93665c78f4537965fb3e"},{"author":{"_account_id":17169,"name":"John Hua","email":"ihuazhihao@gmail.com","username":"johnhua"},"change_message_id":"38c3fc74cc4801b4205b9e2ffe1ce47738f985f1","unresolved":false,"context_lines":[{"line_number":1924,"context_line":"def get_disk_used(session):"},{"line_number":1925,"context_line":"    \"\"\"Since the VHD has a virtual size of 40GB when uploaded to glance"},{"line_number":1926,"context_line":"    although the physical utilisation will only be the size of its"},{"line_number":1927,"context_line":"    snapshot. So the used disk space should be the virtual_allocation for"},{"line_number":1928,"context_line":"    all VDIs attached to a VM plus physical_utilization for all other VDIs"},{"line_number":1929,"context_line":"    as they cannot expand"},{"line_number":1930,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":7,"id":"3ac371cc_8dce342c","line":1927,"range":{"start_line":1927,"start_character":4,"end_line":1927,"end_character":12},"in_reply_to":"3ac371cc_e723caa5","updated":"2016-08-17 10:43:28.000000000","message":"Done","commit_id":"8ece532dca957cd28b3c93665c78f4537965fb3e"},{"author":{"_account_id":6735,"name":"Bob Ball","email":"bob.ball@citrix.com","username":"bob-ball"},"change_message_id":"5f3992aef3dbe3b3d4160208ea2f01fad9c1194b","unresolved":false,"context_lines":[{"line_number":1931,"context_line":""},{"line_number":1932,"context_line":"    sr_ref \u003d scan_default_sr(session)"},{"line_number":1933,"context_line":""},{"line_number":1934,"context_line":"    used_vbds \u003d session.call_xenapi(\"VBD.get_all\")"},{"line_number":1935,"context_line":"    used_vdis \u003d [session.call_xenapi(\"VBD.get_VDI\", vbd_ref)"},{"line_number":1936,"context_line":"                 for vbd_ref in used_vbds]"},{"line_number":1937,"context_line":"    # Filter out unplugged VBDs"}],"source_content_type":"text/x-python","patch_set":7,"id":"3ac371cc_273de2bb","line":1934,"updated":"2016-08-16 09:04:48.000000000","message":"Please use the new-style for accessing XAPI calls:\nsession.VBD.get_all()\nsession.VBD.get_VDI(vbd_ref)\netc","commit_id":"8ece532dca957cd28b3c93665c78f4537965fb3e"},{"author":{"_account_id":17169,"name":"John Hua","email":"ihuazhihao@gmail.com","username":"johnhua"},"change_message_id":"38c3fc74cc4801b4205b9e2ffe1ce47738f985f1","unresolved":false,"context_lines":[{"line_number":1931,"context_line":""},{"line_number":1932,"context_line":"    sr_ref \u003d scan_default_sr(session)"},{"line_number":1933,"context_line":""},{"line_number":1934,"context_line":"    used_vbds \u003d session.call_xenapi(\"VBD.get_all\")"},{"line_number":1935,"context_line":"    used_vdis \u003d [session.call_xenapi(\"VBD.get_VDI\", vbd_ref)"},{"line_number":1936,"context_line":"                 for vbd_ref in used_vbds]"},{"line_number":1937,"context_line":"    # Filter out unplugged VBDs"}],"source_content_type":"text/x-python","patch_set":7,"id":"3ac371cc_0d540451","line":1934,"in_reply_to":"3ac371cc_273de2bb","updated":"2016-08-17 10:43:28.000000000","message":"Done","commit_id":"8ece532dca957cd28b3c93665c78f4537965fb3e"},{"author":{"_account_id":6735,"name":"Bob Ball","email":"bob.ball@citrix.com","username":"bob-ball"},"change_message_id":"5f3992aef3dbe3b3d4160208ea2f01fad9c1194b","unresolved":false,"context_lines":[{"line_number":1932,"context_line":"    sr_ref \u003d scan_default_sr(session)"},{"line_number":1933,"context_line":""},{"line_number":1934,"context_line":"    used_vbds \u003d session.call_xenapi(\"VBD.get_all\")"},{"line_number":1935,"context_line":"    used_vdis \u003d [session.call_xenapi(\"VBD.get_VDI\", vbd_ref)"},{"line_number":1936,"context_line":"                 for vbd_ref in used_vbds]"},{"line_number":1937,"context_line":"    # Filter out unplugged VBDs"},{"line_number":1938,"context_line":"    used_vdis \u003d [vdi for vdi in used_vdis if vdi !\u003d \u0027Opaqueref:NULL\u0027]"}],"source_content_type":"text/x-python","patch_set":7,"id":"3ac371cc_67519ad8","line":1935,"updated":"2016-08-16 09:04:48.000000000","message":"Perhaps this should be \u0027attached_vdis\u0027 and the \u0027unused_vdis\u0027 should be \u0027fixedsize_vdis\u0027?  Would make it clearer to others who may not 100% understand what\u0027s going on here.","commit_id":"8ece532dca957cd28b3c93665c78f4537965fb3e"},{"author":{"_account_id":17169,"name":"John Hua","email":"ihuazhihao@gmail.com","username":"johnhua"},"change_message_id":"38c3fc74cc4801b4205b9e2ffe1ce47738f985f1","unresolved":false,"context_lines":[{"line_number":1932,"context_line":"    sr_ref \u003d scan_default_sr(session)"},{"line_number":1933,"context_line":""},{"line_number":1934,"context_line":"    used_vbds \u003d session.call_xenapi(\"VBD.get_all\")"},{"line_number":1935,"context_line":"    used_vdis \u003d [session.call_xenapi(\"VBD.get_VDI\", vbd_ref)"},{"line_number":1936,"context_line":"                 for vbd_ref in used_vbds]"},{"line_number":1937,"context_line":"    # Filter out unplugged VBDs"},{"line_number":1938,"context_line":"    used_vdis \u003d [vdi for vdi in used_vdis if vdi !\u003d \u0027Opaqueref:NULL\u0027]"}],"source_content_type":"text/x-python","patch_set":7,"id":"3ac371cc_cd5dcc7a","line":1935,"in_reply_to":"3ac371cc_67519ad8","updated":"2016-08-17 10:43:28.000000000","message":"Done","commit_id":"8ece532dca957cd28b3c93665c78f4537965fb3e"},{"author":{"_account_id":6735,"name":"Bob Ball","email":"bob.ball@citrix.com","username":"bob-ball"},"change_message_id":"04b6a339a0da5ac860b7662ce1bae9675faeb4f8","unresolved":false,"context_lines":[{"line_number":1921,"context_line":"    return None"},{"line_number":1922,"context_line":""},{"line_number":1923,"context_line":""},{"line_number":1924,"context_line":"def get_disk_used(session):"},{"line_number":1925,"context_line":"    \"\"\"Since glance images are downloaded and snapshotted before they are used."},{"line_number":1926,"context_line":"    Only a small proportion of its VDI will be in use and it will never grow."},{"line_number":1927,"context_line":"    So the real disk usage for VDIs varies with their capability to expand."}],"source_content_type":"text/x-python","patch_set":11,"id":"3ac371cc_06f49a58","line":1924,"updated":"2016-08-18 10:54:48.000000000","message":"I still think this should be in host.py; it\u0027s a useful function for the host statistics really (as it\u0027s quite specialised there) - so I don\u0027t think there is value in separating it out into a utils file.","commit_id":"dcec842f115f5a3b2831b15e13cb0170ea87657a"},{"author":{"_account_id":17169,"name":"John Hua","email":"ihuazhihao@gmail.com","username":"johnhua"},"change_message_id":"5b63d643154d41928d67009a0b194d595319ec3b","unresolved":false,"context_lines":[{"line_number":1921,"context_line":"    return None"},{"line_number":1922,"context_line":""},{"line_number":1923,"context_line":""},{"line_number":1924,"context_line":"def get_disk_used(session):"},{"line_number":1925,"context_line":"    \"\"\"Since glance images are downloaded and snapshotted before they are used."},{"line_number":1926,"context_line":"    Only a small proportion of its VDI will be in use and it will never grow."},{"line_number":1927,"context_line":"    So the real disk usage for VDIs varies with their capability to expand."}],"source_content_type":"text/x-python","patch_set":11,"id":"3ac371cc_32626917","line":1924,"in_reply_to":"3ac371cc_06f49a58","updated":"2016-08-19 09:48:58.000000000","message":"Done","commit_id":"dcec842f115f5a3b2831b15e13cb0170ea87657a"},{"author":{"_account_id":17920,"name":"Jianghua Wang","email":"jianghua.wang@citrix.com","username":"wjhfresh"},"change_message_id":"0e32bfca37f0b1aa66cd2361076465c53136c396","unresolved":false,"context_lines":[{"line_number":1922,"context_line":""},{"line_number":1923,"context_line":""},{"line_number":1924,"context_line":"def get_disk_used(session):"},{"line_number":1925,"context_line":"    \"\"\"Since glance images are downloaded and snapshotted before they are used."},{"line_number":1926,"context_line":"    Only a small proportion of its VDI will be in use and it will never grow."},{"line_number":1927,"context_line":"    So the real disk usage for VDIs varies with their capability to expand."},{"line_number":1928,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":11,"id":"3ac371cc_ddc7ba62","line":1925,"updated":"2016-08-19 01:58:39.000000000","message":"At here, glance image is only one of the scenarios for snapshot. Any snapshot will result into the base VDI not to grow anymore. right? And glance image will be snapshotted only when cache_image is enabled. Suggest update the comment.","commit_id":"dcec842f115f5a3b2831b15e13cb0170ea87657a"},{"author":{"_account_id":17169,"name":"John Hua","email":"ihuazhihao@gmail.com","username":"johnhua"},"change_message_id":"5b63d643154d41928d67009a0b194d595319ec3b","unresolved":false,"context_lines":[{"line_number":1922,"context_line":""},{"line_number":1923,"context_line":""},{"line_number":1924,"context_line":"def get_disk_used(session):"},{"line_number":1925,"context_line":"    \"\"\"Since glance images are downloaded and snapshotted before they are used."},{"line_number":1926,"context_line":"    Only a small proportion of its VDI will be in use and it will never grow."},{"line_number":1927,"context_line":"    So the real disk usage for VDIs varies with their capability to expand."},{"line_number":1928,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":11,"id":"3ac371cc_124e4d96","line":1925,"in_reply_to":"3ac371cc_ddc7ba62","updated":"2016-08-19 09:48:58.000000000","message":"Done","commit_id":"dcec842f115f5a3b2831b15e13cb0170ea87657a"}]}
