VMware Cloud Community
dinny
Expert
Expert
Jump to solution

How does ESX 3.0.x maintain an internal count of portgroups used?

Hiya,

I'm looking at writing a script to delete my usual ESX vswitch settings and then recreate some new vswitches with different settings (for deployment in a DMZ, with new vlans etc)

I'm aiming to use a mixture of the usual esxcfg-vswitch, esxcfg-vswif and vimsh commands.

One thing I've noticed, is that the internal portgroup numbers (displayed by esxcfg-vswitch) and also needed in the vimsh syntax (for ESX 3.0x) to enable vmotion always seem to be incremented.

I've tried deleting the old portgroups and then restarting the network (and even rebooting) - but the next time I create a new portgroup - the internal count is always set to one higher than the last one used.

Does anyone know where this count is held by ESX (or even better how it can be reset)?

(It doesn't appear to be in the esx.conf)

I am using ESX 3.02

(I also notice that this forum has recently been renamed to ESX 3.5 config (as opposed to ESX 3.0.x) - but I presume that it is still the best place to post this question?)

Cheers

Dinny

0 Kudos
1 Solution

Accepted Solutions
bflynn0
Expert
Expert
Jump to solution

If I understand what you're looking for the last internal number for portgroups is stored in /etc/vmware/esx.conf under the /net/vswitch/pgSequence setting

So for instance the last portgroup that was created is displayed by esxcfg-vswitch -l as follows:

prod_portgroup portgroup28 0 0

And in esx.conf the following is shown:

/net/vswitch/pgSequence = "28"

and this value is updated if I create another portgroup.

This is what I run to enable VMotion without needing to know the portgroup number on my ESX 3.0.x boxes:

/usr/bin/vimsh -n -e "hostsvc/vmotion/vnic_set $(/usr/sbin/esxcfg-vswitch -l | /bin/grep $PGNAME | /bin/awk '{print $2}')"

Either replace $PGNAME with the name of your vmotion portgroup (e.g. VMotionPG) or set the PGNAME variable in the script before the command.

View solution in original post

0 Kudos
7 Replies
weinstein5
Immortal
Immortal
Jump to solution

I am not sure where the count is held but what you might be noticing is the 8 ports that are reserved for intra switch communications - when you look at the port count from esxcfg-vswitch it will show the total count of ports - when you look at the number of ports in the VI client it will show eight less - for example under esxcfg-vswitch vSwitch0 will show 64 ports while the VI client will show 56 - not sure if this what you are seing but I think it might be -

also one number to keep in mind - you can only have a total 4096 total ports -

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful
0 Kudos
dinny
Expert
Expert
Jump to solution

Hiya,

Thanks - but it is the count of portgroups that I am interested in - not the count of ports in a portgroup.

i.e. if you run esxcfg-vswitch -l

It is what you see under the heading "Internal ID"

It is of the form "portgroupn"

Cheers

Dinny

0 Kudos
bflynn0
Expert
Expert
Jump to solution

If I understand what you're looking for the last internal number for portgroups is stored in /etc/vmware/esx.conf under the /net/vswitch/pgSequence setting

So for instance the last portgroup that was created is displayed by esxcfg-vswitch -l as follows:

prod_portgroup portgroup28 0 0

And in esx.conf the following is shown:

/net/vswitch/pgSequence = "28"

and this value is updated if I create another portgroup.

This is what I run to enable VMotion without needing to know the portgroup number on my ESX 3.0.x boxes:

/usr/bin/vimsh -n -e "hostsvc/vmotion/vnic_set $(/usr/sbin/esxcfg-vswitch -l | /bin/grep $PGNAME | /bin/awk '{print $2}')"

Either replace $PGNAME with the name of your vmotion portgroup (e.g. VMotionPG) or set the PGNAME variable in the script before the command.

0 Kudos
dinny
Expert
Expert
Jump to solution

Hiya,

That sounds like exactly what I was after Smiley Happy

Will check it out and award points later tonight...

Thanks v. much.

Dinny

0 Kudos
dinny
Expert
Expert
Jump to solution

Yup,

Just what I was after.

I found that if you have for example deleted a number of portgroups - you can reset that value in esx.conf to ensure that new portgroups are created with lower values.

Completely unsupported no doubt - but handy to know...

Thanks v. much

Dinny

0 Kudos
moberle
Contributor
Contributor
Jump to solution

Dinny i have updated my VBScript ESX Configuration application to handle multiple datacenters with multiple internal and dmz VLAN subnets in each one. I am in the process of fully documenting it now. I will send it to you after Im finished...... If they let me finish it before they throw me into something else.

dinny
Expert
Expert
Jump to solution

Cheers Moberle

Dinny

0 Kudos