how do i add config settings to a distributed virtual switch

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

how do i add config settings to a distributed virtual switch

chuman
This is the function in question.

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()
    hosts = cluster.host
    for x in range(len(hosts)):
        uplink_port_names.append("dvUplink%d" % x)

    for host in hosts:
        dvs_config_spec.uplinkPortPolicy.uplinkPortName = uplink_port_names
        dvs_config_spec.maxPorts = 2147483647
        pnic_spec = vim.dvs.HostMember.PnicSpec()
        pnic_spec.pnicDevice = 'vmnic2'
        pnic_specs.append(pnic_spec)
        dvs_host_config = vim.dvs.HostMember.ConfigSpec()
        dvs_host_config.operation = vim.ConfigSpecOperation.add
        dvs_host_config.host = host
        dvs_host_configs.append(dvs_host_config)
        dvs_host_config.backing = vim.dvs.HostMember.PnicBacking()
        dvs_host_config.backing.pnicSpec = pnic_specs
        dvs_config_spec.host = dvs_host_configs

    dvs_create_spec.configSpec = dvs_config_spec
    dvs_create_spec.productInfo = vim.dvs.ProductSpec(version='6.0.0')

    task = network_folder.CreateDVS_Task(dvs_create_spec)
    wait_for_task(task, si)
    print("Successfully created DVS ", inputs['dvs_name'])
    return get_obj(content, [vim.DistributedVirtualSwitch], inputs['dvs_name'])


----

I am trying to add in these settings, but unsure of where to insert them in the above.  Many thanks.

dvs_config_spec = vim.dvs.VmwareDistributedVirtualSwitch.ConfigSpec()
dvs_config_spec.maxMtu = 6000
dvs_config_spec.lacpApiVersion = vim.dvs.VmwareDistributedVirtualSwitch.LacpApiVersion.multipleLag
Loading...