VMware Cloud Community
rlane
Contributor
Contributor

Announcing RVC - Ruby vSphere Console

http://github.com/vmware/rvc

I'm pleased to announce the first public release of RVC, a Linux shell-like interface to ESX and VirtualCenter which presents the vSphere inventory as a virtual filesystem.

Many useful commands are already implemented, like VM power operations, connecting a VMRC or VNC session (to view your virtual machines' consoles), and vMotion. RVC is designed to make it easy for users to add commands of their own, so I'm counting on the community to contribute commands that I (as an ESX kernel developer at VMware) haven't needed yet.

RVC is written in Ruby, so you will need a Ruby interpreter and RubyGems installed, which you can find in your system's package manager. From there it should be a simple "gem install rvc". If you run into any installation problems please let me know. RVC might even work on OS X but I have not tested it there.

More documentation is available in the GitHub repository README. To get started, run "rvc user@host" and try the "help", "ls", "cd", and "info" commands.

This project is also being released as a VMware Labs Fling, so the same disclaimers apply.

Screencast showing how to run RVC on Windows by Eric Sloof: http://www.ntpro.nl/blog/archives/1738-Video-Latest-fling-from-VMware-Labs-Ruby-vSphere-Console.html. Windows support is a work in progress and has been improved since this screencast.

Packages needed:

FC14: ruby ruby-devel rubygems kernel-devel libxml2 libxml2-devel libxslt libxslt-devel libffi libffi-devel

Changelog:

2011-06-09: 1.4.0 released. Added OS X keychain support, permissions commands, shared sessions, and more.

2011-04-19: 1.3.0 released. Added aggregate marks, datastore.edit, and improved Windows compatibility.

2011-04-12: 1.2.0 released. Added wildcards, guest power ops, and ssh enhancements.

2011-04-05: 1.1.0 released. Added support for linked clones and host maintenance mode operations.

2011-03-26: Initial release.

Reply
0 Kudos
29 Replies
lamw
Community Manager
Community Manager

Very cool fling, was able to get this running on my Mac without too much issue.

Picture 1.png

I noticed that rvc only accepts IP Address of the ESX(i)/vCenter host, even with FQDN it fails, I assume this is expected?

I also found that the "help" operation always throws the following error no matter at what level of the inventory:

/172.30.0.66/ha-datacenter/host> help
All commands:
NoMethodError: undefined method `keys' for [["destroy", "basic.destroy"]]:Array
/usr/local/rvm/gems/ruby-1.8.7-p334/gems/rvc-1.0.1/lib/rvc/modules/basic.rb:60:in `help'
/usr/local/rvm/gems/ruby-1.8.7-p334/gems/rvc-1.0.1/lib/rvc/modules/basic.rb:57:in `each'
/usr/local/rvm/gems/ruby-1.8.7-p334/gems/rvc-1.0.1/lib/rvc/modules/basic.rb:57:in `help'
/usr/local/rvm/gems/ruby-1.8.7-p334/gems/rvc-1.0.1/lib/rvc/modules/basic.rb:53:in `each'
/usr/local/rvm/gems/ruby-1.8.7-p334/gems/rvc-1.0.1/lib/rvc/modules/basic.rb:53:in `help'
/usr/local/rvm/gems/ruby-1.8.7-p334/gems/rvc-1.0.1/lib/rvc/shell.rb:109:in `send'
/usr/local/rvm/gems/ruby-1.8.7-p334/gems/rvc-1.0.1/lib/rvc/shell.rb:109:in `eval_command'
/usr/local/rvm/gems/ruby-1.8.7-p334/gems/rvc-1.0.1/lib/rvc/shell.rb:56:in `eval_input'
/usr/local/rvm/gems/ruby-1.8.7-p334/gems/rvc-1.0.1/bin/rvc:100
/usr/local/rvm/gems/ruby-1.8.7-p334/bin/rvc:19:in `load'
/usr/local/rvm/gems/ruby-1.8.7-p334/bin/rvc:19
/172.30.0.66/ha-datacenter/host> ls
0 vesxi41-1. (standalone): cpu 5 GHz, memory 4294254 GB

The environment is a standalone ESXi 4.1 Update 1 host

OSX 10.5.8

ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin9.8.0]

