示例#1
0
        public void CreatePortGroup(VMware.Vim.HostConfigManager configMgr, string portGroupName, string vSwitchName)
        {
            VMware.Vim.ManagedObjectReference nMob = configMgr.NetworkSystem;

            HostPortGroupSpec portgrp = new HostPortGroupSpec();

            portgrp.name        = portGroupName;
            portgrp.vswitchName = vSwitchName;
            portgrp.policy      = new HostNetworkPolicy();

            vimService.AddPortGroup(nMob != null ? new VimApi_55.ManagedObjectReference()
            {
                type  = nMob.Type,
                Value = nMob.Value
            } : null, portgrp);
        }