Exemplo n.º 1
0
 def setUp(self):
     super(TestAPI, self).setUp()
     self.compute_api = api.API(self.context)
     self.container = objects.Container(self.context,
                                        **utils.get_test_container())
     self.network = objects.Network(self.context,
                                    **utils.get_test_network())
Exemplo n.º 2
0
    def setUp(self):
        super(TestAPI, self).setUp()
        p = mock.patch('zun.scheduler.client.query.SchedulerClient')
        p.start()
        self.addCleanup(p.stop)

        self.compute_api = api.API(self.context)
        self.container = objects.Container(self.context,
                                           **utils.get_test_container())
        self.network = objects.ZunNetwork(self.context,
                                          **utils.get_test_network())
Exemplo n.º 3
0
 def heal_with_rebuilding_container(self, context, container):
     compute_api = zun_compute.API(context)
     rebuild_status = [consts.CREATED, consts.RUNNING, consts.STOPPED]
     try:
         if (container.auto_heal and
                 container.status in rebuild_status):
             context.project_id = container.project_id
             compute_api.container_rebuild(context, container)
         else:
             LOG.warning("Container %s was recorded in DB but "
                         "missing in docker", container.uuid)
             container.status = consts.ERROR
             msg = "No such container:%s in docker" % \
                   (container.container_id)
             container.status_reason = six.text_type(msg)
             container.save(context)
     except Exception as e:
         LOG.warning("heal container with rebuilding failed, "
                     "err code: %s", e)
Exemplo n.º 4
0
 def before(self, state):
     context = state.request.context
     state.request.compute_api = compute_api.API(context)