two ways to hold the states of a job in ironic
2015-05-01 16:47
423 查看
具体说之前,先说一下如何在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外,貌似没有更好的方法。
对于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外,貌似没有更好的方法。
相关文章推荐
- 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
- Scaling Pinterest - From 0 To 10s Of Billions Of Page Views A Month In Two Years
- my understanding of (lower bound,upper bound) binary search, in C++, thanks to two post
- Two ways to create a new thread of execution
- High Scalability - High Scalability - Scaling Pinterest - From 0 to 10s of Billions of Page Views a Month in Two Years
- It is not possible to run two different versions of ASP.NET in the same IIS process.问题的解决
- 10 Ways to Be Liked in Your Job Interview
- XAML applications can run in one of two ways
- How to detect intersection of two faces in 3D
- [ES2018] Two ways to write for-await-of
- It is not possible to run two different versions of ASP.NET in the same IIS process
- It is not possible to run two different versions of ASP.NET in the same IIS process:IIS
- 10 Ways to Learn Java in just a Couple of Weeks
- Fast ways in R to get the first row of a data frame grouped by an identifier
- [RxJS] How To get the results of two HTTP requests made in sequence
- Ten ways to improve the performance of large tables in MySQL--转载
- ORA-12012: error on auto execute of job;PLS-00306: wrong number or types ofarguments in call to
- 2.Different ways of Converting and Casting objects to different types of objects