[yocto] webhob_db and Management Communication API

Lv, ChunhuaX chunhuax.lv at intel.com
Thu Jul 12 20:13:11 PDT 2012


hi everyone,
here are webhob database design and management communication api  Liming designed.
【webhob database】
webhob database include 14 tables:
db_role, db_operator, db_systemConfig, db_settings, db_layers, db_history,
db_builds, db_group, db_project, db_images, db_permissions,db_build_logs,
db_mgt_bitbake_servers, db_build_temp

【Management Communication API】

1.       Build Identification:
GUID:  (int) hash(user_name + project_name + build_name + timerstamp)

2.       Communication response exception code: indicate to user that the management or bitbake server is work normal or not, and try to give the reason category (TBD).
such as, exception code and error code with bitbake server through management which integrated by wdsl client com exception and management exception and other bitbake process logic error or warning.
comm_response_code:
{
‘not_responsing’ = 0x80:  can’t get response from bitbake server by unknown reason

‘bitbake_disconnect’ = 0x81: returned by wdsl client, when wdsl checked the bitbake server disconnected state.

‘bad_request’ = 0x01: no support function or bad parameters format or bad value.

‘sequence_wrong’ = 0x02: not fit build logic sequence

‘timeout’ = 0x03: response timeout

‘bitbake_error’=0x04: get the exception or error from bitbake,
}

3.       Bitbake state machine for management control:
Bitbake_states: { ‘not viable’: bitbake is not viable by any reason
‘free’: bitbake is viable and free, it means the environment of bitbake is initialized and other basic conditions for work is ready and not be bind to a user.
‘modifying’: (reserved), bitbake environment in modifying, such that add a bitbake or delete a bitbake.
‘allocating’: a short-term state maybe need to indicator a bitbake is in allocating operation, then to ‘allocated’
‘allocated’: a bitbake server is allocated for a user or bind a user
‘started’: a short-term state, after allocation operation is completed and environment is ok, such as after completed the source command, then it’s to ‘next_waiting’.
‘next_waiting’: it’s a normal state of bitbake work. It means the bitbake had completed a user operation and waiting the next request.
‘busy’: in async command processing, and not received the command completed state.
}
[cid:image001.jpg at 01CD5F93.169C36A0]

4.       Return value and parameters:

a.       The normal format of parameter is json type or string type, in different request function, it will give the different parameters, please to refer to the function definition below.

b.       Return value:

1)       Change to the async ways to get the return event.

Normal event value such as:

{‘event’:  ‘InParsingRecipe’,

 ‘value’: {

   ‘percent_of_progress’ : 60

}

}

2)       Exception code of response, for example:

{ ‘request’:  ‘set_params() request’

‘error_code’: 0x81

‘error_msg’: ‘no communication with bitbake, bitbake is disconnected’

}

3)       Normal response status:
{ ‘statuses’:
{ ‘GUID’: 11223344 ,
‘bitbke_state’: ’ next_waiting’,
},
}

5.       Functional specification


ApiFunctions:

base


get_ret_event ()

advance_settings


set_params(GUID, settings={‘variables’: []})


get_params(GUID, settings={‘variables’:[]})

app_operations


Initialize_new_build(GUID, reset_all ={‘default’: True})


generate_configuration(GUID)


generate_recipes(GUID)


generate_packages (GUID, tgts, default_task={‘build’: True})


generate_image(GUID, image, toolchain, image_packages, toolchain_packages, default_task={‘build’:True})


cancel_parse(GUID)


cancel_build(GUID, force={‘default’: True})


include_recipes(GUID, sel_recipe)


exclude_recipes(GUID, sel_recipe)


Include_packages(GUID, sel_package)


exclude_packages(GUID, sel_package)

bitbake_mn


get_bitbake_server()


reserve_bitbake_server(GUID)


modify_bitbake_server(GUID)


release_bitbake_server(GUID, bitbake_key)



Syntax:

get_ret_event ()

Parameters:

None

Return value:

type: json
for example:

a.       in normal return of user request:
for example in parse recipes, the return value as below:
if in the course of parsing recipes,
{‘event’:  ‘InParsingRecipe’,
‘values’:
{
‘persent_of_progress’: 94
}
}
If parsing recipes completed:
{‘event’:  ‘ParseRecipeCompleted’,
‘values’: {
‘persent_of_progress’: 100
}
}
If get the tree data:
{ ‘event’:  ‘GeneratedTreeData’,
‘values’: {
 ‘tree’: [{‘’} … ]
}
}

b.       if wrong by bitbake disconnect exception
{    ‘request’:  ‘set_params() request’,
‘error_code’: 0x81,
‘error_msg’: ‘no communication with bitbake, bitbake is disconnected’
}

Description:

Get the return value and other info from the value queue

Constraints:


Syntax:

set_params(GUID, settings={‘variables’: []})

Parameters:

‘settings’: (json) the list of setting variables and its value need to set
for example:  ‘settings’= { ‘varables’ : [{ ‘BBLAYERS’: “/home/build/poky/meta  /home/build/poky/meta-yocto  /home/build/poky/meta-hob”},
{ ‘MACHINE’: “qemu_x86”},
{ ‘SDKMACHINE’: “i586”}, ]}

Return value:

If request be accepted it will return None, or else it return the exception status of communication

Description:

Command of settings

Constraints:

Which must be sent after bitbake state is in started or next_waiting.


Syntax:

get_params(GUID, settings={‘variables’:[]})

Parameters:

‘settings: type json, to indicate which variables need to get
for example:  ‘settings’= { ‘varables’ : [‘BBLAYERS’, ‘MACHINE’, ‘SDKMACHINE’, … ]}

