[ovirt-users] How to create a DataCenterQuota via Python SDK?

nicolas at devels.es nicolas at devels.es
Fri Feb 19 13:56:55 UTC 2016


Hi,

I'm trying to create a Data Center Quota with limits for memory, vcpu 
and storage. As per the class definition, DataCenterQuota expects: a 
datacenter, a quota and a context. Quota class in turn expects limits 
but only as percentages, for hard and soft limits.

However if I dump an already created DataCenterQuota object I see:

{'_Base__context': 36443152,
  'parentclass': <ovirtsdk.xml.params.DataCenter object at 0x278e750>,
  'permissions': 
<ovirtsdk.infrastructure.brokers.DataCenterQuotaPermissions object at 
0x278ef90>,
  'quotaclusterlimits': 
<ovirtsdk.infrastructure.brokers.DataCenterQuotaQuotaClusterLimits 
object at 0x2540490>,
  'quotastoragelimits': 
<ovirtsdk.infrastructure.brokers.DataCenterQuotaQuotaStorageLimits 
object at 0x278ef50>,
  'superclass': <ovirtsdk.xml.params.Quota object at 0x278ec90>}

I see DataCenterQuotaQuotaClusterLimits and 
DataCenterQuotaQuotaStorageLimits allow creating limits for memory/cpu 
and storage respectively, and they're set in the DataCenterQuota 
__init__ method like this:

   self.quotaclusterlimits = DataCenterQuotaQuotaClusterLimits(self, 
context)
   self.quotastoragelimits = DataCenterQuotaQuotaStorageLimits(self, 
context)

However, I'm unable to find out how to handle the 'context' parameter to 
contain those two limit classes.

Could someone shed some light on it? An example would be welcome too.

Thanks.

Nicolás



More information about the Users mailing list