示例#1
0
文件: docker.py 项目: tfukushima/mcp
 def stop_docker_and_resume(self, signum):
     if self.state is not None and self.state.cid() is not None:
         cid = self.state.cid()
         log.info("Trying to stop Docker container: %s", cid)
         container_id = self.state.docker_id
         log.debug("Unwiring the container %s from MidoNet", container_id)
         try:
             log.info("state = %s", dir(self.state))
             midonet.unwire_container_from_midonet(container_id)
             log.debug("Successfully unwired the container %s from MidoNet "\
                       "bridge", container_id)
         except Exception as ex:
             log.error(traceback.format_exc())
         try:
             Run()(deimos.docker.stop(cid))
         except subprocess.CalledProcessError:
             pass
         return deimos.sig.Resume()
示例#2
0
文件: docker.py 项目: midonet/mcp
 def stop_docker_and_resume(self, signum):
     if self.state is not None and self.state.cid() is not None:
         cid = self.state.cid()
         log.info("Trying to stop Docker container: %s", cid)
         container_id = self.state.docker_id
         log.debug("Unwiring the container %s from MidoNet", container_id)
         try:
             log.info("state = %s", dir(self.state))
             midonet.unwire_container_from_midonet(container_id)
             log.debug("Successfully unwired the container %s from MidoNet "\
                       "bridge", container_id)
         except Exception as ex:
             log.error(traceback.format_exc())
         try:
             Run()(deimos.docker.stop(cid))
         except subprocess.CalledProcessError:
             pass
         return deimos.sig.Resume()
示例#3
0
文件: docker.py 项目: tfukushima/mcp
 def destroy(self, destroy_pb, *args):
     log.info(" ".join(args))
     container_id = destroy_pb.container_id.value
     state = deimos.state.State(self.state_root, mesos_id=container_id)
     state.await_launch()
     lk_d = state.lock("destroy", LOCK_EX)
     if state.exit() is None:
         container_id = state.docker_id
         log.debug("Unwiring the container %s from MidoNet", container_id)
         try:
             log.info("state_root = %s", dir(state))
             midonet.unwire_container_from_midonet(container_id)
             log.debug("Successfully unwired the container %s from MidoNet " \
                       "bridge", container_id)
         except Exception as ex:
             log.error(traceback.format_exc())
         Run()(deimos.docker.stop(state.cid()))
     else:
         log.info("Container is stopped")
     return 0
示例#4
0
文件: docker.py 项目: midonet/mcp
 def destroy(self, destroy_pb, *args):
     log.info(" ".join(args))
     container_id = destroy_pb.container_id.value
     state = deimos.state.State(self.state_root, mesos_id=container_id)
     state.await_launch()
     lk_d = state.lock("destroy", LOCK_EX)
     if state.exit() is None:
         container_id = state.docker_id
         log.debug("Unwiring the container %s from MidoNet", container_id)
         try:
             log.info("state_root = %s", dir(state))
             midonet.unwire_container_from_midonet(container_id)
             log.debug("Successfully unwired the container %s from MidoNet " \
                       "bridge", container_id)
         except Exception as ex:
             log.error(traceback.format_exc())
         Run()(deimos.docker.stop(state.cid()))
     else:
         log.info("Container is stopped")
     return 0