¡@

Home 

OpenStack Study: queue.py

OpenStack Index

**** CubicPower OpenStack Study ****

def create_lqueue(cluster, queue_data):

    params = {

        'name': 'display_name',

        'qos_marking': 'qos_marking',

        'min': 'min_bandwidth_rate',

        'max': 'max_bandwidth_rate',

        'dscp': 'dscp'

    }

    queue_obj = dict(

        (nsx_name, queue_data.get(api_name))

        for api_name, nsx_name in params.iteritems()

        if attr.is_attr_set(queue_data.get(api_name))

    )

    if 'display_name' in queue_obj:

        queue_obj['display_name'] = utils.check_and_truncate(

            queue_obj['display_name'])

    queue_obj['tags'] = utils.get_tags()

    try:

        return do_request(HTTP_POST,

                          _build_uri_path(LQUEUE_RESOURCE),

                          jsonutils.dumps(queue_obj),

                          cluster=cluster)['uuid']

    except api_exc.NsxApiException:

        # FIXME(salv-orlando): This should not raise NeutronException

        with excutils.save_and_reraise_exception():

            raise exception.NeutronException()

**** CubicPower OpenStack Study ****

def delete_lqueue(cluster, queue_id):

    try:

        do_request(HTTP_DELETE,

                   _build_uri_path(LQUEUE_RESOURCE,

                                   resource_id=queue_id),

                   cluster=cluster)

    except Exception:

        # FIXME(salv-orlando): This should not raise NeutronException

        with excutils.save_and_reraise_exception():

            raise exception.NeutronException()