40
40
ctxt = context.RequestContext('fake_user', 'fake_project')
41
41
rpcapi = scheduler_rpcapi.SchedulerAPI()
42
42
expected_retval = 'foo' if method == 'call' else None
43
expected_version = kwargs.pop('version', rpcapi.BASE_RPC_API_VERSION)
43
44
expected_msg = rpcapi.make_msg(method, **kwargs)
44
expected_msg['version'] = rpcapi.RPC_API_VERSION
45
expected_msg['version'] = expected_version
45
46
if rpc_method == 'cast' and method == 'run_instance':
46
47
kwargs['call'] = False
66
67
def test_run_instance_call(self):
67
68
self._test_scheduler_api('run_instance', rpc_method='call',
68
topic='fake_topic', request_spec='fake_request_spec',
69
request_spec='fake_request_spec',
69
70
admin_password='pw', injected_files='fake_injected_files',
70
71
requested_networks='fake_requested_networks',
71
72
is_first_time=True, filter_properties='fake_filter_properties',
73
reservations=None, version='1.2')
74
75
def test_run_instance_cast(self):
75
76
self._test_scheduler_api('run_instance', rpc_method='cast',
76
topic='fake_topic', request_spec='fake_request_spec',
77
request_spec='fake_request_spec',
77
78
admin_password='pw', injected_files='fake_injected_files',
78
79
requested_networks='fake_requested_networks',
79
80
is_first_time=True, filter_properties='fake_filter_properties',
81
reservations=None, version='1.2')
82
83
def test_prep_resize(self):
83
84
self._test_scheduler_api('prep_resize', rpc_method='cast',
84
topic='fake_topic', instance_uuid='fake_uuid',
85
instance_type_id='fake_type_id', image='fake_image',
86
update_db='fake_update_db', request_spec='fake_request_spec',
87
filter_properties='fake_props')
85
instance='fake_instance',
86
instance_type='fake_type', image='fake_image',
87
request_spec='fake_request_spec',
88
filter_properties='fake_props', reservations=list('fake_res'),
89
91
def test_show_host_resources(self):
90
92
self._test_scheduler_api('show_host_resources', rpc_method='call',
94
96
self._test_scheduler_api('live_migration', rpc_method='call',
95
97
block_migration='fake_block_migration',
96
98
disk_over_commit='fake_disk_over_commit',
97
instance_id='fake_id', dest='fake_dest', topic='fake_topic')
99
instance='fake_instance', dest='fake_dest', topic='fake_topic',
99
102
def test_update_service_capabilities(self):
100
103
self._test_scheduler_api('update_service_capabilities',
101
104
rpc_method='fanout_cast', service_name='fake_name',
102
105
host='fake_host', capabilities='fake_capabilities')
104
def test_get_host_list(self):
105
self._test_scheduler_api('get_host_list', rpc_method='call')