reubenur-rahman / vmware-pyvmomi-examples

The example codes are written using the VMware official python library pyvmomi
Apache License 2.0
89 stars 60 forks source link

create_dvs_and_dvport_group - example for MTU adjustment pls? #12

Open ghost opened 7 years ago

ghost commented 7 years ago

interested in adding to the code, so maxMtu and lacpApiVersion can be set to a non default value

https://pubs.vmware.com/vsphere-65/index.jsp#com.vmware.wssdk.smssdk.doc/vim.dvs.VmwareDistributedVirtualSwitch.ConfigSpec.html

thx

reubenur-rahman commented 7 years ago

@markchuman

Try the given below code for configSpec

dvs_config_spec = vim.dvs.VmwareDistributedVirtualSwitch.ConfigSpec()
dvs_config_spec.name = "testDVS"
dvs_config_spec.maxMtu = 6000        #1500-9000
dvs_config_spec.lacpApiVersion = vim.dvs.VmwareDistributedVirtualSwitch.LacpApiVersion.multipleLag
ghost commented 7 years ago

Thank you & sorry for noob status right now, but where would you insert this block at?

def create_dvSwitch(si, content, network_folder, cluster): pnic_specs = [] dvs_host_configs = [] uplink_port_names = [] dvs_create_spec = vim.DistributedVirtualSwitch.CreateSpec() dvs_config_spec = vim.DistributedVirtualSwitch.ConfigSpec() dvs_config_spec.name = inputs['dvs_name'] dvs_config_spec.uplinkPortPolicy = vim.DistributedVirtualSwitch.NameArrayUplinkPortPolicy() dvs_config_spec = vim.dvs.VmwareDistributedVirtualSwitch.ConfigSpec() dvs_config_spec.name = inputs['dvs_name'] dvs_config_spec.maxMtu = 9000 dvs_config_spec.lacpApiVersion = vim.dvs.VmwareDistributedVirtualSwitch.LacpApiVersion.multipleLag hosts = cluster.host for x in range(len(hosts)): uplink_port_names.append("dvUplink%d" % x)

tkrausjr commented 4 years ago

I am trying to configure an MTU also on a DVS and having an issue. It looks like VMwareDistributed VirtualSwitch can be used which is different than how I configured my switch as a vim.DistributedVirtualSwitch.