Menu

Virtual Distributed Port Groups?

Anonymous
2011-03-31
2012-12-15
  • Anonymous

    Anonymous - 2011-03-31

    I need the ability using Java to clone or reconfig a virtual machine to  a different vlan. I want to provide the ability to a user to pass in the name of the vlan for example vlan 64 and then either reconfig an existing virtual machine or if they are requesting to do a clone for it to end up on passed in vlan. I have attempted to find the solution and haven't found iit, when the vlan is of type Virtual Distributed Port Group. I believe it will be something like the following but I could be totally wrong.

    if (device instanceof VirtualPCNet32)
        {
          VirtualPCNet32 network = (VirtualPCNet32) device;
          VirtualEthernetCardDistributedVirtualPortBackingInfo networkBackingInfo = (VirtualEthernetCardDistributedVirtualPortBackingInfo)network.getBacking();
        
        
              nicSpec.setOperation(VirtualDeviceConfigSpecOperation.edit);
              VirtualEthernetCard nic =  new VirtualPCNet32();
              nic.setBacking(networkBackingInfo);
              nic.setKey(device.getKey());
              nic.setAddressType(network.getAddressType());
              nicSpec.setDevice(nic);
        }

     
  • Anonymous

    Anonymous - 2011-04-04

    There's kind of  a decent sample available, but it's in Perl not Java:
       http://communities.vmware.com/servlet/JiveServlet/download/1602294-42723/updateVMDVPortgroup.pl

    It takes a distributed virtual switch name and distributed virtual portgroup name, locates the appropriate server
    objects, then uses them to build the VirtualEthernetCardDistributedVirtualPortBackingInfo  and its contained
    DistributedVirtualSwitchPortConnection object necessary to change the VM NIC.

    Note that this is totally different from the non-distributed virtual switch case, which uses the
    VirtualEthernetCardNetworkBackingInfo object instead and sets its deviceName property to
    the portgroup name. So changing a VM from one portgroup type to the other is a major pain.

    Also note that while regular portgroups have names unique within a Datacenter, distributed virtual
    portgroup names are only unique within the distributed virtual switch they're in. In other words, there
    can be only one "VM Network" regular portgroup, but multiple "VM Network" distributed virtual port groups.
    This is why the Perl sample requires both the switch name and the portgroup name.

     

Log in to post a comment.