mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-01-19 07:53:47 +02:00
Check for VMware lock file.
This commit is contained in:
parent
3729a10783
commit
3c4a60cd0a
@ -21,10 +21,6 @@ VMware VM instance.
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import tempfile
|
|
||||||
import json
|
|
||||||
import socket
|
|
||||||
import re
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import configparser
|
import configparser
|
||||||
import shutil
|
import shutil
|
||||||
@ -33,7 +29,6 @@ import asyncio
|
|||||||
from gns3server.utils.asyncio import wait_for_process_termination
|
from gns3server.utils.asyncio import wait_for_process_termination
|
||||||
from gns3server.utils.asyncio import monitor_process
|
from gns3server.utils.asyncio import monitor_process
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from pkg_resources import parse_version
|
|
||||||
from .vmware_error import VMwareError
|
from .vmware_error import VMwareError
|
||||||
from ..nios.nio_udp import NIOUDP
|
from ..nios.nio_udp import NIOUDP
|
||||||
from ..adapters.ethernet_adapter import EthernetAdapter
|
from ..adapters.ethernet_adapter import EthernetAdapter
|
||||||
@ -119,7 +114,7 @@ class VMwareVM(BaseVM):
|
|||||||
except OSError as e:
|
except OSError as e:
|
||||||
raise VMwareError('Could not read VMware VMX file "{}": {}'.format(self._vmx_path, e))
|
raise VMwareError('Could not read VMware VMX file "{}": {}'.format(self._vmx_path, e))
|
||||||
|
|
||||||
# first to some sanity checks
|
# first do some sanity checks
|
||||||
for adapter_number in range(0, self._adapters):
|
for adapter_number in range(0, self._adapters):
|
||||||
connected = "ethernet{}.startConnected".format(adapter_number)
|
connected = "ethernet{}.startConnected".format(adapter_number)
|
||||||
if self._get_vmx_setting(connected):
|
if self._get_vmx_setting(connected):
|
||||||
@ -331,6 +326,9 @@ class VMwareVM(BaseVM):
|
|||||||
Starts this VMware VM.
|
Starts this VMware VM.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if os.path.exists(self._vmx_path + ".lck"):
|
||||||
|
raise VMwareError("VM locked, it is either running or being edited in VMware")
|
||||||
|
|
||||||
ubridge_path = self.ubridge_path
|
ubridge_path = self.ubridge_path
|
||||||
if not ubridge_path or not os.path.isfile(ubridge_path):
|
if not ubridge_path or not os.path.isfile(ubridge_path):
|
||||||
raise VMwareError("ubridge is necessary to start a VMware VM")
|
raise VMwareError("ubridge is necessary to start a VMware VM")
|
||||||
|
Loading…
Reference in New Issue
Block a user