Deprecate conductor's compute_reboot() interface

We no longer need to run reboot() actions through conductor to avoid
the instance action database hit that compute_api.stop() would
entail. This deprecates that interface and makes the manager use
the compute_api method directly.

Related to blueprint compute-api-objects

Change-Id: I86c70fb33b023d55d88a64de1fa6c39c10fd7b01
This commit is contained in:
Dan Smith 2013-08-07 10:39:17 -07:00
parent ca0883c88b
commit f2cfdd765c
8 changed files with 12 additions and 32 deletions

View File

@ -341,9 +341,6 @@ class LocalAPI(object):
def compute_unrescue(self, context, instance):
return self._manager.compute_unrescue(context, instance)
def compute_reboot(self, context, instance, reboot_type):
return self._manager.compute_reboot(context, instance, reboot_type)
class LocalComputeTaskAPI(object):
def __init__(self):

View File

@ -565,6 +565,8 @@ class ConductorManager(manager.Manager):
updates['obj_what_changed'] = objinst.obj_what_changed()
return updates, result
# NOTE(danms): This method is now deprecated and can be removed in
# v2.0 of the RPC API
def compute_reboot(self, context, instance, reboot_type):
self.compute_api.reboot(context, instance, reboot_type)

View File

@ -508,12 +508,6 @@ class ConductorAPI(nova.openstack.common.rpc.proxy.RpcProxy):
objmethod=objmethod, args=args, kwargs=kwargs)
return self.call(context, msg, version='1.50')
def compute_reboot(self, context, instance, reboot_type):
instance_p = jsonutils.to_primitive(instance)
msg = self.make_msg('compute_reboot', instance=instance_p,
reboot_type=reboot_type)
return self.call(context, msg, version='1.53')
class ComputeTaskAPI(nova.openstack.common.rpc.proxy.RpcProxy):
"""Client side of the conductor 'compute' namespaced RPC API

View File

@ -611,13 +611,6 @@ class _BaseTestCase(object):
self.mox.ReplayAll()
self.conductor.compute_unrescue(self.context, 'instance')
def test_compute_reboot(self):
self.mox.StubOutWithMock(self.conductor_manager.compute_api, 'reboot')
self.conductor_manager.compute_api.reboot(self.context, 'instance',
'fake-type')
self.mox.ReplayAll()
self.conductor.compute_reboot(self.context, 'instance', 'fake-type')
class ConductorTestCase(_BaseTestCase, test.TestCase):
"""Conductor Manager Tests."""

View File

@ -28,7 +28,6 @@ from oslo.config import cfg
from nova.compute import api as compute_api
from nova.compute import power_state
from nova.compute import task_states
from nova.conductor import api as conductor_api
from nova import context
from nova import db
from nova import exception
@ -285,10 +284,8 @@ class VMwareAPIVMTestCase(test.TestCase):
def test_poll_rebooting_instances(self):
self.mox.StubOutWithMock(compute_api.API, 'reboot')
self.mox.StubOutWithMock(conductor_api.API, 'compute_reboot')
conductor_api.API.compute_reboot(mox.IgnoreArg(), mox.IgnoreArg(),
mox.IgnoreArg())
# mox will detect if compute_api.API.reboot is called unexpectedly
compute_api.API.reboot(mox.IgnoreArg(), mox.IgnoreArg(),
mox.IgnoreArg())
self.mox.ReplayAll()
self._create_vm()
instances = [self.instance]

View File

@ -32,7 +32,6 @@ from nova.compute import flavors
from nova.compute import power_state
from nova.compute import task_states
from nova.compute import vm_states
from nova.conductor import api as conductor_api
from nova import context
from nova import crypto
from nova import db
@ -1214,10 +1213,8 @@ class XenAPIVMTestCase(stubs.XenAPITestBase):
def test_poll_rebooting_instances(self):
self.mox.StubOutWithMock(compute_api.API, 'reboot')
self.mox.StubOutWithMock(conductor_api.API, 'compute_reboot')
conductor_api.API.compute_reboot(mox.IgnoreArg(), mox.IgnoreArg(),
mox.IgnoreArg())
# mox will detect if compute_api.API.reboot is called unexpectedly
compute_api.API.reboot(mox.IgnoreArg(), mox.IgnoreArg(),
mox.IgnoreArg())
self.mox.ReplayAll()
instance = self._create_instance()
instances = [instance]

View File

@ -31,9 +31,9 @@ import uuid
from oslo.config import cfg
from nova import block_device
from nova import compute
from nova.compute import power_state
from nova.compute import task_states
from nova import conductor
from nova import context as nova_context
from nova import exception
from nova.openstack.common import excutils
@ -78,7 +78,7 @@ class VMwareVMOps(object):
def __init__(self, session, virtapi, volumeops, cluster=None):
"""Initializer."""
self.conductor_api = conductor.API()
self.compute_api = compute.API()
self._session = session
self._virtapi = virtapi
self._volumeops = volumeops
@ -1047,7 +1047,7 @@ class VMwareVMOps(object):
for instance in instances:
LOG.info(_("Automatically hard rebooting"), instance=instance)
self.conductor_api.compute_reboot(ctxt, instance, "HARD")
self.compute_api.reboot(ctxt, instance, "HARD")
def get_info(self, instance):
"""Return data about the VM instance."""

View File

@ -30,12 +30,12 @@ import netaddr
from oslo.config import cfg
from nova import block_device
from nova import compute
from nova.compute import flavors
from nova.compute import power_state
from nova.compute import task_states
from nova.compute import vm_mode
from nova.compute import vm_states
from nova import conductor
from nova import context as nova_context
from nova import exception
from nova.openstack.common import excutils
@ -163,7 +163,7 @@ class VMOps(object):
Management class for VM-related tasks
"""
def __init__(self, session, virtapi):
self.conductor_api = conductor.API()
self.compute_api = compute.API()
self._session = session
self._virtapi = virtapi
self._volumeops = volumeops.VolumeOps(self._session)
@ -1391,7 +1391,7 @@ class VMOps(object):
for instance in instances:
LOG.info(_("Automatically hard rebooting"), instance=instance)
self.conductor_api.compute_reboot(ctxt, instance, "HARD")
self.compute_api.reboot(ctxt, instance, "HARD")
def get_info(self, instance, vm_ref=None):
"""Return data about VM instance."""