Gem 1.6.2

Reply
0 Kudos
rlane
Contributor
Contributor

Thanks for the bug report, I've fixed the help command (it was using a Ruby 1.9 feature). RVC supports DNS hostnames - what error did you get? Can you ping using the same hostname?

Reply
0 Kudos
rtimj
Contributor
Contributor

I am trying to get this installed on FC 14 (64 bit).  Installed Ruby 1.8.7.334-1.fc14, Gems 1.3.7-2.fc14 as well as libxml2, libxslt and devel packages.

I get the foolowing error:

[root@myPC etc]# gem install rvc
Building native extensions.  This could take a while...
..
.
ERROR:  Error installing rvc:
    ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb
checking for ffi.h in /usr/local/include... no
checking for rb_thread_blocking_region()... no
checking for ruby_thread_has_gvl_p()... no
checking for ruby_native_thread_p()... no
checking for rb_thread_call_with_gvl()... no
creating extconf.h
creating Makefile

make
Configuring libffi
/usr/lib/ruby/gems/1.8/gems/ffi-1.0.7/ext/ffi_c/libffi/configure: line 725: 0: Bad file descriptor
make: *** [/usr/lib/ruby/gems/1.8/gems/ffi-1.0.7/ext/ffi_c/libffi/.libs/libffi_convenience.a] Error 1


Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/ffi-1.0.7 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/ffi-1.0.7/ext/ffi_c/gem_make.out

I am a total nob when it comes to ruby so any help would be appreciated.

Thanks.

Tim

Reply
0 Kudos
rlane
Contributor
Contributor

The FFI gem isn't actually required for RVC to work, so you can run "gem install rbvmomi trollop backports && gem install --no-dependencies rvc".

Reply
0 Kudos
rtimj
Contributor
Contributor

Thanks, there was an error of invalid option for --no-dependencies so I used --igonore-dependencies and got it installed but the following error when I run rvc:

/usr/lib/ruby/site_ruby/1.8/rubygems.rb:779:in `report_activate_error': Could not find RubyGem ffi (>= 1.0.7) (Gem::LoadError)
    from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:214:in `activate'
    from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:249:in `activate'
    from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:248:in `each'
    from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:248:in `activate'
    from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:1082:in `gem'
    from /usr/bin/rvc:18

Any ideas?  Thnaks agin.

Tim

Reply
0 Kudos
rtimj
Contributor
Contributor

Sorry, replying to my own post.  Needed to install libffi-devel then all worked, did a gem install rvc and it is working now.

Time to start exploring.

Thanks for writing this.

Tim

Reply
0 Kudos
rlane
Contributor
Contributor

I've pushed rvc-1.0.3, which makes the FFI dependency optional. You'll still want to install it if you can since it enables useful tab-completion features.

Tim, could you post the Fedora packages you needed to install?

Reply
0 Kudos
rtimj
Contributor
Contributor

I started with a base FC14 install and installed the following via 'yum install':

ruby

ruby-devel

rubygems

kernel-devel

libxml2

libxml2-devel

libxslt

libxslt-devel

libffi

libffi-devel

I was able to get ffi installed after using 'gem install ffi' and tab completion is working.

How would I got about updating rvc to I do a gem uninstall download latest and then gem instll again?

Thanks.

Tim

Reply
0 Kudos
rlane
Contributor
Contributor

Use "gem update rvc" to get the latest version.

Reply
0 Kudos
Matthiker
Contributor
Contributor

A great tool, must try.

Reply
0 Kudos
admin
Immortal
Immortal

Just for anyone who might get this issue too:

On Ubuntu 10.04 64-bit after installing all the mentioned packages, when connecting I got the following:

