I want to change the name of portgroup on vSwitch0 ,from 'VMkernel' to 'VMkernel2'.
However, this program does not work well.
Could you please tell me about correct code??
--<MY code>-------------------------------------------
my $entity_view = Vim::find_entity_view(
view_type => 'HostSystem',
filter => { 'name' => 'myesx_name' }
);
my $nwSys = $entity_view->configManager->networkSystem;
my $nwMgr = Vim::get_view(mo_ref => $nwSys);
$nwMgr->UpdatePortGroup(
'pgName' => 'VMkernel',
'portgrp' => {
'name' => 'VMkernel2',
'vlanId' => 0,
'vswitchName' => 'vSwitch0',
},
);
-------------------------------------------------------------
<Output Error>
Expected HostPortGroupSpec for 'portgrp' argument. at (eval 32) line 100
VimService::get_arg_string('HASH(0x391fb90)', 'portgrp', 'HostPortGroupSpec') called at (eval 32) line 132
VimService::build_arg_string('ARRAY(0x1cc30f8)', 'HASH(0x1cc3038)') called at (eval 32) line 4413
VimService::UpdatePortGroup('VimService=HASH(0x17d4da8)', '_this', 'ManagedObjectReference=HASH(0x35a6998)', 'pgName', 'VMkernel', 'portgrp', 'HASH(0x391fb90)') called at /usr/lib/perl5/5.10.0/VMware/VICommon.pm line 1699
ViewBase::invoke('HostNetworkSystem=HASH(0x1ee0a60)', 'UpdatePortGroup', 'pgName', 'VMkernel, 'portgrp', 'HASH(0x391fb90)') called at (eval 249) line 65
HostNetworkSystemOperations::UpdatePortGroup('HostNetworkSystem=HASH(0x1ee0a60)', 'pgName', 'VMkernel', 'portgrp', 'HASH(0x391fb90)') called at ./test.pl line 42