create_dvSwitch.pl

Version 2

    This script create a dvSwitch in a datacenter and attach to it the wanted hosts, each with up to 4 vmnic. It can create up to 4 dvPortgroups, each with the wanted vlan id (or no vlan id).

    Requirement:

    • the datacenter must exists

    • the hosts should be part of the datacenter (if one is not part of the datacenter is removed from list)

    • the vmnics given for each host must not be already bound to any virtual switch. NOTE: The script FAIL if a vmnic doesn't exists or is already bound (perhaps I will add a  check in a next version... no time now:-)* )

     

    A command line example:

     

    ./create_dvSwitch.pl --server vcenter.domain --username user --password password --dc_name datacenter_name --dvswitch_name dvs_name --dvpg_0_name dvportgroup0_name --dvpg_0_vlanid 111 --dvpg_1_name dvportgroup0_name  --dvpg_1_vlanid 112 --host0_name esx0.domain --host0_nic_0 vmnic1 --host0_nic_1 vmnic3 --host1_name esx1.domain  --host1_nic_0 vmnic1 --host1_nic_2 vmnic2

     

    07/23/2010

    Uploaded Version 1.1

    Changes:

     

     

    • added check on nonexistent or already bound physical nics

    • a bit of cleanup