1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-01 04:38:12 +00:00

Drop duplicate code when ubridge is too old

Fix #405
This commit is contained in:
Julien Duponchelle 2016-02-01 16:05:37 +01:00
parent 03414993dc
commit 98537a242a
No known key found for this signature in database
GPG Key ID: 0898C847450754FB
2 changed files with 3 additions and 5 deletions

View File

@ -330,8 +330,6 @@ class BaseVM:
yield from self._ubridge_hypervisor.start() yield from self._ubridge_hypervisor.start()
log.info("Hypervisor {}:{} has successfully started".format(self._ubridge_hypervisor.host, self._ubridge_hypervisor.port)) log.info("Hypervisor {}:{} has successfully started".format(self._ubridge_hypervisor.host, self._ubridge_hypervisor.port))
yield from self._ubridge_hypervisor.connect() yield from self._ubridge_hypervisor.connect()
if parse_version(self._ubridge_hypervisor.version) < parse_version('0.9.3'):
raise VMError("uBridge version must be >= 0.9.3, detected version is {}".format(self._ubridge_hypervisor.version))
@property @property
def hw_virtualization(self): def hw_virtualization(self):

View File

@ -119,15 +119,15 @@ class Hypervisor(UBridgeHypervisor):
@asyncio.coroutine @asyncio.coroutine
def _check_ubridge_version(self): def _check_ubridge_version(self):
""" """
Checks if the ubridge executable version is >= 0.9.1 Checks if the ubridge executable version is >= 0.9.3
""" """
try: try:
output = yield from subprocess_check_output(self._path, "-v", cwd=self._working_dir) output = yield from subprocess_check_output(self._path, "-v", cwd=self._working_dir)
match = re.search("ubridge version ([0-9a-z\.]+)", output) match = re.search("ubridge version ([0-9a-z\.]+)", output)
if match: if match:
version = match.group(1) version = match.group(1)
if parse_version(version) < parse_version("0.9.1"): if parse_version(version) < parse_version("0.9.3"):
raise UbridgeError("uBridge executable version must be >= 0.9.1") raise UbridgeError("uBridge executable version must be >= 0.9.3")
else: else:
raise UbridgeError("Could not determine uBridge version for {}".format(self._path)) raise UbridgeError("Could not determine uBridge version for {}".format(self._path))
except (OSError, subprocess.SubprocessError) as e: except (OSError, subprocess.SubprocessError) as e: