示例#1
0
文件: views.py 项目: young8/dashboard
 def get_instance_prices_data(self):
     return [tables.InstancePricesTableEntry(
         id=x.resource.id,
         instance_type=NovaClient.instance_type_id_to_name(
             x.resource.instancetype.os_instance_type_id),
         price=x.price)
         for x in Price.objects.exclude(
             resource__instancetype__os_instance_type_id=None)]
示例#2
0
 def backwards(self, orm):
     for instance_type in orm.InstanceType.objects.all():
         try:
             instance_type.os_instance_type_id = \
                 NovaClient.instance_type_id_to_name(
                     'instance:' + instance_type.os_instance_type_id)
             instance_type.save()
         except:
             pass
示例#3
0
 def forwards(self, orm):
     for instance_type in orm.InstanceType.objects.all():
         try:
             instance_type.os_instance_type_id = \
                 NovaClient.instance_type_name_to_id(
                     instance_type.os_instance_type_id.split(':')[1])
             instance_type.save()
         except:
             pass
示例#4
0
文件: views.py 项目: kili/dashboard
 def get_instance_prices_data(self):
     return [
         tables.InstancePricesTableEntry(
             id=x.resource.id,
             instance_type=NovaClient.instance_type_id_to_name(x.resource.instancetype.os_instance_type_id),
             price=x.price,
         )
         for x in Price.objects.exclude(resource__instancetype__os_instance_type_id=None)
     ]
示例#5
0
 def handler(cls, **kwargs):
     if AccountManager().get_user_account(
             kwargs['project_id']).balance() >= 0:
         return
     # need to enable all_tenants because of this (read comments):
     # https://bugs.launchpad.net/python-novaclient/+bug/1134382
     [server.stop() for server in NovaClient.get_client().servers.list(
         search_opts={'all_tenants': True,
                      'tenant_id': kwargs['project_id'],
                      'status': 'ACTIVE'})]
示例#6
0
 def _resolve_resource_id(id):
     return NovaClient.get_client().flavors.get(id).name
示例#7
0
 def _resolve_resource_id(id):
     return NovaClient.get_client().flavors.get(id).name