Merge "Remove useless get_instance_faults()"
This commit is contained in:
commit
e1f0575041
@ -22,7 +22,6 @@
|
||||
"compute:update_instance_metadata": "",
|
||||
"compute:delete_instance_metadata": "",
|
||||
|
||||
"compute:get_instance_faults": "",
|
||||
"compute:get_diagnostics": "",
|
||||
"compute:get_instance_diagnostics": "",
|
||||
|
||||
|
@ -3233,18 +3233,6 @@ class API(base.Base):
|
||||
diff=diff)
|
||||
return _metadata
|
||||
|
||||
def get_instance_faults(self, context, instances):
|
||||
"""Get all faults for a list of instance uuids."""
|
||||
|
||||
if not instances:
|
||||
return {}
|
||||
|
||||
for instance in instances:
|
||||
check_policy(context, 'get_instance_faults', instance)
|
||||
|
||||
uuids = [instance.uuid for instance in instances]
|
||||
return self.db.instance_fault_get_by_instance_uuids(context, uuids)
|
||||
|
||||
def _get_root_bdm(self, context, instance, bdms=None):
|
||||
if bdms is None:
|
||||
bdms = objects.BlockDeviceMappingList.get_by_instance_uuid(
|
||||
|
@ -8469,30 +8469,6 @@ class ComputeAPITestCase(BaseTestCase):
|
||||
self.compute_api.update_instance_metadata, self.context,
|
||||
instance, "key")
|
||||
|
||||
def test_get_instance_faults(self):
|
||||
# Get an instances latest fault.
|
||||
instance = self._create_fake_instance_obj()
|
||||
|
||||
fault_fixture = {
|
||||
'code': 404,
|
||||
'instance_uuid': instance['uuid'],
|
||||
'message': "HTTPNotFound",
|
||||
'details': "Stock details for test",
|
||||
'created_at': datetime.datetime(2010, 10, 10, 12, 0, 0),
|
||||
}
|
||||
|
||||
def return_fault(_ctxt, instance_uuids):
|
||||
return dict.fromkeys(instance_uuids, [fault_fixture])
|
||||
|
||||
self.stubs.Set(nova.db,
|
||||
'instance_fault_get_by_instance_uuids',
|
||||
return_fault)
|
||||
|
||||
_context = context.get_admin_context()
|
||||
output = self.compute_api.get_instance_faults(_context, [instance])
|
||||
expected = {instance['uuid']: [fault_fixture]}
|
||||
self.assertEqual(output, expected)
|
||||
|
||||
@staticmethod
|
||||
def _parse_db_block_device_mapping(bdm_ref):
|
||||
attr_list = ('delete_on_termination', 'device_name', 'no_device',
|
||||
@ -10887,20 +10863,6 @@ class ComputePolicyTestCase(BaseTestCase):
|
||||
self.assertRaises(exception.PolicyNotAuthorized,
|
||||
self.compute_api.get_all, self.context)
|
||||
|
||||
def test_get_instance_faults(self):
|
||||
instance1 = self._create_fake_instance_obj()
|
||||
instance2 = self._create_fake_instance_obj()
|
||||
instances = [instance1, instance2]
|
||||
|
||||
rules = {
|
||||
"compute:get_instance_faults": [["false:false"]],
|
||||
}
|
||||
self.policy.set_rules(rules)
|
||||
|
||||
self.assertRaises(exception.PolicyNotAuthorized,
|
||||
self.compute_api.get_instance_faults,
|
||||
context.get_admin_context(), instances)
|
||||
|
||||
def test_force_host_fail(self):
|
||||
rules = {"compute:create": [],
|
||||
"compute:create:forced_host": [["role:fake"]],
|
||||
|
@ -36,7 +36,6 @@ policy_data = """
|
||||
"compute:update_instance_metadata": "",
|
||||
"compute:delete_instance_metadata": "",
|
||||
|
||||
"compute:get_instance_faults": "",
|
||||
"compute:get_diagnostics": "",
|
||||
"compute:get_instance_diagnostics": "",
|
||||
|
||||
|
@ -433,7 +433,6 @@ class RealRolePolicyTestCase(test.NoDBTestCase):
|
||||
"compute:detach_volume",
|
||||
"compute:backup",
|
||||
"compute:get_instance_diagnostics",
|
||||
"compute:get_instance_faults",
|
||||
"compute:get_instance_metadata",
|
||||
"compute:get_lock",
|
||||
"compute:get_mks_console",
|
||||
|
Loading…
x
Reference in New Issue
Block a user