Create VM Using PowerCli and an XML File

To create a VM from a XML file , first we have to create a xml file with the settings for the VM. I created a very basic on that only specifies the name and size of the vDisk.

<CreateVM>
<VM>
<Name>MyVM1</Name>
<HDDCapacity>1</HDDCapacity>
</VM>
<VM>
<Name>MyVM2</Name>
<HDDCapacity>1</HDDCapacity>
</VM>
</CreateVM>

Lets first read the Content of XML file using :

PowerCLI C:\>[xml]$s = Get-Content c:\avn\myvm.xml

Create the virtual machines. using below power cli simple single line script:

PowerCLI C:\> $s.CreateVM.VM | foreach { New-VM -VMHost esxcomp-01a.corp.local -Name $_.Name -DiskMB $_.HDDCapacity}

Here is the Result of successful creation of VMs…

powercli_xml

You can expand the xml file to include a host, disk types,CPU,memory and other settings……

QoS Tagging and Traffic Filtering on vDS

There are two types of QoS Marking/Tagging common in networking are 802.1p (COS) applied on Ethernet(Layer 2) packets and Differentiated Service Code Point (DSCP) Marking applied on IP packets. The physical network devices use these tags to identify important traffic types and provide Quality of Service based on the value of the tag. As business critical and latency sensitive applications are virtualized and run in parallel with other applications on ESXi hosts, it is important to enable traffic management and tagging features on the VDS.

The traffic management feature on the vDS helps reserve bandwidth for important traffic types, and the tagging feature allows the external physical network to understand the level of importance of each traffic type. It is a best practice to tag the traffic near the source to help achieve end-to-end Quality of Service (QoS). During network congestion scenarios, the tagged traffic doesn’t get dropped which translates to a higher Quality of Service (QoS) for the tagged traffic.

Once the packets are classified based on the qualifiers described in the traffic filtering section, users can choose to perform Ethernet (layer2) or IP (layer 3) header level marking. The markings can be configured at the port group level.

Lets Configure this , so that i can ensure that my business critical VMs are getting higher priority at physical layer…

Login to the Web Client and  click on dvSwitch and choose Port Group on which you want to apply TAG:

  1. Click on Manage tab
  2. Select the Settings option
  3. Select Policies
  4. Click on Edit

Qos1.png

  1. Click on Traffic filtering and marking
  2. In the Status drop down box choose Enabled
  3. Click the Green + to add a New Network Traffic Rule

qos2

  1. In the Action: drop down box select Tag (default)
  2. Check the box to the right of DSCP value
  3. In the drop down box for the DSCP value select Maximum 63
  4. In the Traffic direction drop down box select Ingress
  5. Click the Green +

qos3

New Network Traffic Rule – Qualifier

Now that you have decided to tag the traffic the next question is which traffic you would like to tag.There are three options available while defining the qualifier:

  • System Traffic Qualifier
  • New MAC qualifier
  • New IP Qualifier

This means you have options to select packets based on system traffic types, MAC header or IP header fields. here we will create qualifier based on system traffic.

Select New System Traffic Qualifier from the drop down menu qos4.gif

  1. Select Virtual Machine
  2. Click OK

qos5

Check that your rule matches Name: Network Traffic Rule 1

  1. Action: Tag
  2. DSCP Value: Checked
  3. DSCP Value: 63 Traffic
  4. Direction: Ingress
  5. System traffic: Virtual Machine
  6. Click OK

qos6

Same way you can also allow/block the traffic:

Again go to dvPort – Settings – Policies –  Edit – Traffic Filtering and Marking and edit the existing rule that we have created above and change Action to Drop.

qos7

  1. Click the Green + to add a new qualifier.
  2. Select New IP Qualifier… from the drop down list.

qos8

  1. Select ICMP from the Protocol drop down menu.
  2.  Select Source address IP address is of your VM , in my case it is 192.168.100.90
  3. Click OK

qos9

  1. and finally Click OK , this will drop the ping for that particular VM.

So same way you can write many rules with various permutation and combinations to help your organisation to achive QoS and traffic filtering on dVS. I hope this helps you in your environments. Happy Learning 🙂