cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject [1/40] Introduce POM dependency on VSphere 5.1 SDK, not done yet, WIP.
Date Tue, 05 Mar 2013 02:09:47 GMT
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/780ac2a9/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareGuestOsMapper.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareGuestOsMapper.java b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareGuestOsMapper.java
index 7d26983..1433148 100755
--- a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareGuestOsMapper.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareGuestOsMapper.java
@@ -24,146 +24,150 @@ import com.vmware.vim25.VirtualMachineGuestOsIdentifier;
 public class VmwareGuestOsMapper {
 	private static Map<String, VirtualMachineGuestOsIdentifier> s_mapper = new HashMap<String,
VirtualMachineGuestOsIdentifier>();
 	static {
-		s_mapper.put("DOS", VirtualMachineGuestOsIdentifier.dosGuest);
-		s_mapper.put("OS/2", VirtualMachineGuestOsIdentifier.os2Guest);
-
-		s_mapper.put("Windows 3.1", VirtualMachineGuestOsIdentifier.win31Guest);
-		s_mapper.put("Windows 95", VirtualMachineGuestOsIdentifier.win95Guest);
-		s_mapper.put("Windows 98", VirtualMachineGuestOsIdentifier.win98Guest);
-		s_mapper.put("Windows NT 4", VirtualMachineGuestOsIdentifier.winNTGuest);
-		s_mapper.put("Windows XP (32-bit)", VirtualMachineGuestOsIdentifier.winXPProGuest);
-		s_mapper.put("Windows XP (64-bit)", VirtualMachineGuestOsIdentifier.winXPPro64Guest);
-		s_mapper.put("Windows XP SP2 (32-bit)", VirtualMachineGuestOsIdentifier.winXPProGuest);
-		s_mapper.put("Windows XP SP3 (32-bit)", VirtualMachineGuestOsIdentifier.winXPProGuest);
-		s_mapper.put("Windows Vista (32-bit)", VirtualMachineGuestOsIdentifier.winVistaGuest);
-		s_mapper.put("Windows Vista (64-bit)", VirtualMachineGuestOsIdentifier.winVista64Guest);
-		s_mapper.put("Windows 7 (32-bit)", VirtualMachineGuestOsIdentifier.windows7Guest);
-		s_mapper.put("Windows 7 (64-bit)", VirtualMachineGuestOsIdentifier.windows7_64Guest);
-
-		s_mapper.put("Windows 2000 Professional", VirtualMachineGuestOsIdentifier.win2000ProGuest);
-		s_mapper.put("Windows 2000 Server", VirtualMachineGuestOsIdentifier.win2000ServGuest);
-		s_mapper.put("Windows 2000 Server SP4 (32-bit)", VirtualMachineGuestOsIdentifier.win2000ServGuest);
-		s_mapper.put("Windows 2000 Advanced Server", VirtualMachineGuestOsIdentifier.win2000AdvServGuest);
-		
-		s_mapper.put("Windows Server 2003 Enterprise Edition(32-bit)", VirtualMachineGuestOsIdentifier.winNetEnterpriseGuest);
-		s_mapper.put("Windows Server 2003 Enterprise Edition(64-bit)", VirtualMachineGuestOsIdentifier.winNetEnterprise64Guest);
-		s_mapper.put("Windows Server 2008 R2 (64-bit)", VirtualMachineGuestOsIdentifier.winLonghorn64Guest);
-		s_mapper.put("Windows Server 2003 DataCenter Edition(32-bit)", VirtualMachineGuestOsIdentifier.winNetDatacenterGuest);
-		s_mapper.put("Windows Server 2003 DataCenter Edition(64-bit)", VirtualMachineGuestOsIdentifier.winNetDatacenter64Guest);
-		s_mapper.put("Windows Server 2003 Standard Edition(32-bit)", VirtualMachineGuestOsIdentifier.winNetStandardGuest);
-		s_mapper.put("Windows Server 2003 Standard Edition(64-bit)", VirtualMachineGuestOsIdentifier.winNetStandard64Guest);
-		s_mapper.put("Windows Server 2003 Web Edition", VirtualMachineGuestOsIdentifier.winNetWebGuest);
-		s_mapper.put("Microsoft Small Bussiness Server 2003", VirtualMachineGuestOsIdentifier.winNetBusinessGuest);
-		
-		s_mapper.put("Windows Server 2008 (32-bit)", VirtualMachineGuestOsIdentifier.winLonghornGuest);
-		s_mapper.put("Windows Server 2008 (64-bit)", VirtualMachineGuestOsIdentifier.winLonghorn64Guest);
-		
-		s_mapper.put("Open Enterprise Server", VirtualMachineGuestOsIdentifier.oesGuest);
-		
-		s_mapper.put("Asianux 3(32-bit)", VirtualMachineGuestOsIdentifier.asianux3Guest);
-		s_mapper.put("Asianux 3(64-bit)", VirtualMachineGuestOsIdentifier.asianux3_64Guest);
-		
-		s_mapper.put("Debian GNU/Linux 5(64-bit)", VirtualMachineGuestOsIdentifier.debian5_64Guest);
-        s_mapper.put("Debian GNU/Linux 5.0 (32-bit)", VirtualMachineGuestOsIdentifier.debian5Guest);
-		s_mapper.put("Debian GNU/Linux 4(32-bit)", VirtualMachineGuestOsIdentifier.debian4Guest);
-		s_mapper.put("Debian GNU/Linux 4(64-bit)", VirtualMachineGuestOsIdentifier.debian4_64Guest);
-		
-		s_mapper.put("Novell Netware 6.x", VirtualMachineGuestOsIdentifier.netware6Guest);
-		s_mapper.put("Novell Netware 5.1", VirtualMachineGuestOsIdentifier.netware5Guest);
-		
-		s_mapper.put("Sun Solaris 10(32-bit)", VirtualMachineGuestOsIdentifier.solaris10Guest);
-		s_mapper.put("Sun Solaris 10(64-bit)", VirtualMachineGuestOsIdentifier.solaris10_64Guest);
-		s_mapper.put("Sun Solaris 9(Experimental)", VirtualMachineGuestOsIdentifier.solaris9Guest);
-		s_mapper.put("Sun Solaris 8(Experimental)", VirtualMachineGuestOsIdentifier.solaris8Guest);
-		
-		s_mapper.put("FreeBSD (32-bit)", VirtualMachineGuestOsIdentifier.freebsdGuest);
-		s_mapper.put("FreeBSD (64-bit)", VirtualMachineGuestOsIdentifier.freebsd64Guest);
-		
-		s_mapper.put("SCO OpenServer 5", VirtualMachineGuestOsIdentifier.otherGuest);
-		s_mapper.put("SCO UnixWare 7", VirtualMachineGuestOsIdentifier.unixWare7Guest);
-		
-		s_mapper.put("SUSE Linux Enterprise 8(32-bit)", VirtualMachineGuestOsIdentifier.suseGuest);
-		s_mapper.put("SUSE Linux Enterprise 8(64-bit)", VirtualMachineGuestOsIdentifier.suse64Guest);
-		s_mapper.put("SUSE Linux Enterprise 9(32-bit)", VirtualMachineGuestOsIdentifier.suseGuest);
-		s_mapper.put("SUSE Linux Enterprise 9(64-bit)", VirtualMachineGuestOsIdentifier.suse64Guest);
-		s_mapper.put("SUSE Linux Enterprise 10(32-bit)", VirtualMachineGuestOsIdentifier.suseGuest);
-		s_mapper.put("SUSE Linux Enterprise 10(64-bit)", VirtualMachineGuestOsIdentifier.suse64Guest);
-		s_mapper.put("SUSE Linux Enterprise 10(32-bit)", VirtualMachineGuestOsIdentifier.suseGuest);
-		s_mapper.put("Other SUSE Linux(32-bit)", VirtualMachineGuestOsIdentifier.suseGuest);
-		s_mapper.put("Other SUSE Linux(64-bit)", VirtualMachineGuestOsIdentifier.suse64Guest);
-		
-		s_mapper.put("CentOS 4.5 (32-bit)", VirtualMachineGuestOsIdentifier.centosGuest);
-		s_mapper.put("CentOS 4.6 (32-bit)", VirtualMachineGuestOsIdentifier.centosGuest);
-		s_mapper.put("CentOS 4.7 (32-bit)", VirtualMachineGuestOsIdentifier.centosGuest);
-		s_mapper.put("CentOS 4.8 (32-bit)", VirtualMachineGuestOsIdentifier.centosGuest);
-		s_mapper.put("CentOS 5.0 (32-bit)", VirtualMachineGuestOsIdentifier.centosGuest);
-		s_mapper.put("CentOS 5.0 (64-bit)", VirtualMachineGuestOsIdentifier.centos64Guest);
-		s_mapper.put("CentOS 5.1 (32-bit)", VirtualMachineGuestOsIdentifier.centosGuest);
-		s_mapper.put("CentOS 5.1 (64-bit)", VirtualMachineGuestOsIdentifier.centos64Guest);
-		s_mapper.put("CentOS 5.2 (32-bit)", VirtualMachineGuestOsIdentifier.centosGuest);
-		s_mapper.put("CentOS 5.2 (64-bit)", VirtualMachineGuestOsIdentifier.centos64Guest);
-		s_mapper.put("CentOS 5.3 (32-bit)", VirtualMachineGuestOsIdentifier.centosGuest);
-		s_mapper.put("CentOS 5.3 (64-bit)", VirtualMachineGuestOsIdentifier.centos64Guest);
-		s_mapper.put("CentOS 5.4 (32-bit)", VirtualMachineGuestOsIdentifier.centosGuest);
-		s_mapper.put("CentOS 5.4 (64-bit)", VirtualMachineGuestOsIdentifier.centos64Guest);
-		s_mapper.put("CentOS 5.5 (32-bit)", VirtualMachineGuestOsIdentifier.centosGuest);
-		s_mapper.put("CentOS 5.5 (64-bit)", VirtualMachineGuestOsIdentifier.centos64Guest);
-		s_mapper.put("CentOS 5.6 (32-bit)", VirtualMachineGuestOsIdentifier.centosGuest);
-		s_mapper.put("CentOS 5.6 (64-bit)", VirtualMachineGuestOsIdentifier.centos64Guest);
-		s_mapper.put("CentOS 6.0 (32-bit)", VirtualMachineGuestOsIdentifier.centosGuest);
-		s_mapper.put("CentOS 6.0 (64-bit)", VirtualMachineGuestOsIdentifier.centos64Guest);
-		s_mapper.put("Other CentOS (32-bit)", VirtualMachineGuestOsIdentifier.centosGuest);
-		s_mapper.put("Other CentOS (64-bit)", VirtualMachineGuestOsIdentifier.centos64Guest);
-		
-		s_mapper.put("Red Hat Enterprise Linux 2", VirtualMachineGuestOsIdentifier.rhel2Guest);
-		s_mapper.put("Red Hat Enterprise Linux 3(32-bit)", VirtualMachineGuestOsIdentifier.rhel3Guest);
-		s_mapper.put("Red Hat Enterprise Linux 3(64-bit)", VirtualMachineGuestOsIdentifier.rhel3_64Guest);
-		s_mapper.put("Red Hat Enterprise Linux 4(32-bit)", VirtualMachineGuestOsIdentifier.rhel4Guest);
-		s_mapper.put("Red Hat Enterprise Linux 4(64-bit)", VirtualMachineGuestOsIdentifier.rhel4_64Guest);
-		s_mapper.put("Red Hat Enterprise Linux 5(32-bit)", VirtualMachineGuestOsIdentifier.rhel5Guest);
-		s_mapper.put("Red Hat Enterprise Linux 5(64-bit)", VirtualMachineGuestOsIdentifier.rhel5_64Guest);
-		s_mapper.put("Red Hat Enterprise Linux 6(32-bit)", VirtualMachineGuestOsIdentifier.rhel6Guest);
-		s_mapper.put("Red Hat Enterprise Linux 6(64-bit)", VirtualMachineGuestOsIdentifier.rhel6_64Guest);
-		
-		s_mapper.put("Red Hat Enterprise Linux 4.5 (32-bit)", VirtualMachineGuestOsIdentifier.rhel4Guest);
-		s_mapper.put("Red Hat Enterprise Linux 4.6 (32-bit)", VirtualMachineGuestOsIdentifier.rhel4Guest);
-		s_mapper.put("Red Hat Enterprise Linux 4.7 (32-bit)", VirtualMachineGuestOsIdentifier.rhel4Guest);
-		s_mapper.put("Red Hat Enterprise Linux 4.8 (32-bit)", VirtualMachineGuestOsIdentifier.rhel4Guest);
-		s_mapper.put("Red Hat Enterprise Linux 5.0(32-bit)", VirtualMachineGuestOsIdentifier.rhel5Guest);
-		s_mapper.put("Red Hat Enterprise Linux 5.0(64-bit)", VirtualMachineGuestOsIdentifier.rhel5_64Guest);
-		s_mapper.put("Red Hat Enterprise Linux 5.1(32-bit)", VirtualMachineGuestOsIdentifier.rhel5Guest);
-		s_mapper.put("Red Hat Enterprise Linux 5.1(64-bit)", VirtualMachineGuestOsIdentifier.rhel5_64Guest);
-		s_mapper.put("Red Hat Enterprise Linux 5.2(32-bit)", VirtualMachineGuestOsIdentifier.rhel5Guest);
-		s_mapper.put("Red Hat Enterprise Linux 5.2(64-bit)", VirtualMachineGuestOsIdentifier.rhel5_64Guest);
-		s_mapper.put("Red Hat Enterprise Linux 5.3(32-bit)", VirtualMachineGuestOsIdentifier.rhel5Guest);
-		s_mapper.put("Red Hat Enterprise Linux 5.3(64-bit)", VirtualMachineGuestOsIdentifier.rhel5_64Guest);
-		s_mapper.put("Red Hat Enterprise Linux 5.4(32-bit)", VirtualMachineGuestOsIdentifier.rhel5Guest);
-		s_mapper.put("Red Hat Enterprise Linux 5.4(64-bit)", VirtualMachineGuestOsIdentifier.rhel5_64Guest);
-		
-		s_mapper.put("Ubuntu 8.04 (32-bit)", VirtualMachineGuestOsIdentifier.ubuntuGuest);
-		s_mapper.put("Ubuntu 8.04 (64-bit)", VirtualMachineGuestOsIdentifier.ubuntu64Guest);
-		s_mapper.put("Ubuntu 8.10 (32-bit)", VirtualMachineGuestOsIdentifier.ubuntuGuest);
-		s_mapper.put("Ubuntu 8.10 (64-bit)", VirtualMachineGuestOsIdentifier.ubuntu64Guest);
-		s_mapper.put("Ubuntu 9.04 (32-bit)", VirtualMachineGuestOsIdentifier.ubuntuGuest);
-		s_mapper.put("Ubuntu 9.04 (64-bit)", VirtualMachineGuestOsIdentifier.ubuntu64Guest);
-		s_mapper.put("Ubuntu 9.10 (32-bit)", VirtualMachineGuestOsIdentifier.ubuntuGuest);
-		s_mapper.put("Ubuntu 9.10 (64-bit)", VirtualMachineGuestOsIdentifier.ubuntu64Guest);
-		s_mapper.put("Ubuntu 10.04 (32-bit)", VirtualMachineGuestOsIdentifier.ubuntuGuest);
-		s_mapper.put("Ubuntu 10.04 (64-bit)", VirtualMachineGuestOsIdentifier.ubuntu64Guest);
-		s_mapper.put("Ubuntu 10.10 (32-bit)", VirtualMachineGuestOsIdentifier.ubuntuGuest);
-		s_mapper.put("Ubuntu 10.10 (64-bit)", VirtualMachineGuestOsIdentifier.ubuntu64Guest);
-		s_mapper.put("Other Ubuntu (32-bit)", VirtualMachineGuestOsIdentifier.ubuntuGuest);
-		s_mapper.put("Other Ubuntu (64-bit)", VirtualMachineGuestOsIdentifier.ubuntu64Guest);
-
-		s_mapper.put("Other 2.6x Linux (32-bit)", VirtualMachineGuestOsIdentifier.other26xLinuxGuest);
-		s_mapper.put("Other 2.6x Linux (64-bit)", VirtualMachineGuestOsIdentifier.other26xLinux64Guest);
-		s_mapper.put("Other Linux (32-bit)", VirtualMachineGuestOsIdentifier.otherLinuxGuest);
-		s_mapper.put("Other Linux (64-bit)", VirtualMachineGuestOsIdentifier.otherLinux64Guest);
-		
-		s_mapper.put("Other (32-bit)", VirtualMachineGuestOsIdentifier.otherGuest);
-		s_mapper.put("Other (64-bit)", VirtualMachineGuestOsIdentifier.otherGuest64);
+		s_mapper.put("DOS", VirtualMachineGuestOsIdentifier.DOS_GUEST);
+		s_mapper.put("OS/2", VirtualMachineGuestOsIdentifier.OS_2_GUEST);
+
+		s_mapper.put("Windows 3.1", VirtualMachineGuestOsIdentifier.WIN_31_GUEST);
+		s_mapper.put("Windows 95", VirtualMachineGuestOsIdentifier.WIN_95_GUEST);
+		s_mapper.put("Windows 98", VirtualMachineGuestOsIdentifier.WIN_98_GUEST);
+		s_mapper.put("Windows NT 4", VirtualMachineGuestOsIdentifier.WIN_NT_GUEST);
+		s_mapper.put("Windows XP (32-bit)", VirtualMachineGuestOsIdentifier.WIN_XP_PRO_GUEST);
+		s_mapper.put("Windows XP (64-bit)", VirtualMachineGuestOsIdentifier.WIN_XP_PRO_64_GUEST);
+		s_mapper.put("Windows XP SP2 (32-bit)", VirtualMachineGuestOsIdentifier.WIN_XP_PRO_GUEST);
+		s_mapper.put("Windows XP SP3 (32-bit)", VirtualMachineGuestOsIdentifier.WIN_XP_PRO_GUEST);
+		s_mapper.put("Windows Vista (32-bit)", VirtualMachineGuestOsIdentifier.WIN_VISTA_GUEST);
+		s_mapper.put("Windows Vista (64-bit)", VirtualMachineGuestOsIdentifier.WIN_VISTA_64_GUEST);
+		s_mapper.put("Windows 7 (32-bit)", VirtualMachineGuestOsIdentifier.WINDOWS_7_GUEST);
+		s_mapper.put("Windows 7 (64-bit)", VirtualMachineGuestOsIdentifier.WINDOWS_7_64_GUEST);
+
+		s_mapper.put("Windows 2000 Professional", VirtualMachineGuestOsIdentifier.WIN_2000_PRO_GUEST);
+		s_mapper.put("Windows 2000 Server", VirtualMachineGuestOsIdentifier.WIN_2000_SERV_GUEST);
+		s_mapper.put("Windows 2000 Server SP4 (32-bit)", VirtualMachineGuestOsIdentifier.WIN_2000_SERV_GUEST);
+		s_mapper.put("Windows 2000 Advanced Server", VirtualMachineGuestOsIdentifier.WIN_2000_ADV_SERV_GUEST);
+
+		s_mapper.put("Windows Server 2003 Enterprise Edition(32-bit)", VirtualMachineGuestOsIdentifier.WIN_NET_ENTERPRISE_GUEST);
+		s_mapper.put("Windows Server 2003 Enterprise Edition(64-bit)", VirtualMachineGuestOsIdentifier.WIN_NET_ENTERPRISE_64_GUEST);
+		s_mapper.put("Windows Server 2008 R2 (64-bit)", VirtualMachineGuestOsIdentifier.WIN_LONGHORN_64_GUEST);
+		s_mapper.put("Windows Server 2003 DataCenter Edition(32-bit)", VirtualMachineGuestOsIdentifier.WIN_NET_DATACENTER_GUEST);
+		s_mapper.put("Windows Server 2003 DataCenter Edition(64-bit)", VirtualMachineGuestOsIdentifier.WIN_NET_DATACENTER_64_GUEST);
+		s_mapper.put("Windows Server 2003 Standard Edition(32-bit)", VirtualMachineGuestOsIdentifier.WIN_NET_STANDARD_GUEST);
+		s_mapper.put("Windows Server 2003 Standard Edition(64-bit)", VirtualMachineGuestOsIdentifier.WIN_NET_STANDARD_64_GUEST);
+		s_mapper.put("Windows Server 2003 Web Edition", VirtualMachineGuestOsIdentifier.WIN_NET_WEB_GUEST);
+		s_mapper.put("Microsoft Small Bussiness Server 2003", VirtualMachineGuestOsIdentifier.WIN_NET_BUSINESS_GUEST);
+
+		s_mapper.put("Windows Server 2008 (32-bit)", VirtualMachineGuestOsIdentifier.WIN_LONGHORN_GUEST);
+		s_mapper.put("Windows Server 2008 (64-bit)", VirtualMachineGuestOsIdentifier.WIN_LONGHORN_64_GUEST);
+
+        s_mapper.put("Windows 8", VirtualMachineGuestOsIdentifier.WINDOWS_8_GUEST);
+        s_mapper.put("Windows 8 (64 bit)", VirtualMachineGuestOsIdentifier.WINDOWS_8_64_GUEST);
+        s_mapper.put("Windows 8 Server (64 bit)", VirtualMachineGuestOsIdentifier.WINDOWS_8_SERVER_64_GUEST);
+
+		s_mapper.put("Open Enterprise Server", VirtualMachineGuestOsIdentifier.OES_GUEST);
+
+		s_mapper.put("Asianux 3(32-bit)", VirtualMachineGuestOsIdentifier.ASIANUX_3_GUEST);
+		s_mapper.put("Asianux 3(64-bit)", VirtualMachineGuestOsIdentifier.ASIANUX_3_64_GUEST);
+
+		s_mapper.put("Debian GNU/Linux 5(64-bit)", VirtualMachineGuestOsIdentifier.DEBIAN_5_64_GUEST);
+        s_mapper.put("Debian GNU/Linux 5.0 (32-bit)", VirtualMachineGuestOsIdentifier.DEBIAN_5_GUEST);
+		s_mapper.put("Debian GNU/Linux 4(32-bit)", VirtualMachineGuestOsIdentifier.DEBIAN_4_GUEST);
+		s_mapper.put("Debian GNU/Linux 4(64-bit)", VirtualMachineGuestOsIdentifier.DEBIAN_4_64_GUEST);
+
+		s_mapper.put("Novell Netware 6.x", VirtualMachineGuestOsIdentifier.NETWARE_6_GUEST);
+		s_mapper.put("Novell Netware 5.1", VirtualMachineGuestOsIdentifier.NETWARE_5_GUEST);
+
+		s_mapper.put("Sun Solaris 10(32-bit)", VirtualMachineGuestOsIdentifier.SOLARIS_10_GUEST);
+		s_mapper.put("Sun Solaris 10(64-bit)", VirtualMachineGuestOsIdentifier.SOLARIS_10_64_GUEST);
+		s_mapper.put("Sun Solaris 9(Experimental)", VirtualMachineGuestOsIdentifier.SOLARIS_9_GUEST);
+		s_mapper.put("Sun Solaris 8(Experimental)", VirtualMachineGuestOsIdentifier.SOLARIS_8_GUEST);
+
+		s_mapper.put("FreeBSD (32-bit)", VirtualMachineGuestOsIdentifier.FREEBSD_GUEST);
+		s_mapper.put("FreeBSD (64-bit)", VirtualMachineGuestOsIdentifier.FREEBSD_64_GUEST);
+
+		s_mapper.put("SCO OpenServer 5", VirtualMachineGuestOsIdentifier.OTHER_GUEST);
+		s_mapper.put("SCO UnixWare 7", VirtualMachineGuestOsIdentifier.UNIX_WARE_7_GUEST);
+
+		s_mapper.put("SUSE Linux Enterprise 8(32-bit)", VirtualMachineGuestOsIdentifier.SUSE_GUEST);
+		s_mapper.put("SUSE Linux Enterprise 8(64-bit)", VirtualMachineGuestOsIdentifier.SUSE_64_GUEST);
+		s_mapper.put("SUSE Linux Enterprise 9(32-bit)", VirtualMachineGuestOsIdentifier.SUSE_GUEST);
+		s_mapper.put("SUSE Linux Enterprise 9(64-bit)", VirtualMachineGuestOsIdentifier.SUSE_64_GUEST);
+		s_mapper.put("SUSE Linux Enterprise 10(32-bit)", VirtualMachineGuestOsIdentifier.SUSE_GUEST);
+		s_mapper.put("SUSE Linux Enterprise 10(64-bit)", VirtualMachineGuestOsIdentifier.SUSE_64_GUEST);
+		s_mapper.put("SUSE Linux Enterprise 10(32-bit)", VirtualMachineGuestOsIdentifier.SUSE_GUEST);
+		s_mapper.put("Other SUSE Linux(32-bit)", VirtualMachineGuestOsIdentifier.SUSE_GUEST);
+		s_mapper.put("Other SUSE Linux(64-bit)", VirtualMachineGuestOsIdentifier.SUSE_64_GUEST);
+
+		s_mapper.put("CentOS 4.5 (32-bit)", VirtualMachineGuestOsIdentifier.CENTOS_GUEST);
+		s_mapper.put("CentOS 4.6 (32-bit)", VirtualMachineGuestOsIdentifier.CENTOS_GUEST);
+		s_mapper.put("CentOS 4.7 (32-bit)", VirtualMachineGuestOsIdentifier.CENTOS_GUEST);
+		s_mapper.put("CentOS 4.8 (32-bit)", VirtualMachineGuestOsIdentifier.CENTOS_GUEST);
+		s_mapper.put("CentOS 5.0 (32-bit)", VirtualMachineGuestOsIdentifier.CENTOS_GUEST);
+		s_mapper.put("CentOS 5.0 (64-bit)", VirtualMachineGuestOsIdentifier.CENTOS_64_GUEST);
+		s_mapper.put("CentOS 5.1 (32-bit)", VirtualMachineGuestOsIdentifier.CENTOS_GUEST);
+		s_mapper.put("CentOS 5.1 (64-bit)", VirtualMachineGuestOsIdentifier.CENTOS_64_GUEST);
+		s_mapper.put("CentOS 5.2 (32-bit)", VirtualMachineGuestOsIdentifier.CENTOS_GUEST);
+		s_mapper.put("CentOS 5.2 (64-bit)", VirtualMachineGuestOsIdentifier.CENTOS_64_GUEST);
+		s_mapper.put("CentOS 5.3 (32-bit)", VirtualMachineGuestOsIdentifier.CENTOS_GUEST);
+		s_mapper.put("CentOS 5.3 (64-bit)", VirtualMachineGuestOsIdentifier.CENTOS_64_GUEST);
+		s_mapper.put("CentOS 5.4 (32-bit)", VirtualMachineGuestOsIdentifier.CENTOS_GUEST);
+		s_mapper.put("CentOS 5.4 (64-bit)", VirtualMachineGuestOsIdentifier.CENTOS_64_GUEST);
+		s_mapper.put("CentOS 5.5 (32-bit)", VirtualMachineGuestOsIdentifier.CENTOS_GUEST);
+		s_mapper.put("CentOS 5.5 (64-bit)", VirtualMachineGuestOsIdentifier.CENTOS_64_GUEST);
+		s_mapper.put("CentOS 5.6 (32-bit)", VirtualMachineGuestOsIdentifier.CENTOS_GUEST);
+		s_mapper.put("CentOS 5.6 (64-bit)", VirtualMachineGuestOsIdentifier.CENTOS_64_GUEST);
+		s_mapper.put("CentOS 6.0 (32-bit)", VirtualMachineGuestOsIdentifier.CENTOS_GUEST);
+		s_mapper.put("CentOS 6.0 (64-bit)", VirtualMachineGuestOsIdentifier.CENTOS_64_GUEST);
+		s_mapper.put("Other CentOS (32-bit)", VirtualMachineGuestOsIdentifier.CENTOS_GUEST);
+		s_mapper.put("Other CentOS (64-bit)", VirtualMachineGuestOsIdentifier.CENTOS_64_GUEST);
+
+		s_mapper.put("Red Hat Enterprise Linux 2", VirtualMachineGuestOsIdentifier.RHEL_2_GUEST);
+		s_mapper.put("Red Hat Enterprise Linux 3(32-bit)", VirtualMachineGuestOsIdentifier.RHEL_3_GUEST);
+		s_mapper.put("Red Hat Enterprise Linux 3(64-bit)", VirtualMachineGuestOsIdentifier.RHEL_3_64_GUEST);
+		s_mapper.put("Red Hat Enterprise Linux 4(32-bit)", VirtualMachineGuestOsIdentifier.RHEL_4_GUEST);
+		s_mapper.put("Red Hat Enterprise Linux 4(64-bit)", VirtualMachineGuestOsIdentifier.RHEL_4_64_GUEST);
+		s_mapper.put("Red Hat Enterprise Linux 5(32-bit)", VirtualMachineGuestOsIdentifier.RHEL_5_GUEST);
+		s_mapper.put("Red Hat Enterprise Linux 5(64-bit)", VirtualMachineGuestOsIdentifier.RHEL_5_64_GUEST);
+		s_mapper.put("Red Hat Enterprise Linux 6(32-bit)", VirtualMachineGuestOsIdentifier.RHEL_6_GUEST);
+		s_mapper.put("Red Hat Enterprise Linux 6(64-bit)", VirtualMachineGuestOsIdentifier.RHEL_6_64_GUEST);
+
+		s_mapper.put("Red Hat Enterprise Linux 4.5 (32-bit)", VirtualMachineGuestOsIdentifier.RHEL_4_GUEST);
+		s_mapper.put("Red Hat Enterprise Linux 4.6 (32-bit)", VirtualMachineGuestOsIdentifier.RHEL_4_GUEST);
+		s_mapper.put("Red Hat Enterprise Linux 4.7 (32-bit)", VirtualMachineGuestOsIdentifier.RHEL_4_GUEST);
+		s_mapper.put("Red Hat Enterprise Linux 4.8 (32-bit)", VirtualMachineGuestOsIdentifier.RHEL_4_GUEST);
+		s_mapper.put("Red Hat Enterprise Linux 5.0(32-bit)", VirtualMachineGuestOsIdentifier.RHEL_5_GUEST);
+		s_mapper.put("Red Hat Enterprise Linux 5.0(64-bit)", VirtualMachineGuestOsIdentifier.RHEL_5_64_GUEST);
+		s_mapper.put("Red Hat Enterprise Linux 5.1(32-bit)", VirtualMachineGuestOsIdentifier.RHEL_5_GUEST);
+		s_mapper.put("Red Hat Enterprise Linux 5.1(64-bit)", VirtualMachineGuestOsIdentifier.RHEL_5_64_GUEST);
+		s_mapper.put("Red Hat Enterprise Linux 5.2(32-bit)", VirtualMachineGuestOsIdentifier.RHEL_5_GUEST);
+		s_mapper.put("Red Hat Enterprise Linux 5.2(64-bit)", VirtualMachineGuestOsIdentifier.RHEL_5_64_GUEST);
+		s_mapper.put("Red Hat Enterprise Linux 5.3(32-bit)", VirtualMachineGuestOsIdentifier.RHEL_5_GUEST);
+		s_mapper.put("Red Hat Enterprise Linux 5.3(64-bit)", VirtualMachineGuestOsIdentifier.RHEL_5_64_GUEST);
+		s_mapper.put("Red Hat Enterprise Linux 5.4(32-bit)", VirtualMachineGuestOsIdentifier.RHEL_5_GUEST);
+		s_mapper.put("Red Hat Enterprise Linux 5.4(64-bit)", VirtualMachineGuestOsIdentifier.RHEL_5_64_GUEST);
+
+		s_mapper.put("Ubuntu 8.04 (32-bit)", VirtualMachineGuestOsIdentifier.UBUNTU_GUEST);
+		s_mapper.put("Ubuntu 8.04 (64-bit)", VirtualMachineGuestOsIdentifier.UBUNTU_64_GUEST);
+		s_mapper.put("Ubuntu 8.10 (32-bit)", VirtualMachineGuestOsIdentifier.UBUNTU_GUEST);
+		s_mapper.put("Ubuntu 8.10 (64-bit)", VirtualMachineGuestOsIdentifier.UBUNTU_64_GUEST);
+		s_mapper.put("Ubuntu 9.04 (32-bit)", VirtualMachineGuestOsIdentifier.UBUNTU_GUEST);
+		s_mapper.put("Ubuntu 9.04 (64-bit)", VirtualMachineGuestOsIdentifier.UBUNTU_64_GUEST);
+		s_mapper.put("Ubuntu 9.10 (32-bit)", VirtualMachineGuestOsIdentifier.UBUNTU_GUEST);
+		s_mapper.put("Ubuntu 9.10 (64-bit)", VirtualMachineGuestOsIdentifier.UBUNTU_64_GUEST);
+		s_mapper.put("Ubuntu 10.04 (32-bit)", VirtualMachineGuestOsIdentifier.UBUNTU_GUEST);
+		s_mapper.put("Ubuntu 10.04 (64-bit)", VirtualMachineGuestOsIdentifier.UBUNTU_64_GUEST);
+		s_mapper.put("Ubuntu 10.10 (32-bit)", VirtualMachineGuestOsIdentifier.UBUNTU_GUEST);
+		s_mapper.put("Ubuntu 10.10 (64-bit)", VirtualMachineGuestOsIdentifier.UBUNTU_64_GUEST);
+		s_mapper.put("Other Ubuntu (32-bit)", VirtualMachineGuestOsIdentifier.UBUNTU_GUEST);
+		s_mapper.put("Other Ubuntu (64-bit)", VirtualMachineGuestOsIdentifier.UBUNTU_64_GUEST);
+
+		s_mapper.put("Other 2.6x Linux (32-bit)", VirtualMachineGuestOsIdentifier.OTHER_26_X_LINUX_GUEST);
+		s_mapper.put("Other 2.6x Linux (64-bit)", VirtualMachineGuestOsIdentifier.OTHER_26_X_LINUX_64_GUEST);
+		s_mapper.put("Other Linux (32-bit)", VirtualMachineGuestOsIdentifier.OTHER_LINUX_GUEST);
+		s_mapper.put("Other Linux (64-bit)", VirtualMachineGuestOsIdentifier.OTHER_LINUX_64_GUEST);
+
+		s_mapper.put("Other (32-bit)", VirtualMachineGuestOsIdentifier.OTHER_GUEST);
+		s_mapper.put("Other (64-bit)", VirtualMachineGuestOsIdentifier.OTHER_GUEST_64);
 	}
-	
+
 	public static VirtualMachineGuestOsIdentifier getGuestOsIdentifier(String guestOsName) {
 		return s_mapper.get(guestOsName);
 	}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/780ac2a9/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareHelper.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareHelper.java b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareHelper.java
index 47ff8e2..8e6947f 100644
--- a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareHelper.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareHelper.java
@@ -23,6 +23,7 @@ import java.io.IOException;
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.io.StringWriter;
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Random;
@@ -69,38 +70,38 @@ import com.vmware.vim25.VirtualVmxnet3;
 
 public class VmwareHelper {
     private static final Logger s_logger = Logger.getLogger(VmwareHelper.class);
-	
+
 	public static VirtualDevice prepareNicDevice(VirtualMachineMO vmMo, ManagedObjectReference
morNetwork, VirtualEthernetCardType deviceType,
 		String portGroupName, String macAddress, int deviceNumber, int contextNumber, boolean conntected,
boolean connectOnStart) throws Exception {
-		
+
 		VirtualEthernetCard nic;
 		switch(deviceType) {
 		case E1000 :
 			nic = new VirtualE1000();
 			break;
-			
+
 		case PCNet32 :
 			nic = new VirtualPCNet32();
 			break;
-			
+
 		case Vmxnet2 :
 			nic = new VirtualVmxnet2();
 			break;
-			
+
 		case Vmxnet3 :
 			nic = new VirtualVmxnet3();
 			break;
-			
+
 		default :
 			assert(false);
 			nic = new VirtualE1000();
 		}
-		
+
 		VirtualEthernetCardNetworkBackingInfo nicBacking = new VirtualEthernetCardNetworkBackingInfo();
 		nicBacking.setDeviceName(portGroupName);
 		nicBacking.setNetwork(morNetwork);
 		nic.setBacking(nicBacking);
-		
+
 		VirtualDeviceConnectInfo connectInfo = new VirtualDeviceConnectInfo();
 		connectInfo.setAllowGuestControl(true);
 		connectInfo.setConnected(conntected);
@@ -112,7 +113,7 @@ public class VmwareHelper {
 		nic.setKey(-contextNumber);
 		return nic;
 	}
-	
+
     public static VirtualDevice prepareDvNicDevice(VirtualMachineMO vmMo, ManagedObjectReference
morNetwork, VirtualEthernetCardType deviceType,
             String dvPortGroupName, String dvSwitchUuid, String macAddress, int deviceNumber,
int contextNumber, boolean conntected, boolean connectOnStart) throws Exception {
 
@@ -144,7 +145,7 @@ public class VmwareHelper {
         final VirtualDeviceConnectInfo connectInfo = new VirtualDeviceConnectInfo();
 
         dvPortConnection.setSwitchUuid(dvSwitchUuid);
-        dvPortConnection.setPortgroupKey(morNetwork.get_value());
+        dvPortConnection.setPortgroupKey(morNetwork.getValue());
         dvPortBacking.setPort(dvPortConnection);
         nic.setBacking(dvPortBacking);
         nic.setKey(30);
@@ -162,13 +163,13 @@ public class VmwareHelper {
     }
 
 	// vmdkDatastorePath: [datastore name] vmdkFilePath
-	public static VirtualDevice prepareDiskDevice(VirtualMachineMO vmMo, int controllerKey,
String vmdkDatastorePath, 
+	public static VirtualDevice prepareDiskDevice(VirtualMachineMO vmMo, int controllerKey,
String vmdkDatastorePath,
 		int sizeInMb, ManagedObjectReference morDs, int deviceNumber, int contextNumber) throws
Exception {
-		
+
 		VirtualDisk disk = new VirtualDisk();
 
 		VirtualDiskFlatVer2BackingInfo backingInfo = new VirtualDiskFlatVer2BackingInfo();
-        backingInfo.setDiskMode(VirtualDiskMode.persistent.toString());
+        backingInfo.setDiskMode(VirtualDiskMode.PERSISTENT.toString());
     	backingInfo.setThinProvisioned(true);
     	backingInfo.setEagerlyScrub(false);
         backingInfo.setDatastore(morDs);
@@ -180,7 +181,7 @@ public class VmwareHelper {
         if(deviceNumber < 0)
         	deviceNumber = vmMo.getNextDeviceNumber(controllerKey);
 		disk.setControllerKey(controllerKey);
-		
+
 	    disk.setKey(-contextNumber);
 	    disk.setUnitNumber(deviceNumber);
 	    disk.setCapacityInKB(sizeInMb*1024);
@@ -189,19 +190,19 @@ public class VmwareHelper {
 	    connectInfo.setConnected(true);
 	    connectInfo.setStartConnected(true);
 	    disk.setConnectable(connectInfo);
-	    
+
 	    return disk;
 	}
-	
+
 	// vmdkDatastorePath: [datastore name] vmdkFilePath, create delta disk based on disk from
template
-	public static VirtualDevice prepareDiskDevice(VirtualMachineMO vmMo, int controllerKey,
String vmdkDatastorePath, 
+	public static VirtualDevice prepareDiskDevice(VirtualMachineMO vmMo, int controllerKey,
String vmdkDatastorePath,
 		int sizeInMb, ManagedObjectReference morDs, VirtualDisk templateDisk, int deviceNumber,
int contextNumber) throws Exception {
-		
+
 		assert(templateDisk != null);
 		VirtualDeviceBackingInfo parentBacking = templateDisk.getBacking();
 		assert(parentBacking != null);
-		
-		// TODO Not sure if we need to check if the disk in template and the new disk needs to
share the 
+
+		// TODO Not sure if we need to check if the disk in template and the new disk needs to
share the
 		// same datastore
 		VirtualDisk disk = new VirtualDisk();
 		if(parentBacking instanceof VirtualDiskFlatVer1BackingInfo) {
@@ -242,13 +243,13 @@ public class VmwareHelper {
 		} else {
 			throw new Exception("Unsupported disk backing: " + parentBacking.getClass().getCanonicalName());
 		}
-		
+
 		if(controllerKey < 0)
 			controllerKey = vmMo.getIDEDeviceControllerKey();
 		disk.setControllerKey(controllerKey);
 		if(deviceNumber < 0)
 			deviceNumber = vmMo.getNextDeviceNumber(controllerKey);
-		
+
 	    disk.setKey(-contextNumber);
 	    disk.setUnitNumber(deviceNumber);
 	    disk.setCapacityInKB(sizeInMb*1024);
@@ -259,94 +260,94 @@ public class VmwareHelper {
 	    disk.setConnectable(connectInfo);
 	    return disk;
 	}
-	
+
 	// vmdkDatastorePath: [datastore name] vmdkFilePath
-	public static VirtualDevice prepareDiskDevice(VirtualMachineMO vmMo, int controllerKey,
String vmdkDatastorePathChain[], 
+	public static VirtualDevice prepareDiskDevice(VirtualMachineMO vmMo, int controllerKey,
String vmdkDatastorePathChain[],
 		ManagedObjectReference morDs, int deviceNumber, int contextNumber) throws Exception {
-		
+
 		assert(vmdkDatastorePathChain != null);
 		assert(vmdkDatastorePathChain.length >= 1);
-	
+
 		VirtualDisk disk = new VirtualDisk();
-		
+
 		VirtualDiskFlatVer2BackingInfo backingInfo = new VirtualDiskFlatVer2BackingInfo();
         backingInfo.setDatastore(morDs);
         backingInfo.setFileName(vmdkDatastorePathChain[0]);
-        backingInfo.setDiskMode(VirtualDiskMode.persistent.toString());
+        backingInfo.setDiskMode(VirtualDiskMode.PERSISTENT.toString());
         if(vmdkDatastorePathChain.length > 1) {
         	String[] parentDisks = new String[vmdkDatastorePathChain.length - 1];
         	for(int i = 0; i < vmdkDatastorePathChain.length - 1; i++)
         		parentDisks[i] = vmdkDatastorePathChain[i + 1];
-        	
+
         	setParentBackingInfo(backingInfo, morDs, parentDisks);
         }
-        
+
         disk.setBacking(backingInfo);
 
 		if(controllerKey < 0)
 			controllerKey = vmMo.getIDEDeviceControllerKey();
         if(deviceNumber < 0)
         	deviceNumber = vmMo.getNextDeviceNumber(controllerKey);
-		
+
 		disk.setControllerKey(controllerKey);
 	    disk.setKey(-contextNumber);
 	    disk.setUnitNumber(deviceNumber);
-	    
+
 	    VirtualDeviceConnectInfo connectInfo = new VirtualDeviceConnectInfo();
 	    connectInfo.setConnected(true);
 	    connectInfo.setStartConnected(true);
 	    disk.setConnectable(connectInfo);
-	    
+
 	    return disk;
 	}
-	
-	public static VirtualDevice prepareDiskDevice(VirtualMachineMO vmMo, int controllerKey,

-		Pair<String, ManagedObjectReference>[] vmdkDatastorePathChain, 
+
+	public static VirtualDevice prepareDiskDevice(VirtualMachineMO vmMo, int controllerKey,
+		Pair<String, ManagedObjectReference>[] vmdkDatastorePathChain,
 		int deviceNumber, int contextNumber) throws Exception {
-		
+
 		assert(vmdkDatastorePathChain != null);
 		assert(vmdkDatastorePathChain.length >= 1);
-	
+
 		VirtualDisk disk = new VirtualDisk();
-		
+
 		VirtualDiskFlatVer2BackingInfo backingInfo = new VirtualDiskFlatVer2BackingInfo();
         backingInfo.setDatastore(vmdkDatastorePathChain[0].second());
         backingInfo.setFileName(vmdkDatastorePathChain[0].first());
-        backingInfo.setDiskMode(VirtualDiskMode.persistent.toString());
+        backingInfo.setDiskMode(VirtualDiskMode.PERSISTENT.toString());
         if(vmdkDatastorePathChain.length > 1) {
         	Pair<String, ManagedObjectReference>[] parentDisks = new Pair[vmdkDatastorePathChain.length
- 1];
         	for(int i = 0; i < vmdkDatastorePathChain.length - 1; i++)
         		parentDisks[i] = vmdkDatastorePathChain[i + 1];
-        	
+
         	setParentBackingInfo(backingInfo, parentDisks);
         }
-        
+
         disk.setBacking(backingInfo);
 
 		if(controllerKey < 0)
 			controllerKey = vmMo.getIDEDeviceControllerKey();
         if(deviceNumber < 0)
         	deviceNumber = vmMo.getNextDeviceNumber(controllerKey);
-		
+
 		disk.setControllerKey(controllerKey);
 	    disk.setKey(-contextNumber);
 	    disk.setUnitNumber(deviceNumber);
-	    
+
 	    VirtualDeviceConnectInfo connectInfo = new VirtualDeviceConnectInfo();
 	    connectInfo.setConnected(true);
 	    connectInfo.setStartConnected(true);
 	    disk.setConnectable(connectInfo);
-	    
+
 	    return disk;
 	}
-	
-	private static void setParentBackingInfo(VirtualDiskFlatVer2BackingInfo backingInfo, 
+
+	private static void setParentBackingInfo(VirtualDiskFlatVer2BackingInfo backingInfo,
 		ManagedObjectReference morDs, String[] parentDatastorePathList) {
-		
+
 		VirtualDiskFlatVer2BackingInfo parentBacking = new VirtualDiskFlatVer2BackingInfo();
 		parentBacking.setDatastore(morDs);
-		parentBacking.setDiskMode(VirtualDiskMode.persistent.toString());
-		
+		parentBacking.setDiskMode(VirtualDiskMode.PERSISTENT.toString());
+
 		if(parentDatastorePathList.length > 1) {
 			String[] nextDatastorePathList = new String[parentDatastorePathList.length -1];
 			for(int i = 0; i < parentDatastorePathList.length -1; i++)
@@ -354,17 +355,17 @@ public class VmwareHelper {
 			setParentBackingInfo(parentBacking, morDs, nextDatastorePathList);
 		}
 		parentBacking.setFileName(parentDatastorePathList[0]);
-		
+
 		backingInfo.setParent(parentBacking);
 	}
-	
-	private static void setParentBackingInfo(VirtualDiskFlatVer2BackingInfo backingInfo, 
+
+	private static void setParentBackingInfo(VirtualDiskFlatVer2BackingInfo backingInfo,
 		Pair<String, ManagedObjectReference>[] parentDatastorePathList) {
-		
+
 		VirtualDiskFlatVer2BackingInfo parentBacking = new VirtualDiskFlatVer2BackingInfo();
 		parentBacking.setDatastore(parentDatastorePathList[0].second());
-		parentBacking.setDiskMode(VirtualDiskMode.persistent.toString());
-		
+		parentBacking.setDiskMode(VirtualDiskMode.PERSISTENT.toString());
+
 		if(parentDatastorePathList.length > 1) {
 			Pair<String, ManagedObjectReference>[] nextDatastorePathList = new Pair[parentDatastorePathList.length
-1];
 			for(int i = 0; i < parentDatastorePathList.length -1; i++)
@@ -372,33 +373,33 @@ public class VmwareHelper {
 			setParentBackingInfo(parentBacking, nextDatastorePathList);
 		}
 		parentBacking.setFileName(parentDatastorePathList[0].first());
-		
+
 		backingInfo.setParent(parentBacking);
 	}
-	
+
 	public static Pair<VirtualDevice, Boolean> prepareIsoDevice(VirtualMachineMO vmMo,
String isoDatastorePath, ManagedObjectReference morDs,
 		boolean connect, boolean connectAtBoot, int deviceNumber, int contextNumber) throws Exception
{
-		
+
 		boolean newCdRom = false;
 		VirtualCdrom cdRom = (VirtualCdrom )vmMo.getIsoDevice();
 		if(cdRom == null) {
 			newCdRom = true;
 			cdRom = new VirtualCdrom();
-			
+
 			assert(vmMo.getIDEDeviceControllerKey() >= 0);
 			cdRom.setControllerKey(vmMo.getIDEDeviceControllerKey());
 			if(deviceNumber < 0)
 				deviceNumber = vmMo.getNextIDEDeviceNumber();
 
-			cdRom.setUnitNumber(deviceNumber);            
+			cdRom.setUnitNumber(deviceNumber);
 			cdRom.setKey(-contextNumber);
 		}
-		
+
 	    VirtualDeviceConnectInfo cInfo = new VirtualDeviceConnectInfo();
 	    cInfo.setConnected(connect);
 	    cInfo.setStartConnected(connectAtBoot);
 	    cdRom.setConnectable(cInfo);
-	    
+
         if(isoDatastorePath != null) {
             VirtualCdromIsoBackingInfo backingInfo = new VirtualCdromIsoBackingInfo();
 	        backingInfo.setFileName(isoDatastorePath);
@@ -409,32 +410,32 @@ public class VmwareHelper {
     		backingInfo.setDeviceName("");
     		cdRom.setBacking(backingInfo);
         }
-		
+
 		return new Pair<VirtualDevice, Boolean>(cdRom, newCdRom);
 	}
-	
+
 	public static VirtualDisk getRootDisk(VirtualDisk[] disks) {
 		if(disks.length == 1)
 			return disks[0];
-		
+
 		// TODO : for now, always return the first disk as root disk
 		return disks[0];
 	}
-	
-	public static ManagedObjectReference findSnapshotInTree(VirtualMachineSnapshotTree[] snapTree,
String findName) {
+
+	public static ManagedObjectReference findSnapshotInTree(List<VirtualMachineSnapshotTree>
snapTree, String findName) {
 		assert(findName != null);
-		
+
 		ManagedObjectReference snapMor = null;
-		if (snapTree == null) 
+		if (snapTree == null)
 			return snapMor;
-		
-		for (int i = 0; i < snapTree.length && snapMor == null; i++) {
-			VirtualMachineSnapshotTree node = snapTree[i];
+
+		for (int i = 0; i < snapTree.size() && snapMor == null; i++) {
+			VirtualMachineSnapshotTree node = snapTree.get(i);
 
 			if (node.getName().equals(findName)) {
 				snapMor = node.getSnapshot();
 			} else {
-				VirtualMachineSnapshotTree[] childTree = node.getChildSnapshotList();
+				List<VirtualMachineSnapshotTree> childTree = node.getChildSnapshotList();
 				snapMor = findSnapshotInTree(childTree, findName);
 			}
 		}
@@ -442,94 +443,94 @@ public class VmwareHelper {
 	}
 
 	public static byte[] composeDiskInfo(List<Ternary<String, String, String>> diskInfo,
int disksInChain, boolean includeBase) throws IOException {
-		
+
 		BufferedWriter out = null;
 		ByteArrayOutputStream bos = new ByteArrayOutputStream();
-		
+
 		try {
-			out = new BufferedWriter(new OutputStreamWriter(bos)); 
+			out = new BufferedWriter(new OutputStreamWriter(bos));
 
 			out.write("disksInChain=" + disksInChain);
 			out.newLine();
-			
+
 			out.write("disksInBackup=" + diskInfo.size());
 			out.newLine();
-			
+
 			out.write("baseDiskIncluded=" + includeBase);
 			out.newLine();
-			
+
 			int seq = disksInChain - 1;
 			for(Ternary<String, String, String> item : diskInfo) {
 				out.write(String.format("disk%d.fileName=%s", seq, item.first()));
 				out.newLine();
-				
+
 				out.write(String.format("disk%d.baseFileName=%s", seq, item.second()));
 				out.newLine();
-				
+
 				if(item.third() != null) {
 					out.write(String.format("disk%d.parentFileName=%s", seq, item.third()));
 					out.newLine();
 				}
 				seq--;
 			}
-			
+
 			out.newLine();
 		} finally {
 			if(out != null)
 				out.close();
 		}
-		
+
 		return bos.toByteArray();
 	}
-	
-	public static OptionValue[] composeVncOptions(OptionValue[] optionsToMerge, 
+
+	public static OptionValue[] composeVncOptions(OptionValue[] optionsToMerge,
 		boolean enableVnc, String vncPassword, int vncPort, String keyboardLayout) {
-		
+
 		int numOptions = 3;
 		boolean needKeyboardSetup = false;
 		if(keyboardLayout != null && !keyboardLayout.isEmpty()) {
 			numOptions++;
 			needKeyboardSetup = true;
 		}
-		
+
 		if(optionsToMerge != null)
 			numOptions += optionsToMerge.length;
-		
+
 		OptionValue[] options = new OptionValue[numOptions];
 		int i = 0;
 		if(optionsToMerge != null) {
 			for(int j = 0; j < optionsToMerge.length; j++)
 				options[i++] = optionsToMerge[j];
 		}
-			
+
 		options[i] = new OptionValue();
 		options[i].setKey("RemoteDisplay.vnc.enabled");
 		options[i++].setValue(enableVnc ? "true" : "false");
-  
+
 		options[i] = new OptionValue();
 		options[i].setKey("RemoteDisplay.vnc.password");
 		options[i++].setValue(vncPassword);
-  
+
 		options[i] = new OptionValue();
 		options[i].setKey("RemoteDisplay.vnc.port");
 		options[i++].setValue("" + vncPort);
-		
+
 		if(needKeyboardSetup) {
 			options[i] = new OptionValue();
 			options[i].setKey("RemoteDisplay.vnc.keymap");
 			options[i++].setValue(keyboardLayout);
 		}
-		
+
 		return options;
 	}
-	
+
 	public static void setBasicVmConfig(VirtualMachineConfigSpec vmConfig, int cpuCount, int
cpuSpeedMHz, int cpuReservedMhz,
 		int memoryMB, int memoryReserveMB, String guestOsIdentifier, boolean limitCpuUse) {
-		
+
 		// VM config basics
 		vmConfig.setMemoryMB((long)memoryMB);
 		vmConfig.setNumCPUs(cpuCount);
-		
+
 		ResourceAllocationInfo cpuInfo = new ResourceAllocationInfo();
 		if (limitCpuUse) {
 			cpuInfo.setLimit((long)(cpuSpeedMHz * cpuCount));
@@ -539,52 +540,52 @@ public class VmwareHelper {
 
 		cpuInfo.setReservation((long)cpuReservedMhz);
 		vmConfig.setCpuAllocation(cpuInfo);
-		
+
 		ResourceAllocationInfo memInfo = new ResourceAllocationInfo();
 		memInfo.setLimit((long)memoryMB);
 		memInfo.setReservation((long)memoryReserveMB);
 		vmConfig.setMemoryAllocation(memInfo);
-		
+
 		vmConfig.setGuestId(guestOsIdentifier);
 	}
-	
+
 	public static ManagedObjectReference getDiskDeviceDatastore(VirtualDisk diskDevice) throws
Exception {
 		VirtualDeviceBackingInfo backingInfo = diskDevice.getBacking();
 		assert(backingInfo instanceof VirtualDiskFlatVer2BackingInfo);
 		return ((VirtualDiskFlatVer2BackingInfo)backingInfo).getDatastore();
 	}
-	
+
 	public static Object getPropValue(ObjectContent oc, String name) {
-		DynamicProperty[] props = oc.getPropSet();
-		
+		List<DynamicProperty> props = oc.getPropSet();
+
 		for(DynamicProperty prop : props) {
 			if(prop.getName().equalsIgnoreCase(name))
 				return prop.getVal();
 		}
-		
+
 		return null;
 	}
-	
+
 	public static String getFileExtension(String fileName, String defaultExtension) {
 		int pos = fileName.lastIndexOf('.');
 		if(pos < 0)
 			return defaultExtension;
-		
-		return fileName.substring(pos); 
+
+		return fileName.substring(pos);
 	}
-	
+
 	public static boolean isSameHost(String ipAddress, String destName) {
 		// TODO : may need to do DNS lookup to compare IP address exactly
 		return ipAddress.equals(destName);
 	}
-	
+
 	public static void deleteVolumeVmdkFiles(DatastoreMO dsMo, String volumeName, DatacenterMO
dcMo) throws Exception {
         String volumeDatastorePath = String.format("[%s] %s.vmdk", dsMo.getName(), volumeName);
         dsMo.deleteFile(volumeDatastorePath, dcMo.getMor(), true);
-        
+
         volumeDatastorePath = String.format("[%s] %s-flat.vmdk", dsMo.getName(), volumeName);
         dsMo.deleteFile(volumeDatastorePath, dcMo.getMor(), true);
-	    
+
         volumeDatastorePath = String.format("[%s] %s-delta.vmdk", dsMo.getName(), volumeName);
         dsMo.deleteFile(volumeDatastorePath, dcMo.getMor(), true);
 	}
@@ -592,38 +593,50 @@ public class VmwareHelper {
 	public static String getExceptionMessage(Throwable e) {
 		return getExceptionMessage(e, false);
 	}
-	
+
 	public static String getExceptionMessage(Throwable e, boolean printStack) {
-		if(e instanceof MethodFault) {
-			final StringWriter writer = new StringWriter();
-			writer.append("Exception: " + e.getClass().getName() + "\n");
-			writer.append("message: " + ((MethodFault)e).getFaultString() + "\n");
-			
-			if(printStack) {
-				writer.append("stack: ");
-				e.printStackTrace(new PrintWriter(writer));
-			}
-			return writer.toString();
-		}
-		
+	    //TODO: in vim 5.1, exceptions do not have a base exception class, MethodFault becomes
a FaultInfo that we can only get
+	    // from individual exception through getFaultInfo, so we have to use reflection here
to get MethodFault information.
+	    try{
+	        Class cls = e.getClass();
+	        Method mth = cls.getDeclaredMethod("getFaultInfo", null);
+	        if ( mth != null ){
+	            Object fault = mth.invoke(e, null);
+	            if (fault instanceof MethodFault) {
+	                final StringWriter writer = new StringWriter();
+	                writer.append("Exception: " + fault.getClass().getName() + "\n");
+	                writer.append("message: " + ((MethodFault)fault).getFaultMessage() + "\n");
+
+	                if(printStack) {
+	                    writer.append("stack: ");
+	                    e.printStackTrace(new PrintWriter(writer));
+	                }
+	                return writer.toString();
+	            }
+	        }
+	    }
+	    catch (Exception ex){
+
+	    }
+
 		return ExceptionUtil.toString(e, printStack);
 	}
-	
+
 	public static VirtualMachineMO pickOneVmOnRunningHost(List<VirtualMachineMO> vmList,
boolean bFirstFit) throws Exception {
 		List<VirtualMachineMO> candidates = new ArrayList<VirtualMachineMO>();
-		
+
     	for(VirtualMachineMO vmMo : vmList) {
     		HostMO hostMo = vmMo.getRunningHost();
     		if(hostMo.isHyperHostConnected())
     			candidates.add(vmMo);
     	}
-    	
+
     	if(candidates.size() == 0)
     		return null;
-    	
+
     	if(bFirstFit)
     		return candidates.get(0);
-    	
+
     	Random random = new Random();
     	return candidates.get(random.nextInt(candidates.size()));
 	}


Mime
View raw message