Merge "Update get_instance_diagnostics for instance objects"

This commit is contained in:
Jenkins
2016-06-29 13:45:13 +00:00
committed by Gerrit Code Review
5 changed files with 16 additions and 12 deletions

View File

@@ -13,7 +13,7 @@
"disabled_reason": null, "disabled_reason": null,
"report_count": 1, "report_count": 1,
"forced_down": false, "forced_down": false,
"version": 12 "version": 13
} }
}, },
"event_type": "service.update", "event_type": "service.update",

View File

@@ -481,7 +481,7 @@ class ComputeVirtAPI(virtapi.VirtAPI):
class ComputeManager(manager.Manager): class ComputeManager(manager.Manager):
"""Manages the running instances from creation to destruction.""" """Manages the running instances from creation to destruction."""
target = messaging.Target(version='4.12') target = messaging.Target(version='4.13')
# How long to wait in seconds before re-issuing a shutdown # How long to wait in seconds before re-issuing a shutdown
# signal to an instance during power off. The overall # signal to an instance during power off. The overall

View File

@@ -312,6 +312,7 @@ class ComputeAPI(object):
can handle the version_cap being set to 4.11 can handle the version_cap being set to 4.11
* 4.12 - Remove migration_id from live_migration_force_complete * 4.12 - Remove migration_id from live_migration_force_complete
* 4.13 - Make get_instance_diagnostics send an instance object
''' '''
VERSION_ALIASES = { VERSION_ALIASES = {
@@ -554,13 +555,14 @@ class ComputeAPI(object):
return cctxt.call(ctxt, 'get_diagnostics', instance=instance) return cctxt.call(ctxt, 'get_diagnostics', instance=instance)
def get_instance_diagnostics(self, ctxt, instance): def get_instance_diagnostics(self, ctxt, instance):
# TODO(danms): This needs to be fixed for objects version = '4.13'
instance_p = jsonutils.to_primitive(instance) cell_client = self.get_cell_client(ctxt)
kwargs = {'instance': instance_p} if not cell_client.can_send_version(version):
version = '4.0' version = '4.0'
cctxt = self.get_cell_client(ctxt).prepare( instance = objects_base.obj_to_primitive(instance)
server=_compute_host(None, instance), version=version) cctxt = cell_client.prepare(server=_compute_host(None, instance),
return cctxt.call(ctxt, 'get_instance_diagnostics', **kwargs) version=version)
return cctxt.call(ctxt, 'get_instance_diagnostics', instance=instance)
def get_vnc_console(self, ctxt, instance, console_type): def get_vnc_console(self, ctxt, instance, console_type):
version = '4.0' version = '4.0'

View File

@@ -30,7 +30,7 @@ LOG = logging.getLogger(__name__)
# NOTE(danms): This is the global service version counter # NOTE(danms): This is the global service version counter
SERVICE_VERSION = 12 SERVICE_VERSION = 13
# NOTE(danms): This is our SERVICE_VERSION history. The idea is that any # NOTE(danms): This is our SERVICE_VERSION history. The idea is that any
@@ -79,6 +79,8 @@ SERVICE_VERSION_HISTORY = (
# Version 12: The network APIs and compute manager support a NetworkRequest # Version 12: The network APIs and compute manager support a NetworkRequest
# object where the network_id value is 'auto' or 'none'. # object where the network_id value is 'auto' or 'none'.
{'compute_rpc': '4.12'}, {'compute_rpc': '4.12'},
# Version 13: Compute RPC version 4.13
{'compute_rpc': '4.13'},
) )

View File

@@ -251,10 +251,10 @@ class ComputeRpcAPITestCase(test.NoDBTestCase):
instance=self.fake_instance_obj, version='4.0') instance=self.fake_instance_obj, version='4.0')
def test_get_instance_diagnostics(self): def test_get_instance_diagnostics(self):
expected_args = {'instance': self.fake_instance} expected_args = {'instance': self.fake_instance_obj}
self._test_compute_api('get_instance_diagnostics', 'call', self._test_compute_api('get_instance_diagnostics', 'call',
expected_args, instance=self.fake_instance_obj, expected_args, instance=self.fake_instance_obj,
version='4.0') version='4.13')
def test_get_vnc_console(self): def test_get_vnc_console(self):
self._test_compute_api('get_vnc_console', 'call', self._test_compute_api('get_vnc_console', 'call',