Check for the Dynamips version.

This commit is contained in:
grossmj 2014-04-09 15:59:51 -06:00
parent 2bb3c0b466
commit 0110fe33d4
2 changed files with 5 additions and 1 deletions

View File

@ -75,7 +75,7 @@ class DynamipsHypervisor(object):
raise DynamipsError("Could not connect to server: {}".format(e))
try:
self._version = self.send("hypervisor version")[0][4:]
self._version = self.send("hypervisor version")[0].split("-", 1)[0]
except IndexError:
self._version = "Unknown"

View File

@ -20,6 +20,8 @@ Manages Dynamips hypervisors (load-balancing etc.)
"""
from .hypervisor import Hypervisor
from .dynamips_error import DynamipsError
from pkg_resources import parse_version
import socket
import time
import logging
@ -471,6 +473,8 @@ class HypervisorManager(object):
log.info("hypervisor {}:{} has successfully started".format(hypervisor.host, hypervisor.port))
hypervisor.connect()
if parse_version(hypervisor.version) < parse_version('0.2.11'):
raise DynamipsError("Dynamips version must be >= 0.2.11, detected version is {}".format(hypervisor.version))
hypervisor.baseconsole = self._base_console_port
hypervisor.baseaux = self._base_aux_port
hypervisor.baseudp = self._current_base_udp_port