VMware Cloud Community
esarakaitis
Enthusiast
Enthusiast

portgroups?

I dont see any functionality surrounding portgroups or virtual switches...

Am I not looking in the right place? I'm esentially wanting to build a workflow to add a portgroup to a vswitch to every host in a cluster.

0 Kudos
6 Replies
tschoergez
Leadership
Leadership

Hi Eric,

portgroups are named as VcHostPortGroup. You can edit a host's network configuration with the VcHostNetworkSystem.updateVirtualSwitch()-method.

Cheers,

joerg

0 Kudos
esarakaitis
Enthusiast
Enthusiast

so there is no workflow or action element for this, are there plans to develop this?

0 Kudos
esarakaitis
Enthusiast
Enthusiast

// ------- UpdateNetworkConfig -------
for (i=0; i<actionResult.length; i++) 
{
var config = new VcHostNetworkConfig();
config.portgroup = System.getModule("com.vmware.onyx").array(VcHostPortGroupConfig, 1);
config.portgroup[0] = new VcHostPortGroupConfig();
config.portgroup[0].changeOperation = "add";
config.portgroup[0].spec = new VcHostPortGroupSpec();
config.portgroup[0].spec.name = VLAN_Name;
config.portgroup[0].spec.vlanId = VLAN_ID;
config.portgroup[0].spec.vswitchName = Switch_Name;
config.portgroup[0].spec.policy = new VcHostNetworkPolicy();

actionResult[i].updateNetworkConfig(config, "modify");  // HostNetworkSystem
}

is the code I'm using from Onyx. Property: updateNetworkConfig not found on object: VCHostSystem is the error im getting.

0 Kudos
Andreas_Diemer
Enthusiast
Enthusiast

Hi esarakaitis,

just build a workflow with following input parameters:

*Host

*PortGroupName (assuming this name does NOT exist)

*VlanID

*vSitchName (assuming this vSwitch exist on Host)

and this code:

var HPGspec = new VcHostPortGroupSpec();
HPGspec.name = PortGroupName;
HPGspec.vlanId = VlanID;
HPGspec.vswitchName = vSwitchName;
var Policy = new VcHostNetworkPolicy();
HPGspec.policy = Policy;
Host.configManager.networkSystem.addPortGroup(HPGspec);

With another Workflow you can loop over all hosts in a cluster and call this workflow for each host in loop.

The package contain both: adding a port group & iterating over cluster and add port group.

-


Regards,

don't forget: award points to helpful answers

visit & http://mighty-virtualization.blogspot.com/

------ for correct and / or useful answers please award points visit http://www.vcoteam.info & http://mighty-virtualization.blogspot.com
0 Kudos
geno5150
Contributor
Contributor

I tried to use this package, but I am getting an error:

Property named 'addPortGroup' not found on the object: VcManagedObjectReference

Any idea why this woul dbe? It's like Orchestrator doesn't recognize Host.configManager.networkSystem is a valid object.

-Geno

0 Kudos
Andreas_Diemer
Enthusiast
Enthusiast

Hi Geno,

I've just reimported my package and everything works fine. It is just an example for this method. Are all Parameters set? They are all mandatory, but not set as mandatory in presentation tab.

Are there any vSwitches in your host configuration or do yo use only dvSwichtes?

Regards, Andreas

add question - Message was edited by: Andreas Diemer

------ for correct and / or useful answers please award points visit http://www.vcoteam.info & http://mighty-virtualization.blogspot.com
0 Kudos