IOS devices can be deployed on cloud instances.

This commit is contained in:
Jerry Seutter
2014-10-27 18:12:56 -06:00
parent 91894935bf
commit c4afc33ea8
7 changed files with 45 additions and 19 deletions

View File

@ -61,6 +61,7 @@ class IModule(multiprocessing.Process):
self._current_destination = None
self._current_call_id = None
self._stopping = False
self._cloud_settings = config.cloud_settings()
def _setup(self):
"""
@ -173,11 +174,13 @@ class IModule(multiprocessing.Process):
:param results: JSON results to the ZeroMQ server
"""
log.error('got here 4')
jsonrpc_response = jsonrpc.JSONRPCResponse(results, self._current_call_id)()
# add session to the response
response = [self._current_session, jsonrpc_response]
log.debug("ZeroMQ client ({}) sending: {}".format(self.name, response))
log.error("ZeroMQ client ({}) sending: {}".format(self.name, response))
log.error('got here 5')
self._stream.send_json(response)
def send_param_error(self):

View File

@ -146,16 +146,17 @@ class VM(object):
if os.path.isfile(updated_image_path):
image = updated_image_path
else:
if not os.path.exists(self.images_directory):
os.mkdir(self.images_directory)
if request.get("cloud_path", None):
# Download the image from cloud files
cloud_path = request.get("cloud_path")
full_cloud_path = "/".join((cloud_path, image))
provider = get_provider(self.cloud_settings)
provider = get_provider(self._cloud_settings)
provider.download_file(full_cloud_path, updated_image_path)
try:
if platform not in PLATFORMS:
raise DynamipsError("Unknown router platform: {}".format(platform))
@ -200,6 +201,7 @@ class VM(object):
if self._hypervisor_manager.ghost_ios_support:
self.set_ghost_ios(router)
log.error('got here 1')
except DynamipsError as e:
dynamips_stdout = ""
if hypervisor:
@ -209,6 +211,7 @@ class VM(object):
self._hypervisor_manager.hypervisors.remove(hypervisor)
dynamips_stdout = hypervisor.read_stdout()
self.send_custom_error(str(e) + dynamips_stdout)
log.error('got here 2')
return
response = {"name": router.name,
@ -216,6 +219,7 @@ class VM(object):
defaults = router.defaults()
response.update(defaults)
self._routers[router.id] = router
log.error('got here 3 {}'.format(response))
self.send_response(response)
@IModule.route("dynamips.vm.delete")