[libvirt] [PATCH] esx: Support vSphere 5.x

Matthias Bolte matthias.bolte at googlemail.com
Tue Nov 1 17:22:09 UTC 2011

2011/10/21 Patrice LACHANCE <patlachance at gmail.com>:
> Hello

Sorry for the late response.

> Based on http://www.redhat.com/archives/libvir-list/2010-July/msg00480.html,
> I created this quick patch to accept connection to vSphere 5.x

The patch looks good in general.

> Notes:
> - I had to remove the warnings for version > 4.1 & 5 because they were
> generating errors when running scripts encapsulating virsh commands with
> opennebula. A better option might be to relie on an environment variable
> (for example DONT_BLAME_LIBVIRT!) to toggle warnings on/off

The warnings are there for a reason. If you need to suppress them then
you can already do that via the logging configuration

LIBVIRT_LOG_OUTPUTS=4:stderr virsh

This will only output errors, but suppresses warnings. Actually you
should not see this warnings with all currently available vSphere
versions. Those warnings are meant for future vSphere versions.

> - Ran only a few tests but it works as expected.

You added virtual hardware 8 version to
esxVI_ProductVersionToDefaultVirtualHWVersion but missed to add it to
virVMXParseConfig. This breaks virsh dumpxml for vSphere 5.0. I've
fixed that.

diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index be91c13..9ba06e5 100644 (file)
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -1278,9 +1279,10 @@ virVMXParseConfig(virVMXContext *ctx,
virCapsPtr caps, const char *vmx)
         goto cleanup;

-    if (virtualHW_version != 4 && virtualHW_version != 7) {
+    if (virtualHW_version != 4 && virtualHW_version != 7 &&
+        virtualHW_version != 8) {
-                  _("Expecting VMX entry 'virtualHW.version' to be 4 or 7 "
+                  _("Expecting VMX entry 'virtualHW.version' to be 4, 7 or 8 "
                     "but found %lld"),
         goto cleanup;

Actually we're currently in feature freeze for libvirt 0.9.7, but as
this is a pure addition patch, that will not break existing code I
pushed it now. Also because I don't want to delay this for another
release cycle.

ACK, thanks.

Matthias Bolte

More information about the libvir-list mailing list