cc1
v2.1
CC1 source code docs
|
USER Model User's class for keeping quota. More...
Classes | |
class | Meta |
Public Member Functions | |
def | __unicode__ |
def | check_points |
Check if used points is over the limit It raises exception in that case. | |
def | check_quota |
def | check_storage |
Checks if User's storage quota is sufficient for image with given size. | |
def | dict |
def | get_quota |
def | long_dict |
def | points_history |
Finds all User's VM's that have been working within current callendar month, which didn't fail at any stage of existence. | |
def | used_cpu |
def | used_memory |
def | used_points |
def | used_storage |
Static Public Member Functions | |
def | create |
Method creates and returns CM User's data. | |
def | get |
Returns the User instance by passed id. |
Static Public Attributes | |
tuple | cpu = models.IntegerField() |
tuple | memory = models.IntegerField() |
tuple | points = models.IntegerField() |
tuple | public_ip = models.IntegerField() |
tuple | storage = models.IntegerField() |
USER Model User's class for keeping quota.
To have the ability to create and manage VMs and to have access to other CC1 features one needs to have an User account. User's general data is stored and proceeded on CLM and that's where User authorization and authentication is performed. However, User's quota differs within CM's and not every User has granted access to each Cluster. Thats why User class exists also on CM and User's quota is stored here.
User quota is defined in "settings.py" file. It covers:
Points a month are calculated based on overall monthly storage, CPU, and RAM usage.
By default each user gains quota speficied by CM settings. It may be further adjusted by admin via admin interface.
def src.cm.models.user.User.check_points | ( | self | ) |
def src.cm.models.user.User.check_quota | ( | self, | |
template_count | |||
) |
Method checks this User's quota for ability to run VMs based on given Template and it raises CMException, if it's exceeded: @param template_count @exception CMException('user_cpu_limit') @exception CMException('user_memory_limit') @exception CMException('user_storage_limit') @exception CMException('user_points_limit')
def src.cm.models.user.User.check_storage | ( | self, | |
size | |||
) |
|
static |
def src.cm.models.user.User.dict | ( | self | ) |
dict
) user's data
|
static |
def src.cm.models.user.User.get_quota | ( | self, | |
fields = None , |
|||
used = True , |
|||
total = True |
|||
) |
def src.cm.models.user.User.long_dict | ( | self | ) |
dict
) user's extended data in dictionary format. id
(int
)cpu
(int
) CPU total granted by User quotamemory
(int
) memory total [MB] granted by User quotastorage
(int
) storage total [MB] granted by User quotapublic_ip
(int
) public IPs count total granted by User quotapoints
(int
) points total granted by User quotaused_cpu
(int
) cpu currently used by Userused_memory
(int
) memory currently used by Userused_storage
(int
) storage currently used by Userused_public_ip
(int
) public IPs count currently used by Userused_points
(int
) points used within current month by User def src.cm.models.user.User.points_history | ( | self | ) |
Finds all User's VM's that have been working within current callendar month, which didn't fail at any stage of existence.
Counts points for those VMs consumed within current month. Failed VMs don't count.
dict
) points
(list(list)
) infos about points used in specified moments of timelimit
(int
) User's quota for points per month def src.cm.models.user.User.used_cpu | ( | self | ) |
def src.cm.models.user.User.used_memory | ( | self | ) |
def src.cm.models.user.User.used_points | ( | self | ) |
int
) points consumed by VMs of this User's that have been working within current calendar month. Those might either have been started the previous month and be still running during months break, or be just started in current month. Those may be still running or already closed VMs. def src.cm.models.user.User.used_storage | ( | self | ) |
|
static |
|
static |
|
static |
|
static |
|
static |