- 论坛徽章:
- 0
|
通常, 运行 "esxcfg-vswitch -l"
--root@esxhost5--# esxcfg-vswitch -l
Switch Name Num Ports Used Ports Configured Ports MTU Uplinks
vSwitch0 64 4 64 1500 vmnic0
PortGroup Name VLAN ID Used Ports Uplinks
Service Console 0 1 vmnic0
Switch Name Num Ports Used Ports Configured Ports MTU Uplinks
vSwitch1 64 18 64 1500 vmnic1
PortGroup Name VLAN ID Used Ports Uplinks
Prod_1 501 5 vmnic1
Prod_2 502 2 vmnic1
Prod_3 503 2 vmnic1
Prod_4 504 3 vmnic1
Prod_5 505 6 vmnic1
[email=--root@esxhost5]--root@esxhost5[/email]
--#
读读以下Perl 可使你轻松拥有自己控制代码。
my $portGroups = $vSwitch->portgroup;
foreach my $port (@$portGroups) {
my $pg = FindPortGroupbyKey ($netMgr, $vSwitch->key, $port);
next unless (defined $pg);
my $usedPorts = (defined $pg->port) ? $#{$pg->port} + 1 : 0;
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/94326/showart_1904035.html |
|