Last week I spoke to some fellows here at VMware and think about a solution to automate the MTU size for a dvPort/PortGroup with vCO automation. In the past there was no automated way than the excellent solution by Scott Lowe. Based on these findings i try to build this in vCO, knowing that the vSphere Client does not support this directly.
At first i had to identify the Port which serves the vmkernel and a few input parameters:
At first I need the host (in my case as string because this is used for an external excitation via SOAP), the name of the dvSwitch, the new IP address of the vmkernel interface and the new subnet mask. So i set the host (VcPlugin.getAllHostSystems) and use the getAllDvSwitches workflow from one of my last publications.
After that I set the dvSwitch based on the input parameter (dvSwitch) and searching for the right port. The main procedure to identify the right port is: if(Ports[h].connectee.type == "hostVmkVnic") cause this compares to the vmkernel NIC.
At this point I know everything to change the MTU of the vmkernel Port, but... the API shows an cruel description:
So as mentioned when reading the article there is no direct API based way to set the MTU of a dvPort. In my case I solve the problem with using direct ssh commands. The drawback with this is the username/password dependence.
So after identifying the right host, the vmkernel port, the new ip address and subnet mask the ssh commands can run. As you can see I used exact the same commands as the console guys use.
So, hope this helps.
No comments:
Post a Comment