[Openstack] wsgi code duplication

Ghe Rivero ghe.rivero at stackops.com
Tue Apr 24 10:15:00 UTC 2012


Hi Everyone,
   i've been looking through wsgi code, and i have found a lot of
duplicated code between all the projects. Running a quick and dirty search,
i get the following numbers (just focusing on glance  horizon  keystone
 nova  openstack-common  quantum  swift projects):
- There are 87 classes defined, but only "40 different". Rough numbers:
(Number of times the class appears)
      6 Request
      5 Server
      5 Router
      5 Middleware
      5 Debug
      4 WritableLogger
      3 XMLDictSerializer
      3 XMLDeserializer
      3 TextDeserializer
      3 Resource
      3 JSONDictSerializer
      3 JSONDeserializer
      3 DictSerializer
      3 Application
      3 ActionDispatcher
      2 ResponseSerializer
      2 RequestHeadersDeserializer
      2 RequestDeserializer
      2 Fault
      2 Controller

And some of them only defined and used once: (some are the same with
different name like  ResponseHeader*s*Serializer
and ResponseHeaderSerializer)
      1 WSGIContext
      1 Serializer
      1 ResponseObject
      1 ResponseHeadersSerializer
      1 ResponseHeaderSerializer
      1 ResourceExceptionHandler
      1 Resource
      1 OverLimitFault
      1 MetadataXMLDeserializer
      1 Loader
      1 JSONResponseSerializer
      1 JSONRequestDeserializer
      1 FilterFactory
      1 ExtensionRouter
      1 ControllerMetaclass
      1 ComposingRouter
      1 ComposableRouter
      1 BasePasteFactory
      1 BaseApplication
      1 AppFactory

Running a code analysis duplication tool like
http://clonedigger.sourceforge.net/, the numbers and mostly the same:
around 45% of the code is duplicated (A full output is available at
http://debostack.org/paste/wsgi.html). I think there are a lot improvements
we can get here using openstack-common as the base for all the wsgi code.
(As Adam Young reported[1], services can be migrated to use HTTPD, but
quantum[2] have some issues. Using the same code, the solution should be
the same in all projects). I will open a blueprint for this and update the
info as much as possible.

[1] -
http://adam.younglogic.com/2012/03/keystone-should-move-to-apache-httpd/
[2] - https://lists.launchpad.net/openstack/msg09966.html


-- 
Ghe Rivero
*OpenStack & Distribution Engineer
**www.stackops.com | * ghe.rivero at stackops.com <diego.parrilla at stackops.com>
** | +34 625 63 45 23 | skype:ghe.rivero*
* <http://www.stackops.com/>
*

*

******************** ADVERTENCIA LEGAL ********************
Le informamos, como destinatario de este mensaje, que el correo electrónico
y las comunicaciones por medio de Internet no permiten asegurar ni
garantizar la confidencialidad de los mensajes transmitidos, así como
tampoco su integridad o su correcta recepción, por lo que STACKOPS
TECHNOLOGIES S.L. no asume responsabilidad alguna por tales circunstancias.
Si no consintiese en la utilización del correo electrónico o de las
comunicaciones vía Internet le rogamos nos lo comunique y ponga en nuestro
conocimiento de manera inmediata. Este mensaje va dirigido, de manera
exclusiva, a su destinatario y contiene información confidencial y sujeta
al secreto profesional, cuya divulgación no está permitida por la ley. En
caso de haber recibido este mensaje por error, le rogamos que, de forma
inmediata, nos lo comunique mediante correo electrónico remitido a nuestra
atención y proceda a su eliminación, así como a la de cualquier documento
adjunto al mismo. Asimismo, le comunicamos que la distribución, copia o
utilización de este mensaje, o de cualquier documento adjunto al mismo,
cualquiera que fuera su finalidad, están prohibidas por la ley.

***************** PRIVILEGED AND CONFIDENTIAL ****************
We hereby inform you, as addressee of this message, that e-mail and
Internet do not guarantee the confidentiality, nor the completeness or
proper reception of the messages sent and, thus, STACKOPS TECHNOLOGIES S.L.
does not assume any liability for those circumstances. Should you not agree
to the use of e-mail or to communications via Internet, you are kindly
requested to notify us immediately. This message is intended exclusively
for the person to whom it is addressed and contains privileged and
confidential information protected from disclosure by law. If you are not
the addressee indicated in this message, you should immediately delete it
and any attachments and notify the sender by reply e-mail. In such case,
you are hereby notified that any dissemination, distribution, copying or
use of this message or any attachments, for any purpose, is strictly
prohibited by law.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20120424/ab07466f/attachment.html>


More information about the Openstack mailing list