openstack team mailing list archive
-
openstack team
-
Mailing list archive
-
Message #15085
Possibility to have non python sub project in openstack
Hi,
These days I was working on a nova-scheduler translated to erlang(update
database, rpc messaging all in erlang).
Currently it can responds to the following commands the same as the
nova-scheduler in python:
euca-run-instances -n N -t m1.tiny ami-00000003
euca-run-instances -t m1.tiny ami-00000003
It is still a work in progress and code need to be beautified, functions
needs to be completed, bugs need to be fixed.
Since what I see openstack now is a complete python stack, What I like
to know is:
Is it possible to have a non python sub project in openstack?
How to make a non python project a sub project of openstack?
Will mixed language projects in openstack be helpfull or messfull?
Best Regards, Hengqing Hu
Attached some code snippet to show some of the ideas:
-module(compute_filter).
%% api
-export([host_passes/2]).
%%%-------------------------------------------------------------------
%%% api
%%%-------------------------------------------------------------------
host_passes({_, State}, FilterProperties) ->
InstanceType = proplists:get_value(<<"instance_type">>,
FilterProperties),
Topic = proplists:get_value(<<"topic">>,
State),
((Topic =/= <<"compute">>) or
(InstanceType =:= undefined) or
(InstanceType =:= null)) orelse
begin
Capabilities = proplists:get_value(<<"capabilities">>,
State),
Service = proplists:get_value(<<"service">>,
State),
CapabilitiesEnabled = proplists:get_value(<<"enabled">>,
Capabilities,
1),
is_service_up(Service) and
is_capabilities_enabled(CapabilitiesEnabled) and
satisfies_extra_specs(Capabilities, InstanceType)
end.
%%%-------------------------------------------------------------------
%%% internal functions
%%%-------------------------------------------------------------------
is_service_up(Service) ->
Disabled = proplists:get_value(<<"disabled">>,
Service),
is_service_enabled(Disabled) and
ensched_lib:service_is_up(Service).
is_capabilities_enabled(1) ->
true;
is_capabilities_enabled(0) ->
false.
is_service_enabled(1) ->
false;
is_service_enabled(0) ->
true.
satisfies_extra_specs(Capabilities, InstanceType) ->
(not lists:keymember(<<"extra_specs">>, 1, InstanceType)) orelse
begin
ExtraSpecs = proplists:get_value(<<"extra_specs">>, InstanceType),
lists:all(
fun({Key, Value})->
Value =:= proplists:get_value(Key, Capabilities)
end,
ExtraSpecs)
end.
Follow ups