{"action":"created","issue":{"url":"https://api.github.com/repos/apache/cloudstack/issues/2795","repository_url":"https://api.github.com/repos/apache/cloudstack","labels_url":"https://api.github.com/repos/apache/cloudstack/issues/2795/labels{/name}","comments_url":"https://api.github.com/repos/apache/cloudstack/issues/2795/comments","events_url":"https://api.github.com/repos/apache/cloudstack/issues/2795/events","html_url":"https://github.com/apache/cloudstack/pull/2795","id":348745410,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA3MDIyNzIx","number":2795,"title":"kvm: Properly report available memory to Management Server","user":{"login":"wido","id":326786,"node_id":"MDQ6VXNlcjMyNjc4Ng==","avatar_url":"https://avatars2.githubusercontent.com/u/326786?v=4","gravatar_id":"","url":"https://api.github.com/users/wido","html_url":"https://github.com/wido","followers_url":"https://api.github.com/users/wido/followers","following_url":"https://api.github.com/users/wido/following{/other_user}","gists_url":"https://api.github.com/users/wido/gists{/gist_id}","starred_url":"https://api.github.com/users/wido/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wido/subscriptions","organizations_url":"https://api.github.com/users/wido/orgs","repos_url":"https://api.github.com/users/wido/repos","events_url":"https://api.github.com/users/wido/events{/privacy}","received_events_url":"https://api.github.com/users/wido/received_events","type":"User","site_admin":false},"labels":[{"id":584072971,"node_id":"MDU6TGFiZWw1ODQwNzI5NzE=","url":"https://api.github.com/repos/apache/cloudstack/labels/kvm","name":"kvm","color":"006b75","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/apache/cloudstack/milestones/4","html_url":"https://github.com/apache/cloudstack/milestone/4","labels_url":"https://api.github.com/repos/apache/cloudstack/milestones/4/labels","id":3009550,"node_id":"MDk6TWlsZXN0b25lMzAwOTU1MA==","number":4,"title":"4.12.0.0","description":"Milestone for PRs targetted for the next major 4.12.0.0 release. PRs should be sent for master branch.","creator":{"login":"rhtyd","id":95203,"node_id":"MDQ6VXNlcjk1MjAz","avatar_url":"https://avatars0.githubusercontent.com/u/95203?v=4","gravatar_id":"","url":"https://api.github.com/users/rhtyd","html_url":"https://github.com/rhtyd","followers_url":"https://api.github.com/users/rhtyd/followers","following_url":"https://api.github.com/users/rhtyd/following{/other_user}","gists_url":"https://api.github.com/users/rhtyd/gists{/gist_id}","starred_url":"https://api.github.com/users/rhtyd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhtyd/subscriptions","organizations_url":"https://api.github.com/users/rhtyd/orgs","repos_url":"https://api.github.com/users/rhtyd/repos","events_url":"https://api.github.com/users/rhtyd/events{/privacy}","received_events_url":"https://api.github.com/users/rhtyd/received_events","type":"User","site_admin":false},"open_issues":40,"closed_issues":156,"state":"open","created_at":"2018-01-03T08:46:42Z","updated_at":"2018-12-05T00:04:44Z","due_on":null,"closed_at":null},"comments":51,"created_at":"2018-08-08T14:14:17Z","updated_at":"2018-12-05T16:21:11Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/apache/cloudstack/pulls/2795","html_url":"https://github.com/apache/cloudstack/pull/2795","diff_url":"https://github.com/apache/cloudstack/pull/2795.diff","patch_url":"https://github.com/apache/cloudstack/pull/2795.patch"},"body":"## Description\r\nThe KVM Agent had two mechanisms for reporting its capabilities\r\nand memory to the Management Server.\r\n\r\nOn startup it would ask libvirt the amount of Memory the Host has\r\nand subtract and add the reserved and overcommit memory.\r\n\r\nWhen the HostStats were however reported to the Management Server\r\nthese two configured values on the Agent were no longer reported\r\nin the statistics thus showing all the available memory in the\r\nAgent/Host to the Management Server.\r\n\r\nThis commit unifies this by using the same logic on Agent Startup\r\nand during statistics reporting.\r\n\r\n  memory=3069636608, reservedMemory=1073741824\r\n\r\nThis was reported by a 4GB Hypervisor with this setting:\r\n\r\n  host.reserved.mem.mb=1024\r\n\r\nThe GUI (thus API) would then show:\r\n\r\n  Memory Total\t2.86 GB\r\n\r\nThis way the Agent properly 'lies' to the Management Server about its\r\ncapabilities in terms of Memory.\r\n\r\nThis is very helpful if you want to overprovision or undercommit machines\r\nfor various reasons.\r\n\r\nOvercommitting can be done when KSM or ZSwap or a fast SWAP device is\r\ninstalled in the machine.\r\n\r\nUnderprovisioning is done when the Host might run other tasks then a KVM\r\nhypervisor, for example when it runs in a hyperconverged setup with Ceph.\r\n\r\nIn addition internally many values have been changed from a Double to a Long\r\nand also store the amount of bytes instead of Kilobytes.\r\n\r\n## Types of changes\r\n- [ ] Breaking change (fix or feature that would cause existing functionality to change)\r\n- [ ] New feature (non-breaking change which adds functionality)\r\n- [ ] Bug fix (non-breaking change which fixes an issue)\r\n- [x] Enhancement (improves an existing feature and functionality)\r\n- [ ] Cleanup (Code refactoring and cleanup, that may add test cases)\r\n\r\n## How Has This Been Tested?\r\n\r\nI tested this on a CloudStack 4.12 test setup running on my local system.\r\n\r\nThe KVM Agent will report the amount of memory it has minus any reservations. This way the Mgmt server will never know the exact amount of memory the Agent has.\r\n\r\n## Checklist:\r\n- [x] I have read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/master/CONTRIBUTING.md) document.\r\n- [x] My code follows the code style of this project.\r\n- [ ] My change requires a change to the documentation.\r\n- [ ] I have updated the documentation accordingly.\r\nTesting\r\n- [x] I have added tests to cover my changes.\r\n- [ ] All relevant new and existing integration tests have passed.\r\n- [ ] A full integration testsuite with all test that can run on my environment has passed.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/apache/cloudstack/issues/comments/444546151","html_url":"https://github.com/apache/cloudstack/pull/2795#issuecomment-444546151","issue_url":"https://api.github.com/repos/apache/cloudstack/issues/2795","id":444546151,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NDU0NjE1MQ==","user":{"login":"wido","id":326786,"node_id":"MDQ6VXNlcjMyNjc4Ng==","avatar_url":"https://avatars2.githubusercontent.com/u/326786?v=4","gravatar_id":"","url":"https://api.github.com/users/wido","html_url":"https://github.com/wido","followers_url":"https://api.github.com/users/wido/followers","following_url":"https://api.github.com/users/wido/following{/other_user}","gists_url":"https://api.github.com/users/wido/gists{/gist_id}","starred_url":"https://api.github.com/users/wido/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wido/subscriptions","organizations_url":"https://api.github.com/users/wido/orgs","repos_url":"https://api.github.com/users/wido/repos","events_url":"https://api.github.com/users/wido/events{/privacy}","received_events_url":"https://api.github.com/users/wido/received_events","type":"User","site_admin":false},"created_at":"2018-12-05T16:21:11Z","updated_at":"2018-12-05T16:21:11Z","author_association":"CONTRIBUTOR","body":"@rafaelweingartner I think I addressed your comments.\r\n\r\nI left the 'hvm' code in there as it does serve a purpose. If the node the Agent is started on does not have VT enabled in the BIOS we throw an error and also report to the mgmt server we are not HVM capable. So that's good.\r\n\r\nOtherwise I also fixed the Unit Test, so I think we are good :)"}}
{"actor":{"display_login":"wido"}}