python compute-api package

Bug #1310804 reported by Pedro Marques
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenContrail
Fix Committed
Undecided
Unassigned

Bug Description

Currently, the python API binding that informs the compute-node agent when a port is added or removed is part of the nova-driver package. This code is also used in Xen drivers (Cloudstack), neutron vif driver and network namespace provisioning (w/o OpenStack).
This functionality should be made into an independent library and include the methods necessary to convert between uuid format and the binary string representation expected by the thrift interface.

Proposal is to create a python package called contrail-compute-api.

Tags: api
Revision history for this message
Pedro Marques (5-roque) wrote :

The following is an example of a class that would provide this API:
https://github.com/pedro-r-marques/nova-docker/blob/opencontrail/novadocker/virt/docker/opencontrail_api.py

Missing in the code above is the functionality found in the nova-vif-driver: being able to have a periodic check that verifies that the agent is still up, have a dictionary with the ports.

The intent here is to build a package that follows the convention of having
top-dir/
   setup.py
   top_dir/files
   top_dir/gen_py
   top_dir/tests

And use as much as possible the same structure that the nova package is using and we are copying to the api-server.

Revision history for this message
Pedro Marques (5-roque) wrote :
Changed in opencontrail:
status: New → Fix Committed
Revision history for this message
Numan Siddique (numansiddique) wrote :

Hi Pedro,

I am enhancing the neutrin vif driver to you this package. I had to do couple of changes to make it work properly

1. I had to change the import - 'from gen_py.instance_service' to 'from nova_contrail_vif.gen_py.instance_service' at line 6 in the vrouter_api.py. I guess this would be taken care when opencontrail is installed by devstack
2. I had to comment the line 32 : "client.open()" in the file vrouter_api.py. I am getting exception that Client.open is not defined.

I have one more comment. The function 'add_port' in vrouter_apy.py expects the arguments 'vm_uuid' and 'vif_uuid' to be of type uuid string but expects the kwargs['network_uuid'], kwargs['vm_project_uuid'] to be uuid int.

Is it possible to be consistent so that the neutron vif driver or any other client doesn't need to convert to int for the kwargs

Thanks
Numan

Revision history for this message
Pedro Marques (5-roque) wrote : Re: [Bug 1310804] python compute-api package

Numan,

On Apr 29, 2014, at 4:34 AM, Numan Siddique <email address hidden> wrote:

> Hi Pedro,
>
> I am enhancing the neutrin vif driver to you this package. I had to do
> couple of changes to make it work properly
>
> 1. I had to change the import - 'from gen_py.instance_service' to 'from nova_contrail_vif.gen_py.instance_service' at line 6 in the vrouter_api.py. I guess this would be taken care when opencontrail is installed by devstack

The instance_service files are now included in the python-contrail-vrouter-api package.

> 2. I had to comment the line 32 : "client.open()" in the file vrouter_api.py. I am getting exception that Client.open is not defined.

Ack. Will fix.

>
> I have one more comment. The function 'add_port' in vrouter_apy.py
> expects the arguments 'vm_uuid' and 'vif_uuid' to be of type uuid string
> but expects the kwargs['network_uuid'], kwargs['vm_project_uuid'] to be
> uuid int.
>
> Is it possible to be consistent so that the neutron vif driver or any
> other client doesn't need to convert to int for the kwargs

Yes. My mistake.

>
> Thanks
> Numan
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1310804
>
> Title:
> python compute-api package
>
> Status in OpenContrail:
> Fix Committed
>
> Bug description:
> Currently, the python API binding that informs the compute-node agent when a port is added or removed is part of the nova-driver package. This code is also used in Xen drivers (Cloudstack), neutron vif driver and network namespace provisioning (w/o OpenStack).
> This functionality should be made into an independent library and include the methods necessary to convert between uuid format and the binary string representation expected by the thrift interface.
>
> Proposal is to create a python package called contrail-compute-api.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/opencontrail/+bug/1310804/+subscriptions

tags: added: api
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.