{"action":"created","comment":{"url":"https://api.github.com/repos/vmware/docker-volume-vsphere/pulls/comments/102998685","pull_request_review_id":23776328,"id":102998685,"diff_hunk":"@@ -331,9 +336,27 @@ def get_datastore_name(datastore_url):\n         return auth.DEFAULT_DS\n \n     # Query datastore name from VIM API\n+    logging.debug(\"get_datastore_name: ds_objects=%s\", get_datastore_objects())\n     res = [d.info.name for d in get_datastore_objects() if d.info.url == datastore_url]\n     return res[0]\n \n+def get_datastore_name_from_config_path(config_path):\n+    \"\"\"Returns datastore NAME in config_path (not url-name which may be used in path)\n+    \"\"\"\n+    # path is always /vmfs/volumes/<datastore>/... , so extract datastore:\n+    config_ds_name = config_path.split(\"/\")[3]\n+    # get_datastore() return the cached value\n+    # if datastore is changed outside\n+    # ds_name may have a stale value\n+    # therefore, force to refresh datastore cache by calling get_datastores()\n+    # with need_refresh=True\n+    ds_name = [x[0] for x in get_datastores(need_refresh=True) \\","path":"esx_service/utils/vmdk_utils.py","position":55,"original_position":55,"commit_id":"3a88ba8e524f724dab91108e003a97b37656712c","original_commit_id":"3a88ba8e524f724dab91108e003a97b37656712c","user":{"login":"lipingxue","id":4754483,"avatar_url":"https://avatars.githubusercontent.com/u/4754483?v=3","gravatar_id":"","url":"https://api.github.com/users/lipingxue","html_url":"https://github.com/lipingxue","followers_url":"https://api.github.com/users/lipingxue/followers","following_url":"https://api.github.com/users/lipingxue/following{/other_user}","gists_url":"https://api.github.com/users/lipingxue/gists{/gist_id}","starred_url":"https://api.github.com/users/lipingxue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lipingxue/subscriptions","organizations_url":"https://api.github.com/users/lipingxue/orgs","repos_url":"https://api.github.com/users/lipingxue/repos","events_url":"https://api.github.com/users/lipingxue/events{/privacy}","received_events_url":"https://api.github.com/users/lipingxue/received_events","type":"User","site_admin":false},"body":"This will not work. Since get_datastore() use cache value, it will return the old datastore name here instead of \"not found\". Unless we do refresh, we don't know whether the old datastore name is still valid.","created_at":"2017-02-24T18:12:37Z","updated_at":"2017-02-24T18:12:37Z","html_url":"https://github.com/vmware/docker-volume-vsphere/pull/959#discussion_r102998685","pull_request_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/pulls/959","_links":{"self":{"href":"https://api.github.com/repos/vmware/docker-volume-vsphere/pulls/comments/102998685"},"html":{"href":"https://github.com/vmware/docker-volume-vsphere/pull/959#discussion_r102998685"},"pull_request":{"href":"https://api.github.com/repos/vmware/docker-volume-vsphere/pulls/959"}}},"pull_request":{"url":"https://api.github.com/repos/vmware/docker-volume-vsphere/pulls/959","id":107725305,"html_url":"https://github.com/vmware/docker-volume-vsphere/pull/959","diff_url":"https://github.com/vmware/docker-volume-vsphere/pull/959.diff","patch_url":"https://github.com/vmware/docker-volume-vsphere/pull/959.patch","issue_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/issues/959","number":959,"state":"open","locked":false,"title":"Fixes issue #818 by forcing to refresh datastore cache ","user":{"login":"lipingxue","id":4754483,"avatar_url":"https://avatars.githubusercontent.com/u/4754483?v=3","gravatar_id":"","url":"https://api.github.com/users/lipingxue","html_url":"https://github.com/lipingxue","followers_url":"https://api.github.com/users/lipingxue/followers","following_url":"https://api.github.com/users/lipingxue/following{/other_user}","gists_url":"https://api.github.com/users/lipingxue/gists{/gist_id}","starred_url":"https://api.github.com/users/lipingxue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lipingxue/subscriptions","organizations_url":"https://api.github.com/users/lipingxue/orgs","repos_url":"https://api.github.com/users/lipingxue/repos","events_url":"https://api.github.com/users/lipingxue/events{/privacy}","received_events_url":"https://api.github.com/users/lipingxue/received_events","type":"User","site_admin":false},"body":"There are two reasons that blocking volume to be created on a datastore which name includes spaces.\r\n1. one is in function \"findDeviceByPath\",  \"vmdk_path\" cannot be parsed correctly if datastore name includes spaces. This has been fixed by PR https://github.com/vmware/docker-volume-vsphere/pull/905\r\n\r\n2. another reason when try to get datastore name from VM configure path (function \"get_datastore_name_from_config_path\", previous name is \"get_datastore_name(config_path), I rename this function and move it from vmdk_ops.py to vmdk_utils.py), it may return the stale datastore name.\r\n\r\nThis is the example:\r\nConfiguration: only _DEFAULT tenant is configured, VM \"photon5\" is create on datastore \"datastore1\"\r\n\r\nstep 1: create a volume \"vol1\" by running \"docker volume create --driver=vmdk --name=vol1\"\r\nA volume \"vol1\" will be created on datastore \"datastore1\"\r\n\r\nstep2: rename datastore \"datastore1\" to \"datastore   1\" (actually, the space in the name does not matter here)\r\nstep3: create another volume \"vol2\" by running \"docker volume create --driver=vmdk --name=vol1\"\r\nThe above command will fail with error \"IndexError('list index out of range',)\".\r\n\r\nFunction  \"get_datastore_name_from_config_path\" is called to get the datastore where the VM is created, in our case, it should return \"datastore   1\".(\"datastore1\" is renamed to \"datastore    1\" in above step2), but function  \"\"get_datastore_name_from_config_path\" returned an incorrect cached value \"datastore1\", which is wrong\r\n\r\nThe fix is to force refresh datastore cache in function  \"get_datastore_name_from_config_path\".","created_at":"2017-02-23T22:15:20Z","updated_at":"2017-02-24T18:12:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c3749537494bea80b6ff763212302d3569a8d33a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/pulls/959/commits","review_comments_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/pulls/959/comments","review_comment_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/pulls/comments{/number}","comments_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/issues/959/comments","statuses_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/statuses/3a88ba8e524f724dab91108e003a97b37656712c","head":{"label":"vmware:create_vol_fail_on_ds_space_issue_818.liping","ref":"create_vol_fail_on_ds_space_issue_818.liping","sha":"3a88ba8e524f724dab91108e003a97b37656712c","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":49599693,"name":"docker-volume-vsphere","full_name":"vmware/docker-volume-vsphere","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/docker-volume-vsphere","description":"vSphere Docker Volume Service","fork":false,"url":"https://api.github.com/repos/vmware/docker-volume-vsphere","forks_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/forks","keys_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/teams","hooks_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/hooks","issue_events_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/issues/events{/number}","events_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/events","assignees_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/assignees{/user}","branches_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/branches{/branch}","tags_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/tags","blobs_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/git/refs{/sha}","trees_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/statuses/{sha}","languages_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/languages","stargazers_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/stargazers","contributors_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/contributors","subscribers_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/subscribers","subscription_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/subscription","commits_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/commits{/sha}","git_commits_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/git/commits{/sha}","comments_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/comments{/number}","issue_comment_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/issues/comments{/number}","contents_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/contents/{+path}","compare_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/merges","archive_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/downloads","issues_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/issues{/number}","pulls_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/pulls{/number}","milestones_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/milestones{/number}","notifications_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/labels{/name}","releases_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/releases{/id}","deployments_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/deployments","created_at":"2016-01-13T20:25:36Z","updated_at":"2017-02-24T15:15:25Z","pushed_at":"2017-02-24T08:19:40Z","git_url":"git://github.com/vmware/docker-volume-vsphere.git","ssh_url":"git@github.com:vmware/docker-volume-vsphere.git","clone_url":"https://github.com/vmware/docker-volume-vsphere.git","svn_url":"https://github.com/vmware/docker-volume-vsphere","homepage":"https://vmware.github.io/docker-volume-vsphere","size":9321,"stargazers_count":108,"watchers_count":108,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":27,"mirror_url":null,"open_issues_count":139,"forks":27,"open_issues":139,"watchers":108,"default_branch":"master"}},"base":{"label":"vmware:master","ref":"master","sha":"e76f6635a94f3f48e493a6e3f546f72b19d37fdf","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":49599693,"name":"docker-volume-vsphere","full_name":"vmware/docker-volume-vsphere","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/docker-volume-vsphere","description":"vSphere Docker Volume Service","fork":false,"url":"https://api.github.com/repos/vmware/docker-volume-vsphere","forks_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/forks","keys_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/teams","hooks_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/hooks","issue_events_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/issues/events{/number}","events_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/events","assignees_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/assignees{/user}","branches_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/branches{/branch}","tags_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/tags","blobs_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/git/refs{/sha}","trees_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/statuses/{sha}","languages_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/languages","stargazers_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/stargazers","contributors_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/contributors","subscribers_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/subscribers","subscription_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/subscription","commits_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/commits{/sha}","git_commits_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/git/commits{/sha}","comments_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/comments{/number}","issue_comment_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/issues/comments{/number}","contents_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/contents/{+path}","compare_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/merges","archive_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/downloads","issues_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/issues{/number}","pulls_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/pulls{/number}","milestones_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/milestones{/number}","notifications_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/labels{/name}","releases_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/releases{/id}","deployments_url":"https://api.github.com/repos/vmware/docker-volume-vsphere/deployments","created_at":"2016-01-13T20:25:36Z","updated_at":"2017-02-24T15:15:25Z","pushed_at":"2017-02-24T08:19:40Z","git_url":"git://github.com/vmware/docker-volume-vsphere.git","ssh_url":"git@github.com:vmware/docker-volume-vsphere.git","clone_url":"https://github.com/vmware/docker-volume-vsphere.git","svn_url":"https://github.com/vmware/docker-volume-vsphere","homepage":"https://vmware.github.io/docker-volume-vsphere","size":9321,"stargazers_count":108,"watchers_count":108,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":27,"mirror_url":null,"open_issues_count":139,"forks":27,"open_issues":139,"watchers":108,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/vmware/docker-volume-vsphere/pulls/959"},"html":{"href":"https://github.com/vmware/docker-volume-vsphere/pull/959"},"issue":{"href":"https://api.github.com/repos/vmware/docker-volume-vsphere/issues/959"},"comments":{"href":"https://api.github.com/repos/vmware/docker-volume-vsphere/issues/959/comments"},"review_comments":{"href":"https://api.github.com/repos/vmware/docker-volume-vsphere/pulls/959/comments"},"review_comment":{"href":"https://api.github.com/repos/vmware/docker-volume-vsphere/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/vmware/docker-volume-vsphere/pulls/959/commits"},"statuses":{"href":"https://api.github.com/repos/vmware/docker-volume-vsphere/statuses/3a88ba8e524f724dab91108e003a97b37656712c"}}}}
{"actor":{"display_login":"lipingxue"}}