posted

0 Comments

In today’s article, we will be taking a deeper look into the features of the Ruby vSphere Console (RVC) by examining its command structure and syntax. With RVC being built in Ruby, and built upon the Ruby interface to the vSphere API (RbVmomi), it serves to offer considerable strengths that we can leverage to expedite operations in our vSphere infrastructures. RVC began its life in VMware Labs as a Fling as a Ruby based CLI for the vSphere infrastructure. VMware Lab “Flings” are really interesting Engineering side projects. As a Fling, RVC became such a considerable tool for VMware Engineering, Support, and others that it was decided to extend its functionality to include support for Virtual SAN environments. RVC has now become a robust CLI for managing vSphere and Virtual SAN infrastructures.

First though, if you need assistance with recommended practices for RVC deployment, or how to login and navigate your vSphere and Virtual SAN infrastructure, please take a look at our first two blog articles from this series.

Managing Virtual SAN with RVC Series:
Part 1 – Introduction to the Ruby vSphere Console
Part 2 – Navigating your vSphere and Virtual SAN infrastructure with RVC

RVC Virtual SAN and SPBM Namespaces

Tab-completion
Commands and paths can be tab completed as is typical in most command line interfaces. Whitespace characters will need to be escaped with a backslash.

Wildcards
Many commands such as “vm.on” can operate on multiple objects at once. RVC supports simple globbing (pattern matching based on wildcard characters) using “*” as well as advanced regular expression (regex) syntax. To use a regex, prefix the path element with “%”. For example: “vm.on myvms/%^(linux|windows)” will power on VMs whose names start with “linux” or “windows” in the “myvms” folder. Note that it is necessary to explicitly anchor the pattern with “^” and “$” if you wish to match the whole path element.

Command Examples
Below are a few initial commands to help get you started with RVC. Remember, to obtain a listing of namespaces, simply type “help” at the RVC command line. To obtain a listing of commands within a particular namespace, type “help <namespace>” at the RVC command line.

Virtual SAN Namespace
The RVC Virtual SAN (VSAN) namespace contains 29 commands to interact with a Virtual SAN infrastructure. There are also a number of other commands in other namespaces that are used. For instance, the SPBM namespace contains the spbm.profile_create command that can be used to create storage profiles.

Here are the commands from the RVC Virtual SAN (VSAN) namespace:

vsan.apply_license_to_cluster vsan.check_limits vsan.check_state vsan.cluster_change_autoclaim
vsan.cluster_info vsan.cluster_set_default_policy vsan.cmmds_find vsan.disable_vsan_on_cluster
vsan.disk_object_info vsan.disks_info vsan.disks_stats vsan.enable_vsan_on_cluster
vsan.enter_maintenance_mode vsan.fix_renamed_vms vsan.host_consume_disks vsan.host_info
vsan.host_wipe_vsan_disks vsan.lldpnetmap vsan.obj_status_report vsan.object_info
vsan.object_reconfigure vsan.observer vsan.reapply_vsan_vmknic_config vsan.recover_spbm
vsan.resync_dashboard vsan.support_information vsan.vm_object_info vsan.vm_perf_stats
vsan.whatif_host_failures

SPBM Namespace
The Storage Profile Based Managed (SPBM) namespace contains 8 commands to interface with the vSphere Storage Policy services.

spbm.check_compliance spbm.device_add_disk
spbm.device_change_storage_profile spbm.namespace_change_storage_profile
spbm.profile_apply spbm.profile_create
spbm.profile_delete spbm.vm_change_storage_profile

RVC Command Structure

All RVC commands exist as Ruby modules within the RVC software. If you are using the vCenter Server Appliance, these modules can be found in the directory path “/opt/vmware/rvc/lib/rvc/modules”. If you are handy with Ruby, or would like to learn, you can even make custom RVC commands with just a little bit of Ruby code. Simply create your module, upload it to the RVC modules directory, and then login to RVC to begin using your new, custom commands.

RVC commands are in the form of “<namespace>.<command>” where <command> is a function within the Ruby module named <namespace>. For instance, “vsan.rb” is a Ruby module within the RVC software and is located in “/opt/vmware/rvc/lib/rvc/modules”. The command “vsan.enable_vsan_on_cluster” refers to the “enable_vsan_on_cluster” function within the vsan.rb Ruby module. All 29 RVC namespaces, exist as separate Ruby modules wherein the 197 RVC commands are located as separate Ruby functions. Here is a list of all RVC v1.8.0 commands. See the Resource section at the bottom of this article for the help output for each command.

As you can see, there are a whole host of possibilities for RVC to expedite vSphere and Virtual SAN infrastructure deployment as well as daily operations.

Stay tuned next week as we demonstrate how to leverage RVC to deploy our Virtual SAN environment as well as beginning our exploration of troubleshooting and monitoring Virtual SAN environments via RVC!

Resources
RVC CLI Help Output
RVC v1.8.0 Command List

Managing Virtual SAN with RVC Series:
Part 1 – Introduction to the Ruby vSphere Console
Part 2 – Navigating your vSphere and Virtual SAN infrastructure with RVC

 

 

About the Author

Joe Cook

Joe Cook is a Senior Technical Marketing Manager at VMware, currently focusing on automation of current and future VMware software-defined storage products, with specific emphasis on automating datacenter operations. Joe has over 20 years of industry experience in the design, implementation, and operation of complex IT environments ranging in size from Enterprise to SMB. Stay in touch with Joe via @CloudAnimal on Twitter for information on: vSphere Storage Policy Based Management Virtual Virtual SAN Monitoring and Troubleshooting VVOLs