2 Replies Latest reply on Nov 21, 2010 9:30 PM by KFukumoto

    How to get dVS portgroup connected  to guestNic

    KFukumoto Lurker

      Hi

       

      I am trying to get portgroupName connected to specific guestNic.

       

      In case of standard vSwitch , I can get the portgroupName connencted the guestNic

      by following sample code.  I got the portgroupName in the Data object guestNicInfo->network.

       

      But, In case of dVS , the sample do not work well. No data in the guestNicInfo->network.

       

      How can I get the dVS-porgroupName connected to guestNic ?

       

      #= sample code ==

      my $vm_views = Vim::find_entity_views(view_type=>"VirtualMachine");

          foreach my $vm_view(@$vm_views){

          print "=== virtualMachine : ". $vm_view->name ."\n";

          my $guestInfo = $vm_view->guest;

          my $guestNicInfos = $guestInfo->net;

          foreach my $guestNicInfo(@$guestNicInfos){

              print "---- guestNicInfos----


      \n";

              print " deviceConfigId:" . $guestNicInfo->deviceConfigId ."\n";    #DeviceKey

              print " porgroupName connected to the guestNic" . $guestNicInfo->network ."\n";

          }

      }

      #=================