Esempio n. 1
0
    def test_call_zone_method_generates_exception(self):
        context = {}
        method = 'raises_exception'
        results = api.call_zone_method(context, method)

        # FIXME(sirp): for now the _error_trap code is catching errors and
        # converting them to a ("ERROR", "string") tuples. The code (and this
        # test) should eventually handle real exceptions.
        expected = [(1, ('ERROR', 'testing'))]
        self.assertEqual(expected, results)
Esempio n. 2
0
 def _call_zone_method(self, context, method, specs, zones):
     """Call novaclient zone method. Broken out for testing."""
     return api.call_zone_method(context, method, specs=specs, zones=zones)
Esempio n. 3
0
 def _call_zone_method(self, context, method, specs, zones):
     """Call novaclient zone method. Broken out for testing."""
     return api.call_zone_method(context, method, specs=specs, zones=zones)
Esempio n. 4
0
 def test_call_zone_method(self):
     context = {}
     method = 'do_something'
     results = api.call_zone_method(context, method)
     expected = [(1, 42)]
     self.assertEqual(expected, results)
Esempio n. 5
0
 def test_call_zone_method(self):
     context = {}
     method = 'do_something'
     results = api.call_zone_method(context, method)
     expected = [(1, 42)]
     self.assertEqual(expected, results)
Esempio n. 6
0
        else:
            instances = self.db.instance_get_all(context)

        if instances is None:
            instances = []
        elif not isinstance(instances, list):
            instances = [instances]

        if not recurse_zones:
            return instances

        admin_context = context.elevated()
        children = scheduler_api.call_zone_method(admin_context,
                "list",
                novaclient_collection_name="servers",
                reservation_id=reservation_id,
                project_id=project_id,
                fixed_ip=fixed_ip,
                recurse_zones=True)

        for zone, servers in children:
            for server in servers:
                # Results are ready to send to user. No need to scrub.
                server._info['_is_precooked'] = True
                instances.append(server._info)
        return instances

    def _cast_compute_message(self, method, context, instance_id, host=None,
                              params=None):
        """Generic handler for RPC casts to compute.