InventorySnapshot

InventorySnapshot allows a user to "snapshot" a given vCenter inventory configuration and then reproduce it. The "inventory" includes the Datacenter folders, datacenters, clusters, resource pools, vApps, hierarchy, roles and permissions, configuration settings, and custom fields. In other words, if you have an inventory with a given set of hosts and VMs organized into a group of clusters, we can faithfully reproduce this environment, including the cluster settings and custom roles you may have defined. As a simple example, suppose you have an inventory with one datacenter (DC A), one cluster (Cluster A), and two hosts (Host A and Host B). At a high level, our fling emits a PowerCLI script that, when executed, does the following:
  1. Creates Datacenter “DC A.”
  2. Creates cluster “Cluster A.”
  3. Adds host “Host A” to “Cluster A.”
  4. Adds host “Host B” to “Cluster A.”
Notice that this can be helpful for a variety of reasons. For example, suppose you’ve spent a lot of time creating a development vCenter environment, and now you wish to deploy it in production. Using our fling, you can snapshot your “dev” environment and then run it against the “production” vCenter server, saving you the task of laboriously adding each host, creating the proper clusters and resource pools, etc. For more details, review the following document.

Prerequisites

  • Java 1.6.0_23 or higher
    To run InventorySnapshot, you must have Java installed. We require version 1.6.0_23 or higher, and you can use either the JRE or the JDK. If Java is not already installed on your system, please visit http://www.oracle.com/technetwork/java/javase/downloads/index.html and download Java SE 6 Update 23.
  • PowerCLI 4.1.U1 or higher
    To run InventorySnapshot, you must have the VMware PowerCLI installed. In our case, we have tested with version 4.1U1, build 332441. To download this, please see the following URL: http://www.vmware.com/support/developer/PowerCLI. Note that to complete this step, you will also need to install Powershell, as discussed in the PowerCLI documentation.

Assumptions

  • VMs are already registered on their hosts.
  • Entity names (VMs, Folders, etc.) are unique within an inventory.

Caveats

See section VII of the documentation for a complete list of caveats.

  • Currently does not archive alarm information.
  • May not support certain non-English or special characters in entity names.

For a complete step-by-step guide to using this fling, review the documentation and watch the provided videos.

To get started, do the following:

  • Snapshot the inventory using the UI.
    • In Windows, double-click on inventorySnapshot.bat to bring up the UI.
    • In Linux and MacOS, use the inventorySnapshot.sh shell script to bring up the UI.
  • Edit the createInventory.ps1 PowerCLI script (generated in the previous step) so that the host passwords are correct. You can do this using the UI, or you can manually edit the createInventory.ps1 file using your favorite text editor. Just search for 'PASSWORD' to see where you need to input the proper passwords. If you use the UI, the file is saved as “createInventory-PasswordModified.ps1.”
  • Login to a vCenter server using the PowerCLI, change into the directory that contains the createInventory.ps1 script, and just type .\createInventory-PasswordModified.ps1. If you edited the script by hand and saved it as createInventory.ps1, then type createInventory.ps1 instead.

This vCenter fling takes a snapshot of the vCenter inventory and creates a bunch of binary files to describe this inventory and the configuration of the various entities (clusters, networks, etc.). More importantly, it also creates a file called "createInventory.ps1." This is a PowerCLI script.

This PowerCLI script contains commands to re-create the inventory that you've just archived. Feel free to take a look! It is important to note that re-creating most inventories requires adding hosts. As a placeholder for the actual passwords of the hosts being added, our script generates “-password 'PASSWORD'” in the createInventory.ps1 script. Using the UI, we enable you to change the passwords for each host. Of course, you can also open up the file in the editor of your choice and change them yourself. Please note that for now, we store the PowerCLI script as a plaintext file, so your passwords are cleartext. If there is sufficient demand, we can work on changing this.

Inventory Snapshot

Updates in Version 1.1

These release notes are intended to supplement and super-cede the documentation in this fling.This release introduces three new features.

1. Template restoration. We have added snapshot and restore of VM templates. In other words, if you have templates in your hierarchy, when you snapshot and then restore the inventory, the templates should be re-registered properly. Prior to this release, we did not archive template information.

2. Command-line snapshot. You can now initiate InventorySnapshot from the command line using cmdLineSnapshot.bat or cmdLineSnapshot.sh. This will snapshot the inventory from the command line, but it will use dummy passwords for the ESX hosts. In order to edit the passwords for the ESX hosts, you will need to use the readFromSnapshot.bat (or readFromSnapshot.sh) UI. When you click on this script, a UI will come up that will ask you to specify the directory where the snapshot has been stored. You type in the name of the directory and click on 'Read from snapshot directory.' The UI will then load the snapshot, allowing you to modify host passwords, etc. You can also use the 'Browse for snapshot directory' to find the snapshot directory using the file browser.

3. Non-unique folder names. In the past, we required all entities (folders, VMs, RPs, etc.) to have unique names. We have now relaxed this restriction for VM and host folders. You can now have the following hierarchy:

Root
|
->Production A Folder
| |
| -->Production Folder
| |
| -->Host A1
|
->Production B Folder
  |
  -->Production Folder
     |
     -->Host B1

Note that the folder name "Production Folder" is repeated. This works for hosts and VMs. It should also work with datastores and networks, though those have not been as extensively tested.

Updates in Version 1.0.1

This version fixes a bug that throws ArrayIndexOutofBoundsException when the ClusterConfigSpecEx of the cluster contains ClusterAffinityRule and ClusterAntiAffinityRule data defined.

Updates in Version 1.0.2

  1. Support for UTF-16 and international character sets. PowerCLI version 4.1u1 runs the generated PowerCLI seamlessly. If you would like to view the PowerCLI file we create (instead of just running it with the PowerCLI interpreter), your text editor must support UTF-16. For example, on MacOS, emacs 22.1.1 (among other editors) supports UTF-16, and on Windows, TeXworks (among other editors) supports UTF-16.
  2. Bug fix for users without DRS licenses: in version 1.0 and 1.0.1, we created clusters with DRS enabled by default, and then reconfigured the cluster according to its actual settings. However, if a user does not have a DRS license and creates clusters without DRS, the cluster creation would fail with a license error. We now correctly create a cluster without DRS settings first, and then we reconfigure it according to its actual settings.
  3. Removal of some spurious file reads: this should speed up the PowerCLI generation phase slightly, but will likely have no other visible impact.
Add a Comment
Report a Bug