{"action":"created","comment":{"url":"https://api.github.com/repos/xapi-project/xen-api/pulls/comments/166201585","pull_request_review_id":94240373,"id":166201585,"diff_hunk":"@@ -301,3 +301,39 @@ let copy ~__context ~vm ~preserve_mac_address vif =\n         warn \"Ignoring exception raised while creating PVS_proxy when copying a VIF: %s\"\n           (Printexc.to_string e)) proxies;\n   result\n+\n+let backend_of_bridge_network net =\n+  let open Xenops_interface in\n+  if List.mem_assoc \"backend_vm\" net.API.network_other_config then begin\n+    let backend_vm = List.assoc \"backend_vm\" net.API.network_other_config in\n+    debug \"Using VM %s as backend for VIF on network %s\" backend_vm net.API.network_uuid;\n+    Network.Remote (backend_vm, net.API.network_bridge)\n+  end else\n+    Network.Local net.API.network_bridge (* PR-1255 *)\n+\n+let get_backend ~__context ~self =\n+  let vif_record = Db.VIF.get_record_internal ~__context ~self in\n+  let net = Db.Network.get_record ~__context ~self:vif_record.Db_actions.vIF_network in\n+  let host = Helpers.get_localhost ~__context in\n+  let pifs = Db.PIF.get_refs_where ~__context ~expr:(And (\n+    Eq (Field \"network\", Literal (Ref.string_of vif_record.Db_actions.vIF_network)),\n+    Eq (Field \"host\", Literal (Ref.string_of host))\n+    )) in\n+  match pifs with\n+  | [] -> backend_of_bridge_network net\n+  | pif :: _ ->\n+    let back_pif =","path":"ocaml/xapi/xapi_vif_helpers.ml","position":36,"original_position":25,"commit_id":"eaf609834dbd297431b7936609c0340d621a91c1","original_commit_id":"eaf609834dbd297431b7936609c0340d621a91c1","user":{"login":"minglumlu","id":27800561,"avatar_url":"https://avatars2.githubusercontent.com/u/27800561?v=4","gravatar_id":"","url":"https://api.github.com/users/minglumlu","html_url":"https://github.com/minglumlu","followers_url":"https://api.github.com/users/minglumlu/followers","following_url":"https://api.github.com/users/minglumlu/following{/other_user}","gists_url":"https://api.github.com/users/minglumlu/gists{/gist_id}","starred_url":"https://api.github.com/users/minglumlu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minglumlu/subscriptions","organizations_url":"https://api.github.com/users/minglumlu/orgs","repos_url":"https://api.github.com/users/minglumlu/repos","events_url":"https://api.github.com/users/minglumlu/events{/privacy}","received_events_url":"https://api.github.com/users/minglumlu/received_events","type":"User","site_admin":false},"body":"New function is in use :)","created_at":"2018-02-06T06:59:31Z","updated_at":"2018-02-06T06:59:31Z","html_url":"https://github.com/xapi-project/xen-api/pull/3408#discussion_r166201585","pull_request_url":"https://api.github.com/repos/xapi-project/xen-api/pulls/3408","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/xapi-project/xen-api/pulls/comments/166201585"},"html":{"href":"https://github.com/xapi-project/xen-api/pull/3408#discussion_r166201585"},"pull_request":{"href":"https://api.github.com/repos/xapi-project/xen-api/pulls/3408"}},"in_reply_to_id":165990070},"pull_request":{"url":"https://api.github.com/repos/xapi-project/xen-api/pulls/3408","id":163905777,"html_url":"https://github.com/xapi-project/xen-api/pull/3408","diff_url":"https://github.com/xapi-project/xen-api/pull/3408.diff","patch_url":"https://github.com/xapi-project/xen-api/pull/3408.patch","issue_url":"https://api.github.com/repos/xapi-project/xen-api/issues/3408","number":3408,"state":"open","locked":false,"title":"CP-25795: Add new VIF backend for network SR-IOV","user":{"login":"minglumlu","id":27800561,"avatar_url":"https://avatars2.githubusercontent.com/u/27800561?v=4","gravatar_id":"","url":"https://api.github.com/users/minglumlu","html_url":"https://github.com/minglumlu","followers_url":"https://api.github.com/users/minglumlu/followers","following_url":"https://api.github.com/users/minglumlu/following{/other_user}","gists_url":"https://api.github.com/users/minglumlu/gists{/gist_id}","starred_url":"https://api.github.com/users/minglumlu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minglumlu/subscriptions","organizations_url":"https://api.github.com/users/minglumlu/orgs","repos_url":"https://api.github.com/users/minglumlu/repos","events_url":"https://api.github.com/users/minglumlu/events{/privacy}","received_events_url":"https://api.github.com/users/minglumlu/received_events","type":"User","site_admin":false},"body":"Following changes are done when Xapi requests service of Xenopsd to start a VM:\r\n1. support network SR-IOV VF backed vif;\r\n2. add a new function to get backend of vif\r\n3. add PCI of network SR-IOV VF into metadata.\r\n4. add a new Api.error 'vif_has_no_sriov_vf_reserved'\r\n    \r\nSigned-off-by: Ming Lu ming.lu@citrix.com","created_at":"2018-01-19T07:53:23Z","updated_at":"2018-02-06T06:59:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5ee11c210fea5f7f69ca50cbc89caaa45a779d03","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/xapi-project/xen-api/pulls/3408/commits","review_comments_url":"https://api.github.com/repos/xapi-project/xen-api/pulls/3408/comments","review_comment_url":"https://api.github.com/repos/xapi-project/xen-api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/xapi-project/xen-api/issues/3408/comments","statuses_url":"https://api.github.com/repos/xapi-project/xen-api/statuses/eaf609834dbd297431b7936609c0340d621a91c1","head":{"label":"minglumlu:private/mingl/CP-25795","ref":"private/mingl/CP-25795","sha":"eaf609834dbd297431b7936609c0340d621a91c1","user":{"login":"minglumlu","id":27800561,"avatar_url":"https://avatars2.githubusercontent.com/u/27800561?v=4","gravatar_id":"","url":"https://api.github.com/users/minglumlu","html_url":"https://github.com/minglumlu","followers_url":"https://api.github.com/users/minglumlu/followers","following_url":"https://api.github.com/users/minglumlu/following{/other_user}","gists_url":"https://api.github.com/users/minglumlu/gists{/gist_id}","starred_url":"https://api.github.com/users/minglumlu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minglumlu/subscriptions","organizations_url":"https://api.github.com/users/minglumlu/orgs","repos_url":"https://api.github.com/users/minglumlu/repos","events_url":"https://api.github.com/users/minglumlu/events{/privacy}","received_events_url":"https://api.github.com/users/minglumlu/received_events","type":"User","site_admin":false},"repo":{"id":88826598,"name":"xen-api","full_name":"minglumlu/xen-api","owner":{"login":"minglumlu","id":27800561,"avatar_url":"https://avatars2.githubusercontent.com/u/27800561?v=4","gravatar_id":"","url":"https://api.github.com/users/minglumlu","html_url":"https://github.com/minglumlu","followers_url":"https://api.github.com/users/minglumlu/followers","following_url":"https://api.github.com/users/minglumlu/following{/other_user}","gists_url":"https://api.github.com/users/minglumlu/gists{/gist_id}","starred_url":"https://api.github.com/users/minglumlu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minglumlu/subscriptions","organizations_url":"https://api.github.com/users/minglumlu/orgs","repos_url":"https://api.github.com/users/minglumlu/repos","events_url":"https://api.github.com/users/minglumlu/events{/privacy}","received_events_url":"https://api.github.com/users/minglumlu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/minglumlu/xen-api","description":"The Xapi Project's XenAPI Server","fork":true,"url":"https://api.github.com/repos/minglumlu/xen-api","forks_url":"https://api.github.com/repos/minglumlu/xen-api/forks","keys_url":"https://api.github.com/repos/minglumlu/xen-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/minglumlu/xen-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/minglumlu/xen-api/teams","hooks_url":"https://api.github.com/repos/minglumlu/xen-api/hooks","issue_events_url":"https://api.github.com/repos/minglumlu/xen-api/issues/events{/number}","events_url":"https://api.github.com/repos/minglumlu/xen-api/events","assignees_url":"https://api.github.com/repos/minglumlu/xen-api/assignees{/user}","branches_url":"https://api.github.com/repos/minglumlu/xen-api/branches{/branch}","tags_url":"https://api.github.com/repos/minglumlu/xen-api/tags","blobs_url":"https://api.github.com/repos/minglumlu/xen-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/minglumlu/xen-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/minglumlu/xen-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/minglumlu/xen-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/minglumlu/xen-api/statuses/{sha}","languages_url":"https://api.github.com/repos/minglumlu/xen-api/languages","stargazers_url":"https://api.github.com/repos/minglumlu/xen-api/stargazers","contributors_url":"https://api.github.com/repos/minglumlu/xen-api/contributors","subscribers_url":"https://api.github.com/repos/minglumlu/xen-api/subscribers","subscription_url":"https://api.github.com/repos/minglumlu/xen-api/subscription","commits_url":"https://api.github.com/repos/minglumlu/xen-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/minglumlu/xen-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/minglumlu/xen-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/minglumlu/xen-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/minglumlu/xen-api/contents/{+path}","compare_url":"https://api.github.com/repos/minglumlu/xen-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/minglumlu/xen-api/merges","archive_url":"https://api.github.com/repos/minglumlu/xen-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/minglumlu/xen-api/downloads","issues_url":"https://api.github.com/repos/minglumlu/xen-api/issues{/number}","pulls_url":"https://api.github.com/repos/minglumlu/xen-api/pulls{/number}","milestones_url":"https://api.github.com/repos/minglumlu/xen-api/milestones{/number}","notifications_url":"https://api.github.com/repos/minglumlu/xen-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/minglumlu/xen-api/labels{/name}","releases_url":"https://api.github.com/repos/minglumlu/xen-api/releases{/id}","deployments_url":"https://api.github.com/repos/minglumlu/xen-api/deployments","created_at":"2017-04-20T05:59:05Z","updated_at":"2017-04-20T05:59:10Z","pushed_at":"2018-01-25T02:34:12Z","git_url":"git://github.com/minglumlu/xen-api.git","ssh_url":"git@github.com:minglumlu/xen-api.git","clone_url":"https://github.com/minglumlu/xen-api.git","svn_url":"https://github.com/minglumlu/xen-api","homepage":"http://xenproject.org/developers/teams/xapi.html","size":29889,"stargazers_count":0,"watchers_count":0,"language":"OCaml","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":"master"}},"base":{"label":"xapi-project:sr-iov","ref":"sr-iov","sha":"d87f6d0d7b7aabcc9db1f64543e33acc6e06fecd","user":{"login":"xapi-project","id":317268,"avatar_url":"https://avatars3.githubusercontent.com/u/317268?v=4","gravatar_id":"","url":"https://api.github.com/users/xapi-project","html_url":"https://github.com/xapi-project","followers_url":"https://api.github.com/users/xapi-project/followers","following_url":"https://api.github.com/users/xapi-project/following{/other_user}","gists_url":"https://api.github.com/users/xapi-project/gists{/gist_id}","starred_url":"https://api.github.com/users/xapi-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xapi-project/subscriptions","organizations_url":"https://api.github.com/users/xapi-project/orgs","repos_url":"https://api.github.com/users/xapi-project/repos","events_url":"https://api.github.com/users/xapi-project/events{/privacy}","received_events_url":"https://api.github.com/users/xapi-project/received_events","type":"Organization","site_admin":false},"repo":{"id":960233,"name":"xen-api","full_name":"xapi-project/xen-api","owner":{"login":"xapi-project","id":317268,"avatar_url":"https://avatars3.githubusercontent.com/u/317268?v=4","gravatar_id":"","url":"https://api.github.com/users/xapi-project","html_url":"https://github.com/xapi-project","followers_url":"https://api.github.com/users/xapi-project/followers","following_url":"https://api.github.com/users/xapi-project/following{/other_user}","gists_url":"https://api.github.com/users/xapi-project/gists{/gist_id}","starred_url":"https://api.github.com/users/xapi-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xapi-project/subscriptions","organizations_url":"https://api.github.com/users/xapi-project/orgs","repos_url":"https://api.github.com/users/xapi-project/repos","events_url":"https://api.github.com/users/xapi-project/events{/privacy}","received_events_url":"https://api.github.com/users/xapi-project/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/xapi-project/xen-api","description":"The Xapi Project's XenAPI Server","fork":false,"url":"https://api.github.com/repos/xapi-project/xen-api","forks_url":"https://api.github.com/repos/xapi-project/xen-api/forks","keys_url":"https://api.github.com/repos/xapi-project/xen-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xapi-project/xen-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xapi-project/xen-api/teams","hooks_url":"https://api.github.com/repos/xapi-project/xen-api/hooks","issue_events_url":"https://api.github.com/repos/xapi-project/xen-api/issues/events{/number}","events_url":"https://api.github.com/repos/xapi-project/xen-api/events","assignees_url":"https://api.github.com/repos/xapi-project/xen-api/assignees{/user}","branches_url":"https://api.github.com/repos/xapi-project/xen-api/branches{/branch}","tags_url":"https://api.github.com/repos/xapi-project/xen-api/tags","blobs_url":"https://api.github.com/repos/xapi-project/xen-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xapi-project/xen-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xapi-project/xen-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/xapi-project/xen-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xapi-project/xen-api/statuses/{sha}","languages_url":"https://api.github.com/repos/xapi-project/xen-api/languages","stargazers_url":"https://api.github.com/repos/xapi-project/xen-api/stargazers","contributors_url":"https://api.github.com/repos/xapi-project/xen-api/contributors","subscribers_url":"https://api.github.com/repos/xapi-project/xen-api/subscribers","subscription_url":"https://api.github.com/repos/xapi-project/xen-api/subscription","commits_url":"https://api.github.com/repos/xapi-project/xen-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/xapi-project/xen-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/xapi-project/xen-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/xapi-project/xen-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/xapi-project/xen-api/contents/{+path}","compare_url":"https://api.github.com/repos/xapi-project/xen-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xapi-project/xen-api/merges","archive_url":"https://api.github.com/repos/xapi-project/xen-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xapi-project/xen-api/downloads","issues_url":"https://api.github.com/repos/xapi-project/xen-api/issues{/number}","pulls_url":"https://api.github.com/repos/xapi-project/xen-api/pulls{/number}","milestones_url":"https://api.github.com/repos/xapi-project/xen-api/milestones{/number}","notifications_url":"https://api.github.com/repos/xapi-project/xen-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xapi-project/xen-api/labels{/name}","releases_url":"https://api.github.com/repos/xapi-project/xen-api/releases{/id}","deployments_url":"https://api.github.com/repos/xapi-project/xen-api/deployments","created_at":"2010-10-04T10:52:57Z","updated_at":"2018-02-01T17:09:16Z","pushed_at":"2018-02-06T03:24:44Z","git_url":"git://github.com/xapi-project/xen-api.git","ssh_url":"git@github.com:xapi-project/xen-api.git","clone_url":"https://github.com/xapi-project/xen-api.git","svn_url":"https://github.com/xapi-project/xen-api","homepage":"http://xenproject.org/developers/teams/xapi.html","size":30483,"stargazers_count":253,"watchers_count":253,"language":"OCaml","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":200,"mirror_url":null,"archived":false,"open_issues_count":16,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":200,"open_issues":16,"watchers":253,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/xapi-project/xen-api/pulls/3408"},"html":{"href":"https://github.com/xapi-project/xen-api/pull/3408"},"issue":{"href":"https://api.github.com/repos/xapi-project/xen-api/issues/3408"},"comments":{"href":"https://api.github.com/repos/xapi-project/xen-api/issues/3408/comments"},"review_comments":{"href":"https://api.github.com/repos/xapi-project/xen-api/pulls/3408/comments"},"review_comment":{"href":"https://api.github.com/repos/xapi-project/xen-api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/xapi-project/xen-api/pulls/3408/commits"},"statuses":{"href":"https://api.github.com/repos/xapi-project/xen-api/statuses/eaf609834dbd297431b7936609c0340d621a91c1"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"minglumlu"}}