added call to reset_network from openstack api down to vmops
This commit is contained in:
@@ -242,6 +242,20 @@ class Controller(wsgi.Controller):
|
|||||||
return faults.Fault(exc.HTTPUnprocessableEntity())
|
return faults.Fault(exc.HTTPUnprocessableEntity())
|
||||||
return exc.HTTPAccepted()
|
return exc.HTTPAccepted()
|
||||||
|
|
||||||
|
def reset_network(self, req, id):
|
||||||
|
"""
|
||||||
|
admin only operation which resets networking on an instance
|
||||||
|
|
||||||
|
"""
|
||||||
|
context = req.environ['nova.context']
|
||||||
|
try:
|
||||||
|
self.compute_api.reset_network(context, id)
|
||||||
|
except:
|
||||||
|
readable = traceback.format_exc()
|
||||||
|
LOG.exception(_("Compute.api::reset_network %s"), readable)
|
||||||
|
return faults.Fault(exc.HTTPUnprocessableEntity())
|
||||||
|
return exc.HTTPAccepted()
|
||||||
|
|
||||||
def pause(self, req, id):
|
def pause(self, req, id):
|
||||||
""" Permit Admins to Pause the server. """
|
""" Permit Admins to Pause the server. """
|
||||||
ctxt = req.environ['nova.context']
|
ctxt = req.environ['nova.context']
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
# vim: tabstop=5 shiftwidth=4 softtabstop=4
|
||||||
|
|
||||||
# Copyright 2010 United States Government as represented by the
|
# Copyright 2010 United States Government as represented by the
|
||||||
# Administrator of the National Aeronautics and Space Administration.
|
# Administrator of the National Aeronautics and Space Administration.
|
||||||
@@ -463,6 +463,13 @@ class API(base.Base):
|
|||||||
instance = self.get(context, instance_id)
|
instance = self.get(context, instance_id)
|
||||||
return instance['locked']
|
return instance['locked']
|
||||||
|
|
||||||
|
def reset_network(self, context, instance_id):
|
||||||
|
"""
|
||||||
|
resets networking on the instance
|
||||||
|
|
||||||
|
"""
|
||||||
|
self._cast_compute_message('reset_network', context, instance_id)
|
||||||
|
|
||||||
def attach_volume(self, context, instance_id, volume_id, device):
|
def attach_volume(self, context, instance_id, volume_id, device):
|
||||||
if not re.match("^/dev/[a-z]d[a-z]+$", device):
|
if not re.match("^/dev/[a-z]d[a-z]+$", device):
|
||||||
raise exception.ApiError(_("Invalid device specified: %s. "
|
raise exception.ApiError(_("Invalid device specified: %s. "
|
||||||
|
|||||||
@@ -494,6 +494,18 @@ class ComputeManager(manager.Manager):
|
|||||||
instance_ref = self.db.instance_get(context, instance_id)
|
instance_ref = self.db.instance_get(context, instance_id)
|
||||||
return instance_ref['locked']
|
return instance_ref['locked']
|
||||||
|
|
||||||
|
@checks_instance_lock
|
||||||
|
def reset_network(self, context, instance_id):
|
||||||
|
"""
|
||||||
|
resets the networking on the instance
|
||||||
|
|
||||||
|
"""
|
||||||
|
context = context.elevated()
|
||||||
|
instance_ref = self.db.instance_get(context, instance_id)
|
||||||
|
LOG.debug(_('instance %s: reset network'), instance_id,
|
||||||
|
context=context)
|
||||||
|
self.driver.reset_network(instance_ref)
|
||||||
|
|
||||||
@exception.wrap_exception
|
@exception.wrap_exception
|
||||||
def get_console_output(self, context, instance_id):
|
def get_console_output(self, context, instance_id):
|
||||||
"""Send the console output for an instance."""
|
"""Send the console output for an instance."""
|
||||||
|
|||||||
@@ -188,6 +188,10 @@ class XenAPIConnection(object):
|
|||||||
"""resume the specified instance"""
|
"""resume the specified instance"""
|
||||||
self._vmops.resume(instance, callback)
|
self._vmops.resume(instance, callback)
|
||||||
|
|
||||||
|
def reset_network(self, instance):
|
||||||
|
"""reset networking for specified instance"""
|
||||||
|
self._vmops.reset_network(instance)
|
||||||
|
|
||||||
def get_info(self, instance_id):
|
def get_info(self, instance_id):
|
||||||
"""Return data about VM instance"""
|
"""Return data about VM instance"""
|
||||||
return self._vmops.get_info(instance_id)
|
return self._vmops.get_info(instance_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user