~ubuntu-branches/ubuntu/saucy/nova/saucy-proposed

« back to all changes in this revision

Viewing changes to nova/api/ec2/ec2utils.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Adam Gandelman
  • Date: 2013-02-22 09:27:29 UTC
  • mfrom: (1.1.68)
  • Revision ID: package-import@ubuntu.com-20130222092729-nn3gt8rf97uvts77
Tags: 2013.1.g3-0ubuntu1
[ Chuck Short ]
* New usptream release. 
* debian/patches/debian/patches/fix-ubuntu-tests.patch: Refreshed.
* debian/nova-baremetal.logrotate: Fix logfile path.
* debian/control, debian/nova-spiceproxy.{install, logrotate, upstart}:
  Add spice html5 proxy support.
* debian/nova-novncproxy.upstart: Start on runlevel [2345]
* debian/rules: Call testr directly since run_tests.sh -N gives weird return
  value when tests pass.
* debian/pyddist-overrides: Add websockify.
* debian/nova-common.postinst: Removed config file conversion, since
  the option is no longer available. (LP: #1110567)
* debian/control: Add python-pyasn1 as a dependency.
* debian/control: Add python-oslo-config as a dependency.
* debian/control: Suggest sysfsutils, sg3-utils, multipath-tools for fibre
  channel support.

[ Adam Gandelman ]
* debian/control: Fix typo (websocikfy -> websockify).

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
 
74
74
 
75
75
def ec2_id_to_id(ec2_id):
76
 
    """Convert an ec2 ID (i-[base 16 number]) to an instance id (int)"""
 
76
    """Convert an ec2 ID (i-[base 16 number]) to an instance id (int)."""
77
77
    try:
78
78
        return int(ec2_id.split('-')[-1], 16)
79
79
    except ValueError:
104
104
 
105
105
 
106
106
def get_ip_info_for_instance(context, instance):
107
 
    """Return a dictionary of IP information for an instance"""
 
107
    """Return a dictionary of IP information for an instance."""
108
108
 
109
109
    info_cache = instance['info_cache'] or {}
110
110
    cached_nwinfo = info_cache.get('network_info')
115
115
    return get_ip_info_for_instance_from_nw_info(nw_info)
116
116
 
117
117
 
118
 
def get_availability_zone_by_host(services, host):
 
118
def get_availability_zone_by_host(services, host, conductor_api=None):
119
119
    if len(services) > 0:
120
 
        return availability_zones.get_host_availability_zone(context, host)
 
120
        return availability_zones.get_host_availability_zone(
 
121
            context.get_admin_context(), host, conductor_api)
121
122
    return 'unknown zone'
122
123
 
123
124
 
124
125
def id_to_ec2_id(instance_id, template='i-%08x'):
125
 
    """Convert an instance ID (int) to an ec2 ID (i-[base 16 number])"""
 
126
    """Convert an instance ID (int) to an ec2 ID (i-[base 16 number])."""
126
127
    return template % int(instance_id)
127
128
 
128
129
 
178
179
 
179
180
 
180
181
def is_ec2_timestamp_expired(request, expires=None):
181
 
    """Checks the timestamp or expiry time included in a EC2 request
 
182
    """Checks the timestamp or expiry time included in an EC2 request
182
183
    and returns true if the request is expired
183
184
    """
184
185
    query_time = None