dvPortgroup Inheritance

June 15, 2013

Table of Contents

Someone may claim the default settings for portgroup inheritance in the dvSwitches, they may be missing in the vSphere client but they still exist and can be set in the API.The real problem was every new dvPortgroup does not have the correct settings for the environment, so you have to manually and set them after the dvGroup is created. vCloud Director compounds the issue because users can create dvPortgroup but don’t have access to change them(e.g.security, failover). So I found a defaultPortConfig, by using the ReconfigureDvs_Task, Iwrote the following PowerCLI script:

 

#Get the dvSwitch I want to edit

$dvswitch = Get-VirtualSwitch name dvSwitch -distributed | Get-View

#create the spec, note the object type

$spec = New-Object VMware.Vim.DVSConfigSpec

$spec.configVersion = $dvswitch.Config.ConfigVersion

$spec.defaultPortConfig = New-Object VMware.Vim.VMwareDVSPortSetting

$spec.defaultPortConfig.uplinkTeamingPolicy = New-Object VMware.Vim.VmwareUplinkPortTeamingPolicy

#policy

$spec.defaultPortConfig.uplinkTeamingPolicy.policy = New-Object VMware.Vim.StringPolicy

$spec.defaultPortConfig.uplinkTeamingPolicy.policy.inherited = $false

$spec.defaultPortConfig.uplinkTeamingPolicy.policy.value = “failover_explicit”

#notify switches

$spec.defaultPortConfig.uplinkTeamingPolicy.notifySwitches = New-Object VMware.Vim.BoolPolicy

$spec.defaultPortConfig.uplinkTeamingPolicy.notifySwitches.inherited = $false

$spec.defaultPortConfig.uplinkTeamingPolicy.notifySwitches.value = $true

#rolling order

$spec.defaultPortConfig.uplinkTeamingPolicy.rollingOrder = New-Object VMware.Vim.BoolPolicy

$spec.defaultPortConfig.uplinkTeamingPolicy.rollingOrder.inherited = $false

$spec.defaultPortConfig.uplinkTeamingPolicy.rollingOrder.value = $false

#failure criteria

$spec.defaultPortConfig.uplinkTeamingPolicy.failureCriteria = New-Object VMware.Vim.DVSFailureCriteria

$spec.defaultPortConfig.uplinkTeamingPolicy.failureCriteria.inherited = $false

$spec.defaultPortConfig.uplinkTeamingPolicy.failureCriteria.checkBeacon = New-Object VMware.Vim.BoolPolicy

$spec.defaultPortConfig.uplinkTeamingPolicy.failureCriteria.checkBeacon.inherited = $false

$spec.defaultPortConfig.uplinkTeamingPolicy.failureCriteria.checkBeacon.value = $true

#uplink port order

$spec.defaultPortConfig.uplinkTeamingPolicy.uplinkPortOrder = New-Object VMware.Vim.VMwareUplinkPortOrderPolicy

$spec.defaultPortConfig.uplinkTeamingPolicy.uplinkPortOrder.inherited = $false

$spec.defaultPortConfig.uplinkTeamingPolicy.uplinkPortOrder.activeUplinkPort = New-Object System.String[] (2)

$spec.defaultPortConfig.uplinkTeamingPolicy.uplinkPortOrder.activeUplinkPort[0] = “dvUplink1”

$spec.defaultPortConfig.uplinkTeamingPolicy.uplinkPortOrder.activeUplinkPort[1] = “dvUplink3”

$spec.defaultPortConfig.uplinkTeamingPolicy.uplinkPortOrder.standbyUplinkPort = New-Object System.String[] (2)

$spec.defaultPortConfig.uplinkTeamingPolicy.uplinkPortOrder.standbyUplinkPort[0] = “dvUplink2”

$spec.defaultPortConfig.uplinkTeamingPolicy.uplinkPortOrder.standbyUplinkPort[1] = “dvUplink4”

#push the reconfig

$dvswitch.ReconfigureDVS_Task($spec)

If your failover settings is different and the script is not working visit the VMwareDVSPortSettingfor more information.

Share on
Facebook
Twitter
LinkedIn
Pinterest
More posts

Dedicated Servers Quick Guide

What is a Dedicated Servers? Why bother using a dedicated server over a VPS or Shared Hosting?A dedicated server is a server 100% dedicated to your website/project or business needs.

SolusVM Easy Quick Install

Quick Easy Install Debian/Ubuntu apt update reboot wget https://files.soluslabs.com/install.shsh install.sh Centos yum update reboot wget https://files.soluslabs.com/install.shsh install.sh If you get an error it is because you need to install: wget Try a

Sharing vApps in vCloud with PowerCLI

Some times vCloud Directors give the organization users grainy control over the the level of access users have to vApps , this is all controlled through the the vCloud API

vMA 5.1 Patch 1 Released

Expendable news item here too good not to be posted.  For those who may have missed it, VMware has released an update to the vSphere Management Assistant (vMA) 5.1 appliances

Organizing Your Slim Based Project

A Slim Based Project is basically extended over three main directories. Slim framework directory Project directory This directory contains your project files like routers, views, models. Being a microframework, Slim

🎉 New Year’s Special🎉
50% OFF for Life!

🔥 DELL Bare-metal Dedicated Server in New York & Amsterdam

💻 Server Highlights:

🔹 Powerful Compute: Dual Intel Xeon Gold (80 Cores, Hyper-Threading)
🔹 Massive Storage: 23TB SSD Flash + 1TB NVMe Boot (HW RAID)
🔹 1TB DDR4 RAM (2666MHz) for Ultimate Multitasking
🔹 10Gbps Redundant Uplinks for Ultra-Fast Connectivity
🔹 10 IPv4 + IPv6 Addresses Included 

💲 Just $699/month – 50% OFF FOR LIFE! (Reg $1399/month)
🚀 Zero Setup Costs | Flexible OS: Ubuntu, Proxmox, ESXi, Windows, etc.

✅ Reserve Risk-Free! 30-Day Money-Back Guarantee
💡 100% Uptime Assurance – Enterprise-Grade Hardware 

🖥 Ideal for Virtualization, Data-Intensive Apps, & High Traffic Sites

Use coupon code at checkout for the discount to apply FBHEO3023EJFB
⚡ Limited Availability – Don’t Miss Out!

Get 90% Discount

First 3 People gets the Bonus!
Don't Miss Out Our Big Sale

Get 0-90% On All
247Rack Services

247Rack

The Sale Is Until The End Of March