two ways to hold the states of a job in ironic
来源:互联网 发布:奥地利网络恐怖主义 编辑:程序博客网 时间:2024/05/26 15:59
具体说之前,先说一下如何在horizon中做点击link跳转至别的页面,
对于Django来说这是一个很简单的问题,有用shortcuts.redirct的,也可以在url配置之后使用一个function,在function中return HttpResponseRedirect的,总之是可以办到的,
但是在horion中,要是表格中的某一项是一个link,点击后跳转到新的页面怎么办呢。
我用上面的两种方法尝试都不能得出结论,最后发现点击创建好的instance中flavor属性(最新的horizon版本)时,会弹出一个小的template页面,里面记录flavor的信息,
既然有template网页也就可以做个href的mark,于是:
模仿instance页面即可,
{% load i18n %}
<a href="{{link}}" target="_blank" id="datum_{{ id }}" class="link-popover" rel="popover" tabindex="0" data-trigger="focus" data-content="
Clink to Jump
" data-original-title="{% blocktrans %}Jump: {{ ipaddress }}">{{ ipaddress }}{% endblocktrans %}</a>
<script type="text/javascript" charset="utf-8">
$(function () {
var $page= $("#datum_{{ id }}");
if ( $page.popover ) {
$page.popover({html:true});
}
});
</script>
有一个ironic的使用场景,horizon上点击后发送一个vendor_passthru的任务,但是这个任务十分耗时,可能需要几十分钟才能完成,然而界面上又需要立即返回,
很显然我们需要使用thread,如果是自己写一个thread,在请求返回之后主进程没了,thread也没了,不可,可以依赖ironic自己的thread pool。
J版的ironic中vendor_passthru方法不支持异步,直接根据driver或者node解析出要执行的vendor方法,然后调用返回,
K版的ironicvendor_passthru方法支持异步(async),可以定义一个异步的方法,这样界面可以做出相应,同时后台会在thread pool中添加一个线程继续运行。
对driver_vendor_passthru:
if is_async:
self._spawn_worker(vendor_func, context, **info)
if self._worker_pool.free():
return self._worker_pool.spawn(func, *args, **kwargs)
如果一个任务和conductor有关,甚至不和特定的driver相关,比如ironic的power state 是period task,这个时候,J版的ironic就没有办法了,虽然它有一部分poriod的
code,不过应该是个过渡状态,比起K版差很多,K版的使用可以做到:
1. 在conductor manager中实现自己的period_task(J版可以做到这一点)
2.在自己的driver中实现driver自己的driver_period_task
用起来方便很多。
现在我希望实现vendor_passthru的异步返回,在J版中,除了update之外,使用conductor manager的period_task外,貌似没有更好的方法。
- two ways to hold the states of a job in ironic
- getting a job while studying in the United States
- Ten Ways to Check if an Integer Is a Power Of Two in C
- Ten Ways to Check if an Integer Is a Power Of Two in C
- Ten Ways to Check if an Integer Is a Power Of Two in C
- Two ways to create a new thread of execution
- A summary of the ways to call external programs
- Fast ways in R to get the first row of a data frame grouped by an identifier
- The two ways of creating Thread
- states of the thread
- How to save states of Views in Fragments on TabChange
- 4 ways to send a PDF file to the IE Client in ASP.NET 2.0
- 4 ways to send a PDF file to the IE Client in ASP.NET 2.0
- Different ways to execute a SQL Agent job
- 10 Ways to Learn Java in just a Couple of Weeks
- giuseppe zanotti outlet a trouser legs will be able to hold her.But half of the weight loss
- Script To Release Hold In A Sales Order
- two ways of multiThread
- Surf算法原理及openCV代码实现
- 适合中文版本的Easy RM to MP3 Converter rop 过depexploit
- Caused by: java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index
- BGP中IBGP和EBGP的区别和联系
- leetcode JumpGame
- two ways to hold the states of a job in ironic
- mysql报错: Unknown character set: 'utf8mb4'
- 【java】动态代理+ThreadLocal实现数据源及事务管理
- 系统入门(9):Dalvik VM和JVM的区别
- ImageLoader学习笔记
- Codeforces Round #301 (Div. 2) A,B,C,D,E题解
- LinkedIn slashes full-year profit forecast
- C++求一个字符串中的所有回文字符串并且输出结果(字符串操作)
- 系统入门(11):Android4.0窗口机制和创建过程分析