{"action":"created","comment":{"url":"https://api.github.com/repos/SchSeba/kubemacpool/pulls/comments/268450969","pull_request_review_id":218099424,"id":268450969,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI2ODQ1MDk2OQ==","diff_hunk":"@@ -0,0 +1,162 @@\n+/*\n+Copyright 2019 The KubeMacPool Authors.\n+\n+Licensed under the Apache License, Version 2.0 (the \"License\");\n+you may not use this file except in compliance with the License.\n+You may obtain a copy of the License at\n+\n+    http://www.apache.org/licenses/LICENSE-2.0\n+\n+Unless required by applicable law or agreed to in writing, software\n+distributed under the License is distributed on an \"AS IS\" BASIS,\n+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+See the License for the specific language governing permissions and\n+limitations under the License.\n+*/\n+\n+package pool_manager\n+\n+import (\n+\t\"fmt\"\n+\t\"net\"\n+\n+\tcorev1 \"k8s.io/api/core/v1\"\n+\tkubevirt \"kubevirt.io/kubevirt/pkg/api/v1\"\n+)\n+\n+func (p *PoolManager) AllocateVirtualMachineMac(virtualMachine *kubevirt.VirtualMachine) error {\n+\tp.poolMutex.Lock()\n+\tdefer p.poolMutex.Unlock()\n+\n+\tp.setAsLeader()\n+\tif len(virtualMachine.Spec.Template.Spec.Domain.Devices.Interfaces) == 0 {\n+\t\tlog.V(1).Info(\"failed to find interfaces for virtual machine\", \"virtualMachine\", virtualMachine)\n+\t\treturn nil\n+\t}\n+\n+\tif len(virtualMachine.Spec.Template.Spec.Networks) == 0 {\n+\t\tlog.Info(\"no networks found for virtual machine skipping mac allocation\", \"name\", virtualMachine.Name,\n+\t\t\t\"namespace\", virtualMachine.Namespace)\n+\t}\n+\n+\tnetworks := map[string]kubevirt.Network{}\n+\tfor _, network := range virtualMachine.Spec.Template.Spec.Networks {\n+\t\tnetworks[network.Name] = network\n+\t}\n+\n+\tlog.V(1).Info(\"virtual machine data\",\n+\t\t\"name\", virtualMachine.Name,\n+\t\t\"namespace\", virtualMachine.Namespace,\n+\t\t\"interfaces\", virtualMachine.Spec.Template.Spec.Domain.Devices.Interfaces)\n+\n+\tfor idx, iface := range virtualMachine.Spec.Template.Spec.Domain.Devices.Interfaces {\n+\t\tif iface.Masquerade == nil && iface.Slirp == nil && networks[iface.Name].Multus == nil {\n+\t\t\tlog.Info(\"for k8s network mac address will be set only for masquerade and slirp\")","path":"pkg/pool-manager/virtualmachine_pool.go","position":null,"original_position":54,"commit_id":"e154058083e03f780ba0cba3a99eafa8da00b6be","original_commit_id":"793c2d37c29622f6504062ae3c479d4a8def4262","user":{"login":"SchSeba","id":4209208,"node_id":"MDQ6VXNlcjQyMDkyMDg=","avatar_url":"https://avatars3.githubusercontent.com/u/4209208?v=4","gravatar_id":"","url":"https://api.github.com/users/SchSeba","html_url":"https://github.com/SchSeba","followers_url":"https://api.github.com/users/SchSeba/followers","following_url":"https://api.github.com/users/SchSeba/following{/other_user}","gists_url":"https://api.github.com/users/SchSeba/gists{/gist_id}","starred_url":"https://api.github.com/users/SchSeba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SchSeba/subscriptions","organizations_url":"https://api.github.com/users/SchSeba/orgs","repos_url":"https://api.github.com/users/SchSeba/repos","events_url":"https://api.github.com/users/SchSeba/events{/privacy}","received_events_url":"https://api.github.com/users/SchSeba/received_events","type":"User","site_admin":false},"body":"done","created_at":"2019-03-24T20:22:29Z","updated_at":"2019-03-24T20:25:21Z","html_url":"https://github.com/SchSeba/kubemacpool/pull/7#discussion_r268450969","pull_request_url":"https://api.github.com/repos/SchSeba/kubemacpool/pulls/7","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/SchSeba/kubemacpool/pulls/comments/268450969"},"html":{"href":"https://github.com/SchSeba/kubemacpool/pull/7#discussion_r268450969"},"pull_request":{"href":"https://api.github.com/repos/SchSeba/kubemacpool/pulls/7"}},"in_reply_to_id":267832929},"pull_request":{"url":"https://api.github.com/repos/SchSeba/kubemacpool/pulls/7","id":259915024,"node_id":"MDExOlB1bGxSZXF1ZXN0MjU5OTE1MDI0","html_url":"https://github.com/SchSeba/kubemacpool/pull/7","diff_url":"https://github.com/SchSeba/kubemacpool/pull/7.diff","patch_url":"https://github.com/SchSeba/kubemacpool/pull/7.patch","issue_url":"https://api.github.com/repos/SchSeba/kubemacpool/issues/7","number":7,"state":"open","locked":false,"title":"Integrate kubevirt","user":{"login":"SchSeba","id":4209208,"node_id":"MDQ6VXNlcjQyMDkyMDg=","avatar_url":"https://avatars3.githubusercontent.com/u/4209208?v=4","gravatar_id":"","url":"https://api.github.com/users/SchSeba","html_url":"https://github.com/SchSeba","followers_url":"https://api.github.com/users/SchSeba/followers","following_url":"https://api.github.com/users/SchSeba/following{/other_user}","gists_url":"https://api.github.com/users/SchSeba/gists{/gist_id}","starred_url":"https://api.github.com/users/SchSeba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SchSeba/subscriptions","organizations_url":"https://api.github.com/users/SchSeba/orgs","repos_url":"https://api.github.com/users/SchSeba/repos","events_url":"https://api.github.com/users/SchSeba/events{/privacy}","received_events_url":"https://api.github.com/users/SchSeba/received_events","type":"User","site_admin":false},"body":"Added the ability to allocate and save mac address for kubevirt virtual machines objects.\r\n\r\nthis way all the time a VM is configure in the cluster even if it's stop the mac address will be reserve for him. (allow the virtual machine to have the same mac address after restart)\r\n\r\nminor changes:\r\n* update the godep file\r\n* fix a bug with the latest available mac\n\n<!-- Reviewable:start -->\n---\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/schseba/kubemacpool/7)\n<!-- Reviewable:end -->\n","created_at":"2019-03-11T10:43:29Z","updated_at":"2019-03-24T20:25:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6b47cbae61e9f09c35aabc3e19868b4ce3d3e700","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/SchSeba/kubemacpool/pulls/7/commits","review_comments_url":"https://api.github.com/repos/SchSeba/kubemacpool/pulls/7/comments","review_comment_url":"https://api.github.com/repos/SchSeba/kubemacpool/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SchSeba/kubemacpool/issues/7/comments","statuses_url":"https://api.github.com/repos/SchSeba/kubemacpool/statuses/e154058083e03f780ba0cba3a99eafa8da00b6be","head":{"label":"SchSeba:integrate_kubevirt","ref":"integrate_kubevirt","sha":"e154058083e03f780ba0cba3a99eafa8da00b6be","user":{"login":"SchSeba","id":4209208,"node_id":"MDQ6VXNlcjQyMDkyMDg=","avatar_url":"https://avatars3.githubusercontent.com/u/4209208?v=4","gravatar_id":"","url":"https://api.github.com/users/SchSeba","html_url":"https://github.com/SchSeba","followers_url":"https://api.github.com/users/SchSeba/followers","following_url":"https://api.github.com/users/SchSeba/following{/other_user}","gists_url":"https://api.github.com/users/SchSeba/gists{/gist_id}","starred_url":"https://api.github.com/users/SchSeba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SchSeba/subscriptions","organizations_url":"https://api.github.com/users/SchSeba/orgs","repos_url":"https://api.github.com/users/SchSeba/repos","events_url":"https://api.github.com/users/SchSeba/events{/privacy}","received_events_url":"https://api.github.com/users/SchSeba/received_events","type":"User","site_admin":false},"repo":{"id":165827963,"node_id":"MDEwOlJlcG9zaXRvcnkxNjU4Mjc5NjM=","name":"kubemacpool","full_name":"SchSeba/kubemacpool","private":false,"owner":{"login":"SchSeba","id":4209208,"node_id":"MDQ6VXNlcjQyMDkyMDg=","avatar_url":"https://avatars3.githubusercontent.com/u/4209208?v=4","gravatar_id":"","url":"https://api.github.com/users/SchSeba","html_url":"https://github.com/SchSeba","followers_url":"https://api.github.com/users/SchSeba/followers","following_url":"https://api.github.com/users/SchSeba/following{/other_user}","gists_url":"https://api.github.com/users/SchSeba/gists{/gist_id}","starred_url":"https://api.github.com/users/SchSeba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SchSeba/subscriptions","organizations_url":"https://api.github.com/users/SchSeba/orgs","repos_url":"https://api.github.com/users/SchSeba/repos","events_url":"https://api.github.com/users/SchSeba/events{/privacy}","received_events_url":"https://api.github.com/users/SchSeba/received_events","type":"User","site_admin":false},"html_url":"https://github.com/SchSeba/kubemacpool","description":null,"fork":false,"url":"https://api.github.com/repos/SchSeba/kubemacpool","forks_url":"https://api.github.com/repos/SchSeba/kubemacpool/forks","keys_url":"https://api.github.com/repos/SchSeba/kubemacpool/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SchSeba/kubemacpool/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SchSeba/kubemacpool/teams","hooks_url":"https://api.github.com/repos/SchSeba/kubemacpool/hooks","issue_events_url":"https://api.github.com/repos/SchSeba/kubemacpool/issues/events{/number}","events_url":"https://api.github.com/repos/SchSeba/kubemacpool/events","assignees_url":"https://api.github.com/repos/SchSeba/kubemacpool/assignees{/user}","branches_url":"https://api.github.com/repos/SchSeba/kubemacpool/branches{/branch}","tags_url":"https://api.github.com/repos/SchSeba/kubemacpool/tags","blobs_url":"https://api.github.com/repos/SchSeba/kubemacpool/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SchSeba/kubemacpool/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SchSeba/kubemacpool/git/refs{/sha}","trees_url":"https://api.github.com/repos/SchSeba/kubemacpool/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SchSeba/kubemacpool/statuses/{sha}","languages_url":"https://api.github.com/repos/SchSeba/kubemacpool/languages","stargazers_url":"https://api.github.com/repos/SchSeba/kubemacpool/stargazers","contributors_url":"https://api.github.com/repos/SchSeba/kubemacpool/contributors","subscribers_url":"https://api.github.com/repos/SchSeba/kubemacpool/subscribers","subscription_url":"https://api.github.com/repos/SchSeba/kubemacpool/subscription","commits_url":"https://api.github.com/repos/SchSeba/kubemacpool/commits{/sha}","git_commits_url":"https://api.github.com/repos/SchSeba/kubemacpool/git/commits{/sha}","comments_url":"https://api.github.com/repos/SchSeba/kubemacpool/comments{/number}","issue_comment_url":"https://api.github.com/repos/SchSeba/kubemacpool/issues/comments{/number}","contents_url":"https://api.github.com/repos/SchSeba/kubemacpool/contents/{+path}","compare_url":"https://api.github.com/repos/SchSeba/kubemacpool/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SchSeba/kubemacpool/merges","archive_url":"https://api.github.com/repos/SchSeba/kubemacpool/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SchSeba/kubemacpool/downloads","issues_url":"https://api.github.com/repos/SchSeba/kubemacpool/issues{/number}","pulls_url":"https://api.github.com/repos/SchSeba/kubemacpool/pulls{/number}","milestones_url":"https://api.github.com/repos/SchSeba/kubemacpool/milestones{/number}","notifications_url":"https://api.github.com/repos/SchSeba/kubemacpool/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SchSeba/kubemacpool/labels{/name}","releases_url":"https://api.github.com/repos/SchSeba/kubemacpool/releases{/id}","deployments_url":"https://api.github.com/repos/SchSeba/kubemacpool/deployments","created_at":"2019-01-15T10:02:53Z","updated_at":"2019-03-22T14:03:52Z","pushed_at":"2019-03-24T20:24:47Z","git_url":"git://github.com/SchSeba/kubemacpool.git","ssh_url":"git@github.com:SchSeba/kubemacpool.git","clone_url":"https://github.com/SchSeba/kubemacpool.git","svn_url":"https://github.com/SchSeba/kubemacpool","homepage":null,"size":117868,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":1,"open_issues":2,"watchers":1,"default_branch":"master"}},"base":{"label":"SchSeba:master","ref":"master","sha":"3f3a2dc3932ab22d68afe20babce0d0093d9f1f4","user":{"login":"SchSeba","id":4209208,"node_id":"MDQ6VXNlcjQyMDkyMDg=","avatar_url":"https://avatars3.githubusercontent.com/u/4209208?v=4","gravatar_id":"","url":"https://api.github.com/users/SchSeba","html_url":"https://github.com/SchSeba","followers_url":"https://api.github.com/users/SchSeba/followers","following_url":"https://api.github.com/users/SchSeba/following{/other_user}","gists_url":"https://api.github.com/users/SchSeba/gists{/gist_id}","starred_url":"https://api.github.com/users/SchSeba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SchSeba/subscriptions","organizations_url":"https://api.github.com/users/SchSeba/orgs","repos_url":"https://api.github.com/users/SchSeba/repos","events_url":"https://api.github.com/users/SchSeba/events{/privacy}","received_events_url":"https://api.github.com/users/SchSeba/received_events","type":"User","site_admin":false},"repo":{"id":165827963,"node_id":"MDEwOlJlcG9zaXRvcnkxNjU4Mjc5NjM=","name":"kubemacpool","full_name":"SchSeba/kubemacpool","private":false,"owner":{"login":"SchSeba","id":4209208,"node_id":"MDQ6VXNlcjQyMDkyMDg=","avatar_url":"https://avatars3.githubusercontent.com/u/4209208?v=4","gravatar_id":"","url":"https://api.github.com/users/SchSeba","html_url":"https://github.com/SchSeba","followers_url":"https://api.github.com/users/SchSeba/followers","following_url":"https://api.github.com/users/SchSeba/following{/other_user}","gists_url":"https://api.github.com/users/SchSeba/gists{/gist_id}","starred_url":"https://api.github.com/users/SchSeba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SchSeba/subscriptions","organizations_url":"https://api.github.com/users/SchSeba/orgs","repos_url":"https://api.github.com/users/SchSeba/repos","events_url":"https://api.github.com/users/SchSeba/events{/privacy}","received_events_url":"https://api.github.com/users/SchSeba/received_events","type":"User","site_admin":false},"html_url":"https://github.com/SchSeba/kubemacpool","description":null,"fork":false,"url":"https://api.github.com/repos/SchSeba/kubemacpool","forks_url":"https://api.github.com/repos/SchSeba/kubemacpool/forks","keys_url":"https://api.github.com/repos/SchSeba/kubemacpool/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SchSeba/kubemacpool/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SchSeba/kubemacpool/teams","hooks_url":"https://api.github.com/repos/SchSeba/kubemacpool/hooks","issue_events_url":"https://api.github.com/repos/SchSeba/kubemacpool/issues/events{/number}","events_url":"https://api.github.com/repos/SchSeba/kubemacpool/events","assignees_url":"https://api.github.com/repos/SchSeba/kubemacpool/assignees{/user}","branches_url":"https://api.github.com/repos/SchSeba/kubemacpool/branches{/branch}","tags_url":"https://api.github.com/repos/SchSeba/kubemacpool/tags","blobs_url":"https://api.github.com/repos/SchSeba/kubemacpool/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SchSeba/kubemacpool/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SchSeba/kubemacpool/git/refs{/sha}","trees_url":"https://api.github.com/repos/SchSeba/kubemacpool/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SchSeba/kubemacpool/statuses/{sha}","languages_url":"https://api.github.com/repos/SchSeba/kubemacpool/languages","stargazers_url":"https://api.github.com/repos/SchSeba/kubemacpool/stargazers","contributors_url":"https://api.github.com/repos/SchSeba/kubemacpool/contributors","subscribers_url":"https://api.github.com/repos/SchSeba/kubemacpool/subscribers","subscription_url":"https://api.github.com/repos/SchSeba/kubemacpool/subscription","commits_url":"https://api.github.com/repos/SchSeba/kubemacpool/commits{/sha}","git_commits_url":"https://api.github.com/repos/SchSeba/kubemacpool/git/commits{/sha}","comments_url":"https://api.github.com/repos/SchSeba/kubemacpool/comments{/number}","issue_comment_url":"https://api.github.com/repos/SchSeba/kubemacpool/issues/comments{/number}","contents_url":"https://api.github.com/repos/SchSeba/kubemacpool/contents/{+path}","compare_url":"https://api.github.com/repos/SchSeba/kubemacpool/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SchSeba/kubemacpool/merges","archive_url":"https://api.github.com/repos/SchSeba/kubemacpool/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SchSeba/kubemacpool/downloads","issues_url":"https://api.github.com/repos/SchSeba/kubemacpool/issues{/number}","pulls_url":"https://api.github.com/repos/SchSeba/kubemacpool/pulls{/number}","milestones_url":"https://api.github.com/repos/SchSeba/kubemacpool/milestones{/number}","notifications_url":"https://api.github.com/repos/SchSeba/kubemacpool/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SchSeba/kubemacpool/labels{/name}","releases_url":"https://api.github.com/repos/SchSeba/kubemacpool/releases{/id}","deployments_url":"https://api.github.com/repos/SchSeba/kubemacpool/deployments","created_at":"2019-01-15T10:02:53Z","updated_at":"2019-03-22T14:03:52Z","pushed_at":"2019-03-24T20:24:47Z","git_url":"git://github.com/SchSeba/kubemacpool.git","ssh_url":"git@github.com:SchSeba/kubemacpool.git","clone_url":"https://github.com/SchSeba/kubemacpool.git","svn_url":"https://github.com/SchSeba/kubemacpool","homepage":null,"size":117868,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":1,"open_issues":2,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SchSeba/kubemacpool/pulls/7"},"html":{"href":"https://github.com/SchSeba/kubemacpool/pull/7"},"issue":{"href":"https://api.github.com/repos/SchSeba/kubemacpool/issues/7"},"comments":{"href":"https://api.github.com/repos/SchSeba/kubemacpool/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/SchSeba/kubemacpool/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/SchSeba/kubemacpool/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SchSeba/kubemacpool/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/SchSeba/kubemacpool/statuses/e154058083e03f780ba0cba3a99eafa8da00b6be"}},"author_association":"OWNER"}}
{"actor":{"display_login":"SchSeba"}}