[vSphere] Support passing of a distributed switch for each interface. #2185
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background:
Remark: This is only related to the vSphere implementation of fog.
It is not yet possible with fog to create a nic (nic backing) on a vmware guest on different distributed switches that host the same network but are located in different datacenters.
Until now there is no option to add a nic with a specific distributed switch aside the nic configuration.
This leads to guests not being created.
Error message:
The message A specified parameter was not correct. spec.deviceChange.device.port.switchUuid is the relevant error message from vmware.
The error is located at the place where the raw network is selected from vsphere as follows (lib/fog/vsphere/requests/compute/get_network.rb):
This will select the first distributed switch to be found matching the required network name. Nevertheless if the same network is used in different dcs always the same distributed switch is selected.
This will fail in one of the two dcs as a special distributed switch is required.
Solution:
It would be an option to pass the required distributed switch along with the interface to be created (optional).
If there is no distributed switch passed as option the code is executed as before but otherwise the network for this given distributed switch is selected.
The solution might look as follows:
This pull request solves this critical problem with this aproach.
Any better ideas?
Let me know what you think.
Marc.