I am trying to create a workflow to Block All Ports on a Port Group. I think I have everything setup correctly but not sure what to put under the Scripting Tag.
This is what I have after editing an existing.
// ------- ReconfigureDVPortgroup_Task -------
// General Settings:
var spec = new VcDVPortgroupConfigSpec();
spec.configVersion = dvPortgroup.config.configVersion; // retrieves configVersion to use during update
spec.name = dvPortgroupName;
// Policies - Misc:
defaultPortConfig.blocked = new VcBoolPolicy();
defaultPortConfig.blocked.inherited = false;
defaultPortConfig.blocked.value = blockAllPorts; // Shuts down all ports in the portgroup if set to true
task = dvPortgroup.reconfigureDVPortgroup_Task(spec);
Well, you can either pass dvPortgroupName as a workflow input parameter, or you can comment out this line spec.name = dvPortgroupName;
There is already out-of-the-box workflow that does so (plus other things) - Update distributed virtual port group (available under Library > vCenter > Networking > Distributed Virtual Port Group).
the corresponding setting is on workflow tab/group labelled Miscellaneous
That is the one I am working from. Trying to consolidate it so there is only one option.
The following should work:
// General Settings:
var spec = new VcDVPortgroupConfigSpec();
spec.configVersion = dvPortgroup.config.configVersion; // retrieves configVersion to use during update
spec.name = dvPortgroupName;
// Policies - Misc:
spec.defaultPortConfig = new VcVMwareDVSPortSetting();
spec.defaultPortConfig.blocked = new VcBoolPolicy();
spec.defaultPortConfig.blocked.inherited = false;
spec.defaultPortConfig.blocked.value = blockAllPorts; // Shuts down all ports in the portgroup if set to true
task = dvPortgroup.reconfigureDVPortgroup_Task(spec);
Still getting "Reference Error dvPortgroupName is not defined"
Thanks
Well, you can either pass dvPortgroupName as a workflow input parameter, or you can comment out this line spec.name = dvPortgroupName;
That worked. Thanks for the help.