{"action":"created","comment":{"url":"https://api.github.com/repos/kubevirt/kubevirt/pulls/comments/93238398","pull_request_review_id":13760269,"id":93238398,"diff_hunk":"@@ -68,19 +71,41 @@ func main() {\n \t\tpanic(err)\n \t}\n \n+\t// Create event recorder\n+\tcoreClient, err := kubecli.Get()\n+\tif err != nil {\n+\t\tpanic(err)\n+\t}\n+\tbroadcaster := record.NewBroadcaster()\n+\tbroadcaster.StartRecordingToSink(&kubecorev1.EventSinkImpl{Interface: coreClient.Events(api.NamespaceDefault)})\n+\trecorder := broadcaster.NewRecorder(kubev1.EventSource{Component: \"virt-handler\", Host: *host})\n+\n \tdomainListWatcher := virtcache.NewListWatchFromClient(domainLWConn, libvirtapi.VIR_DOMAIN_EVENT_ID_LIFECYCLE)\n \n \t_, domainController := kubecli.NewInformer(domainListWatcher, &libvirt.Domain{}, 0, kubecli.ResourceEventHandlerFuncs{\n \t\tAddFunc: func(obj interface{}) error {\n-\t\t\tfmt.Printf(\"Domain ADDED: %s: %s\\n\", obj.(*libvirt.Domain).GetObjectMeta().GetName(), obj.(*libvirt.Domain).Status.Status)\n+\t\t\tdomain := obj.(*libvirt.Domain)\n+\t\t\t// TODO this just demonstrates how to do event logging. More fine grained differentiations are necessary here.\n+\t\t\t// TODO For now we use an empty reference for event logging, normally whenever an event is logged, an update on the VM object itself is also part of this\n+\t\t\tif domain.Status.Status == libvirt.Running {\n+\t\t\t\trecorder.Event(NewVMReferenceFromDomain(domain), kubev1.EventTypeNormal, \"Started\", \"VM started\")","path":"cmd/virt-handler/virt-handler.go","position":36,"original_position":36,"commit_id":"36dead810a9a990290990da656dd84db3e8ff434","original_commit_id":"36dead810a9a990290990da656dd84db3e8ff434","user":{"login":"fabiand","id":83456,"avatar_url":"https://avatars.githubusercontent.com/u/83456?v=3","gravatar_id":"","url":"https://api.github.com/users/fabiand","html_url":"https://github.com/fabiand","followers_url":"https://api.github.com/users/fabiand/followers","following_url":"https://api.github.com/users/fabiand/following{/other_user}","gists_url":"https://api.github.com/users/fabiand/gists{/gist_id}","starred_url":"https://api.github.com/users/fabiand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabiand/subscriptions","organizations_url":"https://api.github.com/users/fabiand/orgs","repos_url":"https://api.github.com/users/fabiand/repos","events_url":"https://api.github.com/users/fabiand/events{/privacy}","received_events_url":"https://api.github.com/users/fabiand/received_events","type":"User","site_admin":false},"body":"I'm not so much worried about the load on the API server. I'm rather more concerned about the semantics of the events.\r\nTo me the question is what kind of event do we want to spawn when?\r\n\r\nCurrently it looks like the events are rather coupled to th evirt-handler state. This is okay if we want this semantics.","created_at":"2016-12-20T13:41:34Z","updated_at":"2016-12-20T13:41:34Z","html_url":"https://github.com/kubevirt/kubevirt/pull/4#discussion_r93238398","pull_request_url":"https://api.github.com/repos/kubevirt/kubevirt/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/kubevirt/kubevirt/pulls/comments/93238398"},"html":{"href":"https://github.com/kubevirt/kubevirt/pull/4#discussion_r93238398"},"pull_request":{"href":"https://api.github.com/repos/kubevirt/kubevirt/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/kubevirt/kubevirt/pulls/4","id":98564074,"html_url":"https://github.com/kubevirt/kubevirt/pull/4","diff_url":"https://github.com/kubevirt/kubevirt/pull/4.diff","patch_url":"https://github.com/kubevirt/kubevirt/pull/4.patch","issue_url":"https://api.github.com/repos/kubevirt/kubevirt/issues/4","number":4,"state":"open","locked":false,"title":"WIP Add \"Started\" and \"Deleted\" event for VMs","user":{"login":"rmohr","id":4534621,"avatar_url":"https://avatars.githubusercontent.com/u/4534621?v=3","gravatar_id":"","url":"https://api.github.com/users/rmohr","html_url":"https://github.com/rmohr","followers_url":"https://api.github.com/users/rmohr/followers","following_url":"https://api.github.com/users/rmohr/following{/other_user}","gists_url":"https://api.github.com/users/rmohr/gists{/gist_id}","starred_url":"https://api.github.com/users/rmohr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmohr/subscriptions","organizations_url":"https://api.github.com/users/rmohr/orgs","repos_url":"https://api.github.com/users/rmohr/repos","events_url":"https://api.github.com/users/rmohr/events{/privacy}","received_events_url":"https://api.github.com/users/rmohr/received_events","type":"User","site_admin":false},"body":"Send first VM events from virt-handler to kubernetes event stream.\r\nThe events can be watched like every other kubernetes event with\r\n\r\n  kubectl get events --watch\r\n\r\nChange-Id: Ifa94045ad226ffb98042d8d183bb9e9b2d4ed87f","created_at":"2016-12-19T13:22:01Z","updated_at":"2016-12-20T13:41:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ce5cc03d2c4634fddac6c12bff717ae7da92c688","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/kubevirt/kubevirt/pulls/4/commits","review_comments_url":"https://api.github.com/repos/kubevirt/kubevirt/pulls/4/comments","review_comment_url":"https://api.github.com/repos/kubevirt/kubevirt/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubevirt/kubevirt/issues/4/comments","statuses_url":"https://api.github.com/repos/kubevirt/kubevirt/statuses/36dead810a9a990290990da656dd84db3e8ff434","head":{"label":"rmohr:events","ref":"events","sha":"36dead810a9a990290990da656dd84db3e8ff434","user":{"login":"rmohr","id":4534621,"avatar_url":"https://avatars.githubusercontent.com/u/4534621?v=3","gravatar_id":"","url":"https://api.github.com/users/rmohr","html_url":"https://github.com/rmohr","followers_url":"https://api.github.com/users/rmohr/followers","following_url":"https://api.github.com/users/rmohr/following{/other_user}","gists_url":"https://api.github.com/users/rmohr/gists{/gist_id}","starred_url":"https://api.github.com/users/rmohr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmohr/subscriptions","organizations_url":"https://api.github.com/users/rmohr/orgs","repos_url":"https://api.github.com/users/rmohr/repos","events_url":"https://api.github.com/users/rmohr/events{/privacy}","received_events_url":"https://api.github.com/users/rmohr/received_events","type":"User","site_admin":false},"repo":{"id":76846344,"name":"kubevirt","full_name":"rmohr/kubevirt","owner":{"login":"rmohr","id":4534621,"avatar_url":"https://avatars.githubusercontent.com/u/4534621?v=3","gravatar_id":"","url":"https://api.github.com/users/rmohr","html_url":"https://github.com/rmohr","followers_url":"https://api.github.com/users/rmohr/followers","following_url":"https://api.github.com/users/rmohr/following{/other_user}","gists_url":"https://api.github.com/users/rmohr/gists{/gist_id}","starred_url":"https://api.github.com/users/rmohr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmohr/subscriptions","organizations_url":"https://api.github.com/users/rmohr/orgs","repos_url":"https://api.github.com/users/rmohr/repos","events_url":"https://api.github.com/users/rmohr/events{/privacy}","received_events_url":"https://api.github.com/users/rmohr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rmohr/kubevirt","description":"KubeVirt is a virtual machine management architecture built around Kubernetes.","fork":true,"url":"https://api.github.com/repos/rmohr/kubevirt","forks_url":"https://api.github.com/repos/rmohr/kubevirt/forks","keys_url":"https://api.github.com/repos/rmohr/kubevirt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rmohr/kubevirt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rmohr/kubevirt/teams","hooks_url":"https://api.github.com/repos/rmohr/kubevirt/hooks","issue_events_url":"https://api.github.com/repos/rmohr/kubevirt/issues/events{/number}","events_url":"https://api.github.com/repos/rmohr/kubevirt/events","assignees_url":"https://api.github.com/repos/rmohr/kubevirt/assignees{/user}","branches_url":"https://api.github.com/repos/rmohr/kubevirt/branches{/branch}","tags_url":"https://api.github.com/repos/rmohr/kubevirt/tags","blobs_url":"https://api.github.com/repos/rmohr/kubevirt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rmohr/kubevirt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rmohr/kubevirt/git/refs{/sha}","trees_url":"https://api.github.com/repos/rmohr/kubevirt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rmohr/kubevirt/statuses/{sha}","languages_url":"https://api.github.com/repos/rmohr/kubevirt/languages","stargazers_url":"https://api.github.com/repos/rmohr/kubevirt/stargazers","contributors_url":"https://api.github.com/repos/rmohr/kubevirt/contributors","subscribers_url":"https://api.github.com/repos/rmohr/kubevirt/subscribers","subscription_url":"https://api.github.com/repos/rmohr/kubevirt/subscription","commits_url":"https://api.github.com/repos/rmohr/kubevirt/commits{/sha}","git_commits_url":"https://api.github.com/repos/rmohr/kubevirt/git/commits{/sha}","comments_url":"https://api.github.com/repos/rmohr/kubevirt/comments{/number}","issue_comment_url":"https://api.github.com/repos/rmohr/kubevirt/issues/comments{/number}","contents_url":"https://api.github.com/repos/rmohr/kubevirt/contents/{+path}","compare_url":"https://api.github.com/repos/rmohr/kubevirt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rmohr/kubevirt/merges","archive_url":"https://api.github.com/repos/rmohr/kubevirt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rmohr/kubevirt/downloads","issues_url":"https://api.github.com/repos/rmohr/kubevirt/issues{/number}","pulls_url":"https://api.github.com/repos/rmohr/kubevirt/pulls{/number}","milestones_url":"https://api.github.com/repos/rmohr/kubevirt/milestones{/number}","notifications_url":"https://api.github.com/repos/rmohr/kubevirt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rmohr/kubevirt/labels{/name}","releases_url":"https://api.github.com/repos/rmohr/kubevirt/releases{/id}","deployments_url":"https://api.github.com/repos/rmohr/kubevirt/deployments","created_at":"2016-12-19T09:10:20Z","updated_at":"2016-12-19T09:10:21Z","pushed_at":"2016-12-20T12:58:29Z","git_url":"git://github.com/rmohr/kubevirt.git","ssh_url":"git@github.com:rmohr/kubevirt.git","clone_url":"https://github.com/rmohr/kubevirt.git","svn_url":"https://github.com/rmohr/kubevirt","homepage":null,"size":750,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"kubevirt:master","ref":"master","sha":"f06d08c625e5f9fd5dbee03e856928739a998277","user":{"login":"kubevirt","id":18700703,"avatar_url":"https://avatars.githubusercontent.com/u/18700703?v=3","gravatar_id":"","url":"https://api.github.com/users/kubevirt","html_url":"https://github.com/kubevirt","followers_url":"https://api.github.com/users/kubevirt/followers","following_url":"https://api.github.com/users/kubevirt/following{/other_user}","gists_url":"https://api.github.com/users/kubevirt/gists{/gist_id}","starred_url":"https://api.github.com/users/kubevirt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubevirt/subscriptions","organizations_url":"https://api.github.com/users/kubevirt/orgs","repos_url":"https://api.github.com/users/kubevirt/repos","events_url":"https://api.github.com/users/kubevirt/events{/privacy}","received_events_url":"https://api.github.com/users/kubevirt/received_events","type":"Organization","site_admin":false},"repo":{"id":76686583,"name":"kubevirt","full_name":"kubevirt/kubevirt","owner":{"login":"kubevirt","id":18700703,"avatar_url":"https://avatars.githubusercontent.com/u/18700703?v=3","gravatar_id":"","url":"https://api.github.com/users/kubevirt","html_url":"https://github.com/kubevirt","followers_url":"https://api.github.com/users/kubevirt/followers","following_url":"https://api.github.com/users/kubevirt/following{/other_user}","gists_url":"https://api.github.com/users/kubevirt/gists{/gist_id}","starred_url":"https://api.github.com/users/kubevirt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubevirt/subscriptions","organizations_url":"https://api.github.com/users/kubevirt/orgs","repos_url":"https://api.github.com/users/kubevirt/repos","events_url":"https://api.github.com/users/kubevirt/events{/privacy}","received_events_url":"https://api.github.com/users/kubevirt/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kubevirt/kubevirt","description":"KubeVirt is a virtual machine management architecture built around Kubernetes.","fork":false,"url":"https://api.github.com/repos/kubevirt/kubevirt","forks_url":"https://api.github.com/repos/kubevirt/kubevirt/forks","keys_url":"https://api.github.com/repos/kubevirt/kubevirt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kubevirt/kubevirt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kubevirt/kubevirt/teams","hooks_url":"https://api.github.com/repos/kubevirt/kubevirt/hooks","issue_events_url":"https://api.github.com/repos/kubevirt/kubevirt/issues/events{/number}","events_url":"https://api.github.com/repos/kubevirt/kubevirt/events","assignees_url":"https://api.github.com/repos/kubevirt/kubevirt/assignees{/user}","branches_url":"https://api.github.com/repos/kubevirt/kubevirt/branches{/branch}","tags_url":"https://api.github.com/repos/kubevirt/kubevirt/tags","blobs_url":"https://api.github.com/repos/kubevirt/kubevirt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kubevirt/kubevirt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kubevirt/kubevirt/git/refs{/sha}","trees_url":"https://api.github.com/repos/kubevirt/kubevirt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kubevirt/kubevirt/statuses/{sha}","languages_url":"https://api.github.com/repos/kubevirt/kubevirt/languages","stargazers_url":"https://api.github.com/repos/kubevirt/kubevirt/stargazers","contributors_url":"https://api.github.com/repos/kubevirt/kubevirt/contributors","subscribers_url":"https://api.github.com/repos/kubevirt/kubevirt/subscribers","subscription_url":"https://api.github.com/repos/kubevirt/kubevirt/subscription","commits_url":"https://api.github.com/repos/kubevirt/kubevirt/commits{/sha}","git_commits_url":"https://api.github.com/repos/kubevirt/kubevirt/git/commits{/sha}","comments_url":"https://api.github.com/repos/kubevirt/kubevirt/comments{/number}","issue_comment_url":"https://api.github.com/repos/kubevirt/kubevirt/issues/comments{/number}","contents_url":"https://api.github.com/repos/kubevirt/kubevirt/contents/{+path}","compare_url":"https://api.github.com/repos/kubevirt/kubevirt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kubevirt/kubevirt/merges","archive_url":"https://api.github.com/repos/kubevirt/kubevirt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kubevirt/kubevirt/downloads","issues_url":"https://api.github.com/repos/kubevirt/kubevirt/issues{/number}","pulls_url":"https://api.github.com/repos/kubevirt/kubevirt/pulls{/number}","milestones_url":"https://api.github.com/repos/kubevirt/kubevirt/milestones{/number}","notifications_url":"https://api.github.com/repos/kubevirt/kubevirt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kubevirt/kubevirt/labels{/name}","releases_url":"https://api.github.com/repos/kubevirt/kubevirt/releases{/id}","deployments_url":"https://api.github.com/repos/kubevirt/kubevirt/deployments","created_at":"2016-12-16T21:24:26Z","updated_at":"2016-12-20T09:02:37Z","pushed_at":"2016-12-20T12:58:27Z","git_url":"git://github.com/kubevirt/kubevirt.git","ssh_url":"git@github.com:kubevirt/kubevirt.git","clone_url":"https://github.com/kubevirt/kubevirt.git","svn_url":"https://github.com/kubevirt/kubevirt","homepage":null,"size":744,"stargazers_count":2,"watchers_count":2,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":3,"forks":5,"open_issues":3,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubevirt/kubevirt/pulls/4"},"html":{"href":"https://github.com/kubevirt/kubevirt/pull/4"},"issue":{"href":"https://api.github.com/repos/kubevirt/kubevirt/issues/4"},"comments":{"href":"https://api.github.com/repos/kubevirt/kubevirt/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/kubevirt/kubevirt/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/kubevirt/kubevirt/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubevirt/kubevirt/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/kubevirt/kubevirt/statuses/36dead810a9a990290990da656dd84db3e8ff434"}}}}
{"actor":{"display_login":"fabiand"}}