WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Resources
    • Nested Virtualization
  • VMware Nostalgia
  • Apple

Exploring VSAN APIs Part 8 – Maintenance Mode

04.02.2014 by William Lam // Leave a Comment

When it is time to patch, upgrade or service an ESXi host running VSAN, the first thing you will want to do is to place the host into Maintenance Mode. If you have never performed this operation on a VSAN host before, you should be aware that there is a new option to specify how the data for VSAN will be migrated. Below is a screenshot of the three options provided when using the vSphere Web Client.

vsan-host-maint-0
To learn more about the new VSAN data migration option, I highly recommend you check out Cormac Hogan's blog article here which goes into more detail. From a vSphere API point of view, the Maintenance Mode operation is still being provided by the traditional EnterMaintenanceMode_Task() method, but there is now a new optional property called HostMaintenanceSpec that specifies the option (exposed as an enum) to use for VSAN data migration. To demonstrate this functionality, I have created a sample vSphere SDK for Perl script called vsanHostMaintenanceMode.pl

Disclaimer:  These scripts are provided for informational and educational purposes only. It should be thoroughly tested before attempting to use in a production environment.

The script requires three input parameters:

  • vihost - Name of the ESXi host to perform the maintance mode operaton
  • operation - The operation to perform [enter|exit]
  • mode - The VSAN data migration policy [ensure|evac|no]

Here is an example of placing an ESXi host into Maintenance Mode using the "Ensure Accessibility" VSAN data migration option:

./vsanHostMaintenanceMode.pl --server vcenter55-1.primp-industries.com --username root --vihost vesxi55-1.primp-industries.com --operation enter --mode ensure

vsan-host-maint-1
To take the ESXi host out of Maintance Mode, you can run the following command:

./vsanHostMaintenanceMode.pl --vcenter55-1.primp-industries.com --username root --vihost vesxi55-1.primp-industries.com --operation exit

vsan-host-maint-2

  1. Exploring VSAN APIs Part 1 – Enable VSAN Cluster
  2. Exploring VSAN APIs Part 2 – Query available SSDs
  3. Exploring VSAN APIs Part 3 – Enable VSAN Traffic Type
  4. Exploring VSAN APIs Part 4 – VSAN Disk Mappings
  5. Exploring VSAN APIs Part 5 – VSAN Host Status
  6. Exploring VSAN APIs Part 6 – Modifying Virtual Machine VM Storage Policy
  7. Exploring VSAN APIs Part 7 – VSAN Datastore Folder Management
  8. Exploring VSAN APIs Part 8 – Maintenance Mode
  9. Exploring VSAN APIs Part 9 – VSAN Component count
  10. Exploring VSAN APIs Part 10 – VSAN Disk Health

Categories // VSAN, vSphere 5.5 Tags // maintenance mode, VSAN, vSphere API

Simulating vSphere Performance Metrics using VCSIM

04.01.2014 by William Lam // 7 Comments

A really useful tool that I leverage from time to time is VCSIM (vCenter Simulator) which can be found within the VCSA (vCenter Server Appliance). VCSIM allows you to easily "simulate" a custom vSphere Inventory that can be used for a variety of use cases including custom reports using the vSphere API/CLIs. There are additional capabilities that VCSIM provides and one that I have not explored much is the simulation of vSphere Performance Metrics. Having received a couple of inquires regarding VCSIM and performance metrics, I figure this would be a good opportunity to explore this feature in a bit more detail.

Disclaimer: This is not officially supported by VMware, use at your own risk.

Before getting starting, you should familiarize yourself with VCSIM by reading these two articles here and here.

By default when running VCSIM, there are no Performance Metrics. If you wish to include it, you will need to ensure the following two lines are added to your VCSIM configuration file:

<perfCounterInfo>vcsim/model/PerfCounterInfo.xml</perfCounterInfo>
<metricMetadata>vcsim/model/metricMetadata.cfg</metricMetadata>

The first file contains the performance metric definitions that are supported and the second file will specify which metrics will be simulated. To demonstrate the performance metric capabilities of VCSIM, I will be using the following configuration files which you can just copy/paste:

vghetto-perf-vcsim.cfg - This will be our VCSIM configuration file

