{"action":"created","comment":{"url":"https://api.github.com/repos/vmware/vic/pulls/comments/67594769","id":67594769,"diff_hunk":"@@ -129,39 +138,88 @@ func (vm *VirtualMachine) configure(spec *types.VirtualMachineConfigSpec) types.\n \treturn nil\n }\n \n-func (vm *VirtualMachine) create(spec *types.VirtualMachineConfigSpec) types.BaseMethodFault {\n-\tp, fault := parseDatastorePath(spec.Files.VmPathName)\n+func (vm *VirtualMachine) useDatastore(name string) *Datastore {\n+\thost := Map.Get(*vm.Runtime.Host).(*HostSystem)\n+\n+\tds := Map.FindByName(name, host.Datastore).(*Datastore)\n+\n+\tif Map.FindByName(name, vm.Datastore) == nil {\n+\t\tvm.Datastore = append(vm.Datastore, ds.Reference())\n+\t}\n+\n+\treturn ds\n+}\n+\n+func (vm *VirtualMachine) setLog(w io.Writer) {\n+\tvm.log = log.New(w, \"vmx \", log.Flags())\n+}\n+\n+func (vm *VirtualMachine) createFile(spec string, name string) (*os.File, types.BaseMethodFault) {\n+\tp, fault := parseDatastorePath(spec)\n \tif fault != nil {\n-\t\treturn fault\n+\t\treturn nil, fault\n \t}\n \n-\thost := Map.Get(*vm.Runtime.Host).(*HostSystem)\n-\tds := Map.FindByName(p.Datastore, host.Datastore).(*Datastore)\n+\tds := vm.useDatastore(p.Datastore)\n+\n+\tfile := path.Join(ds.Info.GetDatastoreInfo().Url, p.Path)\n+\n+\tif name != \"\" {\n+\t\tif path.Ext(file) != \"\" {\n+\t\t\tfile = path.Dir(file)\n+\t\t}\n+\n+\t\tfile = path.Join(file, name)\n+\t}\n \n-\t// Assuming local datastore for now.  TODO: should be via datastore browser / file manager\n-\tdir := ds.Info.GetDatastoreInfo().Url\n+\tdir := path.Dir(file)\n \n-\tvmx := path.Join(dir, p.Path)\n+\t_ = os.MkdirAll(dir, 0700)","path":"pkg/vsphere/simulator/virtual_machine.go","position":113,"original_position":113,"commit_id":"7e128a20997bf77672e4c5289eee272181396a8a","original_commit_id":"7e128a20997bf77672e4c5289eee272181396a8a","user":{"login":"hickeng","id":3923729,"avatar_url":"https://avatars.githubusercontent.com/u/3923729?v=3","gravatar_id":"","url":"https://api.github.com/users/hickeng","html_url":"https://github.com/hickeng","followers_url":"https://api.github.com/users/hickeng/followers","following_url":"https://api.github.com/users/hickeng/following{/other_user}","gists_url":"https://api.github.com/users/hickeng/gists{/gist_id}","starred_url":"https://api.github.com/users/hickeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hickeng/subscriptions","organizations_url":"https://api.github.com/users/hickeng/orgs","repos_url":"https://api.github.com/users/hickeng/repos","events_url":"https://api.github.com/users/hickeng/events{/privacy}","received_events_url":"https://api.github.com/users/hickeng/received_events","type":"User","site_admin":false},"body":"@dougm Perhaps we make this configurable - I agree that we should try to avoid the rename at all, but it's not completely within our control. Having the simulator deliberately from known behavior won't help us ensure that we correctly handle the case where rename does happen.","created_at":"2016-06-18T03:43:34Z","updated_at":"2016-06-18T03:43:34Z","html_url":"https://github.com/vmware/vic/pull/1125#discussion_r67594769","pull_request_url":"https://api.github.com/repos/vmware/vic/pulls/1125","_links":{"self":{"href":"https://api.github.com/repos/vmware/vic/pulls/comments/67594769"},"html":{"href":"https://github.com/vmware/vic/pull/1125#discussion_r67594769"},"pull_request":{"href":"https://api.github.com/repos/vmware/vic/pulls/1125"}}},"pull_request":{"url":"https://api.github.com/repos/vmware/vic/pulls/1125","id":74170618,"html_url":"https://github.com/vmware/vic/pull/1125","diff_url":"https://github.com/vmware/vic/pull/1125.diff","patch_url":"https://github.com/vmware/vic/pull/1125.patch","issue_url":"https://api.github.com/repos/vmware/vic/issues/1125","number":1125,"state":"open","locked":false,"title":"vcsim fixes and enhancements","user":{"login":"dougm","id":30171,"avatar_url":"https://avatars.githubusercontent.com/u/30171?v=3","gravatar_id":"","url":"https://api.github.com/users/dougm","html_url":"https://github.com/dougm","followers_url":"https://api.github.com/users/dougm/followers","following_url":"https://api.github.com/users/dougm/following{/other_user}","gists_url":"https://api.github.com/users/dougm/gists{/gist_id}","starred_url":"https://api.github.com/users/dougm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dougm/subscriptions","organizations_url":"https://api.github.com/users/dougm/orgs","repos_url":"https://api.github.com/users/dougm/repos","events_url":"https://api.github.com/users/dougm/events{/privacy}","received_events_url":"https://api.github.com/users/dougm/received_events","type":"User","site_admin":false},"body":"In support of #809 - much of these are related to testing govmomi/govc against vcsim, but also of use with vic.","created_at":"2016-06-16T23:51:18Z","updated_at":"2016-06-18T03:43:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"508e6fe40a64ae78acb6ccbd51d673e6938e957d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/vmware/vic/pulls/1125/commits","review_comments_url":"https://api.github.com/repos/vmware/vic/pulls/1125/comments","review_comment_url":"https://api.github.com/repos/vmware/vic/pulls/comments{/number}","comments_url":"https://api.github.com/repos/vmware/vic/issues/1125/comments","statuses_url":"https://api.github.com/repos/vmware/vic/statuses/7e128a20997bf77672e4c5289eee272181396a8a","head":{"label":"dougm:vcsim","ref":"vcsim","sha":"7e128a20997bf77672e4c5289eee272181396a8a","user":{"login":"dougm","id":30171,"avatar_url":"https://avatars.githubusercontent.com/u/30171?v=3","gravatar_id":"","url":"https://api.github.com/users/dougm","html_url":"https://github.com/dougm","followers_url":"https://api.github.com/users/dougm/followers","following_url":"https://api.github.com/users/dougm/following{/other_user}","gists_url":"https://api.github.com/users/dougm/gists{/gist_id}","starred_url":"https://api.github.com/users/dougm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dougm/subscriptions","organizations_url":"https://api.github.com/users/dougm/orgs","repos_url":"https://api.github.com/users/dougm/repos","events_url":"https://api.github.com/users/dougm/events{/privacy}","received_events_url":"https://api.github.com/users/dougm/received_events","type":"User","site_admin":false},"repo":{"id":55453476,"name":"vic","full_name":"dougm/vic","owner":{"login":"dougm","id":30171,"avatar_url":"https://avatars.githubusercontent.com/u/30171?v=3","gravatar_id":"","url":"https://api.github.com/users/dougm","html_url":"https://github.com/dougm","followers_url":"https://api.github.com/users/dougm/followers","following_url":"https://api.github.com/users/dougm/following{/other_user}","gists_url":"https://api.github.com/users/dougm/gists{/gist_id}","starred_url":"https://api.github.com/users/dougm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dougm/subscriptions","organizations_url":"https://api.github.com/users/dougm/orgs","repos_url":"https://api.github.com/users/dougm/repos","events_url":"https://api.github.com/users/dougm/events{/privacy}","received_events_url":"https://api.github.com/users/dougm/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dougm/vic","description":"Integrated containers on vSphere","fork":true,"url":"https://api.github.com/repos/dougm/vic","forks_url":"https://api.github.com/repos/dougm/vic/forks","keys_url":"https://api.github.com/repos/dougm/vic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dougm/vic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dougm/vic/teams","hooks_url":"https://api.github.com/repos/dougm/vic/hooks","issue_events_url":"https://api.github.com/repos/dougm/vic/issues/events{/number}","events_url":"https://api.github.com/repos/dougm/vic/events","assignees_url":"https://api.github.com/repos/dougm/vic/assignees{/user}","branches_url":"https://api.github.com/repos/dougm/vic/branches{/branch}","tags_url":"https://api.github.com/repos/dougm/vic/tags","blobs_url":"https://api.github.com/repos/dougm/vic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dougm/vic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dougm/vic/git/refs{/sha}","trees_url":"https://api.github.com/repos/dougm/vic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dougm/vic/statuses/{sha}","languages_url":"https://api.github.com/repos/dougm/vic/languages","stargazers_url":"https://api.github.com/repos/dougm/vic/stargazers","contributors_url":"https://api.github.com/repos/dougm/vic/contributors","subscribers_url":"https://api.github.com/repos/dougm/vic/subscribers","subscription_url":"https://api.github.com/repos/dougm/vic/subscription","commits_url":"https://api.github.com/repos/dougm/vic/commits{/sha}","git_commits_url":"https://api.github.com/repos/dougm/vic/git/commits{/sha}","comments_url":"https://api.github.com/repos/dougm/vic/comments{/number}","issue_comment_url":"https://api.github.com/repos/dougm/vic/issues/comments{/number}","contents_url":"https://api.github.com/repos/dougm/vic/contents/{+path}","compare_url":"https://api.github.com/repos/dougm/vic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dougm/vic/merges","archive_url":"https://api.github.com/repos/dougm/vic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dougm/vic/downloads","issues_url":"https://api.github.com/repos/dougm/vic/issues{/number}","pulls_url":"https://api.github.com/repos/dougm/vic/pulls{/number}","milestones_url":"https://api.github.com/repos/dougm/vic/milestones{/number}","notifications_url":"https://api.github.com/repos/dougm/vic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dougm/vic/labels{/name}","releases_url":"https://api.github.com/repos/dougm/vic/releases{/id}","deployments_url":"https://api.github.com/repos/dougm/vic/deployments","created_at":"2016-04-04T23:45:43Z","updated_at":"2016-04-04T23:45:44Z","pushed_at":"2016-06-17T01:58:00Z","git_url":"git://github.com/dougm/vic.git","ssh_url":"git@github.com:dougm/vic.git","clone_url":"https://github.com/dougm/vic.git","svn_url":"https://github.com/dougm/vic","homepage":null,"size":18083,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"vmware:master","ref":"master","sha":"2e57f6c58c4e3741cc1ef863bdf120b0f10982d8","user":{"login":"vmware","id":473334,"avatar_url":"https://avatars.githubusercontent.com/u/473334?v=3","gravatar_id":"","url":"https://api.github.com/users/vmware","html_url":"https://github.com/vmware","followers_url":"https://api.github.com/users/vmware/followers","following_url":"https://api.github.com/users/vmware/following{/other_user}","gists_url":"https://api.github.com/users/vmware/gists{/gist_id}","starred_url":"https://api.github.com/users/vmware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vmware/subscriptions","organizations_url":"https://api.github.com/users/vmware/orgs","repos_url":"https://api.github.com/users/vmware/repos","events_url":"https://api.github.com/users/vmware/events{/privacy}","received_events_url":"https://api.github.com/users/vmware/received_events","type":"Organization","site_admin":false},"repo":{"id":49597898,"name":"vic","full_name":"vmware/vic","owner":{"login":"vmware","id":473334,"avatar_url":"https://avatars.githubusercontent.com/u/473334?v=3","gravatar_id":"","url":"https://api.github.com/users/vmware","html_url":"https://github.com/vmware","followers_url":"https://api.github.com/users/vmware/followers","following_url":"https://api.github.com/users/vmware/following{/other_user}","gists_url":"https://api.github.com/users/vmware/gists{/gist_id}","starred_url":"https://api.github.com/users/vmware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vmware/subscriptions","organizations_url":"https://api.github.com/users/vmware/orgs","repos_url":"https://api.github.com/users/vmware/repos","events_url":"https://api.github.com/users/vmware/events{/privacy}","received_events_url":"https://api.github.com/users/vmware/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/vmware/vic","description":"Integrated containers on vSphere","fork":false,"url":"https://api.github.com/repos/vmware/vic","forks_url":"https://api.github.com/repos/vmware/vic/forks","keys_url":"https://api.github.com/repos/vmware/vic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vmware/vic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vmware/vic/teams","hooks_url":"https://api.github.com/repos/vmware/vic/hooks","issue_events_url":"https://api.github.com/repos/vmware/vic/issues/events{/number}","events_url":"https://api.github.com/repos/vmware/vic/events","assignees_url":"https://api.github.com/repos/vmware/vic/assignees{/user}","branches_url":"https://api.github.com/repos/vmware/vic/branches{/branch}","tags_url":"https://api.github.com/repos/vmware/vic/tags","blobs_url":"https://api.github.com/repos/vmware/vic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vmware/vic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vmware/vic/git/refs{/sha}","trees_url":"https://api.github.com/repos/vmware/vic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vmware/vic/statuses/{sha}","languages_url":"https://api.github.com/repos/vmware/vic/languages","stargazers_url":"https://api.github.com/repos/vmware/vic/stargazers","contributors_url":"https://api.github.com/repos/vmware/vic/contributors","subscribers_url":"https://api.github.com/repos/vmware/vic/subscribers","subscription_url":"https://api.github.com/repos/vmware/vic/subscription","commits_url":"https://api.github.com/repos/vmware/vic/commits{/sha}","git_commits_url":"https://api.github.com/repos/vmware/vic/git/commits{/sha}","comments_url":"https://api.github.com/repos/vmware/vic/comments{/number}","issue_comment_url":"https://api.github.com/repos/vmware/vic/issues/comments{/number}","contents_url":"https://api.github.com/repos/vmware/vic/contents/{+path}","compare_url":"https://api.github.com/repos/vmware/vic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vmware/vic/merges","archive_url":"https://api.github.com/repos/vmware/vic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vmware/vic/downloads","issues_url":"https://api.github.com/repos/vmware/vic/issues{/number}","pulls_url":"https://api.github.com/repos/vmware/vic/pulls{/number}","milestones_url":"https://api.github.com/repos/vmware/vic/milestones{/number}","notifications_url":"https://api.github.com/repos/vmware/vic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vmware/vic/labels{/name}","releases_url":"https://api.github.com/repos/vmware/vic/releases{/id}","deployments_url":"https://api.github.com/repos/vmware/vic/deployments","created_at":"2016-01-13T19:53:57Z","updated_at":"2016-06-15T22:44:22Z","pushed_at":"2016-06-18T03:42:05Z","git_url":"git://github.com/vmware/vic.git","ssh_url":"git@github.com:vmware/vic.git","clone_url":"https://github.com/vmware/vic.git","svn_url":"https://github.com/vmware/vic","homepage":null,"size":62287,"stargazers_count":90,"watchers_count":90,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":36,"mirror_url":null,"open_issues_count":432,"forks":36,"open_issues":432,"watchers":90,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/vmware/vic/pulls/1125"},"html":{"href":"https://github.com/vmware/vic/pull/1125"},"issue":{"href":"https://api.github.com/repos/vmware/vic/issues/1125"},"comments":{"href":"https://api.github.com/repos/vmware/vic/issues/1125/comments"},"review_comments":{"href":"https://api.github.com/repos/vmware/vic/pulls/1125/comments"},"review_comment":{"href":"https://api.github.com/repos/vmware/vic/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/vmware/vic/pulls/1125/commits"},"statuses":{"href":"https://api.github.com/repos/vmware/vic/statuses/7e128a20997bf77672e4c5289eee272181396a8a"}}}}
{"actor":{"display_login":"hickeng"}}