{"action":"created","comment":{"url":"https://api.github.com/repos/apache/cloudstack/pulls/comments/44281795","id":44281795,"diff_hunk":"@@ -165,4 +171,173 @@ private void addIndexForVMInstance(Connection conn) {\n         return new File[] { new File(script) };\n     }\n \n+    @SuppressWarnings(\"serial\")\n+    private void updateSystemVmTemplates(final Connection conn) {\n+        s_logger.debug(\"Updating System Vm template IDs\");\n+        // Get all hypervisors in use\n+        final Set<Hypervisor.HypervisorType> hypervisorsListInUse = new HashSet<Hypervisor.HypervisorType>();\n+        try (PreparedStatement pstmt = conn.prepareStatement(\"select distinct(hypervisor_type) from `cloud`.`cluster` where removed is null\"); ResultSet rs = pstmt.executeQuery()) {\n+            while (rs.next()) {\n+                switch (Hypervisor.HypervisorType.getType(rs.getString(1))) {\n+                case XenServer:\n+                    hypervisorsListInUse.add(Hypervisor.HypervisorType.XenServer);\n+                    break;\n+                case KVM:\n+                    hypervisorsListInUse.add(Hypervisor.HypervisorType.KVM);\n+                    break;\n+                case VMware:\n+                    hypervisorsListInUse.add(Hypervisor.HypervisorType.VMware);\n+                    break;\n+                case Hyperv:\n+                    hypervisorsListInUse.add(Hypervisor.HypervisorType.Hyperv);\n+                    break;\n+                case LXC:\n+                    hypervisorsListInUse.add(Hypervisor.HypervisorType.LXC);\n+                    break;\n+                case Ovm3:\n+                    hypervisorsListInUse.add(Hypervisor.HypervisorType.Ovm3);\n+                    break;\n+                default: // no action on cases Any, BareMetal, None, Ovm,\n+                    // Parralels, Simulator and VirtualBox:\n+                    break;\n+                }\n+            }\n+        } catch (final SQLException e) {\n+            s_logger.error(\"updateSystemVmTemplates:Exception while getting hypervisor types from clusters: \" + e.getMessage());\n+            throw new CloudRuntimeException(\"updateSystemVmTemplates:Exception while getting hypervisor types from clusters\", e);\n+        }\n+\n+        final Map<Hypervisor.HypervisorType, String> NewTemplateNameList = new HashMap<Hypervisor.HypervisorType, String>() {","path":"engine/schema/src/com/cloud/upgrade/dao/Upgrade452to460.java","position":85,"original_position":85,"commit_id":"72e79bcaa6eacc0041694120f7ea53792dc68975","original_commit_id":"72e79bcaa6eacc0041694120f7ea53792dc68975","user":{"login":"DaanHoogland","id":2486961,"avatar_url":"https://avatars.githubusercontent.com/u/2486961?v=3","gravatar_id":"","url":"https://api.github.com/users/DaanHoogland","html_url":"https://github.com/DaanHoogland","followers_url":"https://api.github.com/users/DaanHoogland/followers","following_url":"https://api.github.com/users/DaanHoogland/following{/other_user}","gists_url":"https://api.github.com/users/DaanHoogland/gists{/gist_id}","starred_url":"https://api.github.com/users/DaanHoogland/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DaanHoogland/subscriptions","organizations_url":"https://api.github.com/users/DaanHoogland/orgs","repos_url":"https://api.github.com/users/DaanHoogland/repos","events_url":"https://api.github.com/users/DaanHoogland/events{/privacy}","received_events_url":"https://api.github.com/users/DaanHoogland/received_events","type":"User","site_admin":false},"body":"naming convention: var starting with capital","created_at":"2015-11-09T14:45:18Z","updated_at":"2015-11-09T14:45:18Z","html_url":"https://github.com/apache/cloudstack/pull/1050#discussion_r44281795","pull_request_url":"https://api.github.com/repos/apache/cloudstack/pulls/1050","_links":{"self":{"href":"https://api.github.com/repos/apache/cloudstack/pulls/comments/44281795"},"html":{"href":"https://github.com/apache/cloudstack/pull/1050#discussion_r44281795"},"pull_request":{"href":"https://api.github.com/repos/apache/cloudstack/pulls/1050"}}},"pull_request":{"url":"https://api.github.com/repos/apache/cloudstack/pulls/1050","id":50128980,"html_url":"https://github.com/apache/cloudstack/pull/1050","diff_url":"https://github.com/apache/cloudstack/pull/1050.diff","patch_url":"https://github.com/apache/cloudstack/pull/1050.patch","issue_url":"https://api.github.com/repos/apache/cloudstack/issues/1050","number":1050,"state":"open","locked":false,"title":"CLOUDSTACK-9046 - Fix upgrade path from 4.4 and 4.5 to 4.6","user":{"login":"wilderrodrigues","id":5129209,"avatar_url":"https://avatars.githubusercontent.com/u/5129209?v=3","gravatar_id":"","url":"https://api.github.com/users/wilderrodrigues","html_url":"https://github.com/wilderrodrigues","followers_url":"https://api.github.com/users/wilderrodrigues/followers","following_url":"https://api.github.com/users/wilderrodrigues/following{/other_user}","gists_url":"https://api.github.com/users/wilderrodrigues/gists{/gist_id}","starred_url":"https://api.github.com/users/wilderrodrigues/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wilderrodrigues/subscriptions","organizations_url":"https://api.github.com/users/wilderrodrigues/orgs","repos_url":"https://api.github.com/users/wilderrodrigues/repos","events_url":"https://api.github.com/users/wilderrodrigues/events{/privacy}","received_events_url":"https://api.github.com/users/wilderrodrigues/received_events","type":"User","site_admin":false},"body":"This PR fixes the upgrade path from 4.4.x/4.5.x to 4.6.0. We introduced the logic to update the database with the correct information about the SystemVMs.\r\n\r\nWe tested this PR with by doing an upgrade from 4.4.4 to 4.6.0 and it works as expected.\r\n","created_at":"2015-11-09T14:34:53Z","updated_at":"2015-11-09T14:45:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ac2d74cdb2b8100fbf23651ada0298d1dea32b08","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/cloudstack/pulls/1050/commits","review_comments_url":"https://api.github.com/repos/apache/cloudstack/pulls/1050/comments","review_comment_url":"https://api.github.com/repos/apache/cloudstack/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/cloudstack/issues/1050/comments","statuses_url":"https://api.github.com/repos/apache/cloudstack/statuses/72e79bcaa6eacc0041694120f7ea53792dc68975","head":{"label":"ekholabs:fix/upgrade_path-CLOUDSTACK-9046","ref":"fix/upgrade_path-CLOUDSTACK-9046","sha":"72e79bcaa6eacc0041694120f7ea53792dc68975","user":{"login":"ekholabs","id":4188903,"avatar_url":"https://avatars.githubusercontent.com/u/4188903?v=3","gravatar_id":"","url":"https://api.github.com/users/ekholabs","html_url":"https://github.com/ekholabs","followers_url":"https://api.github.com/users/ekholabs/followers","following_url":"https://api.github.com/users/ekholabs/following{/other_user}","gists_url":"https://api.github.com/users/ekholabs/gists{/gist_id}","starred_url":"https://api.github.com/users/ekholabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ekholabs/subscriptions","organizations_url":"https://api.github.com/users/ekholabs/orgs","repos_url":"https://api.github.com/users/ekholabs/repos","events_url":"https://api.github.com/users/ekholabs/events{/privacy}","received_events_url":"https://api.github.com/users/ekholabs/received_events","type":"Organization","site_admin":false},"repo":{"id":41543307,"name":"cloudstack","full_name":"ekholabs/cloudstack","owner":{"login":"ekholabs","id":4188903,"avatar_url":"https://avatars.githubusercontent.com/u/4188903?v=3","gravatar_id":"","url":"https://api.github.com/users/ekholabs","html_url":"https://github.com/ekholabs","followers_url":"https://api.github.com/users/ekholabs/followers","following_url":"https://api.github.com/users/ekholabs/following{/other_user}","gists_url":"https://api.github.com/users/ekholabs/gists{/gist_id}","starred_url":"https://api.github.com/users/ekholabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ekholabs/subscriptions","organizations_url":"https://api.github.com/users/ekholabs/orgs","repos_url":"https://api.github.com/users/ekholabs/repos","events_url":"https://api.github.com/users/ekholabs/events{/privacy}","received_events_url":"https://api.github.com/users/ekholabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ekholabs/cloudstack","description":"Mirror of Apache Cloudstack","fork":true,"url":"https://api.github.com/repos/ekholabs/cloudstack","forks_url":"https://api.github.com/repos/ekholabs/cloudstack/forks","keys_url":"https://api.github.com/repos/ekholabs/cloudstack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ekholabs/cloudstack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ekholabs/cloudstack/teams","hooks_url":"https://api.github.com/repos/ekholabs/cloudstack/hooks","issue_events_url":"https://api.github.com/repos/ekholabs/cloudstack/issues/events{/number}","events_url":"https://api.github.com/repos/ekholabs/cloudstack/events","assignees_url":"https://api.github.com/repos/ekholabs/cloudstack/assignees{/user}","branches_url":"https://api.github.com/repos/ekholabs/cloudstack/branches{/branch}","tags_url":"https://api.github.com/repos/ekholabs/cloudstack/tags","blobs_url":"https://api.github.com/repos/ekholabs/cloudstack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ekholabs/cloudstack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ekholabs/cloudstack/git/refs{/sha}","trees_url":"https://api.github.com/repos/ekholabs/cloudstack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ekholabs/cloudstack/statuses/{sha}","languages_url":"https://api.github.com/repos/ekholabs/cloudstack/languages","stargazers_url":"https://api.github.com/repos/ekholabs/cloudstack/stargazers","contributors_url":"https://api.github.com/repos/ekholabs/cloudstack/contributors","subscribers_url":"https://api.github.com/repos/ekholabs/cloudstack/subscribers","subscription_url":"https://api.github.com/repos/ekholabs/cloudstack/subscription","commits_url":"https://api.github.com/repos/ekholabs/cloudstack/commits{/sha}","git_commits_url":"https://api.github.com/repos/ekholabs/cloudstack/git/commits{/sha}","comments_url":"https://api.github.com/repos/ekholabs/cloudstack/comments{/number}","issue_comment_url":"https://api.github.com/repos/ekholabs/cloudstack/issues/comments{/number}","contents_url":"https://api.github.com/repos/ekholabs/cloudstack/contents/{+path}","compare_url":"https://api.github.com/repos/ekholabs/cloudstack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ekholabs/cloudstack/merges","archive_url":"https://api.github.com/repos/ekholabs/cloudstack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ekholabs/cloudstack/downloads","issues_url":"https://api.github.com/repos/ekholabs/cloudstack/issues{/number}","pulls_url":"https://api.github.com/repos/ekholabs/cloudstack/pulls{/number}","milestones_url":"https://api.github.com/repos/ekholabs/cloudstack/milestones{/number}","notifications_url":"https://api.github.com/repos/ekholabs/cloudstack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ekholabs/cloudstack/labels{/name}","releases_url":"https://api.github.com/repos/ekholabs/cloudstack/releases{/id}","created_at":"2015-08-28T11:14:37Z","updated_at":"2015-08-28T11:15:00Z","pushed_at":"2015-11-09T14:14:40Z","git_url":"git://github.com/ekholabs/cloudstack.git","ssh_url":"git@github.com:ekholabs/cloudstack.git","clone_url":"https://github.com/ekholabs/cloudstack.git","svn_url":"https://github.com/ekholabs/cloudstack","homepage":null,"size":496007,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"790297cdba6510dbf669a79a0fd1e11301a0971a","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":9759448,"name":"cloudstack","full_name":"apache/cloudstack","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/cloudstack","description":"Mirror of Apache Cloudstack","fork":false,"url":"https://api.github.com/repos/apache/cloudstack","forks_url":"https://api.github.com/repos/apache/cloudstack/forks","keys_url":"https://api.github.com/repos/apache/cloudstack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/cloudstack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/cloudstack/teams","hooks_url":"https://api.github.com/repos/apache/cloudstack/hooks","issue_events_url":"https://api.github.com/repos/apache/cloudstack/issues/events{/number}","events_url":"https://api.github.com/repos/apache/cloudstack/events","assignees_url":"https://api.github.com/repos/apache/cloudstack/assignees{/user}","branches_url":"https://api.github.com/repos/apache/cloudstack/branches{/branch}","tags_url":"https://api.github.com/repos/apache/cloudstack/tags","blobs_url":"https://api.github.com/repos/apache/cloudstack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/cloudstack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/cloudstack/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/cloudstack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/cloudstack/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/cloudstack/languages","stargazers_url":"https://api.github.com/repos/apache/cloudstack/stargazers","contributors_url":"https://api.github.com/repos/apache/cloudstack/contributors","subscribers_url":"https://api.github.com/repos/apache/cloudstack/subscribers","subscription_url":"https://api.github.com/repos/apache/cloudstack/subscription","commits_url":"https://api.github.com/repos/apache/cloudstack/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/cloudstack/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/cloudstack/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/cloudstack/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/cloudstack/contents/{+path}","compare_url":"https://api.github.com/repos/apache/cloudstack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/cloudstack/merges","archive_url":"https://api.github.com/repos/apache/cloudstack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/cloudstack/downloads","issues_url":"https://api.github.com/repos/apache/cloudstack/issues{/number}","pulls_url":"https://api.github.com/repos/apache/cloudstack/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/cloudstack/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/cloudstack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/cloudstack/labels{/name}","releases_url":"https://api.github.com/repos/apache/cloudstack/releases{/id}","created_at":"2013-04-29T22:27:12Z","updated_at":"2015-11-07T18:55:50Z","pushed_at":"2015-11-09T14:34:53Z","git_url":"git://github.com/apache/cloudstack.git","ssh_url":"git@github.com:apache/cloudstack.git","clone_url":"https://github.com/apache/cloudstack.git","svn_url":"https://github.com/apache/cloudstack","homepage":null,"size":764832,"stargazers_count":313,"watchers_count":313,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":399,"mirror_url":"git://git.apache.org/cloudstack.git","open_issues_count":128,"forks":399,"open_issues":128,"watchers":313,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/cloudstack/pulls/1050"},"html":{"href":"https://github.com/apache/cloudstack/pull/1050"},"issue":{"href":"https://api.github.com/repos/apache/cloudstack/issues/1050"},"comments":{"href":"https://api.github.com/repos/apache/cloudstack/issues/1050/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/cloudstack/pulls/1050/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/cloudstack/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/cloudstack/pulls/1050/commits"},"statuses":{"href":"https://api.github.com/repos/apache/cloudstack/statuses/72e79bcaa6eacc0041694120f7ea53792dc68975"}}}}