1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-24 17:28:08 +00:00

Tweak how VMware VMs are found with fallback to search in the default location for VMs.

This commit is contained in:
grossmj 2017-10-18 15:27:03 +07:00
parent 1f4b87ae9c
commit 98b201e9e5

View File

@ -680,13 +680,14 @@ class VMware(BaseManager):
# check for the right VMware version # check for the right VMware version
yield from self.check_vmware_version() yield from self.check_vmware_version()
vmware_vms = []
inventory_path = self.get_vmware_inventory_path() inventory_path = self.get_vmware_inventory_path()
if os.path.exists(inventory_path) and self.host_type != "player": if os.path.exists(inventory_path) and self.host_type != "player":
# inventory may exist for VMware player if VMware workstation has been previously installed # inventory may exist for VMware player if VMware workstation has been previously installed
return self._get_vms_from_inventory(inventory_path) vmware_vms = self._get_vms_from_inventory(inventory_path)
else: if not vmware_vms:
# VMware player has no inventory file, let's search the default location for VMs # Backup method or for VMware player which has no inventory file
# Let's search the default location for VMs
vmware_preferences_path = self.get_vmware_preferences_path() vmware_preferences_path = self.get_vmware_preferences_path()
default_vm_path = self.get_vmware_default_vm_path() default_vm_path = self.get_vmware_default_vm_path()
pairs = {} pairs = {}
@ -714,7 +715,7 @@ class VMware(BaseManager):
found = True found = True
if found is False: if found is False:
vmware_vms.append({"vmname": pairs[display_name], "vmx_path": value}) vmware_vms.append({"vmname": pairs[display_name], "vmx_path": value})
return vmware_vms return vmware_vms
@staticmethod @staticmethod
def _get_linux_vmware_binary(): def _get_linux_vmware_binary():