bug fixes
This commit is contained in:
parent
01fa4d0cfd
commit
bffaee539d
3 changed files with 13 additions and 7 deletions
|
@ -3,7 +3,7 @@ import requests
|
|||
|
||||
class SWSStatisticsClient(object):
|
||||
def get_vm(self, vm_id, limit=96):
|
||||
r = requests.get('http://localhost:8089/stats/v1/compute/vms/%s' % vm_id, params={'limit': limit})
|
||||
r = requests.get('http://server-stats.gocloud.ru/stats/v1/compute/vms/%s' % vm_id, params={'limit': limit})
|
||||
if r.status_code == 200:
|
||||
return r.json()
|
||||
return None
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
# coding: utf-8
|
||||
|
||||
from SWSCloudCore import models
|
||||
from SWSCloudCore.controllers.tasks import ControllerTasks
|
||||
from SWSCloudCore.controllers.vms import ControllerVMS
|
||||
|
||||
nb = models.Settings.get_item('NEGATIVE_BALANCE')
|
||||
|
||||
|
@ -16,13 +18,17 @@ if int(models.Settings.get_item('SERVICE_VMS_ENABLE')) == 1:
|
|||
# Списание средств
|
||||
x = models.UsersBalance.update(
|
||||
balance=models.UsersBalance.balance - price_quarter
|
||||
).where(
|
||||
models.UsersBalance.user == vm.user.id)
|
||||
).where(models.UsersBalance.user == vm.user.id)
|
||||
x.execute()
|
||||
|
||||
# Shutting down all VMs by users who doesn't have money
|
||||
if nb < 500:
|
||||
pass
|
||||
# Shutting down all VMs by users who doesn't have money
|
||||
user_balance = models.UsersBalance.select(
|
||||
models.UsersBalance.balance).where(models.UsersBalance.user == vm.user.id).get().balance
|
||||
if -500 < user_balance:
|
||||
print "user_balance", user_balance
|
||||
ControllerVMS(vm.user.id).status_set(vm.id, 3)
|
||||
# Создание задания
|
||||
ControllerTasks(vm.user.id).create(vm.datacenter.id, vm.server.id, 'vm_stop', 0, vm_id=vm.id)
|
||||
|
||||
|
||||
if int(models.Settings.get_item('SERVICE_CONTAINERS_ENABLE')) == 1:
|
||||
|
|
2
setup.py
2
setup.py
|
@ -4,7 +4,7 @@ from setuptools import setup
|
|||
|
||||
setup(
|
||||
name='SWSCloudCore',
|
||||
version='2.7.6',
|
||||
version='2.7.7',
|
||||
author='Vyacheslav Anzhiganov',
|
||||
author_email='hello@anzhiganov.com',
|
||||
packages=[
|
||||
|
|
Loading…
Add table
Reference in a new issue