# rvc 10.21.65.41
/home/eamon/.gem/ruby/1.8/gems/rvc-1.0.3/lib/rvc/modules/vim.rb:64:in `connect': uninitialized constant RVC::CmdModule::OpenSSL (NameError)
                from /home/eamon/.gem/ruby/1.8/gems/rvc-1.0.3/lib/rvc/modules/vim.rb:54:in `loop'
                from /home/eamon/.gem/ruby/1.8/gems/rvc-1.0.3/lib/rvc/modules/vim.rb:54:in `connect'
                from /home/eamon/.gem/ruby/1.8/gems/rvc-1.0.3/bin/rvc:63
                from /home/eamon/.gem/ruby/1.8/gems/rvc-1.0.3/bin/rvc:60:in `each'
                from /home/eamon/.gem/ruby/1.8/gems/rvc-1.0.3/bin/rvc:60
                from /home/eamon/.gem/ruby/1.8/bin/rvc:19:in `load'
                from /home/eamon/.gem/ruby/1.8/bin/rvc:19

Solution (given by rlane) is to install the package libopenssl-ruby1.x (1.8 for me). Works now 🙂

Reply
0 Kudos
stefan_winter
Contributor
Contributor

Hi,

THANKS for this awesome tool. I'm one of the members of the "give us a Linux client" choir. Installed this on an openSUSE 11.4 64-Bit - and it works perfectly out of the box.

Now my only question is: WHY does this have to be done by ESX developers on their own as only a VMware-the-company halfheartedly supported project - this is so great, release it as a proper VMWare Product!

Now off to enjoy VMRCs in RVC! 🙂

Stefan

Reply
0 Kudos
jcwuerfl
Hot Shot
Hot Shot

Wow, interesting project.  If this project continues to grow I wonder if there's a possibilty to include it in the vMA? and wondering why its not added yet to the VMware Flings area?  Wondering what other commands you will add next?   svmotion, editing properties of the vms?  connecting/disconnecting floppies/cdroms etc. ?

Reply
0 Kudos
lamw
Community Manager
Community Manager

This would indeed be a neat utility to add to vMA, for now, you'll have to manually install but here is a quick blog post on how to do so - http://www.virtuallyghetto.com/2011/04/how-to-install-ruby-vsphere-console-on.html

Reply
0 Kudos
rlane
Contributor
Contributor

I'll talk with the vMA developers and see what we can do; I think I'd need to support the vMA's fastpass authentication mechanism. The Flings post is coming soon.

For dealing with virtual devices, check out the vm.devices, vm.connect, vm.disconnect, and vm.insert_cdrom commands. Storage vMotion is a good idea, I'll add that. I'm also wondering what commands I'll add next - send me suggestions (or patches)!

Reply
0 Kudos
lamw
Community Manager
Community Manager

You don't necessary need to support vi-fastpass, as it's jus another authentication mechanisms, but it would be neat if you could integrate with vifp library.

Regarding other commands, some operations at the cluster would be nice such as creating, deleting and modifying clusters and also ability to add/remove hosts from a cluster.

Have you had any thoughts about bulk operations and how that could/might work? That would be an extremely useful feature to have to somehow bulk operations based on some type of regex for an object, say power on all VMs that start with A*

Reply
0 Kudos
stefan_winter
Contributor
Contributor

After running this past my colleagues: a command to show host/cluster resource usage would be nice (x of y GHz used, x of y GB RAM in use would be good enough for a start).

Stefan

Reply
0 Kudos
rtimj
Contributor
Contributor

This may be a stupid question but I did not see a method for doing a graceful guest shutdown.  Am I missing it?

Thanks, this is a great alternative, who knows maybe it will put some pressure VMWare to officially roll out a Linux vSphere client.

Tim

Reply
0 Kudos
rlane
Contributor
Contributor

RVC has been officially released as a Fling: http://labs.vmware.com/flings/rvc

I've added guest power operations, globbing (wildcards), and an enhancement to the ssh command from Doug MacEachern to the git repo. I'll release a new version with these features early next week.

Reply
0 Kudos