{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/pulls/comments/59604785","id":59604785,"diff_hunk":"@@ -12,107 +12,154 @@\n # See the License for the specific language governing permissions and\n # limitations under the License.\n \n+import json\n import logging\n-import time\n-\n \n+from perfkitbenchmarker import disk\n from perfkitbenchmarker import errors\n from perfkitbenchmarker import flags\n-from perfkitbenchmarker import disk\n+from perfkitbenchmarker import vm_util\n from perfkitbenchmarker.providers.openstack import utils as os_utils\n \n FLAGS = flags.FLAGS\n \n+REMOTE_BOOT_DISK_SIZE_GB = 50\n+\n+\n+def CreateVolume(resource, name, image=None):\n+  \"\"\"Creates a remote (Cinder) block volume.\"\"\"\n+  vol_cmd = os_utils.OpenStackCLICommand(resource, 'volume', 'create', name)\n+  vol_cmd.flags['availability-zone'] = resource.zone\n+  if image:\n+    vol_cmd.flags['image'] = image\n+    vol_cmd.flags['size'] = GetImageMinDiskSize(resource, image)\n+  if FLAGS.openstack_volume_size:\n+    vol_cmd.flags['size'] = FLAGS.openstack_volume_size\n+  else:\n+    vol_cmd.flags['size'] = REMOTE_BOOT_DISK_SIZE_GB\n+  stdout, _, _ = vol_cmd.Issue()\n+  vol_resp = json.loads(stdout)\n+  return vol_resp\n+\n+\n+def GetImageMinDiskSize(resource, image):\n+  \"\"\"Returns minimum disk size required by the image.\"\"\"\n+  image_cmd = os_utils.OpenStackCLICommand(resource, 'image', 'show', image)\n+  stdout, _, _ = image_cmd.Issue()\n+  image_resp = json.loads(stdout)\n+  volume_size = max((int(image_resp['min_disk']), REMOTE_BOOT_DISK_SIZE_GB,))\n+  return volume_size\n+\n+\n+def DeleteVolume(resource, volume_id):\n+  \"\"\"Deletes a remote (Cinder) block volume.\"\"\"\n+  vol_cmd = os_utils.OpenStackCLICommand(resource, 'volume', 'delete',\n+                                         volume_id)\n+  del vol_cmd.flags['format']  # volume delete does not support json output\n+  vol_cmd.Issue()\n+\n+\n+@vm_util.Retry(poll_interval=1, max_retries=-1, timeout=300, log_errors=False,","path":"perfkitbenchmarker/providers/openstack/os_disk.py","position":54,"original_position":54,"commit_id":"a3335b2032720bf4c896348a78afc32f3c7b9237","original_commit_id":"a3335b2032720bf4c896348a78afc32f3c7b9237","user":{"login":"meteorfox","id":232300,"avatar_url":"https://avatars.githubusercontent.com/u/232300?v=3","gravatar_id":"","url":"https://api.github.com/users/meteorfox","html_url":"https://github.com/meteorfox","followers_url":"https://api.github.com/users/meteorfox/followers","following_url":"https://api.github.com/users/meteorfox/following{/other_user}","gists_url":"https://api.github.com/users/meteorfox/gists{/gist_id}","starred_url":"https://api.github.com/users/meteorfox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meteorfox/subscriptions","organizations_url":"https://api.github.com/users/meteorfox/orgs","repos_url":"https://api.github.com/users/meteorfox/repos","events_url":"https://api.github.com/users/meteorfox/events{/privacy}","received_events_url":"https://api.github.com/users/meteorfox/received_events","type":"User","site_admin":false},"body":"For the most part, this operation is really quick (< 5 seconds for empty volumes) which is why I have the small `poll_interval`, but thinking about it, when we create a boot volume with an image it might take longer, but it will depend on the backend implementation they configured to use (LVM, Ceph, etc). I can bump it up to 5 seconds, that should be good enough for most cases.","created_at":"2016-04-13T18:53:42Z","updated_at":"2016-04-13T18:53:42Z","html_url":"https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/pull/942#discussion_r59604785","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/pulls/942","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/pulls/comments/59604785"},"html":{"href":"https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/pull/942#discussion_r59604785"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/pulls/942"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/pulls/942","id":65860094,"html_url":"https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/pull/942","diff_url":"https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/pull/942.diff","patch_url":"https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/pull/942.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/issues/942","number":942,"state":"open","locked":false,"title":"OpenStack CLI provider implementation","user":{"login":"meteorfox","id":232300,"avatar_url":"https://avatars.githubusercontent.com/u/232300?v=3","gravatar_id":"","url":"https://api.github.com/users/meteorfox","html_url":"https://github.com/meteorfox","followers_url":"https://api.github.com/users/meteorfox/followers","following_url":"https://api.github.com/users/meteorfox/following{/other_user}","gists_url":"https://api.github.com/users/meteorfox/gists{/gist_id}","starred_url":"https://api.github.com/users/meteorfox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meteorfox/subscriptions","organizations_url":"https://api.github.com/users/meteorfox/orgs","repos_url":"https://api.github.com/users/meteorfox/repos","events_url":"https://api.github.com/users/meteorfox/events{/privacy}","received_events_url":"https://api.github.com/users/meteorfox/received_events","type":"User","site_admin":false},"body":"OpenStack provider implementation that similar to the other providers uses the CLI utilities instead of Python libraries.\r\n\r\nUsing the CLI utilities has several benefits:\r\n- Interacts with cloud provider the same way a user would.\r\n- Lists the commands used to interact with OpenStack while previously only HTTP requests were logged.\r\n- Pushes backward-compatibility support to the CLI instead of PKB managing it itself.\r\n- OpenStack CLI utilities are commited to backward-compatiblity of supported releases.\r\n- Allows `Specs` implementation to be easily pickled.\r\n- Configuration is handled by the CLI, simplifies options and configuration.\r\n- Removes PKB's direct dependency to OpenStack python libraries.\r\n- Simplifies error handling (internally)\r\n\r\nAddresses Issues #909 #899\r\n\r\nFull log showing run across all run stages:\r\nhttps://gist.github.com/meteorfox/e14434b6f88a18f287c3c8d918c78b84\r\n","created_at":"2016-04-08T23:19:22Z","updated_at":"2016-04-13T18:53:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2768831b748df19c0e9c498736e43798069f9855","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/pulls/942/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/pulls/942/comments","review_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/issues/942/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/statuses/a3335b2032720bf4c896348a78afc32f3c7b9237","head":{"label":"meteorfox:openstack-cli-provider","ref":"openstack-cli-provider","sha":"a3335b2032720bf4c896348a78afc32f3c7b9237","user":{"login":"meteorfox","id":232300,"avatar_url":"https://avatars.githubusercontent.com/u/232300?v=3","gravatar_id":"","url":"https://api.github.com/users/meteorfox","html_url":"https://github.com/meteorfox","followers_url":"https://api.github.com/users/meteorfox/followers","following_url":"https://api.github.com/users/meteorfox/following{/other_user}","gists_url":"https://api.github.com/users/meteorfox/gists{/gist_id}","starred_url":"https://api.github.com/users/meteorfox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meteorfox/subscriptions","organizations_url":"https://api.github.com/users/meteorfox/orgs","repos_url":"https://api.github.com/users/meteorfox/repos","events_url":"https://api.github.com/users/meteorfox/events{/privacy}","received_events_url":"https://api.github.com/users/meteorfox/received_events","type":"User","site_admin":false},"repo":{"id":31044872,"name":"PerfKitBenchmarker","full_name":"meteorfox/PerfKitBenchmarker","owner":{"login":"meteorfox","id":232300,"avatar_url":"https://avatars.githubusercontent.com/u/232300?v=3","gravatar_id":"","url":"https://api.github.com/users/meteorfox","html_url":"https://github.com/meteorfox","followers_url":"https://api.github.com/users/meteorfox/followers","following_url":"https://api.github.com/users/meteorfox/following{/other_user}","gists_url":"https://api.github.com/users/meteorfox/gists{/gist_id}","starred_url":"https://api.github.com/users/meteorfox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meteorfox/subscriptions","organizations_url":"https://api.github.com/users/meteorfox/orgs","repos_url":"https://api.github.com/users/meteorfox/repos","events_url":"https://api.github.com/users/meteorfox/events{/privacy}","received_events_url":"https://api.github.com/users/meteorfox/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/meteorfox/PerfKitBenchmarker","description":"Perfkit Benchmarker contains set of benchmarks to measure and compare cloud offerings. The benchmarks are not tuned (i.e. use defaults) to reflect what most users will see. PerfKit Benchmarker is licensed under the Apache 2 license terms. Please make sure to read, understand and agree to the terms of the LICENSE and CONTRIBUTING files before proceeding.","fork":true,"url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker","forks_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/forks","keys_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/teams","hooks_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/hooks","issue_events_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/issues/events{/number}","events_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/events","assignees_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/assignees{/user}","branches_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/branches{/branch}","tags_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/tags","blobs_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/git/refs{/sha}","trees_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/statuses/{sha}","languages_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/languages","stargazers_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/stargazers","contributors_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/contributors","subscribers_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/subscribers","subscription_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/subscription","commits_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/commits{/sha}","git_commits_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/git/commits{/sha}","comments_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/comments{/number}","issue_comment_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/issues/comments{/number}","contents_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/contents/{+path}","compare_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/merges","archive_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/downloads","issues_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/issues{/number}","pulls_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/pulls{/number}","milestones_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/milestones{/number}","notifications_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/labels{/name}","releases_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/releases{/id}","deployments_url":"https://api.github.com/repos/meteorfox/PerfKitBenchmarker/deployments","created_at":"2015-02-20T00:39:49Z","updated_at":"2016-01-15T16:06:24Z","pushed_at":"2016-04-11T19:31:17Z","git_url":"git://github.com/meteorfox/PerfKitBenchmarker.git","ssh_url":"git@github.com:meteorfox/PerfKitBenchmarker.git","clone_url":"https://github.com/meteorfox/PerfKitBenchmarker.git","svn_url":"https://github.com/meteorfox/PerfKitBenchmarker","homepage":"","size":4345,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"GoogleCloudPlatform:master","ref":"master","sha":"3b1163afaf67df80e1571c0236783749087b82d3","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":21950910,"name":"PerfKitBenchmarker","full_name":"GoogleCloudPlatform/PerfKitBenchmarker","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/PerfKitBenchmarker","description":"Perfkit Benchmarker contains set of benchmarks to measure and compare cloud offerings. The benchmarks use defaults to reflect what most users will see. PerfKit Benchmarker is licensed under the Apache 2 license terms. Please make sure to read, understand and agree to the terms of the LICENSE and CONTRIBUTING files before proceeding.","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/deployments","created_at":"2014-07-17T17:23:26Z","updated_at":"2016-04-08T09:23:16Z","pushed_at":"2016-04-13T18:21:23Z","git_url":"git://github.com/GoogleCloudPlatform/PerfKitBenchmarker.git","ssh_url":"git@github.com:GoogleCloudPlatform/PerfKitBenchmarker.git","clone_url":"https://github.com/GoogleCloudPlatform/PerfKitBenchmarker.git","svn_url":"https://github.com/GoogleCloudPlatform/PerfKitBenchmarker","homepage":"http://googlecloudplatform.github.io/PerfKitBenchmarker/","size":85490,"stargazers_count":619,"watchers_count":619,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":129,"mirror_url":null,"open_issues_count":125,"forks":129,"open_issues":125,"watchers":619,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/pulls/942"},"html":{"href":"https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/pull/942"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/issues/942"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/issues/942/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/pulls/942/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/pulls/942/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/PerfKitBenchmarker/statuses/a3335b2032720bf4c896348a78afc32f3c7b9237"}}}}