ec2-api/HACKING.rst
Alexandre Levine 66826e9e5b Initial EC2-API service commit.
This code introduces standalone service which proxies its calls to
existing nova EC2-API.
All the code here except for the ec2api/api/proxy.py,
ec2api/api/ec2client.py and some util functions is taken from current
nova and unused functionality is cut of it.
The proxy.py and ec2client.py files implement the new code which
proxies incoming request (on port 8788) to original EC2 API in nova
on port 8773.
The result is transparently translated back to user.

Change-Id: I4cb84f833d7d4f0e379672710ed39562811d43e0
2014-07-18 19:33:55 -07:00

1.3 KiB

Ec2api Style Commandments

Ec2api Specific Commandments

General

  • Do not use locals(). Example:

    LOG.debug(_("volume %(vol_name)s: creating size %(vol_size)sG") %
              locals()) # BAD
    
    LOG.debug(_("volume %(vol_name)s: creating size %(vol_size)sG") %
              {'vol_name': vol_name,
               'vol_size': vol_size}) # OKAY
  • Use 'raise' instead of 'raise e' to preserve original traceback or exception being reraised:

    except Exception as e:
        ...
        raise e  # BAD
    
    except Exception:
        ...
        raise  # OKAY

Creating Unit Tests

For every new feature, unit tests should be created that both test and (implicitly) document the usage of said feature. If submitting a patch for a bug that had no unit test, a new passing unit test should be added. If a submitted bug fix does have a unit test, be sure to add a new one that fails without the patch and passes with the patch.

For more information on creating unit tests and utilizing the testing infrastructure in OpenStack Ec2api, please read ec2api/testing/README.rst.