{"action":"created","comment":{"url":"https://api.github.com/repos/juju/juju/pulls/comments/174461323","pull_request_review_id":103820087,"id":174461323,"diff_hunk":"@@ -167,27 +149,52 @@ func (api *HighAvailabilityAPI) enableHASingle(st *state.State, spec params.Cont\n \tif err != nil {\n \t\treturn params.ControllersChanges{}, errors.Annotate(err, \"retrieving controller config\")\n \t}\n+\tif err = validateCurrentControllers(st, cfg, cInfo.MachineIds); err != nil {\n+\t\treturn params.ControllersChanges{}, errors.Trace(err)\n+\t}\n \tspec.Constraints.Spaces = cfg.AsSpaceConstraints(spec.Constraints.Spaces)\n \n-\tchanges, err := st.EnableHA(spec.NumControllers, spec.Constraints, series, spec.Placement, api.machineID)\n+\t// Might be nicer to pass the spec itself to this method.\n+\tchanges, err := st.EnableHA(spec.NumControllers, spec.Constraints, spec.Series, spec.Placement, api.machineID)\n \tif err != nil {\n \t\treturn params.ControllersChanges{}, err\n \t}\n \treturn controllersChanges(changes), nil\n }\n \n-// getBootstrapConstraints attempts to return the constraints for the initial\n-// bootstrapped controller.\n-func getBootstrapConstraints(st *state.State) (constraints.Value, error) {\n-\tcontrollerInfo, err := st.ControllerInfo()\n-\tif err != nil {\n-\t\treturn constraints.Value{}, err\n+// validateCurrentControllers checks for a scenario where there is no HA space\n+// in controller configuration and more than one machine-local address on any\n+// of the controller machines. An error is returned if it is detected.\n+func validateCurrentControllers(st *state.State, cfg controller.Config, machineIds []string) error {\n+\tif cfg.JujuHASpace() != \"\" {","path":"apiserver/facades/client/highavailability/highavailability.go","position":113,"original_position":113,"commit_id":"facb7c9cc565692307cb418dbce570c1e671ac4e","original_commit_id":"facb7c9cc565692307cb418dbce570c1e671ac4e","user":{"login":"jameinel","id":202877,"avatar_url":"https://avatars0.githubusercontent.com/u/202877?v=4","gravatar_id":"","url":"https://api.github.com/users/jameinel","html_url":"https://github.com/jameinel","followers_url":"https://api.github.com/users/jameinel/followers","following_url":"https://api.github.com/users/jameinel/following{/other_user}","gists_url":"https://api.github.com/users/jameinel/gists{/gist_id}","starred_url":"https://api.github.com/users/jameinel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jameinel/subscriptions","organizations_url":"https://api.github.com/users/jameinel/orgs","repos_url":"https://api.github.com/users/jameinel/repos","events_url":"https://api.github.com/users/jameinel/events{/privacy}","received_events_url":"https://api.github.com/users/jameinel/received_events","type":"User","site_admin":false},"body":"Probably add a comment about\r\n// HASpace is set, we assume that other code has already ensured all controllers are in that space","created_at":"2018-03-14T13:39:49Z","updated_at":"2018-03-14T13:58:52Z","html_url":"https://github.com/juju/juju/pull/8487#discussion_r174461323","pull_request_url":"https://api.github.com/repos/juju/juju/pulls/8487","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/juju/juju/pulls/comments/174461323"},"html":{"href":"https://github.com/juju/juju/pull/8487#discussion_r174461323"},"pull_request":{"href":"https://api.github.com/repos/juju/juju/pulls/8487"}}},"pull_request":{"url":"https://api.github.com/repos/juju/juju/pulls/8487","id":174943373,"html_url":"https://github.com/juju/juju/pull/8487","diff_url":"https://github.com/juju/juju/pull/8487.diff","patch_url":"https://github.com/juju/juju/pull/8487.patch","issue_url":"https://api.github.com/repos/juju/juju/issues/8487","number":8487,"state":"open","locked":false,"title":"Adds check to enable-ha for when no juju-ha-space is set.","user":{"login":"manadart","id":562661,"avatar_url":"https://avatars3.githubusercontent.com/u/562661?v=4","gravatar_id":"","url":"https://api.github.com/users/manadart","html_url":"https://github.com/manadart","followers_url":"https://api.github.com/users/manadart/followers","following_url":"https://api.github.com/users/manadart/following{/other_user}","gists_url":"https://api.github.com/users/manadart/gists{/gist_id}","starred_url":"https://api.github.com/users/manadart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manadart/subscriptions","organizations_url":"https://api.github.com/users/manadart/orgs","repos_url":"https://api.github.com/users/manadart/repos","events_url":"https://api.github.com/users/manadart/events{/privacy}","received_events_url":"https://api.github.com/users/manadart/received_events","type":"User","site_admin":false},"body":"## Description of change\r\n\r\nRecent changes to controller config and the peergrouper have instituted the following behaviour:\r\n- Configurations for HA and management spaces are supplied as constraints to _bootstrap_ and _enable-ha_.\r\n- The peergrouper will fail to elect a peer group if there is no HA space configured and if any of the candidate machines have more than one cloud-local address available for Mongo peer-group communication.\r\n\r\nThis patch introduces a smoke test upon issuing the _enable-ha_ command, prior to actioning it, that checks the *current* controller machines to ensure they have a unique communication address when no HA space is configured. \r\n\r\n## QA steps\r\n\r\nAccompanying unit tests.\r\n\r\n## Documentation changes\r\n\r\nThis behaviour should be noted in the _enable-ha_ docs.\r\n\r\n## Bug reference\r\n\r\nN/A\r\n","created_at":"2018-03-14T12:44:54Z","updated_at":"2018-03-14T13:58:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c64e9b087824dcb297f6fca078736f3acab35cd8","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/juju/juju/pulls/8487/commits","review_comments_url":"https://api.github.com/repos/juju/juju/pulls/8487/comments","review_comment_url":"https://api.github.com/repos/juju/juju/pulls/comments{/number}","comments_url":"https://api.github.com/repos/juju/juju/issues/8487/comments","statuses_url":"https://api.github.com/repos/juju/juju/statuses/facb7c9cc565692307cb418dbce570c1e671ac4e","head":{"label":"manadart:enable-ha-no-space-check","ref":"enable-ha-no-space-check","sha":"facb7c9cc565692307cb418dbce570c1e671ac4e","user":{"login":"manadart","id":562661,"avatar_url":"https://avatars3.githubusercontent.com/u/562661?v=4","gravatar_id":"","url":"https://api.github.com/users/manadart","html_url":"https://github.com/manadart","followers_url":"https://api.github.com/users/manadart/followers","following_url":"https://api.github.com/users/manadart/following{/other_user}","gists_url":"https://api.github.com/users/manadart/gists{/gist_id}","starred_url":"https://api.github.com/users/manadart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manadart/subscriptions","organizations_url":"https://api.github.com/users/manadart/orgs","repos_url":"https://api.github.com/users/manadart/repos","events_url":"https://api.github.com/users/manadart/events{/privacy}","received_events_url":"https://api.github.com/users/manadart/received_events","type":"User","site_admin":false},"repo":{"id":113540853,"name":"juju","full_name":"manadart/juju","owner":{"login":"manadart","id":562661,"avatar_url":"https://avatars3.githubusercontent.com/u/562661?v=4","gravatar_id":"","url":"https://api.github.com/users/manadart","html_url":"https://github.com/manadart","followers_url":"https://api.github.com/users/manadart/followers","following_url":"https://api.github.com/users/manadart/following{/other_user}","gists_url":"https://api.github.com/users/manadart/gists{/gist_id}","starred_url":"https://api.github.com/users/manadart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manadart/subscriptions","organizations_url":"https://api.github.com/users/manadart/orgs","repos_url":"https://api.github.com/users/manadart/repos","events_url":"https://api.github.com/users/manadart/events{/privacy}","received_events_url":"https://api.github.com/users/manadart/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/manadart/juju","description":"juju is devops distilled","fork":true,"url":"https://api.github.com/repos/manadart/juju","forks_url":"https://api.github.com/repos/manadart/juju/forks","keys_url":"https://api.github.com/repos/manadart/juju/keys{/key_id}","collaborators_url":"https://api.github.com/repos/manadart/juju/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/manadart/juju/teams","hooks_url":"https://api.github.com/repos/manadart/juju/hooks","issue_events_url":"https://api.github.com/repos/manadart/juju/issues/events{/number}","events_url":"https://api.github.com/repos/manadart/juju/events","assignees_url":"https://api.github.com/repos/manadart/juju/assignees{/user}","branches_url":"https://api.github.com/repos/manadart/juju/branches{/branch}","tags_url":"https://api.github.com/repos/manadart/juju/tags","blobs_url":"https://api.github.com/repos/manadart/juju/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/manadart/juju/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/manadart/juju/git/refs{/sha}","trees_url":"https://api.github.com/repos/manadart/juju/git/trees{/sha}","statuses_url":"https://api.github.com/repos/manadart/juju/statuses/{sha}","languages_url":"https://api.github.com/repos/manadart/juju/languages","stargazers_url":"https://api.github.com/repos/manadart/juju/stargazers","contributors_url":"https://api.github.com/repos/manadart/juju/contributors","subscribers_url":"https://api.github.com/repos/manadart/juju/subscribers","subscription_url":"https://api.github.com/repos/manadart/juju/subscription","commits_url":"https://api.github.com/repos/manadart/juju/commits{/sha}","git_commits_url":"https://api.github.com/repos/manadart/juju/git/commits{/sha}","comments_url":"https://api.github.com/repos/manadart/juju/comments{/number}","issue_comment_url":"https://api.github.com/repos/manadart/juju/issues/comments{/number}","contents_url":"https://api.github.com/repos/manadart/juju/contents/{+path}","compare_url":"https://api.github.com/repos/manadart/juju/compare/{base}...{head}","merges_url":"https://api.github.com/repos/manadart/juju/merges","archive_url":"https://api.github.com/repos/manadart/juju/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/manadart/juju/downloads","issues_url":"https://api.github.com/repos/manadart/juju/issues{/number}","pulls_url":"https://api.github.com/repos/manadart/juju/pulls{/number}","milestones_url":"https://api.github.com/repos/manadart/juju/milestones{/number}","notifications_url":"https://api.github.com/repos/manadart/juju/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/manadart/juju/labels{/name}","releases_url":"https://api.github.com/repos/manadart/juju/releases{/id}","deployments_url":"https://api.github.com/repos/manadart/juju/deployments","created_at":"2017-12-08T06:38:11Z","updated_at":"2018-03-14T08:12:46Z","pushed_at":"2018-03-14T12:37:44Z","git_url":"git://github.com/manadart/juju.git","ssh_url":"git@github.com:manadart/juju.git","clone_url":"https://github.com/manadart/juju.git","svn_url":"https://github.com/manadart/juju","homepage":"juju.ubuntu.com","size":207123,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"juju:develop","ref":"develop","sha":"e6a87132b07f4b5bb969b27f2ffdc43af2ed683a","user":{"login":"juju","id":4604548,"avatar_url":"https://avatars0.githubusercontent.com/u/4604548?v=4","gravatar_id":"","url":"https://api.github.com/users/juju","html_url":"https://github.com/juju","followers_url":"https://api.github.com/users/juju/followers","following_url":"https://api.github.com/users/juju/following{/other_user}","gists_url":"https://api.github.com/users/juju/gists{/gist_id}","starred_url":"https://api.github.com/users/juju/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juju/subscriptions","organizations_url":"https://api.github.com/users/juju/orgs","repos_url":"https://api.github.com/users/juju/repos","events_url":"https://api.github.com/users/juju/events{/privacy}","received_events_url":"https://api.github.com/users/juju/received_events","type":"Organization","site_admin":false},"repo":{"id":20445947,"name":"juju","full_name":"juju/juju","owner":{"login":"juju","id":4604548,"avatar_url":"https://avatars0.githubusercontent.com/u/4604548?v=4","gravatar_id":"","url":"https://api.github.com/users/juju","html_url":"https://github.com/juju","followers_url":"https://api.github.com/users/juju/followers","following_url":"https://api.github.com/users/juju/following{/other_user}","gists_url":"https://api.github.com/users/juju/gists{/gist_id}","starred_url":"https://api.github.com/users/juju/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juju/subscriptions","organizations_url":"https://api.github.com/users/juju/orgs","repos_url":"https://api.github.com/users/juju/repos","events_url":"https://api.github.com/users/juju/events{/privacy}","received_events_url":"https://api.github.com/users/juju/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/juju/juju","description":"juju is devops distilled","fork":false,"url":"https://api.github.com/repos/juju/juju","forks_url":"https://api.github.com/repos/juju/juju/forks","keys_url":"https://api.github.com/repos/juju/juju/keys{/key_id}","collaborators_url":"https://api.github.com/repos/juju/juju/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/juju/juju/teams","hooks_url":"https://api.github.com/repos/juju/juju/hooks","issue_events_url":"https://api.github.com/repos/juju/juju/issues/events{/number}","events_url":"https://api.github.com/repos/juju/juju/events","assignees_url":"https://api.github.com/repos/juju/juju/assignees{/user}","branches_url":"https://api.github.com/repos/juju/juju/branches{/branch}","tags_url":"https://api.github.com/repos/juju/juju/tags","blobs_url":"https://api.github.com/repos/juju/juju/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/juju/juju/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/juju/juju/git/refs{/sha}","trees_url":"https://api.github.com/repos/juju/juju/git/trees{/sha}","statuses_url":"https://api.github.com/repos/juju/juju/statuses/{sha}","languages_url":"https://api.github.com/repos/juju/juju/languages","stargazers_url":"https://api.github.com/repos/juju/juju/stargazers","contributors_url":"https://api.github.com/repos/juju/juju/contributors","subscribers_url":"https://api.github.com/repos/juju/juju/subscribers","subscription_url":"https://api.github.com/repos/juju/juju/subscription","commits_url":"https://api.github.com/repos/juju/juju/commits{/sha}","git_commits_url":"https://api.github.com/repos/juju/juju/git/commits{/sha}","comments_url":"https://api.github.com/repos/juju/juju/comments{/number}","issue_comment_url":"https://api.github.com/repos/juju/juju/issues/comments{/number}","contents_url":"https://api.github.com/repos/juju/juju/contents/{+path}","compare_url":"https://api.github.com/repos/juju/juju/compare/{base}...{head}","merges_url":"https://api.github.com/repos/juju/juju/merges","archive_url":"https://api.github.com/repos/juju/juju/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/juju/juju/downloads","issues_url":"https://api.github.com/repos/juju/juju/issues{/number}","pulls_url":"https://api.github.com/repos/juju/juju/pulls{/number}","milestones_url":"https://api.github.com/repos/juju/juju/milestones{/number}","notifications_url":"https://api.github.com/repos/juju/juju/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/juju/juju/labels{/name}","releases_url":"https://api.github.com/repos/juju/juju/releases{/id}","deployments_url":"https://api.github.com/repos/juju/juju/deployments","created_at":"2014-06-03T14:28:10Z","updated_at":"2018-03-14T11:27:42Z","pushed_at":"2018-03-14T13:58:48Z","git_url":"git://github.com/juju/juju.git","ssh_url":"git@github.com:juju/juju.git","clone_url":"https://github.com/juju/juju.git","svn_url":"https://github.com/juju/juju","homepage":"juju.ubuntu.com","size":207113,"stargazers_count":1117,"watchers_count":1117,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":260,"mirror_url":null,"archived":false,"open_issues_count":19,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0"},"forks":260,"open_issues":19,"watchers":1117,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/juju/juju/pulls/8487"},"html":{"href":"https://github.com/juju/juju/pull/8487"},"issue":{"href":"https://api.github.com/repos/juju/juju/issues/8487"},"comments":{"href":"https://api.github.com/repos/juju/juju/issues/8487/comments"},"review_comments":{"href":"https://api.github.com/repos/juju/juju/pulls/8487/comments"},"review_comment":{"href":"https://api.github.com/repos/juju/juju/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/juju/juju/pulls/8487/commits"},"statuses":{"href":"https://api.github.com/repos/juju/juju/statuses/facb7c9cc565692307cb418dbce570c1e671ac4e"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"jameinel"}}