{"action":"created","comment":{"url":"https://api.github.com/repos/Microsoft/hcsshim/pulls/comments/190381770","pull_request_review_id":122745176,"id":190381770,"diff_hunk":"@@ -0,0 +1,129 @@\n+package uvm\n+\n+import (\n+\t\"fmt\"\n+\t//\"path/filepath\"\n+\t\"strings\"\n+\n+\t\"github.com/Microsoft/hcsshim/internal/schema2\"\n+\t\"github.com/Microsoft/hcsshim/internal/wclayer\"\n+\t\"github.com/Microsoft/hcsshim/uvm/lcowhostedsettings\"\n+\t\"github.com/sirupsen/logrus\"\n+)\n+\n+// AddPlan9 adds a Plan9 share to a utility VM. Each Plan9 share is ref-counted and\n+// only added if it isn't already.\n+func (uvm *UtilityVM) AddPlan9(hostPath string, uvmPath string, flags int32) error {\n+\tif uvm.operatingSystem != \"linux\" {\n+\t\treturn errNotSupported\n+\t}\n+\tif uvmPath == \"\" {\n+\t\treturn fmt.Errorf(\"uvmPath must be passed to AddPlan9\")\n+\t}\n+\n+\thostPath = strings.ToLower(hostPath)\n+\tlogrus.Debugf(\"uvm::AddPlan9 %s %s %d id:%s\", hostPath, uvmPath, flags, uvm.id)\n+\tuvm.m.Lock()\n+\tdefer uvm.m.Unlock()\n+\tif uvm.plan9Shares == nil {\n+\t\tuvm.plan9Shares = make(map[string]plan9Info)\n+\t}\n+\tif _, ok := uvm.plan9Shares[hostPath]; !ok {\n+\t\tguid, err := wclayer.NameToGuid(hostPath) // TODO: We should hash the full hostpath on VSMB too\n+\t\tif err != nil {\n+\t\t\tlogrus.Debugf(\"Failed NamedToGuid\", err)\n+\t\t\treturn err\n+\t\t}\n+\n+\t\tuvm.plan9PortCounter++ // TODO: This is temporary. Each share currently requires a unique port in HCS and GCS. This will change so we use a single port (9999)\n+\n+\t\tmodification := &schema2.ModifySettingsRequestV2{\n+\t\t\tResourceType: schema2.ResourceTypePlan9Share,\n+\t\t\tRequestType:  schema2.RequestTypeAdd,\n+\t\t\tSettings: schema2.VirtualMachinesResourcesStoragePlan9ShareV2{\n+\t\t\t\tName: guid.String(),\n+\t\t\t\tPath: hostPath,\n+\t\t\t\tPort: uvm.plan9PortCounter,\n+\t\t\t},\n+\t\t\tResourceUri: fmt.Sprintf(\"virtualmachine/devices/plan9shares/%s\", guid.String()),\n+\t\t\tHostedSettings: lcowhostedsettings.MappedDirectory{\n+\t\t\t\tMountPath: uvmPath,\n+\t\t\t\tPort:      uvm.plan9PortCounter,\n+\t\t\t\tReadOnly:  (flags | schema2.VPlan9FlagReadOnly) == schema2.VPlan9FlagReadOnly,\n+\t\t\t},\n+\t\t}\n+\n+\t\tif err := uvm.Modify(modification); err != nil {\n+\t\t\treturn err\n+\t\t}\n+\t\tuvm.plan9Shares[hostPath] = plan9Info{\n+\t\t\trefCount: 1,\n+\t\t\tuvmPath:  uvmPath,\n+\t\t\tguid:     guid.String(),\n+\t\t\tport:     uvm.plan9PortCounter,\n+\t\t}\n+\t} else {\n+\t\tp9i := plan9Info{","path":"uvm/plan9.go","position":66,"original_position":66,"commit_id":"f00aa07ec0a869d3a28ae688f757996175f54ee4","original_commit_id":"f00aa07ec0a869d3a28ae688f757996175f54ee4","user":{"login":"jstarks","id":9548354,"avatar_url":"https://avatars1.githubusercontent.com/u/9548354?v=4","gravatar_id":"","url":"https://api.github.com/users/jstarks","html_url":"https://github.com/jstarks","followers_url":"https://api.github.com/users/jstarks/followers","following_url":"https://api.github.com/users/jstarks/following{/other_user}","gists_url":"https://api.github.com/users/jstarks/gists{/gist_id}","starred_url":"https://api.github.com/users/jstarks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jstarks/subscriptions","organizations_url":"https://api.github.com/users/jstarks/orgs","repos_url":"https://api.github.com/users/jstarks/repos","events_url":"https://api.github.com/users/jstarks/events{/privacy}","received_events_url":"https://api.github.com/users/jstarks/received_events","type":"User","site_admin":false},"body":"In network.go I have a simpler approach to updating the map, by using a pointer for the map's value type.","created_at":"2018-05-23T20:05:06Z","updated_at":"2018-05-23T20:11:51Z","html_url":"https://github.com/Microsoft/hcsshim/pull/224#discussion_r190381770","pull_request_url":"https://api.github.com/repos/Microsoft/hcsshim/pulls/224","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/Microsoft/hcsshim/pulls/comments/190381770"},"html":{"href":"https://github.com/Microsoft/hcsshim/pull/224#discussion_r190381770"},"pull_request":{"href":"https://api.github.com/repos/Microsoft/hcsshim/pulls/224"}}},"pull_request":{"url":"https://api.github.com/repos/Microsoft/hcsshim/pulls/224","id":190086878,"html_url":"https://github.com/Microsoft/hcsshim/pull/224","diff_url":"https://github.com/Microsoft/hcsshim/pull/224.diff","patch_url":"https://github.com/Microsoft/hcsshim/pull/224.patch","issue_url":"https://api.github.com/repos/Microsoft/hcsshim/issues/224","number":224,"state":"open","locked":false,"title":"Add Plan9 shares for LCOW","user":{"login":"jhowardmsft","id":10522484,"avatar_url":"https://avatars2.githubusercontent.com/u/10522484?v=4","gravatar_id":"","url":"https://api.github.com/users/jhowardmsft","html_url":"https://github.com/jhowardmsft","followers_url":"https://api.github.com/users/jhowardmsft/followers","following_url":"https://api.github.com/users/jhowardmsft/following{/other_user}","gists_url":"https://api.github.com/users/jhowardmsft/gists{/gist_id}","starred_url":"https://api.github.com/users/jhowardmsft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhowardmsft/subscriptions","organizations_url":"https://api.github.com/users/jhowardmsft/orgs","repos_url":"https://api.github.com/users/jhowardmsft/repos","events_url":"https://api.github.com/users/jhowardmsft/events{/privacy}","received_events_url":"https://api.github.com/users/jhowardmsft/received_events","type":"User","site_admin":false},"body":"Signed-off-by: John Howard <jhoward@microsoft.com>","created_at":"2018-05-23T19:54:09Z","updated_at":"2018-05-23T20:11:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"aaa838645f4d48e761f4f6dc4f30638be538659e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Microsoft/hcsshim/pulls/224/commits","review_comments_url":"https://api.github.com/repos/Microsoft/hcsshim/pulls/224/comments","review_comment_url":"https://api.github.com/repos/Microsoft/hcsshim/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Microsoft/hcsshim/issues/224/comments","statuses_url":"https://api.github.com/repos/Microsoft/hcsshim/statuses/f00aa07ec0a869d3a28ae688f757996175f54ee4","head":{"label":"Microsoft:jjh/plan9","ref":"jjh/plan9","sha":"f00aa07ec0a869d3a28ae688f757996175f54ee4","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars2.githubusercontent.com/u/6154722?v=4","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":38258831,"name":"hcsshim","full_name":"Microsoft/hcsshim","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars2.githubusercontent.com/u/6154722?v=4","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/hcsshim","description":"Windows - Host Compute Service Shim","fork":false,"url":"https://api.github.com/repos/Microsoft/hcsshim","forks_url":"https://api.github.com/repos/Microsoft/hcsshim/forks","keys_url":"https://api.github.com/repos/Microsoft/hcsshim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/hcsshim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/hcsshim/teams","hooks_url":"https://api.github.com/repos/Microsoft/hcsshim/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/hcsshim/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/hcsshim/events","assignees_url":"https://api.github.com/repos/Microsoft/hcsshim/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/hcsshim/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/hcsshim/tags","blobs_url":"https://api.github.com/repos/Microsoft/hcsshim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/hcsshim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/hcsshim/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/hcsshim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/hcsshim/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/hcsshim/languages","stargazers_url":"https://api.github.com/repos/Microsoft/hcsshim/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/hcsshim/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/hcsshim/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/hcsshim/subscription","commits_url":"https://api.github.com/repos/Microsoft/hcsshim/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/hcsshim/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/hcsshim/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/hcsshim/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/hcsshim/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/hcsshim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/hcsshim/merges","archive_url":"https://api.github.com/repos/Microsoft/hcsshim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/hcsshim/downloads","issues_url":"https://api.github.com/repos/Microsoft/hcsshim/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/hcsshim/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/hcsshim/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/hcsshim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/hcsshim/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/hcsshim/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/hcsshim/deployments","created_at":"2015-06-29T16:44:26Z","updated_at":"2018-05-22T18:10:44Z","pushed_at":"2018-05-23T19:54:09Z","git_url":"git://github.com/Microsoft/hcsshim.git","ssh_url":"git@github.com:Microsoft/hcsshim.git","clone_url":"https://github.com/Microsoft/hcsshim.git","svn_url":"https://github.com/Microsoft/hcsshim","homepage":null,"size":733,"stargazers_count":120,"watchers_count":120,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":41,"mirror_url":null,"archived":false,"open_issues_count":20,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":41,"open_issues":20,"watchers":120,"default_branch":"master"}},"base":{"label":"Microsoft:master","ref":"master","sha":"433ca492724657a2f7dcf7bdec8cfcb5fb7d9379","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars2.githubusercontent.com/u/6154722?v=4","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":38258831,"name":"hcsshim","full_name":"Microsoft/hcsshim","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars2.githubusercontent.com/u/6154722?v=4","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/hcsshim","description":"Windows - Host Compute Service Shim","fork":false,"url":"https://api.github.com/repos/Microsoft/hcsshim","forks_url":"https://api.github.com/repos/Microsoft/hcsshim/forks","keys_url":"https://api.github.com/repos/Microsoft/hcsshim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/hcsshim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/hcsshim/teams","hooks_url":"https://api.github.com/repos/Microsoft/hcsshim/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/hcsshim/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/hcsshim/events","assignees_url":"https://api.github.com/repos/Microsoft/hcsshim/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/hcsshim/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/hcsshim/tags","blobs_url":"https://api.github.com/repos/Microsoft/hcsshim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/hcsshim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/hcsshim/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/hcsshim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/hcsshim/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/hcsshim/languages","stargazers_url":"https://api.github.com/repos/Microsoft/hcsshim/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/hcsshim/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/hcsshim/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/hcsshim/subscription","commits_url":"https://api.github.com/repos/Microsoft/hcsshim/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/hcsshim/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/hcsshim/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/hcsshim/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/hcsshim/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/hcsshim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/hcsshim/merges","archive_url":"https://api.github.com/repos/Microsoft/hcsshim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/hcsshim/downloads","issues_url":"https://api.github.com/repos/Microsoft/hcsshim/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/hcsshim/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/hcsshim/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/hcsshim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/hcsshim/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/hcsshim/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/hcsshim/deployments","created_at":"2015-06-29T16:44:26Z","updated_at":"2018-05-22T18:10:44Z","pushed_at":"2018-05-23T19:54:09Z","git_url":"git://github.com/Microsoft/hcsshim.git","ssh_url":"git@github.com:Microsoft/hcsshim.git","clone_url":"https://github.com/Microsoft/hcsshim.git","svn_url":"https://github.com/Microsoft/hcsshim","homepage":null,"size":733,"stargazers_count":120,"watchers_count":120,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":41,"mirror_url":null,"archived":false,"open_issues_count":20,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":41,"open_issues":20,"watchers":120,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Microsoft/hcsshim/pulls/224"},"html":{"href":"https://github.com/Microsoft/hcsshim/pull/224"},"issue":{"href":"https://api.github.com/repos/Microsoft/hcsshim/issues/224"},"comments":{"href":"https://api.github.com/repos/Microsoft/hcsshim/issues/224/comments"},"review_comments":{"href":"https://api.github.com/repos/Microsoft/hcsshim/pulls/224/comments"},"review_comment":{"href":"https://api.github.com/repos/Microsoft/hcsshim/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Microsoft/hcsshim/pulls/224/commits"},"statuses":{"href":"https://api.github.com/repos/Microsoft/hcsshim/statuses/f00aa07ec0a869d3a28ae688f757996175f54ee4"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"jstarks"}}