コード例 #1
0
 class Quotas(quotas_models.QuotaModelMixin.Quotas):
     vcpu = quotas_fields.TotalQuotaField(
         target_models=lambda: [Instance],
         path_to_scope='service_project_link',
         target_field='cores',
     )
     ram = quotas_fields.TotalQuotaField(
         target_models=lambda: [Instance],
         path_to_scope='service_project_link',
         target_field='ram',
     )
     storage = quotas_fields.TotalQuotaField(
         target_models=lambda: [Volume, Snapshot],
         path_to_scope='service_project_link',
         target_field='size',
     )
コード例 #2
0
ファイル: models.py プロジェクト: swipswaps/waldur-core
 class Quotas(quotas_models.QuotaModelMixin.Quotas):
     counter_quota = fields.CounterQuotaField(
         target_models=lambda: [ChildModel],
         path_to_scope='parent',
     )
     two_targets_counter_quota = fields.CounterQuotaField(
         target_models=lambda: [ChildModel, SecondChildModel],
         path_to_scope='parent',
     )
     delta_quota = fields.CounterQuotaField(
         target_models=lambda: [ChildModel],
         path_to_scope='parent',
         get_delta=lambda scope: 10
     )
     usage_aggregator_quota = fields.UsageAggregatorQuotaField(
         get_children=lambda scope: scope.children.all(),
     )
     limit_aggregator_quota = fields.LimitAggregatorQuotaField(
         get_children=lambda scope: scope.children.all(),
         default_limit=0,
     )
     second_usage_aggregator_quota = fields.UsageAggregatorQuotaField(
         get_children=lambda scope: scope.children.all(),
         child_quota_name='usage_aggregator_quota',
     )
     total_quota = fields.TotalQuotaField(
         target_models=lambda: [SecondChildModel],
         path_to_scope='parent',
         target_field='size',
     )
コード例 #3
0
 class Quotas(quotas_models.QuotaModelMixin.Quotas):
     enable_fields_caching = False
     nc_project_count = quotas_fields.CounterQuotaField(
         target_models=lambda: [Project],
         path_to_scope='customer',
     )
     nc_service_count = quotas_fields.CounterQuotaField(
         target_models=lambda: Service.get_all_models(),
         path_to_scope='customer',
     )
     nc_service_project_link_count = quotas_fields.CounterQuotaField(
         target_models=lambda: ServiceProjectLink.get_all_models(),
         path_to_scope='project.customer',
     )
     nc_user_count = quotas_fields.QuotaField()
     nc_resource_count = quotas_fields.CounterQuotaField(
         target_models=lambda: ResourceMixin.get_all_models(),
         path_to_scope='project.customer',
     )
     nc_app_count = quotas_fields.CounterQuotaField(
         target_models=lambda: ApplicationMixin.get_all_models(),
         path_to_scope='project.customer',
     )
     nc_vm_count = quotas_fields.CounterQuotaField(
         target_models=lambda: VirtualMachine.get_all_models(),
         path_to_scope='project.customer',
     )
     nc_private_cloud_count = quotas_fields.CounterQuotaField(
         target_models=lambda: PrivateCloud.get_all_models(),
         path_to_scope='project.customer',
     )
     nc_storage_count = quotas_fields.CounterQuotaField(
         target_models=lambda: Storage.get_all_models(),
         path_to_scope='project.customer',
     )
     nc_volume_size = quotas_fields.TotalQuotaField(
         target_models=lambda: Volume.get_all_models(),
         path_to_scope='customer',
         target_field='size',
     )
     nc_snapshot_size = quotas_fields.TotalQuotaField(
         target_models=lambda: Snapshot.get_all_models(),
         path_to_scope='customer',
         target_field='size',
     )