<simulator>
  <enabled>true</enabled>
  <initInventory>vcsim/model/vghetto-perf-inventory.cfg</initInventory>
  <hostConfigLocation>vcsim/model/hostConfig</hostConfigLocation>
  <perfCounterInfo>vcsim/model/PerfCounterInfo.xml</perfCounterInfo>
  <metricMetadata>vcsim/model/metricMetadata.cfg</metricMetadata>
  <datastore>
     <global>1</global>
     <cluster>2</cluster>
     <local>1</local>
     <prefix>vghetto</prefix>
  </datastore>
</simulator>

vghetto-perf-inventory.cfg - This will be our VCSIM inventory configuration file

<config>
  <inventory>
    <dc>1</dc>
    <host-per-dc>0</host-per-dc>
    <vm-per-host>0</vm-per-host>
    <poweron-vm-per-host>0</poweron-vm-per-host>
    <cluster-per-dc>1</cluster-per-dc>
    <host-per-cluster>2</host-per-cluster>
    <rp-per-cluster>1</rp-per-cluster>
    <vm-per-rp>3</vm-per-rp>
    <poweron-vm-per-rp>3</poweron-vm-per-rp>
    <dv-portgroups>0</dv-portgroups>
  </inventory>
  <prefix>vGhetto-</prefix>
  <worker-threads>1</worker-threads>
  <synchronous>true</synchronous>
</config>

To ensure everything is working, we can start VCIM by issuing the following command on the VCSA:

vmware-vcsim-start /etc/vmware-vpx/vcsim/model/vghetto-perf-vcsim.cfg

If everything is working, you should be able to login using the vSphere Web/C# Client to view the small inventory we just created. If you are able to see the inventory, then go ahead and stop VCSIM by issusing the following command:

vmware-vcim-stop false

Note: To ensure our inventory is not destroyed each time, you should pass in the 'false' flag else it will automatically be deleted each time. This is useful if you want to preserve your inventory on subsequent reboots.

For all Performance Metric configurations, you will only need to edit the metricMetadata.cfg file. VCSIM supports four different types of Stats model:

  1. Constant
  2. Linear
  3. Square
  4. Triangle

We will take a look at Stats model for 2-4 since the Constant is not all that interesting 🙂 For our examples, we will take a look at each Stats model for the datastore.datastoreIops.average metrics.

Linear Stats Model:

vcsim-perf-linear

<Metric id="datastore.datastoreIops.average">
  <Instance id="Default"/>
    <StatsModel>
      <Type>Triangle</Type>
      <Values>0,20,10,30,0</Values>
      <Periods>600,300,600,900</Periods>
    </StatsModel>
  </Instance>
  <Instance id="HostDatastore"/>
</Metric>

Square Stats Model:

vcsim-perf-square

<Metric id="datastore.datastoreIops.average">
  <Instance id="Default"/>
    <StatsModel>
      <Type>Square</Type>
      <Values>0,10,0,20,0</Values>
      <Periods>300,300,600,600,300</Periods>
    </StatsModel>
  </Instance>
  <Instance id="HostDatastore"/>
</Metric>

Triangle Stats Model:

vcsim-perf-triangle

<Metric id="datastore.datastoreIops.average">
  <Instance id="Default"/>
    <StatsModel>
      <Type>Triangle</Type>
      <Values>0,20,10,30,0</Values>
      <Periods>600,300,600,900</Periods>
    </StatsModel>
  </Instance>
  <Instance id="HostDatastore"/>
</Metric>

I thought this was pretty neat that the VCSIM developers included a couple of Stats Models that could be leveraged right out of the box! As you can see, it is pretty easy to enable various performance metrics simply by identifying the metric(s) you are interested in and specifying the Stats Model and then starting up VCSIM. The other neat thing that I have been asked about before is can VCSIM simulate performance metrics for specific vSphere entities? I originally thought the answer was no until I started to play with the performance metric simulator a bit more and realize there is a List property that you can use to specify the specific objects in which you want data to be displayed.

Here is an example of of the same performance metric we have been looking at but only enabling it for two Datastores:

vcsim-perf-list

