2
0
Alessandro Pilotti 10 жил өмнө
parent
commit
a511c7aaab

+ 3 - 0
coriolis/constants.py

@@ -32,5 +32,8 @@ TASK_EVENT_INFO = "INFO"
 TASK_EVENT_WARNING = "WARNING"
 TASK_EVENT_WARNING = "WARNING"
 TASK_EVENT_ERROR = "ERROR"
 TASK_EVENT_ERROR = "ERROR"
 
 
+OS_TYPE_BSD = "bsd"
 OS_TYPE_LINUX = "linux"
 OS_TYPE_LINUX = "linux"
+OS_TYPE_OS_X = "osx"
+OS_TYPE_SOLARIS = "solaris"
 OS_TYPE_WINDOWS = "windows"
 OS_TYPE_WINDOWS = "windows"

+ 1 - 4
coriolis/providers/openstack/__init__.py

@@ -412,13 +412,10 @@ class ImportProvider(base.BaseImportProvider):
 
 
                 guest_conn_info = migr_resources.get_guest_connection_info()
                 guest_conn_info = migr_resources.get_guest_connection_info()
 
 
-
-            os_type = None
-
             self._event_manager.progress_update(
             self._event_manager.progress_update(
                 "Preparing instance for target platform")
                 "Preparing instance for target platform")
             osmorphing_manager.morph_image(guest_conn_info,
             osmorphing_manager.morph_image(guest_conn_info,
-                                           os_type,
+                                           export_info.get('os_type'),
                                            hypervisor_type,
                                            hypervisor_type,
                                            constants.PLATFORM_OPENSTACK,
                                            constants.PLATFORM_OPENSTACK,
                                            volume_devs,
                                            volume_devs,

+ 2 - 0
coriolis/providers/vmware_vsphere/__init__.py

@@ -12,6 +12,7 @@ from pyVmomi import vim
 from coriolis import constants
 from coriolis import constants
 from coriolis import exception
 from coriolis import exception
 from coriolis.providers import base
 from coriolis.providers import base
+from coriolis.providers.vmware_vsphere import guestid
 from coriolis import utils
 from coriolis import utils
 
 
 vmware_vsphere_opts = [
 vmware_vsphere_opts = [
@@ -84,6 +85,7 @@ class ExportProvider(base.BaseExportProvider):
                 not vm.config.memoryReservationLockedToMax,
                 not vm.config.memoryReservationLockedToMax,
             'name': vm.config.name,
             'name': vm.config.name,
             'guest_id': vm.config.guestId,
             'guest_id': vm.config.guestId,
+            'os_type': guestid.GUEST_ID_OS_TYPE_MAP.get(vm.config.guestId),
             'id': vm._moId,
             'id': vm._moId,
         }
         }
 
 

+ 245 - 0
coriolis/providers/vmware_vsphere/guestid.py

@@ -0,0 +1,245 @@
+from pyVmomi import vim
+
+from coriolis import constants
+
+
+GUEST_ID_OS_TYPE_MAP = {
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.winNetStandard64Guest:
+    constants.OS_TYPE_WINDOWS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.win95Guest:
+    constants.OS_TYPE_WINDOWS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.centosGuest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.other24xLinux64Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.fedoraGuest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.asianux3Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.slesGuest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.darwin11Guest:
+    constants.OS_TYPE_OS_X,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.darwin13_64Guest:
+    constants.OS_TYPE_OS_X,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.win31Guest:
+    constants.OS_TYPE_WINDOWS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.rhel3Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.openServer6Guest:
+    None,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.winVista64Guest:
+    constants.OS_TYPE_WINDOWS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.windows7Server64Guest:
+    constants.OS_TYPE_WINDOWS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.solaris6Guest:
+    constants.OS_TYPE_SOLARIS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.rhel7Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.solaris7Guest:
+    constants.OS_TYPE_SOLARIS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.debian6_64Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.debian7_64Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.winLonghorn64Guest:
+    constants.OS_TYPE_WINDOWS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.darwin11_64Guest:
+    constants.OS_TYPE_OS_X,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.mandrakeGuest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.winVistaGuest:
+    constants.OS_TYPE_WINDOWS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.windows7Guest:
+    constants.OS_TYPE_WINDOWS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.sles10_64Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.windows7_64Guest:
+    constants.OS_TYPE_WINDOWS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.solaris10_64Guest:
+    constants.OS_TYPE_SOLARIS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.winNTGuest:
+    constants.OS_TYPE_WINDOWS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.sles12_64Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.winNetDatacenter64Guest:
+    constants.OS_TYPE_WINDOWS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.win98Guest:
+    constants.OS_TYPE_WINDOWS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.winNetWebGuest:
+    constants.OS_TYPE_WINDOWS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.genericLinuxGuest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.darwin10_64Guest:
+    constants.OS_TYPE_OS_X,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.netware6Guest:
+    None,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.debian7Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.freebsd64Guest:
+    constants.OS_TYPE_BSD,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.solaris10Guest:
+    constants.OS_TYPE_SOLARIS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.other24xLinuxGuest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.windows8Server64Guest:
+    constants.OS_TYPE_WINDOWS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.fedora64Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.debian6Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.win2000AdvServGuest:
+    constants.OS_TYPE_WINDOWS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.nld9Guest:
+    None,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.asianux4_64Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.rhel7_64Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.darwin12_64Guest:
+    constants.OS_TYPE_OS_X,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.sles10Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.darwinGuest:
+    constants.OS_TYPE_OS_X,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.solaris8Guest:
+    constants.OS_TYPE_SOLARIS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.win2000ProGuest:
+    constants.OS_TYPE_WINDOWS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.winMeGuest:
+    constants.OS_TYPE_WINDOWS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.eComStation2Guest:
+    None,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.winNetStandardGuest:
+    constants.OS_TYPE_WINDOWS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.mandrivaGuest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.opensuse64Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.suseGuest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.windows8_64Guest:
+    constants.OS_TYPE_WINDOWS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.windowsHyperVGuest:
+    constants.OS_TYPE_WINDOWS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.rhel2Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.rhel5Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.other3xLinuxGuest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.netware4Guest:
+    None,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.other26xLinuxGuest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.opensuseGuest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.winXPHomeGuest:
+    constants.OS_TYPE_WINDOWS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.openServer5Guest:
+    None,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.winLonghornGuest:
+    constants.OS_TYPE_WINDOWS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.sles11_64Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.rhel4Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.rhel6_64Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.debian5_64Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.sles12Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.solaris11_64Guest:
+    constants.OS_TYPE_SOLARIS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.oesGuest:
+    None,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.turboLinux64Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.centos64Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.oracleLinuxGuest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.os2Guest:
+    None,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.debian4Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.otherGuest:
+    None,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.sles11Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.windows8Guest:
+    constants.OS_TYPE_WINDOWS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.netware5Guest:
+    None,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.other3xLinux64Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.mandriva64Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.other26xLinux64Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.ubuntuGuest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.winNetDatacenterGuest:
+    constants.OS_TYPE_WINDOWS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.otherGuest64:
+    None,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.suse64Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.redhatGuest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.vmkernelGuest:
+    None,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.winXPPro64Guest:
+    constants.OS_TYPE_WINDOWS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.unixWare7Guest:
+    None,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.otherLinux64Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.turboLinuxGuest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.dosGuest:
+    None,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.otherLinuxGuest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.darwin10Guest:
+    constants.OS_TYPE_OS_X,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.debian5Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.win2000ServGuest:
+    constants.OS_TYPE_WINDOWS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.rhel4_64Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.rhel5_64Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.debian4_64Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.ubuntu64Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.asianux4Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.winNetEnterprise64Guest:
+    constants.OS_TYPE_WINDOWS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.darwin64Guest:
+    constants.OS_TYPE_OS_X,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.sjdsGuest:
+    None,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.rhel6Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.freebsdGuest:
+    constants.OS_TYPE_BSD,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.eComStationGuest:
+    None,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.sles64Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.asianux3_64Guest:
+    constants.OS_TYPE_LINUX,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.winNetEnterpriseGuest:
+    constants.OS_TYPE_WINDOWS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.winXPProGuest:
+    constants.OS_TYPE_WINDOWS,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.vmkernel5Guest:
+    None,
+    vim.vm.GuestOsDescriptor.GuestOsIdentifier.solaris9Guest:
+    constants.OS_TYPE_SOLARIS,
+}