admin context in host_filter.py

Asked by fred yang

Hi,

What will be the best way to get amdin context within derived class JasonFilter(host_filter.JsonFilter) in order to perform db.get_all_by_topic(). zone_aware_scheduler._scheduler(...context...) calls into filter_hosts() without passing "context"

Thanks,
-Fred

Question information

Language:
English Edit question
Status:
Solved
For:
OpenStack Compute (nova) Edit question
Assignee:
No assignee Edit question
Solved by:
fred yang
Solved:
Last query:
Last reply:
Revision history for this message
Ed Leafe (ed-leafe) said :
#1

from nova import context
adm_context = context.get_admin_context()

Revision history for this message
fred yang (fred-yang) said :
#2

It works! Thanks,

BTW, any sample application to exercise Openstck API select() or run-instances through JsonFilter() than through existing hard-coded instance-type through ec2 API? Which we can to modify to test inherited host_filter.JsonFilter() for trusted computing pool though I have modified test_host_filter() for unit testing

Thanks,

Revision history for this message
Sandy Walsh (sandy-walsh) said :
#3

Hi Fred,

There aren't any JsonFilter examples (other than the tests) only because there are no API calls that will permit us to pass in the JSON query string. The plan was for the OS API POST /zones/boot to permit this (it parallels the POST /servers command), but that was put on hold while we prepare for our internal deadline. But, that's where I think it should go so as not to upset the apple cart.

Revision history for this message
fred yang (fred-yang) said :
#4

Got it!
Thanks,