Return value:

The normal response status, for example:
{‘statuses’:
{ ‘GUID’: 11223344 ,
‘bitbke_state’: ’ next_waiting’,
},
}
The exception status, for example:
{‘statuses’:
{ ‘request’:  ‘get_params with params: ‘BBLAYERS’,’MACHINE’, … ’,
‘error_code’: 0x02,
‘error_msg’ : ‘sequence_wrong’,
}
}
Use the function get_ret_event() will get return value from value event queue, please to refer to get_ret_event() above:

Description:

get setting parameters from bitbake.

Constraints:

Which must be sent after bitbake state is in started or next_waiting.


Syntax:

Initialize_new_build(GUID, reset_all ={‘default’: True})

Parameters:

reset_all: (json) indicate new build start from the all settings reset or not,
if True, it will clear the origin settings, or else it will only reset the variables which must be to.

Return value:

type: json
statuses of comm_response please to refer above

Description:

Renew a new build operation

Constraints:

Which must be accepted by bitbake is higher than ‘selected’.


Syntax:

generate_configuration(GUID)

Parameters:

type: json

Return value:

type: json
statuses of response

Description:

Trig parse configuration

Constraints:

Which must be accepted by bitbake is ‘next_waiting.


Syntax:

generate_recipes(GUID)

Parameters:

type: json

Return value:

type: json
statuses of response

Description:

Trig parse recipes

Constraints:

Which must be accepted by bitbake is ‘next_waiting and after the parsed configuration


Syntax:

generate_packages (GUID, tgts, default_task={‘build’: True})

Parameters:

type: json

Return value:

type: json
statuses of response and bitbake

Description:

Build package

Constraints:

Which must be accepted by bitbake is ‘next_waiting.


Syntax:

generate_image(GUID, image, toolchain, image_packages, toolchain_packages, default_task={‘build’:True})

Parameters:

type: json
image: such as { ‘params’: [’core-image-minimal’]}
toolchain: such as{‘params’:[ ’adt’]}
image_packages: the list of packages of build image, such as{‘params’:[ “alt …”]}
toolchain_packages: the list of packages for build toolchain

Return value:

type: json
statuses of response and bitbake

Description:

Build image

Constraints:

Which must be accepted by bitbake is ‘next_waiting.


Syntax:

cancel_parse(GUID)

Parameters:

type: json

Return value:

type: json
statuses of response and bitbake

Description:

Constraints:

Which must be accepted by bitbake is ‘next_waiting’ and started to parse


Syntax:

cancel_build(GUID, force={‘default’: True})

Parameters:

type: json

Return value:

type: json
statuses of response and bitbake

Description:

Constraints:

Which must be accepted by bitbake is ‘next_waiting‘ and started to build


Syntax:

include_recipes(userid, sel_recipe)

Parameters:

type: json
sel_recipe: which recipe be selected , such as {‘params’: [‘acl’]}

Return value:

type: json
statuses of response and bitbake

Description:

Constraints:

Which must be accepted by bitbake is ‘next_waiting’


Syntax:

exclude_recipes(GUID, sel_recipe)

Parameters:

type: json
sel_recipe: which recipe be selected , such as {‘params’: [‘acl’]}

Return value:

type: json
statuses of response and bitbake

Description:

Constraints:

Which must be accepted by bitbake is ‘next_waiting’


Syntax:

include_packages(userid, sel_package)

Parameters:

type: json
sel_package: which package be selected , such as {‘params’: [‘acl’]}

Return value:

type: json
statuses of response and bitbake

Description:

Constraints:

Which must be accepted by bitbake is ‘next_waiting’


Syntax:

exclude_packages(userid, sel_package)

Parameters:

type: json
sel_package: which package be selected , such as {‘params’: [‘acl’]}

Return value:

type: json
statuses of response and bitbake

Description:

Constraints:

Which must be accepted by bitbake is ‘next_waiting’


Syntax:

get_bitbake_server()

Parameters:

Return value:

The return value will be push to the event queue
{‘event’: ‘BitbakeServerInfo’
[{ ‘host_name’:  ‘bitbakeserver_1',
  ‘bitbake_state’: ‘next_waiting’,
…
},
{ ‘host_name’:  ‘bitbakeserver_2',
  ‘bitbake_state’: ‘free’,
  …
},
…
]
}

Description:

Checking and response the all bitbake servers status

Constraints:


Syntax:

reserve_bitbake_server(GUID)

Parameters:

type: json
sel_recipe: which recipe be selected , such as {‘params’: [‘acl’]}

Return value:

type: json
bitbake server info, status, proc_id …

Description:

Checking and allocate a valid bitbake server to a user, and do the related bitbake build Initialization works, then return the bitbake info with proc id.

Constraints:


Syntax:

modify_bitbake_server(GUID, bitbake_id)

Parameters:

type: json

Return value:

type: json
response the bitbake info

Description:

Modify the bitbake configuration and other operations

Constraints:


Syntax:

release_bitbake_server(GUID, bitbake_key)

Parameters:

bitbake_key: (string) if ‘bitbake_key’ is null, this function will release bitbake server which has be bind to that user,
or else this function will release as the bitbake_key specialed

Return value:

type: json
statuses of response

Description:

free the bitbake server

Constraints:


every feedback is very welcome.
thanks
chunhua
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20120713/a7489ea0/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 39465 bytes
Desc: image001.jpg
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20120713/a7489ea0/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: webhob_db.rtf
Type: application/rtf
Size: 2804467 bytes
Desc: webhob_db.rtf
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20120713/a7489ea0/attachment.rtf>


More information about the yocto mailing list