{"action":"created","comment":{"url":"https://api.github.com/repos/crowbar/crowbar-openstack/pulls/comments/49929599","id":49929599,"diff_hunk":"@@ -135,55 +143,74 @@\n   only_if { CrowbarPacemakerHelper.is_cluster_founder?(node) }\n end\n \n-keystone_settings = KeystoneHelper.keystone_settings(node, @cookbook_name)\n-# FIXME: neutron-ha-tool can't do keystone v3 currently\n-os_auth_url_v2 = KeystoneHelper.versioned_service_URL(keystone_settings[\"protocol\"],\n-                                                       keystone_settings[\"internal_url_host\"],\n-                                                       keystone_settings[\"service_port\"],\n-                                                       \"2.0\")\n-\n-ha_tool_primitive_name = \"neutron-ha-tool\"\n-\n-# FIXME: While the neutron-ha-tool resource agent allows specifying a CA\n-# Certificate to use for SSL Certificate verification, it's hard to select\n-# right CA file as we allow Keystone's and Neutron's to use different CAs.  So\n-# we just rely on the correct CA files being installed in a system wide default\n-# location.\n-file \"/etc/neutron/os_password\" do\n-  owner \"root\"\n-  group \"root\"\n-  mode \"0600\"\n-  content keystone_settings[\"admin_password\"]\n-  # Our Chef is apparently too old for this :-/\n-  #sensitive true\n-  action :create\n-end\n+if use_l3_agent\n+  keystone_settings = KeystoneHelper.keystone_settings(node, @cookbook_name)\n+  # FIXME: neutron-ha-tool can't do keystone v3 currently\n+  os_auth_url_v2 = KeystoneHelper.versioned_service_URL(keystone_settings[\"protocol\"],\n+                                                         keystone_settings[\"internal_url_host\"],\n+                                                         keystone_settings[\"service_port\"],\n+                                                         \"2.0\")\n+\n+  # FIXME: While the neutron-ha-tool resource agent allows specifying a CA\n+  # Certificate to use for SSL Certificate verification, it's hard to select\n+  # right CA file as we allow Keystone's and Neutron's to use different CAs.  So\n+  # we just rely on the correct CA files being installed in a system wide default\n+  # location.\n+  file \"/etc/neutron/os_password\" do\n+    owner \"root\"\n+    group \"root\"\n+    mode \"0600\"\n+    content keystone_settings[\"admin_password\"]\n+    # Our Chef is apparently too old for this :-/\n+    #sensitive true\n+    action :create\n+  end\n \n-pacemaker_primitive ha_tool_primitive_name do\n-  agent node[:neutron][:ha][:network][:ha_tool_ra]\n-  params ({\n-    \"os_auth_url\"    => os_auth_url_v2,\n-    \"os_region_name\" => keystone_settings[\"endpoint_region\"],\n-    \"os_tenant_name\" => keystone_settings[\"admin_tenant\"],\n-    \"os_username\"    => keystone_settings[\"admin_user\"],\n-    \"os_insecure\"    => keystone_settings[\"insecure\"] || node[:neutron][:ssl][:insecure]\n-  })\n-  op node[:neutron][:ha][:network][:op]\n-  action [:create, :start]\n-  only_if { use_l3_agent && CrowbarPacemakerHelper.is_cluster_founder?(node) }\n-end\n+  ha_tool_transaction_objects = []\n+\n+  ha_tool_primitive_name = \"neutron-ha-tool\"\n+  pacemaker_primitive ha_tool_primitive_name do\n+    agent node[:neutron][:ha][:network][:ha_tool_ra]\n+    params ({\n+      \"os_auth_url\"    => os_auth_url_v2,\n+      \"os_region_name\" => keystone_settings[\"endpoint_region\"],\n+      \"os_tenant_name\" => keystone_settings[\"admin_tenant\"],\n+      \"os_username\"    => keystone_settings[\"admin_user\"],\n+      \"os_insecure\"    => keystone_settings[\"insecure\"] || node[:neutron][:ssl][:insecure]\n+    })\n+    op node[:neutron][:ha][:network][:op]\n+    action :update\n+    only_if { CrowbarPacemakerHelper.is_cluster_founder?(node) }\n+  end\n+  ha_tool_transaction_objects << \"pacemaker_primitive[#{ha_tool_primitive_name}]\"\n+\n+  ha_tool_location_name = \"l-#{ha_tool_primitive_name}-controller\"\n+  pacemaker_location ha_tool_location_name do\n+    definition OpenStackHAHelper.controller_only_location(ha_tool_location_name, ha_tool_primitive_name)\n+    action :update\n+    only_if { CrowbarPacemakerHelper.is_cluster_founder?(node) }\n+  end\n+  ha_tool_transaction_objects << \"pacemaker_location[#{ha_tool_location_name}]\"\n \n-crowbar_pacemaker_order_only_existing \"o-#{ha_tool_primitive_name}\" do\n-  # While neutron-ha-tool technically doesn't directly depend on postgresql or\n-  # rabbitmq, if these bits are not running, then neutron-server can run but\n-  # can't do what it's being asked. Note that neutron-server does have a\n-  # constraint on these services, but it's optional, not mandatory (because it\n-  # doesn't need to be restarted when postgresql or rabbitmq are restarted).\n-  # So explicitly depend on postgresql and rabbitmq (if they are in the cluster).\n-  ordering \"( postgresql rabbitmq g-haproxy cl-neutron-server #{agents_clone_name} ) #{ha_tool_primitive_name}\"\n-  score \"Mandatory\"\n-  action :create\n-  only_if { use_l3_agent && CrowbarPacemakerHelper.is_cluster_founder?(node) }\n+  pacemaker_transaction \"neutron ha tool\" do\n+    cib_objects ha_tool_transaction_objects\n+    # note that this will also automatically start the resources\n+    action :commit_new\n+    only_if { CrowbarPacemakerHelper.is_cluster_founder?(node) }\n+  end\n+\n+  crowbar_pacemaker_order_only_existing \"o-#{ha_tool_primitive_name}\" do\n+    # While neutron-ha-tool technically doesn't directly depend on postgresql or\n+    # rabbitmq, if these bits are not running, then neutron-server can run but\n+    # can't do what it's being asked. Note that neutron-server does have a\n+    # constraint on these services, but it's optional, not mandatory (because it\n+    # doesn't need to be restarted when postgresql or rabbitmq are restarted).\n+    # So explicitly depend on postgresql and rabbitmq (if they are in the cluster).\n+    ordering \"( postgresql rabbitmq g-haproxy cl-neutron-server #{agents_clone_name} ) #{ha_tool_primitive_name}\"","path":"chef/cookbooks/neutron/recipes/network_agents_ha.rb","position":129,"original_position":129,"commit_id":"43468a417161b7071e6447a6aeb8487f9c0ab12c","original_commit_id":"43468a417161b7071e6447a6aeb8487f9c0ab12c","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Metrics/LineLength: Line is too long. [113/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)","created_at":"2016-01-16T09:20:13Z","updated_at":"2016-01-16T09:20:13Z","html_url":"https://github.com/crowbar/crowbar-openstack/pull/179#discussion_r49929599","pull_request_url":"https://api.github.com/repos/crowbar/crowbar-openstack/pulls/179","_links":{"self":{"href":"https://api.github.com/repos/crowbar/crowbar-openstack/pulls/comments/49929599"},"html":{"href":"https://github.com/crowbar/crowbar-openstack/pull/179#discussion_r49929599"},"pull_request":{"href":"https://api.github.com/repos/crowbar/crowbar-openstack/pulls/179"}}},"pull_request":{"url":"https://api.github.com/repos/crowbar/crowbar-openstack/pulls/179","id":55259645,"html_url":"https://github.com/crowbar/crowbar-openstack/pull/179","diff_url":"https://github.com/crowbar/crowbar-openstack/pull/179.diff","patch_url":"https://github.com/crowbar/crowbar-openstack/pull/179.patch","issue_url":"https://api.github.com/repos/crowbar/crowbar-openstack/issues/179","number":179,"state":"open","locked":false,"title":"Constrain services to only run on controllers when doing HA","user":{"login":"vuntz","id":1758783,"avatar_url":"https://avatars.githubusercontent.com/u/1758783?v=3","gravatar_id":"","url":"https://api.github.com/users/vuntz","html_url":"https://github.com/vuntz","followers_url":"https://api.github.com/users/vuntz/followers","following_url":"https://api.github.com/users/vuntz/following{/other_user}","gists_url":"https://api.github.com/users/vuntz/gists{/gist_id}","starred_url":"https://api.github.com/users/vuntz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vuntz/subscriptions","organizations_url":"https://api.github.com/users/vuntz/orgs","repos_url":"https://api.github.com/users/vuntz/repos","events_url":"https://api.github.com/users/vuntz/events{/privacy}","received_events_url":"https://api.github.com/users/vuntz/received_events","type":"User","site_admin":false},"body":"This depends on ~~https://github.com/crowbar/crowbar-openstack/pull/175 and~~ https://github.com/crowbar/crowbar-ha/pull/56","created_at":"2016-01-06T20:22:55Z","updated_at":"2016-01-16T09:20:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a01433f6eca57827ba0f738bc0fb485bd5e801a8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/crowbar/crowbar-openstack/pulls/179/commits","review_comments_url":"https://api.github.com/repos/crowbar/crowbar-openstack/pulls/179/comments","review_comment_url":"https://api.github.com/repos/crowbar/crowbar-openstack/pulls/comments{/number}","comments_url":"https://api.github.com/repos/crowbar/crowbar-openstack/issues/179/comments","statuses_url":"https://api.github.com/repos/crowbar/crowbar-openstack/statuses/43468a417161b7071e6447a6aeb8487f9c0ab12c","head":{"label":"vuntz:openstack-ha-role-constraints","ref":"openstack-ha-role-constraints","sha":"43468a417161b7071e6447a6aeb8487f9c0ab12c","user":{"login":"vuntz","id":1758783,"avatar_url":"https://avatars.githubusercontent.com/u/1758783?v=3","gravatar_id":"","url":"https://api.github.com/users/vuntz","html_url":"https://github.com/vuntz","followers_url":"https://api.github.com/users/vuntz/followers","following_url":"https://api.github.com/users/vuntz/following{/other_user}","gists_url":"https://api.github.com/users/vuntz/gists{/gist_id}","starred_url":"https://api.github.com/users/vuntz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vuntz/subscriptions","organizations_url":"https://api.github.com/users/vuntz/orgs","repos_url":"https://api.github.com/users/vuntz/repos","events_url":"https://api.github.com/users/vuntz/events{/privacy}","received_events_url":"https://api.github.com/users/vuntz/received_events","type":"User","site_admin":false},"repo":{"id":41142183,"name":"crowbar-openstack","full_name":"vuntz/crowbar-openstack","owner":{"login":"vuntz","id":1758783,"avatar_url":"https://avatars.githubusercontent.com/u/1758783?v=3","gravatar_id":"","url":"https://api.github.com/users/vuntz","html_url":"https://github.com/vuntz","followers_url":"https://api.github.com/users/vuntz/followers","following_url":"https://api.github.com/users/vuntz/following{/other_user}","gists_url":"https://api.github.com/users/vuntz/gists{/gist_id}","starred_url":"https://api.github.com/users/vuntz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vuntz/subscriptions","organizations_url":"https://api.github.com/users/vuntz/orgs","repos_url":"https://api.github.com/users/vuntz/repos","events_url":"https://api.github.com/users/vuntz/events{/privacy}","received_events_url":"https://api.github.com/users/vuntz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vuntz/crowbar-openstack","description":"Openstack deployment for Crowbar","fork":true,"url":"https://api.github.com/repos/vuntz/crowbar-openstack","forks_url":"https://api.github.com/repos/vuntz/crowbar-openstack/forks","keys_url":"https://api.github.com/repos/vuntz/crowbar-openstack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vuntz/crowbar-openstack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vuntz/crowbar-openstack/teams","hooks_url":"https://api.github.com/repos/vuntz/crowbar-openstack/hooks","issue_events_url":"https://api.github.com/repos/vuntz/crowbar-openstack/issues/events{/number}","events_url":"https://api.github.com/repos/vuntz/crowbar-openstack/events","assignees_url":"https://api.github.com/repos/vuntz/crowbar-openstack/assignees{/user}","branches_url":"https://api.github.com/repos/vuntz/crowbar-openstack/branches{/branch}","tags_url":"https://api.github.com/repos/vuntz/crowbar-openstack/tags","blobs_url":"https://api.github.com/repos/vuntz/crowbar-openstack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vuntz/crowbar-openstack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vuntz/crowbar-openstack/git/refs{/sha}","trees_url":"https://api.github.com/repos/vuntz/crowbar-openstack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vuntz/crowbar-openstack/statuses/{sha}","languages_url":"https://api.github.com/repos/vuntz/crowbar-openstack/languages","stargazers_url":"https://api.github.com/repos/vuntz/crowbar-openstack/stargazers","contributors_url":"https://api.github.com/repos/vuntz/crowbar-openstack/contributors","subscribers_url":"https://api.github.com/repos/vuntz/crowbar-openstack/subscribers","subscription_url":"https://api.github.com/repos/vuntz/crowbar-openstack/subscription","commits_url":"https://api.github.com/repos/vuntz/crowbar-openstack/commits{/sha}","git_commits_url":"https://api.github.com/repos/vuntz/crowbar-openstack/git/commits{/sha}","comments_url":"https://api.github.com/repos/vuntz/crowbar-openstack/comments{/number}","issue_comment_url":"https://api.github.com/repos/vuntz/crowbar-openstack/issues/comments{/number}","contents_url":"https://api.github.com/repos/vuntz/crowbar-openstack/contents/{+path}","compare_url":"https://api.github.com/repos/vuntz/crowbar-openstack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vuntz/crowbar-openstack/merges","archive_url":"https://api.github.com/repos/vuntz/crowbar-openstack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vuntz/crowbar-openstack/downloads","issues_url":"https://api.github.com/repos/vuntz/crowbar-openstack/issues{/number}","pulls_url":"https://api.github.com/repos/vuntz/crowbar-openstack/pulls{/number}","milestones_url":"https://api.github.com/repos/vuntz/crowbar-openstack/milestones{/number}","notifications_url":"https://api.github.com/repos/vuntz/crowbar-openstack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vuntz/crowbar-openstack/labels{/name}","releases_url":"https://api.github.com/repos/vuntz/crowbar-openstack/releases{/id}","created_at":"2015-08-21T07:34:22Z","updated_at":"2015-08-21T07:34:23Z","pushed_at":"2016-01-16T09:20:04Z","git_url":"git://github.com/vuntz/crowbar-openstack.git","ssh_url":"git@github.com:vuntz/crowbar-openstack.git","clone_url":"https://github.com/vuntz/crowbar-openstack.git","svn_url":"https://github.com/vuntz/crowbar-openstack","homepage":null,"size":15990,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"crowbar:master","ref":"master","sha":"a651de4c2f6ac8de1e8a903d7c0006dbcd174ea5","user":{"login":"crowbar","id":2910205,"avatar_url":"https://avatars.githubusercontent.com/u/2910205?v=3","gravatar_id":"","url":"https://api.github.com/users/crowbar","html_url":"https://github.com/crowbar","followers_url":"https://api.github.com/users/crowbar/followers","following_url":"https://api.github.com/users/crowbar/following{/other_user}","gists_url":"https://api.github.com/users/crowbar/gists{/gist_id}","starred_url":"https://api.github.com/users/crowbar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crowbar/subscriptions","organizations_url":"https://api.github.com/users/crowbar/orgs","repos_url":"https://api.github.com/users/crowbar/repos","events_url":"https://api.github.com/users/crowbar/events{/privacy}","received_events_url":"https://api.github.com/users/crowbar/received_events","type":"Organization","site_admin":false},"repo":{"id":39006903,"name":"crowbar-openstack","full_name":"crowbar/crowbar-openstack","owner":{"login":"crowbar","id":2910205,"avatar_url":"https://avatars.githubusercontent.com/u/2910205?v=3","gravatar_id":"","url":"https://api.github.com/users/crowbar","html_url":"https://github.com/crowbar","followers_url":"https://api.github.com/users/crowbar/followers","following_url":"https://api.github.com/users/crowbar/following{/other_user}","gists_url":"https://api.github.com/users/crowbar/gists{/gist_id}","starred_url":"https://api.github.com/users/crowbar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crowbar/subscriptions","organizations_url":"https://api.github.com/users/crowbar/orgs","repos_url":"https://api.github.com/users/crowbar/repos","events_url":"https://api.github.com/users/crowbar/events{/privacy}","received_events_url":"https://api.github.com/users/crowbar/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/crowbar/crowbar-openstack","description":"Openstack deployment for Crowbar","fork":false,"url":"https://api.github.com/repos/crowbar/crowbar-openstack","forks_url":"https://api.github.com/repos/crowbar/crowbar-openstack/forks","keys_url":"https://api.github.com/repos/crowbar/crowbar-openstack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/crowbar/crowbar-openstack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/crowbar/crowbar-openstack/teams","hooks_url":"https://api.github.com/repos/crowbar/crowbar-openstack/hooks","issue_events_url":"https://api.github.com/repos/crowbar/crowbar-openstack/issues/events{/number}","events_url":"https://api.github.com/repos/crowbar/crowbar-openstack/events","assignees_url":"https://api.github.com/repos/crowbar/crowbar-openstack/assignees{/user}","branches_url":"https://api.github.com/repos/crowbar/crowbar-openstack/branches{/branch}","tags_url":"https://api.github.com/repos/crowbar/crowbar-openstack/tags","blobs_url":"https://api.github.com/repos/crowbar/crowbar-openstack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/crowbar/crowbar-openstack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/crowbar/crowbar-openstack/git/refs{/sha}","trees_url":"https://api.github.com/repos/crowbar/crowbar-openstack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/crowbar/crowbar-openstack/statuses/{sha}","languages_url":"https://api.github.com/repos/crowbar/crowbar-openstack/languages","stargazers_url":"https://api.github.com/repos/crowbar/crowbar-openstack/stargazers","contributors_url":"https://api.github.com/repos/crowbar/crowbar-openstack/contributors","subscribers_url":"https://api.github.com/repos/crowbar/crowbar-openstack/subscribers","subscription_url":"https://api.github.com/repos/crowbar/crowbar-openstack/subscription","commits_url":"https://api.github.com/repos/crowbar/crowbar-openstack/commits{/sha}","git_commits_url":"https://api.github.com/repos/crowbar/crowbar-openstack/git/commits{/sha}","comments_url":"https://api.github.com/repos/crowbar/crowbar-openstack/comments{/number}","issue_comment_url":"https://api.github.com/repos/crowbar/crowbar-openstack/issues/comments{/number}","contents_url":"https://api.github.com/repos/crowbar/crowbar-openstack/contents/{+path}","compare_url":"https://api.github.com/repos/crowbar/crowbar-openstack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/crowbar/crowbar-openstack/merges","archive_url":"https://api.github.com/repos/crowbar/crowbar-openstack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/crowbar/crowbar-openstack/downloads","issues_url":"https://api.github.com/repos/crowbar/crowbar-openstack/issues{/number}","pulls_url":"https://api.github.com/repos/crowbar/crowbar-openstack/pulls{/number}","milestones_url":"https://api.github.com/repos/crowbar/crowbar-openstack/milestones{/number}","notifications_url":"https://api.github.com/repos/crowbar/crowbar-openstack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/crowbar/crowbar-openstack/labels{/name}","releases_url":"https://api.github.com/repos/crowbar/crowbar-openstack/releases{/id}","created_at":"2015-07-13T10:55:33Z","updated_at":"2016-01-11T12:29:07Z","pushed_at":"2016-01-16T09:20:05Z","git_url":"git://github.com/crowbar/crowbar-openstack.git","ssh_url":"git@github.com:crowbar/crowbar-openstack.git","clone_url":"https://github.com/crowbar/crowbar-openstack.git","svn_url":"https://github.com/crowbar/crowbar-openstack","homepage":null,"size":16139,"stargazers_count":2,"watchers_count":2,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":21,"mirror_url":null,"open_issues_count":26,"forks":21,"open_issues":26,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/crowbar/crowbar-openstack/pulls/179"},"html":{"href":"https://github.com/crowbar/crowbar-openstack/pull/179"},"issue":{"href":"https://api.github.com/repos/crowbar/crowbar-openstack/issues/179"},"comments":{"href":"https://api.github.com/repos/crowbar/crowbar-openstack/issues/179/comments"},"review_comments":{"href":"https://api.github.com/repos/crowbar/crowbar-openstack/pulls/179/comments"},"review_comment":{"href":"https://api.github.com/repos/crowbar/crowbar-openstack/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/crowbar/crowbar-openstack/pulls/179/commits"},"statuses":{"href":"https://api.github.com/repos/crowbar/crowbar-openstack/statuses/43468a417161b7071e6447a6aeb8487f9c0ab12c"}}}}