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

Stop the VMware VM if there is an error while setting up the network connections or console.

This commit is contained in:
grossmj 2016-03-23 10:54:45 -06:00
parent 39c41336db
commit 427cb05c2a

View File

@ -454,21 +454,25 @@ class VMwareVM(BaseVM):
else: else:
yield from self._control_vm("start") yield from self._control_vm("start")
if self._use_ubridge and self._ubridge_hypervisor: try:
for adapter_number in range(0, self._adapters): if self._use_ubridge and self._ubridge_hypervisor:
nio = self._ethernet_adapters[adapter_number].get_nio(0) for adapter_number in range(0, self._adapters):
if nio: nio = self._ethernet_adapters[adapter_number].get_nio(0)
yield from self._add_ubridge_connection(nio, adapter_number) if nio:
yield from self._add_ubridge_connection(nio, adapter_number)
if self._enable_remote_console and self._console is not None: if self._enable_remote_console and self._console is not None:
try: try:
if sys.platform.startswith("win"): if sys.platform.startswith("win"):
yield from wait_for_named_pipe_creation(self._get_pipe_name()) yield from wait_for_named_pipe_creation(self._get_pipe_name())
else: else:
yield from wait_for_file_creation(self._get_pipe_name()) # wait for VMware to create the pipe file. yield from wait_for_file_creation(self._get_pipe_name()) # wait for VMware to create the pipe file.
except asyncio.TimeoutError: except asyncio.TimeoutError:
raise VMwareError('Pipe file "{}" for remote console has not been created by VMware'.format(self._get_pipe_name())) raise VMwareError('Pipe file "{}" for remote console has not been created by VMware'.format(self._get_pipe_name()))
self._start_remote_console() self._start_remote_console()
except VMwareError:
yield from self.stop()
raise
if self._get_vmx_setting("vhv.enable", "TRUE"): if self._get_vmx_setting("vhv.enable", "TRUE"):
self._hw_virtualization = True self._hw_virtualization = True