<Metric id="datastore.datastoreIops.average">
  <Instance id="List">
    <List>vghettoDS_vGhetto-DC0_C0_0,vghettoDS_vGhetto-DC0_C0_1</List>
    <StatsModel>
      <Type>Triangle</Type>
      <Values>0,20,10,30,0</Values>
      <Periods>600,300,600,900</Periods>
    </StatsModel>
  </Instance>
  <Instance id="HostDatastore"/>
</Metric>

 Note: One thing I noticed while playing with the performance metric simulator is that some times the object in the UI is blank when using the vSphere Web Client. If I use the vSphere C# Client, it is perfectly fine and that is also true if you are using the vSphere API to query for these metrics.

Hopefully this was a good overview of how the VCSIM performance metrics feature works. I know there are a couple of internal folks who have used VCSIM injunction with vCenter Operations and I am also curious to see what other neat uses cases exists for the performance metrics feature. Also, if you have created a really cool metricMetadata.cfg configuration file, feel free to share with the rest of the community!

Categories // Not Supported, VCSA, vSphere Tags // performance, VCSA, vcsim, vcva

VSAN Configuration Maximum Query Script

03.31.2014 by William Lam // 1 Comment

In addition to the vSphere Web Client, a great way to further explore VSAN in greater depth is by leveraging RVC and the new VSAN namespace on the command-line. If you have not played with the new the VSAN commands in RVC, Florian Grehl has written a fantastic series that is worth checking out here. While exploring the VSAN commands myself, one command that particularly stood out to me was the vsan.check_limits. The command provides a quick summary of the internal VSAN limits based on your current VSAN Cluster and configuration.

vsan-configuration-maximum-script-0
This actually got me thinking about the vSphere Configuration Maximums for VSAN and how manual of a process it is today to validate that you are currently running within the supported maximums not only for VSAN but for other areas as well. I thought it would be useful have a script that you could periodically validate the current VSAN configuration maximums against an existing VSAN Cluster. Creating this script was also a nice way for me to take what I have learned about the VSAN APIs over these last couple of weeks in my Exploring VSAN APIs series and build something that could be useful.

Disclaimer:  These scripts are provided for informational and educational purposes only. It should be thoroughly tested before attempting to use in a production environment.

I created a vSphere SDK for Perl called vsanConfigMaximumCheck.pl which just accepts the name of a VSAN Cluster and will automatically check the current VSAN configuration maximums which I pulled out of the latest vSphere 5.5 Configuration Maximums document. It implements the majority of the configuration maximums that I thought made sense to display. This script works on any system with the vSphere SDK for Perl installed but does require one additional Perl Module called JSON. The script reports on the following VSAN configuration maximums:

  • VSAN Disk Groups per Host
  • Magnetic Disk per Disk Group
  • SSD Disks per Disk Group
  • Total Magnetic Disks in all Disk Groups per Host
  • Components per VSAN Host
  • Total VSAN nodes in VSAN Cluster
  • VMs per VSAN Cluster

Note: I also have plans on creating a VSAN vCheck report which is something I am still working on. Hopefully you will hear more about that very soon 🙂

Here is an example of running the script against VSAN Cluster called "VSAN-Cluster" by using the following command:

./vsanConfigMaximumCheck.pl --server vcenter55-1.primp-industries.com --username root --cluster VSAN-Cluster

Here is a screenshot of what the results would look like:
vsan-configuration-maximum-script-1
I personally think this information would be really useful to include in the vsan.check_limits RVC command but I also think it would be useful to have outside of RVC for any type of external reporting which can also leverage the vSphere API.

Categories // VSAN, vSphere 5.5 Tags // configuration maximum, VSAN, vSphere API

  • « Previous Page
  • 1
  • …
  • 410
  • 411
  • 412
  • 413
  • 414
  • …
  • 561
  • Next Page »

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • VMware Flings is now available in Free Downloads of Broadcom Support Portal (BSP) 05/19/2025
  • VMUG Connect 2025 - Minimal VMware Cloud Foundation (VCF) 5.x in a Box  05/15/2025
  • Programmatically accessing the Broadcom Compatibility Guide (BCG) 05/06/2025
  • Quick Tip - Validating Broadcom Download Token  05/01/2025
  • Supported chipsets for the USB Network Native Driver for ESXi Fling 04/23/2025

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2025

 

Loading Comments...