{"action":"created","issue":{"url":"https://api.github.com/repos/vmware/govmomi/issues/467","repository_url":"https://api.github.com/repos/vmware/govmomi","labels_url":"https://api.github.com/repos/vmware/govmomi/issues/467/labels{/name}","comments_url":"https://api.github.com/repos/vmware/govmomi/issues/467/comments","events_url":"https://api.github.com/repos/vmware/govmomi/issues/467/events","html_url":"https://github.com/vmware/govmomi/issues/467","id":141138245,"number":467,"title":"Best way to create a VM and bind an un-used dvs portgroup port?","user":{"login":"eyz","id":4591181,"avatar_url":"https://avatars.githubusercontent.com/u/4591181?v=3","gravatar_id":"","url":"https://api.github.com/users/eyz","html_url":"https://github.com/eyz","followers_url":"https://api.github.com/users/eyz/followers","following_url":"https://api.github.com/users/eyz/following{/other_user}","gists_url":"https://api.github.com/users/eyz/gists{/gist_id}","starred_url":"https://api.github.com/users/eyz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eyz/subscriptions","organizations_url":"https://api.github.com/users/eyz/orgs","repos_url":"https://api.github.com/users/eyz/repos","events_url":"https://api.github.com/users/eyz/events{/privacy}","received_events_url":"https://api.github.com/users/eyz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-16T00:42:51Z","updated_at":"2016-03-18T19:57:15Z","closed_at":null,"body":"I plan to obtain an un-used port from a dvs portgroup and assign it to an interface on a new VM. I'd like to know if anyone can think of any gotchas regarding how to ensure the port isn't taken while the VM is being created.\r\n\r\nI see that most CRUD is being done in a task queue, but I'm not sure if there is anything other than checking for failures on the network interface / port binding that would prevent collisions on allocation of the port.\r\n\r\nThoughts?\r\n\r\nFor some reference, see the new [dvs.portgroup.info](https://github.com/eyz/govmomi/blob/dvs-enhancements/govc/dvs/portgroup/info.go) I am working on"},"comment":{"url":"https://api.github.com/repos/vmware/govmomi/issues/comments/198518368","html_url":"https://github.com/vmware/govmomi/issues/467#issuecomment-198518368","issue_url":"https://api.github.com/repos/vmware/govmomi/issues/467","id":198518368,"user":{"login":"eyz","id":4591181,"avatar_url":"https://avatars.githubusercontent.com/u/4591181?v=3","gravatar_id":"","url":"https://api.github.com/users/eyz","html_url":"https://github.com/eyz","followers_url":"https://api.github.com/users/eyz/followers","following_url":"https://api.github.com/users/eyz/following{/other_user}","gists_url":"https://api.github.com/users/eyz/gists{/gist_id}","starred_url":"https://api.github.com/users/eyz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eyz/subscriptions","organizations_url":"https://api.github.com/users/eyz/orgs","repos_url":"https://api.github.com/users/eyz/repos","events_url":"https://api.github.com/users/eyz/events{/privacy}","received_events_url":"https://api.github.com/users/eyz/received_events","type":"User","site_admin":false},"created_at":"2016-03-18T19:57:15Z","updated_at":"2016-03-18T19:57:15Z","body":"Rather than having vm.create -port.dvs -port.dvpg (from PR #473 ) fail due to a port already in use, and runing again until it succeeds, is there some sort of locking or task that would be applicable? Would either ReconfigureDVPortgroup_Task or ReconfigureDVPort_Task lock the objects in the portgroup until after the FetchDVPort query finds an available port, the port is bound, the VM is created, and then the Task would be marked as completed?"}}