I was helping someone with their integration of an SDN controller with CloudStack. The requirement was that the SDN controller needed the uuid of the virtual interface (vif) of the virtual machine so that it could plug it into the right softswitch, manage the vif etc. This vif uuid is generated by the XenServer.
My recommendation was to write a plugin (implement NetworkElement) that would get the vif uuid after the vm started by making a XAPI call (via the agent manager) and then call the SDN controller API with this value. The response: "Unfortunately, the mechanism you describe wouldn't be sufficient as we would require the the VIF uuid before the VM boots, otherwise there might be a race condition where sometimes VMs will boot up and lack network connectivity and therefore might not even receive their DHCP addresses and such. " Currently, when CloudStack starts a VM, all information regarding the VM (including nics and storage) is passed down in a single StartCommand to the hypervisor resource. The hypervisor resource (e.g., CitrixResourceBase or LibVirtComputingResource) takes appropriate actions to create vifs and plug them into the vm and start the vm. One way to solve the integration problem would be to split the StartCommand into multiple commands: for e.g., CreateVif, CreateVolume, CreateVm, StartVm. This changes the agent API and affects all hypervisor resources. Another way is to modify the specific hypervisor resource to do something just after creating the vifs but prior to starting the vm. A third way is to split the agent api into 2 commands: CreateVm and StartVm. Thoughts? -- Chiradeep