~ubuntu-branches/ubuntu/precise/horizon/precise-updates

« back to all changes in this revision

Viewing changes to horizon/horizon/api/nova.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-02-24 10:49:27 UTC
  • mfrom: (1.1.7)
  • Revision ID: package-import@ubuntu.com-20120224104927-0v71grkyxtu106l4
Tags: 2012.1~e4~20120224.1386-0ubuntu1
New upstream version. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
# Administrator of the National Aeronautics and Space Administration.
5
5
# All Rights Reserved.
6
6
#
 
7
# Copyright 2012 Openstack, LLC
7
8
# Copyright 2012 Nebula, Inc.
8
9
# Copyright (c) 2012 X.commerce, a business unit of eBay Inc.
9
10
#
27
28
from novaclient.v1_1 import security_group_rules as nova_rules
28
29
from novaclient.v1_1.servers import REBOOT_HARD
29
30
 
 
31
from horizon.api import keystone
30
32
from horizon.api.base import APIResourceWrapper, APIDictWrapper, url_for
31
33
 
32
34
 
77
79
 
78
80
       Preserves the request info so image name can later be retrieved
79
81
    """
80
 
    _attrs = ['addresses', 'attrs', 'hostId', 'id', 'image', 'links',
 
82
    _attrs = ['addresses', 'attrs', 'id', 'image', 'links',
81
83
             'metadata', 'name', 'private_ip', 'public_ip', 'status', 'uuid',
82
84
             'image_name', 'VirtualInterfaces', 'flavor', 'key_name',
83
 
             'OS-EXT-STS:power_state', 'OS-EXT-STS:task_state']
 
85
             'tenant_id', 'user_id', 'OS-EXT-STS:power_state',
 
86
             'OS-EXT-STS:task_state', 'OS-EXT-SRV-ATTR:instance_name',
 
87
             'OS-EXT-SRV-ATTR:host']
84
88
 
85
89
    def __init__(self, apiresource, request):
86
90
        super(Server, self).__init__(apiresource)
191
195
                                                  console_type)['console'])
192
196
 
193
197
 
194
 
def flavor_create(request, name, memory, vcpu, disk, flavor_id):
 
198
def flavor_create(request, name, memory, vcpu, disk, flavor_id, ephemeral=0):
195
199
    return novaclient(request).flavors.create(name, int(memory), int(vcpu),
196
 
                                              int(disk), flavor_id)
 
200
                                              int(disk), flavor_id,
 
201
                                              ephemeral=int(ephemeral))
197
202
 
198
203
 
199
204
def flavor_delete(request, flavor_id):