ESX Integration¶
Preface¶
ESX integration is almost complete. I am just waiting for my patches to be merged and some final testing on the foreman devel or esx branch.
Although ESX and ESXi are different products they should be considered identical when it comes to working with the Vmware SDK.
Furthermore, vSphere is almost identical to ESX SDK with the exception that vSphere has additional objects and actions available to choose from when using the SDK.
All of these "ESX" products implement the Vsphere SDK through Https
Requirements¶
- libvirt 0.9.1+ (not totally sure on this) but I know it doesn't work with 0.8.1
- ruby-libvirt 0.4.0
- ESX, ESXi, vsphere server, VMware Server (ESX 5 may not be supported)
- A CA (Certificate Authority) to sign new certificates (don't need if you use no_verify=1 option)
- RHEL6 or CentOS6 (not required but its what I use)
- Unofficial virt lib and foreman esx branch (or attached patch) from http://github.com/logicminds
Summary¶
- Install libvirt and libvirt-devel
- Install ruby-libvirt gem
- Start libvirtd
- Test with virsh
- Install unofficial repos
- Setup hypervisor in foreman
Use these steps if not using the no_verify=1 option
- Create ssl key
- Sign key with CA cert and CA key
- Transfers these keys to your ESX or Vsphere server
- Copy CA cert and client cert
¶
Detail Instructions¶
Install libvirt¶
I tried various versions. The latest has too many dependancies so I stuck with 0.9.1 which is perfect for what I need.
I have compiled some RPMs to make it easier to install but you may need to resolve some additional dependancies.
This shouldn't be too bad if you have the EPEL repo.
http://files.remoteadmin.co/rpms/libvirt-0.9.1-1.el6.x86_64.rpm
http://files.remoteadmin.co/rpms/libvirt-client-0.9.1-1.el6.x86_64.rpm
http://files.remoteadmin.co/rpms/libvirt-devel-0.9.1-1.el6.x86_64.rpm
http://files.remoteadmin.co/rpms/libvirt-python-0.9.1-1.el6.x86_64.rpm
You will need to use the following to install all the rpms once downloaded.
yum -y --nogpgcheck localinstall libvirt-*
or
rpm -Uvh libvirt-*
Install libvirt gem¶
gem install ruby-libvirt
Install the attached patch for Feature #955¶
cd /usr/share/foreman (or other foreman path) wget http://files.remoteadmin.co/rpms/0001-Feature-955-vmware-provisioning-support.patch git apply 0001-Feature-955-vmware-provisioning-support.patch RAILS_ENV=production rake db:migrate mv /usr/share/vendor/plugins/virt /tmp
Install virt lib¶
cd /opt git clone git://github.com/logicminds/virt.git virt cd /opt/virt git checkout coreyschanges ln -s /opt/virt /usr/share/foreman/vendor/plugins/virt
Start the libvirtd Service¶
service libvirtd start
Setup ESX Hypervisor in Foreman¶
- Goto Hypervisor (ensure ruby-libvirt is installed and libvirtd is running)
- Add hypervisor to hypervisor list (esx://server?no_verify=1)
- Find the bugs and submit patches to my attention in foreman-dev.
Until this gets put in the foreman project don't create any tickets just yet since our code is currently forked.
If your not using no_verify=1 please follow this page to Setup Certificates
Troubleshoot by Testing with virsh¶
I created a foreman user on my esx server
[root@puppet ~]# virsh
Welcome to virsh, the virtualization interactive terminal.
Type: 'help' for help with commands
'quit' to quit
virsh # connect esx://pdxesx?no_verify=1
Enter foreman's password for pdxesx:
virsh # version
Compiled against library: libvir 0.9.1
Using library: libvir 0.9.1
Using API: ESX 0.9.1
Running hypervisor: ESX 4.1.0
virsh # list
Id Name State
----------------------------------
16 puppetagent1 running
URI
esx://foreman@pdxesx?no_verify=1
Virtual Center support¶
I am kinda disappointed with libvirt's vcenter support. The VPX driver is basically only talking to a single esx host which is similar to the esx driver.
So you will need to add every esx host you wish to control as a separate hypervisor in foreman. However, because a single node in a cluster has the ability to
migrate vms to other nodes you may only need to control one of the nodes and let vmware handle migration when resources are low.
The benefit of using the vpx driver is the use of vcenter centrally managed RBAC.
Support for Vcenter using the following URI
vpx://vcenterserver/DC/Cluster/pdxesx?no_verify=1
username = esxusername (AD environments do not need to append @domain or anything)
I had a chance to test vcenter the other day and it appears that libvirt's support is different for esx than vpx.
I was not able to create a vm with vpx so only the ESX driver works at this time reliably.
Current Issues¶
- Destroy doesn't delete VM only unregisters the vmx file (Libvirt and virt issue)
- Libvirt doesn't yet support List of VMware Networks (Virtual Switches / Port Groups)
- Virt and foreman only show info about first disk(although virt supports multiple disks)
- Listing the VMs on the hypervisor is slow (300ms per vm guest) although it has been improved from previous versions
Known ESX Limitations¶
- Does not work with ESX free edition (unless ESXi is unlicensed)
- Libvirt does not support ESXi 5.0 directly but might be supported under vsphere
Reference Material¶
http://libvirt.org/remote.html#Remote_TLS_server_certificates
http://libvirt.org/drvesx.html#auth
http://www.vmware.com/support/developer/vc-sdk/
-- cosman2001
