{"action":"created","comment":{"url":"https://api.github.com/repos/kata-containers/runtime/pulls/comments/212879518","pull_request_review_id":149597290,"id":212879518,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMjg3OTUxOA==","diff_hunk":"@@ -1267,6 +1267,56 @@ func (c *Container) updateResources(oldResources, newResources ContainerResource\n \t\t// recalculate the actual number of vCPUs if a different number of vCPUs was removed\n \t\tnewResources.VCPUs = oldVCPUs - vcpusRemoved\n \t}\n+\treturn nil\n+}\n+\n+func (c *Container) updateMemoryResources(oldResources, newResources ContainerResources) error {\n+\toldMem := oldResources.Mem\n+\tnewMem := newResources.Mem\n+\n+\tif newMem == 0 || oldMem == newMem {\n+\t\tc.Logger().WithFields(logrus.Fields{\n+\t\t\t\"old-mem\": fmt.Sprintf(\"%dMB\", oldMem),\n+\t\t\t\"new-mem\": fmt.Sprintf(\"%dMB\", newMem),\n+\t\t}).Debug(\"the actual number of Mem will not be modified\")\n+\t\treturn nil\n+\t}\n+\n+\tif oldMem < newMem {\n+\t\t// hot add memory\n+\t\taddMemMB := newMem - oldMem\n+\t\t// hot add memory must be aligned to 128MB\n+\t\tif addMemMB%128 != 0 {\n+\t\t\treturn fmt.Errorf(\"can not hot add memory which isn't aligned to 128MB\")\n+\t\t}\n+\n+\t\tvirtLog.Debugf(\"hot adding %dMB mem\", addMemMB)\n+\t\taddMemDevice := &memoryDevice{\n+\t\t\tsizeMB: int(addMemMB),\n+\t\t}\n+\t\t_, err := c.sandbox.hypervisor.hotplugAddDevice(addMemDevice, memoryDev)\n+\t\tif err != nil {\n+\t\t\treturn err\n+\t\t}\n+\t\tnewResources.Mem = newMem\n+\t\tif err := c.sandbox.agent.onlineCPUMem(0); err != nil {\n+\t\t\treturn err\n+\t\t}\n+\t} else {\n+\t\t// hot remove memory\n+\t\treturn fmt.Errorf(\"can't hot remove memory, we don't support this feature yet\")","path":"virtcontainers/container.go","position":59,"original_position":59,"commit_id":"8cbf499347c086c58eede0c8af7b97fb8be1dfc4","original_commit_id":"8cbf499347c086c58eede0c8af7b97fb8be1dfc4","user":{"login":"ydjainopensource","id":33664673,"node_id":"MDQ6VXNlcjMzNjY0Njcz","avatar_url":"https://avatars0.githubusercontent.com/u/33664673?v=4","gravatar_id":"","url":"https://api.github.com/users/ydjainopensource","html_url":"https://github.com/ydjainopensource","followers_url":"https://api.github.com/users/ydjainopensource/followers","following_url":"https://api.github.com/users/ydjainopensource/following{/other_user}","gists_url":"https://api.github.com/users/ydjainopensource/gists{/gist_id}","starred_url":"https://api.github.com/users/ydjainopensource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ydjainopensource/subscriptions","organizations_url":"https://api.github.com/users/ydjainopensource/orgs","repos_url":"https://api.github.com/users/ydjainopensource/repos","events_url":"https://api.github.com/users/ydjainopensource/events{/privacy}","received_events_url":"https://api.github.com/users/ydjainopensource/received_events","type":"User","site_admin":false},"body":"No I think hotplug would be the better choice here. I say this because, almost all of IBM Z docs use plug/unplug and even ovirt calls it [hotplug](https://ovirt.org/develop/release-management/features/virt/hot-plug-memory/). Looks like Vmware is the only one calling it hotadd. But I am okay with hot add if the community agrees.","created_at":"2018-08-27T06:48:58Z","updated_at":"2018-08-27T06:48:58Z","html_url":"https://github.com/kata-containers/runtime/pull/624#discussion_r212879518","pull_request_url":"https://api.github.com/repos/kata-containers/runtime/pulls/624","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/kata-containers/runtime/pulls/comments/212879518"},"html":{"href":"https://github.com/kata-containers/runtime/pull/624#discussion_r212879518"},"pull_request":{"href":"https://api.github.com/repos/kata-containers/runtime/pulls/624"}},"in_reply_to_id":212250851},"pull_request":{"url":"https://api.github.com/repos/kata-containers/runtime/pulls/624","id":210375807,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEwMzc1ODA3","html_url":"https://github.com/kata-containers/runtime/pull/624","diff_url":"https://github.com/kata-containers/runtime/pull/624.diff","patch_url":"https://github.com/kata-containers/runtime/pull/624.patch","issue_url":"https://api.github.com/repos/kata-containers/runtime/issues/624","number":624,"state":"open","locked":false,"title":"virtcontainers: hotplug memory with kata-runtime update command.","user":{"login":"clarecch","id":42630974,"node_id":"MDQ6VXNlcjQyNjMwOTc0","avatar_url":"https://avatars3.githubusercontent.com/u/42630974?v=4","gravatar_id":"","url":"https://api.github.com/users/clarecch","html_url":"https://github.com/clarecch","followers_url":"https://api.github.com/users/clarecch/followers","following_url":"https://api.github.com/users/clarecch/following{/other_user}","gists_url":"https://api.github.com/users/clarecch/gists{/gist_id}","starred_url":"https://api.github.com/users/clarecch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clarecch/subscriptions","organizations_url":"https://api.github.com/users/clarecch/orgs","repos_url":"https://api.github.com/users/clarecch/repos","events_url":"https://api.github.com/users/clarecch/events{/privacy}","received_events_url":"https://api.github.com/users/clarecch/received_events","type":"User","site_admin":false},"body":"Add support for using update command to hotplug memory to vm.\r\nConnect kata-runtime update interface with hypervisor memory hotplug\r\nfeature.\r\n\r\nSigned-off-by: Clare Chen <clare.chenhui@huawei.com>","created_at":"2018-08-23T08:54:45Z","updated_at":"2018-08-27T06:48:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0989e0d5e1725180ed62492a7389954a37753900","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/kata-containers/runtime/pulls/624/commits","review_comments_url":"https://api.github.com/repos/kata-containers/runtime/pulls/624/comments","review_comment_url":"https://api.github.com/repos/kata-containers/runtime/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kata-containers/runtime/issues/624/comments","statuses_url":"https://api.github.com/repos/kata-containers/runtime/statuses/8cbf499347c086c58eede0c8af7b97fb8be1dfc4","head":{"label":"clarecch:update_memory","ref":"update_memory","sha":"8cbf499347c086c58eede0c8af7b97fb8be1dfc4","user":{"login":"clarecch","id":42630974,"node_id":"MDQ6VXNlcjQyNjMwOTc0","avatar_url":"https://avatars3.githubusercontent.com/u/42630974?v=4","gravatar_id":"","url":"https://api.github.com/users/clarecch","html_url":"https://github.com/clarecch","followers_url":"https://api.github.com/users/clarecch/followers","following_url":"https://api.github.com/users/clarecch/following{/other_user}","gists_url":"https://api.github.com/users/clarecch/gists{/gist_id}","starred_url":"https://api.github.com/users/clarecch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clarecch/subscriptions","organizations_url":"https://api.github.com/users/clarecch/orgs","repos_url":"https://api.github.com/users/clarecch/repos","events_url":"https://api.github.com/users/clarecch/events{/privacy}","received_events_url":"https://api.github.com/users/clarecch/received_events","type":"User","site_admin":false},"repo":{"id":145813712,"node_id":"MDEwOlJlcG9zaXRvcnkxNDU4MTM3MTI=","name":"runtime","full_name":"clarecch/runtime","owner":{"login":"clarecch","id":42630974,"node_id":"MDQ6VXNlcjQyNjMwOTc0","avatar_url":"https://avatars3.githubusercontent.com/u/42630974?v=4","gravatar_id":"","url":"https://api.github.com/users/clarecch","html_url":"https://github.com/clarecch","followers_url":"https://api.github.com/users/clarecch/followers","following_url":"https://api.github.com/users/clarecch/following{/other_user}","gists_url":"https://api.github.com/users/clarecch/gists{/gist_id}","starred_url":"https://api.github.com/users/clarecch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clarecch/subscriptions","organizations_url":"https://api.github.com/users/clarecch/orgs","repos_url":"https://api.github.com/users/clarecch/repos","events_url":"https://api.github.com/users/clarecch/events{/privacy}","received_events_url":"https://api.github.com/users/clarecch/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/clarecch/runtime","description":"Kata Containers runtime","fork":true,"url":"https://api.github.com/repos/clarecch/runtime","forks_url":"https://api.github.com/repos/clarecch/runtime/forks","keys_url":"https://api.github.com/repos/clarecch/runtime/keys{/key_id}","collaborators_url":"https://api.github.com/repos/clarecch/runtime/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/clarecch/runtime/teams","hooks_url":"https://api.github.com/repos/clarecch/runtime/hooks","issue_events_url":"https://api.github.com/repos/clarecch/runtime/issues/events{/number}","events_url":"https://api.github.com/repos/clarecch/runtime/events","assignees_url":"https://api.github.com/repos/clarecch/runtime/assignees{/user}","branches_url":"https://api.github.com/repos/clarecch/runtime/branches{/branch}","tags_url":"https://api.github.com/repos/clarecch/runtime/tags","blobs_url":"https://api.github.com/repos/clarecch/runtime/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/clarecch/runtime/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/clarecch/runtime/git/refs{/sha}","trees_url":"https://api.github.com/repos/clarecch/runtime/git/trees{/sha}","statuses_url":"https://api.github.com/repos/clarecch/runtime/statuses/{sha}","languages_url":"https://api.github.com/repos/clarecch/runtime/languages","stargazers_url":"https://api.github.com/repos/clarecch/runtime/stargazers","contributors_url":"https://api.github.com/repos/clarecch/runtime/contributors","subscribers_url":"https://api.github.com/repos/clarecch/runtime/subscribers","subscription_url":"https://api.github.com/repos/clarecch/runtime/subscription","commits_url":"https://api.github.com/repos/clarecch/runtime/commits{/sha}","git_commits_url":"https://api.github.com/repos/clarecch/runtime/git/commits{/sha}","comments_url":"https://api.github.com/repos/clarecch/runtime/comments{/number}","issue_comment_url":"https://api.github.com/repos/clarecch/runtime/issues/comments{/number}","contents_url":"https://api.github.com/repos/clarecch/runtime/contents/{+path}","compare_url":"https://api.github.com/repos/clarecch/runtime/compare/{base}...{head}","merges_url":"https://api.github.com/repos/clarecch/runtime/merges","archive_url":"https://api.github.com/repos/clarecch/runtime/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/clarecch/runtime/downloads","issues_url":"https://api.github.com/repos/clarecch/runtime/issues{/number}","pulls_url":"https://api.github.com/repos/clarecch/runtime/pulls{/number}","milestones_url":"https://api.github.com/repos/clarecch/runtime/milestones{/number}","notifications_url":"https://api.github.com/repos/clarecch/runtime/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/clarecch/runtime/labels{/name}","releases_url":"https://api.github.com/repos/clarecch/runtime/releases{/id}","deployments_url":"https://api.github.com/repos/clarecch/runtime/deployments","created_at":"2018-08-23T06:56:08Z","updated_at":"2018-08-23T06:56:12Z","pushed_at":"2018-08-23T09:30:36Z","git_url":"git://github.com/clarecch/runtime.git","ssh_url":"git@github.com:clarecch/runtime.git","clone_url":"https://github.com/clarecch/runtime.git","svn_url":"https://github.com/clarecch/runtime","homepage":"","size":4838,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kata-containers:master","ref":"master","sha":"d6a773c90caa72b206fb90304c18498153774f1e","user":{"login":"kata-containers","id":33289952,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMzMjg5OTUy","avatar_url":"https://avatars3.githubusercontent.com/u/33289952?v=4","gravatar_id":"","url":"https://api.github.com/users/kata-containers","html_url":"https://github.com/kata-containers","followers_url":"https://api.github.com/users/kata-containers/followers","following_url":"https://api.github.com/users/kata-containers/following{/other_user}","gists_url":"https://api.github.com/users/kata-containers/gists{/gist_id}","starred_url":"https://api.github.com/users/kata-containers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kata-containers/subscriptions","organizations_url":"https://api.github.com/users/kata-containers/orgs","repos_url":"https://api.github.com/users/kata-containers/repos","events_url":"https://api.github.com/users/kata-containers/events{/privacy}","received_events_url":"https://api.github.com/users/kata-containers/received_events","type":"Organization","site_admin":false},"repo":{"id":110539997,"node_id":"MDEwOlJlcG9zaXRvcnkxMTA1Mzk5OTc=","name":"runtime","full_name":"kata-containers/runtime","owner":{"login":"kata-containers","id":33289952,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMzMjg5OTUy","avatar_url":"https://avatars3.githubusercontent.com/u/33289952?v=4","gravatar_id":"","url":"https://api.github.com/users/kata-containers","html_url":"https://github.com/kata-containers","followers_url":"https://api.github.com/users/kata-containers/followers","following_url":"https://api.github.com/users/kata-containers/following{/other_user}","gists_url":"https://api.github.com/users/kata-containers/gists{/gist_id}","starred_url":"https://api.github.com/users/kata-containers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kata-containers/subscriptions","organizations_url":"https://api.github.com/users/kata-containers/orgs","repos_url":"https://api.github.com/users/kata-containers/repos","events_url":"https://api.github.com/users/kata-containers/events{/privacy}","received_events_url":"https://api.github.com/users/kata-containers/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kata-containers/runtime","description":"Kata Containers runtime","fork":false,"url":"https://api.github.com/repos/kata-containers/runtime","forks_url":"https://api.github.com/repos/kata-containers/runtime/forks","keys_url":"https://api.github.com/repos/kata-containers/runtime/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kata-containers/runtime/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kata-containers/runtime/teams","hooks_url":"https://api.github.com/repos/kata-containers/runtime/hooks","issue_events_url":"https://api.github.com/repos/kata-containers/runtime/issues/events{/number}","events_url":"https://api.github.com/repos/kata-containers/runtime/events","assignees_url":"https://api.github.com/repos/kata-containers/runtime/assignees{/user}","branches_url":"https://api.github.com/repos/kata-containers/runtime/branches{/branch}","tags_url":"https://api.github.com/repos/kata-containers/runtime/tags","blobs_url":"https://api.github.com/repos/kata-containers/runtime/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kata-containers/runtime/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kata-containers/runtime/git/refs{/sha}","trees_url":"https://api.github.com/repos/kata-containers/runtime/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kata-containers/runtime/statuses/{sha}","languages_url":"https://api.github.com/repos/kata-containers/runtime/languages","stargazers_url":"https://api.github.com/repos/kata-containers/runtime/stargazers","contributors_url":"https://api.github.com/repos/kata-containers/runtime/contributors","subscribers_url":"https://api.github.com/repos/kata-containers/runtime/subscribers","subscription_url":"https://api.github.com/repos/kata-containers/runtime/subscription","commits_url":"https://api.github.com/repos/kata-containers/runtime/commits{/sha}","git_commits_url":"https://api.github.com/repos/kata-containers/runtime/git/commits{/sha}","comments_url":"https://api.github.com/repos/kata-containers/runtime/comments{/number}","issue_comment_url":"https://api.github.com/repos/kata-containers/runtime/issues/comments{/number}","contents_url":"https://api.github.com/repos/kata-containers/runtime/contents/{+path}","compare_url":"https://api.github.com/repos/kata-containers/runtime/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kata-containers/runtime/merges","archive_url":"https://api.github.com/repos/kata-containers/runtime/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kata-containers/runtime/downloads","issues_url":"https://api.github.com/repos/kata-containers/runtime/issues{/number}","pulls_url":"https://api.github.com/repos/kata-containers/runtime/pulls{/number}","milestones_url":"https://api.github.com/repos/kata-containers/runtime/milestones{/number}","notifications_url":"https://api.github.com/repos/kata-containers/runtime/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kata-containers/runtime/labels{/name}","releases_url":"https://api.github.com/repos/kata-containers/runtime/releases{/id}","deployments_url":"https://api.github.com/repos/kata-containers/runtime/deployments","created_at":"2017-11-13T11:29:03Z","updated_at":"2018-08-24T18:09:21Z","pushed_at":"2018-08-27T06:48:27Z","git_url":"git://github.com/kata-containers/runtime.git","ssh_url":"git@github.com:kata-containers/runtime.git","clone_url":"https://github.com/kata-containers/runtime.git","svn_url":"https://github.com/kata-containers/runtime","homepage":"","size":4868,"stargazers_count":465,"watchers_count":465,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":104,"mirror_url":null,"archived":false,"open_issues_count":163,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":104,"open_issues":163,"watchers":465,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kata-containers/runtime/pulls/624"},"html":{"href":"https://github.com/kata-containers/runtime/pull/624"},"issue":{"href":"https://api.github.com/repos/kata-containers/runtime/issues/624"},"comments":{"href":"https://api.github.com/repos/kata-containers/runtime/issues/624/comments"},"review_comments":{"href":"https://api.github.com/repos/kata-containers/runtime/pulls/624/comments"},"review_comment":{"href":"https://api.github.com/repos/kata-containers/runtime/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kata-containers/runtime/pulls/624/commits"},"statuses":{"href":"https://api.github.com/repos/kata-containers/runtime/statuses/8cbf499347c086c58eede0c8af7b97fb8be1dfc4"}},"author_association":"NONE"}}
{"actor":{"display_login":"ydjainopensource"}}