Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
ó
±EYc@s\dZddlZddlmZddlmZddlmZddlZddl	Z
ddl
mZddl
mZddl
mZdd	l
mZejeƒZe
jjZd
efd„ƒYZdefd
„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZd„Zd„ZeƒZedddƒedddƒeddd ƒed!d"d#ƒed$d%d&ƒed'd(d)ƒed*d+ƒed,d-ƒed.d/ƒed0d1ƒed2ej d3ƒed4ed5ƒed6d7d8ƒed9ed:ƒgZ!ej"e!ƒd;„Z#d<„Z$dS(=s!Quotas for resources per project.iÿÿÿÿN(tlog(timportutils(t	timeutils(tdb(t	exception(t_LE(tobjectst
DbQuotaDrivercBsCeZdZdZd„Zd„Zd„Zd„Zed„Z	deded„Zdeeddd„Z
deeedd	„Zd
„Zd„Zd„Zdd
„Zdd„Zdddd„Zddd„Zdddd„Zddd„Zddd„Zd„Zdddd„Zd„Zd„Zd„ZRS(sDriver to perform necessary checks to enforce quotas and obtain
    quota information.  The default driver utilizes the local
    database.
    iÿÿÿÿcCstj|||d|ƒS(s)Get a specific quota by project and user.tuser_id(Rt	quota_get(tselftcontextt
project_idRtresource((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pytget_by_project_and_user-scCstj|||ƒS(s Get a specific quota by project.(RR	(R
RRR
((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pytget_by_project2scCstj|||ƒS(s$Get a specific quota by quota class.(Rtquota_class_get(R
Rtquota_classR
((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pytget_by_class7scCsOi}tj|ƒ}x3|jƒD]%}|j|j|jƒ||j<q"W|S(s'Given a list of resources, retrieve the default quotas.
        Use the class quotas named `_DEFAULT_QUOTA_NAME` as default quotas,
        if it exists.

        :param context: The request context, for access checks.
        :param resources: A dictionary of the registered resources.
        (Rtquota_class_get_defaulttvaluestgettnametdefault(R
Rt	resourcestquotastdefault_quotasR
((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pytget_defaults<s	cCsji}tj||ƒ}xK|jƒD]=}|s@|j|kr%|j|j|jƒ||j<q%q%W|S(sðGiven a list of resources, retrieve the quotas for the given
        quota class.

        :param context: The request context, for access checks.
        :param resources: A dictionary of the registered resources.
        :param quota_class: The name of the quota class to return
                            quotas for.
        :param defaults: If True, the default value will be reported
                         if there is no specific value for the
                         resource.
        (Rtquota_class_get_all_by_nameRRRR(R
RRRtdefaultsRtclass_quotasR
((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pytget_class_quotasMsc		Cs—i}	||jkr!|j}n|r<tj||ƒ}
ni}
|j||ƒ}xä|jƒD]Ö}|rƒ|j|krƒqan|j|j|
j|j||jƒƒ}
td|
ƒ|	|j<|r|j|jiƒ}|	|jj	d|jddƒd|jddƒƒn|ra|	|jj	d|
ƒqaqaW|r“tj
||ƒ}x=|D]2}|j|	krZ|	|jdc|j8<qZqZWn|	S(Ntlimittin_useitreservedtremains(
RRRRRRRRtdicttupdatet
quota_get_allR
t
hard_limit(R
RRRRRRtusagesR#tmodified_quotasRRR
R tusaget
all_quotastquota((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyt_process_quotasds6
c
CsÊ|	r|	jƒ}	ntj|||ƒ}	|p?tj||ƒ}
x<tj|
ƒD]+\}}||	jƒkrR||	|<qRqRWd}
|r¥tj|||ƒ}
n|j	||||	|d|d|
ƒS(sÜGiven a list of resources, retrieve the quotas for the given
        user and project.

        :param context: The request context, for access checks.
        :param resources: A dictionary of the registered resources.
        :param project_id: The ID of the project to return quotas for.
        :param user_id: The ID of the user to return quotas for.
        :param quota_class: If project_id != context.project_id, the
                            quota class cannot be determined.  This
                            parameter allows it to be specified.  It
                            will be ignored if project_id ==
                            context.project_id.
        :param defaults: If True, the quota class value (or the
                         default value, if there is no value from the
                         quota class) will be reported if there is no
                         specific value for the resource.
        :param usages: If True, the current in_use and reserved counts
                       will also be returned.
        :param project_quotas: Quotas dictionary for the specified project.
        :param user_quotas: Quotas dictionary for the specified project
                            and user.
        RR(N(
tcopyRt!quota_get_all_by_project_and_usertquota_get_all_by_projecttsixt	iteritemstkeystNonet'quota_usage_get_all_by_project_and_userR-(R
RRRRRRR(tproject_quotastuser_quotastproj_quotastkeytvaluetuser_usages((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pytget_user_quotas”s$				c	

Cst|ptj||ƒ}d}	|rItjd|ƒtj||ƒ}	n|j|||||d|d|	d|ƒS(s—Given a list of resources, retrieve the quotas for the given
        project.

        :param context: The request context, for access checks.
        :param resources: A dictionary of the registered resources.
        :param project_id: The ID of the project to return quotas for.
        :param quota_class: If project_id != context.project_id, the
                            quota class cannot be determined.  This
                            parameter allows it to be specified.  It
                            will be ignored if project_id ==
                            context.project_id.
        :param defaults: If True, the quota class value (or the
                         default value, if there is no value from the
                         quota class) will be reported if there is no
                         specific value for the resource.
        :param usages: If True, the current in_use and reserved counts
                       will also be returned.
        :param remains: If True, the current remains of the project will
                        will be returned.
        :param project_quotas: Quotas dictionary for the specified project.
        s(Getting all quota usages for project: %sRR(R#N(RR0R4tLOGtdebugtquota_usage_get_all_by_projectR-(
R
RRRRRR(R#R6tproject_usages((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pytget_project_quotasÃs		cCs
||jkS(s6A helper method to check for unlimited value.
        (tUNLIMITED_VALUE(R
tv((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyt_is_unlimited_valueçscCs-|j|ƒs|j|ƒr%|jS||S(s]A helper method that handles unlimited values when performing
        sum operation.
        (RDRB(R
tv1tv2((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyt_sum_quota_valuesíscCs-|j|ƒs|j|ƒr%|jS||S(seA helper method that handles unlimited values when performing
        subtraction operation.
        (RDRB(R
RERF((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyt_sub_quota_valuesösc	Cs\i}tj||ƒ}|j|||dtd|ƒ}|rètj|||ƒ}|j||||d|d|ƒ}	xÝ|	jƒD]\\}
}|j||
d|j|
dƒƒ}|d|d}
i|
d6|d6||
<q…Wnpxm|jƒD]_\}
}t	t
|j|d	|dƒƒt
|d|dƒƒ}
i|
d6d
d6||
<qõW|S(s}Given a list of resources, retrieve the range of settable quotas for
        the given user or project.

        :param context: The request context, for access checks.
        :param resources: A dictionary of the registered resources.
        :param project_id: The ID of the project to return quotas for.
        :param user_id: The ID of the user to return quotas for.
        R#R6R7iR!R"tminimumtmaximumR iÿÿÿÿ(RR0RAtTrueR/R<titemsRGRtmaxtintRH(R
RRRRtsettable_quotastdb_proj_quotasR6t
setted_quotasR7R9R:RJRI((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pytget_settable_quotasÿs0					
c	Cs‘g}tjƒ}xx|jƒD]j\}}t|tƒr|dkoO||k}|dk	og||k}|sv|r‰|j|ƒq‰qqW|S(soGiven a list of resources, retrieve the syncable resources
        scoped to a project or a user.

        A resource is syncable if it has a function to sync the quota
        usage record with the actual usage of the project or user.

        :param resources: A dictionary of the registered resources.
        :param user_id: Optional. If user_id is specified, user-scoped
                        resources will be returned. Otherwise,
                        project-scoped resources will be returned.
        :returns: A list of resource names scoped to a project or
                  user that can be sync'd.
        N(Rtquota_get_per_project_resourcesRLt
isinstancetReservableResourceR4tappend(	R
RRtsyncable_resourcestper_project_resourcesR9R:tproject_scopedtuser_scoped((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyt_get_syncable_resources&sc
s@|rd„‰n	d„‰t|ƒ‰‡‡fd†|jƒDƒ}t|ƒt|ƒkrˆt|jƒƒ}	tjdt|	ƒƒ‚n|rçtjdi|d6|d6|d6ƒ|j	|||||j
d	td
|ƒ}
nEtjdi|d6|d6ƒ|j||||j
d	td
|ƒ}
d„|
jƒDƒS(
sìA helper method which retrieves the quotas for the specific
        resources identified by keys, and which apply to the current
        context.

        :param context: The request context, for access checks.
        :param resources: A dictionary of the registered resources.
        :param keys: A list of the desired quotas to retrieve.
        :param has_sync: If True, indicates that the resource must
                         have a sync function; if False, indicates
                         that the resource must NOT have a sync
                         function.
        :param project_id: Specify the project_id if current context
                           is admin and admin wants to impact on
                           common user's tenant.
        :param user_id: Specify the user_id if current context
                        is admin and admin wants to impact on
                        common user.
        :param project_quotas: Quotas dictionary for the specified project.
        cSs
t|dƒS(Ntsync(thasattr(tx((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyt<lambda>YscSst|dƒS(NR\(R](R^((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyR_[scs7i|]-\}}|ˆkrˆ|ƒr||“qS(((t.0tkRC(tdesiredt	sync_filt(s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pys
<dictcomp>]s		tunknownsSGetting quotas for user %(user_id)s and project %(project_id)s. Resources: %(keys)sRRR3R(R6s>Getting quotas for project %(project_id)s. Resources: %(keys)scSs#i|]\}}|d|“qS(R ((R`RaRC((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pys
<dictcomp>ys	(
tsetRLtlenR3RtQuotaResourceUnknowntsortedR=R>R<RtFalseRA(R
RRR3thas_syncRRR6t
sub_resourcesRdR((RbRcs?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyt_get_quotasAs0					cCsæt|dƒg|jƒD]\}}|dkr|^q}|r_tjdt|ƒƒ‚n|d
krw|j}n|d
kr|j}ntj	||ƒ}	|j
|||jƒdtd|d|	ƒ}
|j
|||jƒdtd|d|d|	ƒ}g|jƒD]R\}}|
|dkr:|
||ksZ||dkr|||kr|^q}|râi}
x@|D]8}t
d„|
j|ƒ|	j|ƒfDƒƒ|
|<qyWtjd	t|ƒd
|
did|
ƒ‚nd
S(s¢Check simple quota limits.

        For limits--those quotas for which there is no usage
        synchronization function--this method checks that a set of
        proposed values are permitted by the limit restriction.

        This method will raise a QuotaResourceUnknown exception if a
        given resource is unknown or if it is not a simple limit
        resource.

        If any of the proposed values is over the defined quota, an
        OverQuota exception will be raised with the sorted list of the
        resources which are too high.  Otherwise, the method returns
        nothing.

        :param context: The request context, for access checks.
        :param resources: A dictionary of the registered resources.
        :param values: A dictionary of the values to check against the
                       quota.
        :param project_id: Specify the project_id if current context
                           is admin and admin wants to impact on
                           common user's tenant.
        :param user_id: Specify the user_id if current context
                        is admin and admin wants to impact on
                        common user.
        tcheckitundersRjRR6Rcss!|]}|dk	r|VqdS(N(R4(R`tval((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pys	<genexpr>¸stoversRR(theadroomN(t"_valid_method_call_check_resourcesRLRtInvalidQuotaValueRhR4RRRR0RlR3RitminRt	OverQuota(R
RRRRRR9RoRnR6RR7RpRq((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pytlimit_check{s4
1		 ,
3c

Cst|dƒ|dkr%tj}nt|tjƒrLtjd|ƒ}nt|tjƒrqt	j
ƒ|}nt|tjƒs˜tjd|ƒ‚n|dkrÀ|j
}tjd|ƒn|dkrè|j}tjd|ƒntjdi|d6|d6|d	6ƒtj||ƒ}tjd
i|d6|d6ƒ|j|||jƒdtd|d|ƒ}tjd
i|d6|d6ƒ|j|||jƒdtd|d|d|ƒ}	tjdi|d6|d6|	d6ƒtj||||	||tjtjd|d|ƒS(sœCheck quotas and reserve resources.

        For counting quotas--those quotas for which there is a usage
        synchronization function--this method checks quotas against
        current usage and the desired deltas.

        This method will raise a QuotaResourceUnknown exception if a
        given resource is unknown or if it does not have a usage
        synchronization function.

        If any of the proposed values is over the defined quota, an
        OverQuota exception will be raised with the sorted list of the
        resources which are too high.  Otherwise, the method returns a
        list of reservation UUIDs which were created.

        :param context: The request context, for access checks.
        :param resources: A dictionary of the registered resources.
        :param deltas: A dictionary of the proposed delta changes.
        :param expire: An optional parameter specifying an expiration
                       time for the reservations.  If it is a simple
                       number, it is interpreted as a number of
                       seconds and added to the current time; if it is
                       a datetime.timedelta object, it will also be
                       added to the current time.  A datetime.datetime
                       object will be interpreted as the absolute
                       expiration time.  If None is specified, the
                       default expiration time set by
                       --default-reservation-expire will be used (this
                       value will be treated as a number of seconds).
        :param project_id: Specify the project_id if current context
                           is admin and admin wants to impact on
                           common user's tenant.
        :param user_id: Specify the user_id if current context
                        is admin and admin wants to impact on
                        common user.
        treservetsecondstexpires0Reserving resources using context.project_id: %ss-Reserving resources using context.user_id: %sscAttempting to reserve resources for project %(project_id)s and user %(user_id)s. Deltas: %(deltas)sRRtdeltass;Quota limits for project %(project_id)s: %(project_quotas)sR6RjsAQuotas for project %(project_id)s after resource sync: %(quotas)sRsVQuotas for project %(project_id)s and user %(user_id)s after resource sync: %(quotas)sN(RrR4tCONFtreservation_expireRTR1t
integer_typestdatetimet	timedeltaRtutcnowRtInvalidReservationExpirationRR=R>RRR0RlR3RKt
quota_reservet
until_refreshtmax_age(
R
RRRzRyRRR6RR7((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyRw¾sP&
		
		
		
				cCsP|dkr|j}n|dkr0|j}ntj||d|d|ƒdS(s7Commit reservations.

        :param context: The request context, for access checks.
        :param reservations: A list of the reservation UUIDs, as
                             returned by the reserve() method.
        :param project_id: Specify the project_id if current context
                           is admin and admin wants to impact on
                           common user's tenant.
        :param user_id: Specify the user_id if current context
                        is admin and admin wants to impact on
                        common user.
        RRN(R4RRRtreservation_commit(R
RtreservationsRR((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pytcommit!scCsP|dkr|j}n|dkr0|j}ntj||d|d|ƒdS(s:Roll back reservations.

        :param context: The request context, for access checks.
        :param reservations: A list of the reservation UUIDs, as
                             returned by the reserve() method.
        :param project_id: Specify the project_id if current context
                           is admin and admin wants to impact on
                           common user's tenant.
        :param user_id: Specify the user_id if current context
                        is admin and admin wants to impact on
                        common user.
        RRN(R4RRRtreservation_rollback(R
RR†RR((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pytrollback8scCs^|jƒ}xK|D]C}y&tj||j|j|ddƒWqtjk
rUqXqWdS(sReset the usage records for a particular user on a list of
        resources.  This will force that user's usage records to be
        refreshed the next time a reservation is made.

        Note: this does not affect the currently outstanding
        reservations the user has; those reservations must be
        committed or rolled back (or expired).

        :param context: The request context, for access checks.
        :param resources: A list of the resource names for which the
                          usage must be reset.
        R!iÿÿÿÿN(televatedRtquota_usage_updateRRRtQuotaUsageNotFound(R
RRRŠR
((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pytusage_resetOs
c
CsÀ|dkr|j}n|dkr0|j}n|j||ƒ}|rxJ|D]9}||krOtjd|d|d|d|ƒ‚qOqOWn|}tj|||tj	tj
d|d|ƒS(skRefresh the usage records for a particular project and user
        on a list of resources.  This will force usage records to be
        sync'd immediately to the actual usage.

        This method will raise a QuotaUsageRefreshNotAllowed exception if a
        usage refresh is not allowed on a resource for the given project
        or user.

        :param context: The request context, for access checks.
        :param resources: A dictionary of the registered resources.
        :param project_id: Optional: Project whose resources to
                           refresh.  If not set, then the project_id
                           is taken from the context.
        :param user_id: Optional: User whose resources to refresh.
                        If not set, then the user_id is taken from the
                        context.
        :param resources_names: Optional: A list of the resource names
                                for which the usage must be refreshed.
                                If not specified, then all the usages
                                for the project and user will be refreshed.
        R
RRtsyncableN(R4RRR[RtQuotaUsageRefreshNotAllowedRtquota_usage_refreshR{RƒR„(R
RRRRtresource_namesRWtres_name((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyt
usage_refreshls"
	cCstj|||ƒdS(sDestroy all quotas, usages, and reservations associated with a
        project and user.

        :param context: The request context, for access checks.
        :param project_id: The ID of the project being deleted.
        :param user_id: The ID of the user being deleted.
        N(Rt%quota_destroy_all_by_project_and_user(R
RRR((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pytdestroy_all_by_project_and_useršs	cCstj||ƒdS(sÙDestroy all quotas, usages, and reservations associated with a
        project.

        :param context: The request context, for access checks.
        :param project_id: The ID of the project being deleted.
        N(Rtquota_destroy_all_by_project(R
RR((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pytdestroy_all_by_project¥scCstj|ƒdS(sÂExpire reservations.

        Explores all currently existing reservations and rolls back
        any that have expired.

        :param context: The request context, for access checks.
        N(RR|(R
R((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyRy¯s	N(t__name__t
__module__t__doc__RBRRRRRKRR4RiR-R<RARDRGRHRRR[RlRvRwR‡R‰RR“R•R—Ry(((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyR&sB					/-"				
&9Bb	-		
tNoopQuotaDrivercBsõeZdZd„Zd„Zd„Zd„Zed„Zde
d„Zdeed„Zdeee
d„Z
dd	„Zddd
„Zdddd„Zddd„Zddd
„Zd„Zdddd„Zd„Zd„Zd„ZRS(s+Driver that turns quotas calls into no-ops and pretends that quotas
    for all resources are unlimited.  This can be used if you do not
    wish to have any quota checking.  For instance, with nova compute
    cells, the parent cell should do quota checking, but the child cell
    should not.
    cCsdS(s)Get a specific quota by project and user.iÿÿÿÿ((R
RRRR
((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyRÃscCsdS(s Get a specific quota by project.iÿÿÿÿ((R
RRR
((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyRÈscCsdS(s$Get a specific quota by quota class.iÿÿÿÿ((R
RRR
((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyRÍscCs.i}x!|jƒD]}d||j<qW|S(sÅGiven a list of resources, retrieve the default quotas.

        :param context: The request context, for access checks.
        :param resources: A dictionary of the registered resources.
        iÿÿÿÿ(RR(R
RRRR
((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyRÒscCs.i}x!|jƒD]}d||j<qW|S(sðGiven a list of resources, retrieve the quotas for the given
        quota class.

        :param context: The request context, for access checks.
        :param resources: A dictionary of the registered resources.
        :param quota_class: The name of the quota class to return
                            quotas for.
        :param defaults: If True, the default value will be reported
                         if there is no specific value for the
                         resource.
        iÿÿÿÿ(RR(R
RRRRRR
((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyRÝs
cCs„i}xw|jƒD]i}i||j<d||jd<|rbd||jd<d||jd<n|rd||jd<qqW|S(NiÿÿÿÿR R!R"R#(RR(R
RR(R#RR
((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyt_get_noop_quotasïs
cCs|j|d|ƒS(s"Given a list of resources, retrieve the quotas for the given
        user and project.

        :param context: The request context, for access checks.
        :param resources: A dictionary of the registered resources.
        :param project_id: The ID of the project to return quotas for.
        :param user_id: The ID of the user to return quotas for.
        :param quota_class: If project_id != context.project_id, the
                            quota class cannot be determined.  This
                            parameter allows it to be specified.  It
                            will be ignored if project_id ==
                            context.project_id.
        :param defaults: If True, the quota class value (or the
                         default value, if there is no value from the
                         quota class) will be reported if there is no
                         specific value for the resource.
        :param usages: If True, the current in_use and reserved counts
                       will also be returned.
        R((Rœ(R
RRRRRRR(((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyR<ûscCs|j|d|d|ƒS(sKGiven a list of resources, retrieve the quotas for the given
        project.

        :param context: The request context, for access checks.
        :param resources: A dictionary of the registered resources.
        :param project_id: The ID of the project to return quotas for.
        :param quota_class: If project_id != context.project_id, the
                            quota class cannot be determined.  This
                            parameter allows it to be specified.  It
                            will be ignored if project_id ==
                            context.project_id.
        :param defaults: If True, the quota class value (or the
                         default value, if there is no value from the
                         quota class) will be reported if there is no
                         specific value for the resource.
        :param usages: If True, the current in_use and reserved counts
                       will also be returned.
        :param remains: If True, the current remains of the project will
                        will be returned.
        R(R#(Rœ(R
RRRRRR(R#((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyRAscCs<i}x/|jƒD]!}idd6dd6||j<qW|S(s}Given a list of resources, retrieve the range of settable quotas for
        the given user or project.

        :param context: The request context, for access checks.
        :param resources: A dictionary of the registered resources.
        :param project_id: The ID of the project to return quotas for.
        :param user_id: The ID of the user to return quotas for.
        iRIiÿÿÿÿRJ(RR(R
RRRRRR
((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyRR,s
cCsdS(s¢Check simple quota limits.

        For limits--those quotas for which there is no usage
        synchronization function--this method checks that a set of
        proposed values are permitted by the limit restriction.

        This method will raise a QuotaResourceUnknown exception if a
        given resource is unknown or if it is not a simple limit
        resource.

        If any of the proposed values is over the defined quota, an
        OverQuota exception will be raised with the sorted list of the
        resources which are too high.  Otherwise, the method returns
        nothing.

        :param context: The request context, for access checks.
        :param resources: A dictionary of the registered resources.
        :param values: A dictionary of the values to check against the
                       quota.
        :param project_id: Specify the project_id if current context
                           is admin and admin wants to impact on
                           common user's tenant.
        :param user_id: Specify the user_id if current context
                        is admin and admin wants to impact on
                        common user.
        N((R
RRRRR((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyRv;scCsgS(sœCheck quotas and reserve resources.

        For counting quotas--those quotas for which there is a usage
        synchronization function--this method checks quotas against
        current usage and the desired deltas.

        This method will raise a QuotaResourceUnknown exception if a
        given resource is unknown or if it does not have a usage
        synchronization function.

        If any of the proposed values is over the defined quota, an
        OverQuota exception will be raised with the sorted list of the
        resources which are too high.  Otherwise, the method returns a
        list of reservation UUIDs which were created.

        :param context: The request context, for access checks.
        :param resources: A dictionary of the registered resources.
        :param deltas: A dictionary of the proposed delta changes.
        :param expire: An optional parameter specifying an expiration
                       time for the reservations.  If it is a simple
                       number, it is interpreted as a number of
                       seconds and added to the current time; if it is
                       a datetime.timedelta object, it will also be
                       added to the current time.  A datetime.datetime
                       object will be interpreted as the absolute
                       expiration time.  If None is specified, the
                       default expiration time set by
                       --default-reservation-expire will be used (this
                       value will be treated as a number of seconds).
        :param project_id: Specify the project_id if current context
                           is admin and admin wants to impact on
                           common user's tenant.
        :param user_id: Specify the user_id if current context
                        is admin and admin wants to impact on
                        common user.
        ((R
RRRzRyRR((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyRwYs&cCsdS(s7Commit reservations.

        :param context: The request context, for access checks.
        :param reservations: A list of the reservation UUIDs, as
                             returned by the reserve() method.
        :param project_id: Specify the project_id if current context
                           is admin and admin wants to impact on
                           common user's tenant.
        :param user_id: Specify the user_id if current context
                        is admin and admin wants to impact on
                        common user.
        N((R
RR†RR((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyR‡s
cCsdS(s:Roll back reservations.

        :param context: The request context, for access checks.
        :param reservations: A list of the reservation UUIDs, as
                             returned by the reserve() method.
        :param project_id: Specify the project_id if current context
                           is admin and admin wants to impact on
                           common user's tenant.
        :param user_id: Specify the user_id if current context
                        is admin and admin wants to impact on
                        common user.
        N((R
RR†RR((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyR‰s
cCsdS(sReset the usage records for a particular user on a list of
        resources.  This will force that user's usage records to be
        refreshed the next time a reservation is made.

        Note: this does not affect the currently outstanding
        reservations the user has; those reservations must be
        committed or rolled back (or expired).

        :param context: The request context, for access checks.
        :param resources: A list of the resource names for which the
                          usage must be reset.
        N((R
RR((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyRŸs
cCsdS(skRefresh the usage records for a particular project and user
        on a list of resources.  This will force usage records to be
        sync'd immediately to the actual usage.

        This method will raise a QuotaUsageRefreshNotAllowed exception if a
        usage refresh is not allowed on a resource for the given project
        or user.

        :param context: The request context, for access checks.
        :param resources: A dictionary of the registered resources.
        :param project_id: Optional: Project whose resources to
                           refresh.  If not set, then the project_id
                           is taken from the context.
        :param user_id: Optional: User whose resources to refresh.
                        If not set, then the user_id is taken from the
                        context.
        :param resources_names: Optional: A list of the resource names
                                for which the usage must be refreshed.
                                If not specified, then all the usages
                                for the project and user will be refreshed.
        N((R
RRRRR‘((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyR“®scCsdS(sDestroy all quotas, usages, and reservations associated with a
        project and user.

        :param context: The request context, for access checks.
        :param project_id: The ID of the project being deleted.
        :param user_id: The ID of the user being deleted.
        N((R
RRR((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyR•ÈscCsdS(sÙDestroy all quotas, usages, and reservations associated with a
        project.

        :param context: The request context, for access checks.
        :param project_id: The ID of the project being deleted.
        N((R
RR((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyR—ÒscCsdS(sÂExpire reservations.

        Explores all currently existing reservations and rolls back
        any that have expired.

        :param context: The request context, for access checks.
        N((R
R((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyRyÛsN(R˜R™RšRRRRRKRR4RiRœR<RARRRvRwR‡R‰RR“R•R—Ry(((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyR›»s0				
'		
		tBaseResourcecBs2eZdZdd„Zd„Zed„ƒZRS(s.Describe a single resource for quota checking.cCs||_||_dS(sInitializes a Resource.

        :param name: The name of the resource, i.e., "instances".
        :param flag: The name of the flag or configuration option
                     which specifies the default value of the quota
                     for this resource.
        N(Rtflag(R
RRž((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyt__init__és		cKs¥|jd|jƒ}|jd|jƒ}|rdy|j|||jƒSWqdtjk
r`qdXn|ržy|j|||jƒSWqžtjk
ršqžXn|j	S(s_Given a driver and context, obtain the quota for this
        resource.

        :param driver: A quota driver.
        :param context: The request context.
        :param project_id: The project to obtain the quota value for.
                           If not provided, it is taken from the
                           context.  If it is given as None, no
                           project-specific quota will be searched
                           for.
        :param quota_class: The quota class corresponding to the
                            project, or for which the quota is to be
                            looked up.  If not provided, it is taken
                            from the context.  If it is given as None,
                            no quota class-specific quota will be
                            searched for.  Note that the quota class
                            defaults to the value in the context,
                            which may not correspond to the project if
                            project_id is not the same as the one in
                            the context.
        RR(
RRRRRRtProjectQuotaNotFoundRtQuotaClassNotFoundR(R
tdriverRtkwargsRR((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyR,õscCs|jrt|jSdS(s&Return the default value of the quota.iÿÿÿÿ(RžR{(R
((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyR#sN(R˜R™RšR4RŸR,tpropertyR(((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyRæs	.RUcBs eZdZdZdd„ZRS(sDescribe a reservable resource.RwcCs)tt|ƒj|d|ƒ||_dS(sInitializes a ReservableResource.

        Reservable resources are those resources which directly
        correspond to objects in the database, i.e., instances,
        cores, etc.

        Usage synchronization function must be associated with each
        object. This function will be called to determine the current
        counts of one or more resources. This association is done in
        database backend.

        The usage synchronization function will be passed three
        arguments: an admin context, the project ID, and an opaque
        session object, which should in turn be passed to the
        underlying database function.  Synchronization functions
        should return a dictionary mapping resource names to the
        current in_use count for those resources; more than one
        resource and resource count may be returned.  Note that
        synchronization functions may be associated with more than one
        ReservableResource.

        :param name: The name of the resource, i.e., "volumes".
        :param sync: A dbapi methods name which returns a dictionary
                     to resynchronize the in_use count for one or more
                     resources, as described above.
        :param flag: The name of the flag or configuration option
                     which specifies the default value of the quota
                     for this resource.
        RžN(tsuperRURŸR\(R
RR\Rž((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyRŸ.sN(R˜R™Rštvalid_methodR4RŸ(((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyRU*stAbsoluteResourcecBseZdZdZRS(s#Describe a non-reservable resource.Rm(R˜R™RšR¦(((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyR§PstCountableResourcecBseZdZdd„ZRS(sTDescribe a resource where the counts aren't based solely on the
    project ID.
    cCs)tt|ƒj|d|ƒ||_dS(sÿInitializes a CountableResource.

        Countable resources are those resources which directly
        correspond to objects in the database, i.e., instances, cores,
        etc., but for which a count by project ID is inappropriate.  A
        CountableResource must be constructed with a counting
        function, which will be called to determine the current counts
        of the resource.

        The counting function will be passed the context, along with
        the extra positional and keyword arguments that are passed to
        Quota.count().  It should return an integer specifying the
        count.

        Note that this counting is not performed in a transaction-safe
        manner.  This resource class is a temporary measure to provide
        required functionality, until a better approach to solving
        this problem can be evolved.

        :param name: The name of the resource, i.e., "instances".
        :param count: A callable which returns the count of the
                      resource.  The arguments passed are as described
                      above.
        :param flag: The name of the flag or configuration option
                     which specifies the default value of the quota
                     for this resource.
        RžN(R¥R¨RŸtcount(R
RR©Rž((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyRŸZsN(R˜R™RšR4RŸ(((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyR¨UstQuotaEnginecBs=eZdZdd„Zed„ƒZd„Zd„Zd„Z	d„Z
d„Zd„Zd	„Z
d
„Zed„Zdeed„Zdeeed
„Zdd„Zd„Zddd„Zdddd„Zddd„Zddd„Zd„Zdddd„Zd„Zd„Zd„Zed„ƒZRS(s'Represent the set of recognized quotas.cCsi|_||_d|_dS(sInitialize a Quota object.N(t
_resourcest_driver_clsR4t_QuotaEngine__driver(R
tquota_driver_class((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyRŸ~s		cCsh|jr|jS|js(tj|_nt|jtjƒrUtj|jƒ|_n|j|_|jS(N(	R­R¬R{tquota_driverRTR1tstring_typesRt
import_object(R
((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyt_driver„s		cCs
||jkS(N(R«(R
R
((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyt__contains__scCs||jkr|j|SdS(N(R«(R
R9((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyt__getitem__’scCs||j|j<dS(sRegister a resource.N(R«R(R
R
((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pytregister_resource–scCs"x|D]}|j|ƒqWdS(sRegister a list of resources.N(Rµ(R
RR
((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pytregister_resources›s
cCs|jj||||ƒS(s)Get a specific quota by project and user.(R²R(R
RRRR
((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyR¡scCs|jj|||ƒS(s Get a specific quota by project.(R²R(R
RRR
((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyR§scCs|jj|||ƒS(s$Get a specific quota by quota class.(R²R(R
RRR
((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyR¬scCs|jj||jƒS(sfRetrieve the default quotas.

        :param context: The request context, for access checks.
        (R²RR«(R
R((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyR±scCs|jj||j|d|ƒS(s‰Retrieve the quotas for the given quota class.

        :param context: The request context, for access checks.
        :param quota_class: The name of the quota class to return
                            quotas for.
        :param defaults: If True, the default value will be reported
                         if there is no specific value for the
                         resource.
        R(R²RR«(R
RRR((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyR¹scCs.|jj||j||d|d|d|ƒS(sJRetrieve the quotas for the given user and project.

        :param context: The request context, for access checks.
        :param project_id: The ID of the project to return quotas for.
        :param user_id: The ID of the user to return quotas for.
        :param quota_class: If project_id != context.project_id, the
                            quota class cannot be determined.  This
                            parameter allows it to be specified.
        :param defaults: If True, the quota class value (or the
                         default value, if there is no value from the
                         quota class) will be reported if there is no
                         specific value for the resource.
        :param usages: If True, the current in_use and reserved counts
                       will also be returned.
        RRR((R²R<R«(R
RRRRRR(((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyR<Çs
	cCs1|jj||j|d|d|d|d|ƒS(ssRetrieve the quotas for the given project.

        :param context: The request context, for access checks.
        :param project_id: The ID of the project to return quotas for.
        :param quota_class: If project_id != context.project_id, the
                            quota class cannot be determined.  This
                            parameter allows it to be specified.
        :param defaults: If True, the quota class value (or the
                         default value, if there is no value from the
                         quota class) will be reported if there is no
                         specific value for the resource.
        :param usages: If True, the current in_use and reserved counts
                       will also be returned.
        :param remains: If True, the current remains of the project will
                        will be returned.
        RRR(R#(R²RAR«(R
RRRRR(R#((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyRAßscCs|jj||j|d|ƒS(s9Given a list of resources, retrieve the range of settable quotas for
        the given user or project.

        :param context: The request context, for access checks.
        :param project_id: The ID of the project to return quotas for.
        :param user_id: The ID of the user to return quotas for.
        R(R²RRR«(R
RRR((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyRRùs	cOsT|jj|ƒ}|s)t|dƒrAtjd|gƒ‚n|j|||ŽS(s|Count a resource.

        For countable resources, invokes the count() function and
        returns its result.  Arguments following the context and
        resource are passed directly to the count function declared by
        the resource.

        :param context: The request context, for access checks.
        :param resource: The name of the resource, as a string.
        R©Rd(R«RR]RRgR©(R
RR
targsR£tres((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyR©s
cKs%|jj||j|d|d|ƒS(s§Check simple quota limits.

        For limits--those quotas for which there is no usage
        synchronization function--this method checks that a set of
        proposed values are permitted by the limit restriction.  The
        values to check are given as keyword arguments, where the key
        identifies the specific quota limit to check, and the value is
        the proposed value.

        This method will raise a QuotaResourceUnknown exception if a
        given resource is unknown or if it is not a simple limit
        resource.

        If any of the proposed values is over the defined quota, an
        OverQuota exception will be raised with the sorted list of the
        resources which are too high.  Otherwise, the method returns
        nothing.

        :param context: The request context, for access checks.
        :param project_id: Specify the project_id if current context
                           is admin and admin wants to impact on
                           common user's tenant.
        :param user_id: Specify the user_id if current context
                        is admin and admin wants to impact on
                        common user.
        RR(R²RvR«(R
RRRR((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyRvsc
KsA|jj||j|d|d|d|ƒ}tjd|ƒ|S(sûCheck quotas and reserve resources.

        For counting quotas--those quotas for which there is a usage
        synchronization function--this method checks quotas against
        current usage and the desired deltas.  The deltas are given as
        keyword arguments, and current usage and other reservations
        are factored into the quota check.

        This method will raise a QuotaResourceUnknown exception if a
        given resource is unknown or if it does not have a usage
        synchronization function.

        If any of the proposed values is over the defined quota, an
        OverQuota exception will be raised with the sorted list of the
        resources which are too high.  Otherwise, the method returns a
        list of reservation UUIDs which were created.

        :param context: The request context, for access checks.
        :param expire: An optional parameter specifying an expiration
                       time for the reservations.  If it is a simple
                       number, it is interpreted as a number of
                       seconds and added to the current time; if it is
                       a datetime.timedelta object, it will also be
                       added to the current time.  A datetime.datetime
                       object will be interpreted as the absolute
                       expiration time.  If None is specified, the
                       default expiration time set by
                       --default-reservation-expire will be used (this
                       value will be treated as a number of seconds).
        :param project_id: Specify the project_id if current context
                           is admin and admin wants to impact on
                           common user's tenant.
        RyRRsCreated reservations %s(R²RwR«R=R>(R
RRyRRRzR†((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyRw8s$	cCsby#|jj||d|d|ƒWn(tk
rMtjtdƒ|ƒdSXtjd|ƒdS(s•Commit reservations.

        :param context: The request context, for access checks.
        :param reservations: A list of the reservation UUIDs, as
                             returned by the reserve() method.
        :param project_id: Specify the project_id if current context
                           is admin and admin wants to impact on
                           common user's tenant.
        RRs Failed to commit reservations %sNsCommitted reservations %s(R²R‡t	ExceptionR=RRR>(R
RR†RR((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyR‡es
cCsby#|jj||d|d|ƒWn(tk
rMtjtdƒ|ƒdSXtjd|ƒdS(s˜Roll back reservations.

        :param context: The request context, for access checks.
        :param reservations: A list of the reservation UUIDs, as
                             returned by the reserve() method.
        :param project_id: Specify the project_id if current context
                           is admin and admin wants to impact on
                           common user's tenant.
        RRs#Failed to roll back reservations %sNsRolled back reservations %s(R²R‰R¹R=RRR>(R
RR†RR((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyR‰}s
cCs|jj||ƒdS(sReset the usage records for a particular user on a list of
        resources.  This will force that user's usage records to be
        refreshed the next time a reservation is made.

        Note: this does not affect the currently outstanding
        reservations the user has; those reservations must be
        committed or rolled back (or expired).

        :param context: The request context, for access checks.
        :param resources: A list of the resource names for which the
                          usage must be reset.
        N(R²R(R
RR((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyR•scCs#|jj||j|||ƒdS(s(Refresh the usage records for a particular project and user
        on a list of resources.  This will force usage records to be
        sync'd immediately to the actual usage.

        This method will raise a QuotaUsageRefreshNotAllowed exception if a
        usage refresh is not allowed on a resource for the given project
        or user.

        :param context: The request context, for access checks.
        :param project_id: Optional:  Project whose resources to
                           refresh.  If not set, then the project_id
                           is taken from the context.
        :param user_id: Optional: User whose resources to refresh.
                        If not set, then the user_id is taken from the
                        context.
        :param resources_names: Optional: A list of the resource names
                                for which the usage must be refreshed.
                                If not specified, then all the usages
                                for the project and user will be refreshed.
        N(R²R“R«(R
RRRR‘((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyR“¥scCs|jj|||ƒdS(sDestroy all quotas, usages, and reservations associated with a
        project and user.

        :param context: The request context, for access checks.
        :param project_id: The ID of the project being deleted.
        :param user_id: The ID of the user being deleted.
        N(R²R•(R
RRR((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyR•¿s	cCs|jj||ƒdS(sÙDestroy all quotas, usages, and reservations associated with a
        project.

        :param context: The request context, for access checks.
        :param project_id: The ID of the project being deleted.
        N(R²R—(R
RR((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyR—ËscCs|jj|ƒdS(sÂExpire reservations.

        Explores all currently existing reservations and rolls back
        any that have expired.

        :param context: The request context, for access checks.
        N(R²Ry(R
R((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyRyÕs	cCst|jjƒƒS(N(RhR«R3(R
((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyRàsN( R˜R™RšR4RŸR¤R²R³R´RµR¶RRRRRKRR<RiRARRR©RvRwR‡R‰RR“R•R—RyR(((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyRª{s:								
	-			
	cOstjj||ŽS(sAHelper method to avoid referencing objects.KeyPairList on import.(RtKeyPairListtget_count_by_user(R·R£((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyt_keypair_get_count_by_useråscCs
|j|ƒS(sCHelper method to avoid referencing objects.InstanceGroup on import.(tcount_members_by_user(RtgroupR((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyt#_server_group_count_members_by_userêst	instancest_sync_instancestquota_instancestcorestquota_corestramt	quota_ramtsecurity_groupst_sync_security_groupstquota_security_groupstfloating_ipst_sync_floating_ipstquota_floating_ipst	fixed_ipst_sync_fixed_ipstquota_fixed_ipstmetadata_itemstquota_metadata_itemstinjected_filestquota_injected_filestinjected_file_content_bytest!quota_injected_file_content_bytestinjected_file_path_bytestquota_injected_file_path_lengthtsecurity_group_rulestquota_security_group_rulest	key_pairstquota_key_pairst
server_groupst_sync_server_groupstquota_server_groupstserver_group_memberstquota_server_group_memberscCs_|tkr'tjd|d|ƒ‚nt|}|j|kr[tjd|d|ƒ‚ndS(NtmethodR¸(tQUOTASRtInvalidQuotaMethodUsageR¦(RRáR¸((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyt!_valid_method_call_check_resources

cCs(x!|jƒD]}t||ƒq
WdS(s@A method to check whether the resource can use the quota method.N(R3Rä(R
RáR((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyRrs(%RšR~toslo_logRtloggingt
oslo_utilsRRR1t	nova.conftnovaRRt	nova.i18nRRt	getLoggerR˜R=tconfR{tobjectRR›RRUR§R¨RªR¼R¿Rât"security_group_rule_count_by_groupRR¶RäRr(((s?/home/tvault/.virtenv/lib/python2.7/site-packages/nova/quota.pyt<module>sjÿÿ—ÿ,D&&ÿk