Merge "Fixed outstanding issues from 3 previous reviews comments."
This commit is contained in:
commit
efb03d20cf
|
@ -36,7 +36,6 @@ from ec2api.openstack.common.gettextutils import _
|
|||
from ec2api.openstack.common import jsonutils
|
||||
from ec2api.openstack.common import log as logging
|
||||
from ec2api.openstack.common import timeutils
|
||||
from ec2api import utils
|
||||
from ec2api import wsgi
|
||||
|
||||
|
||||
|
@ -49,28 +48,6 @@ ec2_opts = [
|
|||
cfg.IntOpt('ec2_timestamp_expiry',
|
||||
default=300,
|
||||
help='Time in seconds before ec2 timestamp expires'),
|
||||
cfg.StrOpt('my_ip',
|
||||
default=utils._get_my_ip(),
|
||||
help='IP address of this host'),
|
||||
cfg.StrOpt('ec2_host',
|
||||
default='$my_ip',
|
||||
help='The IP address of the EC2 API server'),
|
||||
cfg.StrOpt('ec2_dmz_host',
|
||||
default='$my_ip',
|
||||
help='The internal IP address of the EC2 API server'),
|
||||
cfg.IntOpt('ec2_port',
|
||||
default=8773,
|
||||
help='The port of the EC2 API server'),
|
||||
cfg.StrOpt('ec2_scheme',
|
||||
default='http',
|
||||
help='The protocol to use when connecting to the EC2 API '
|
||||
'server (http, https)'),
|
||||
cfg.StrOpt('ec2_path',
|
||||
default='/services/Cloud',
|
||||
help='The path prefix used to call the ec2 API server'),
|
||||
cfg.ListOpt('region_list',
|
||||
default=[],
|
||||
help='List of region=fqdn pairs separated by commas'),
|
||||
]
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
|
|
@ -13,7 +13,11 @@
|
|||
# limitations under the License.
|
||||
|
||||
import netaddr
|
||||
from neutronclient.common import exceptions as neutron_exception
|
||||
try:
|
||||
from neutronclient.common import exceptions as neutron_exception
|
||||
except ImportError:
|
||||
pass # clients will log absense of neutronclient in this case
|
||||
from novaclient import exceptions as nova_exception
|
||||
from oslo.config import cfg
|
||||
|
||||
from ec2api.api import clients
|
||||
|
@ -365,7 +369,11 @@ class AddressEngineNova(object):
|
|||
|
||||
def release_address(self, context, public_ip, allocation_id):
|
||||
nova = clients.nova(context)
|
||||
nova.floating_ips.delete(self.get_ip_os_id(context, public_ip))
|
||||
try:
|
||||
nova.floating_ips.delete(self.get_ip_os_id(context, public_ip))
|
||||
except nova_exception.NotFound:
|
||||
# TODO(ft): catch FloatingIPNotFound
|
||||
pass
|
||||
|
||||
def associate_address(self, context, public_ip=None, instance_id=None,
|
||||
allocation_id=None, network_interface_id=None,
|
||||
|
|
|
@ -17,13 +17,33 @@ from oslo.config import cfg
|
|||
from ec2api.api import clients
|
||||
from ec2api.api import common
|
||||
from ec2api.openstack.common import log as logging
|
||||
from ec2api import utils
|
||||
|
||||
|
||||
availability_zone_opts = [
|
||||
cfg.StrOpt('internal_service_availability_zone',
|
||||
default='internal',
|
||||
help='The availability_zone to show internal services under'),
|
||||
]
|
||||
cfg.StrOpt('my_ip',
|
||||
default=utils._get_my_ip(),
|
||||
help='IP address of this host'),
|
||||
cfg.StrOpt('ec2_host',
|
||||
default='$my_ip',
|
||||
help='The IP address of the EC2 API server'),
|
||||
cfg.IntOpt('ec2_port',
|
||||
default=8788,
|
||||
help='The port of the EC2 API server'),
|
||||
cfg.StrOpt('ec2_scheme',
|
||||
default='http',
|
||||
help='The protocol to use when connecting to the EC2 API '
|
||||
'server (http, https)'),
|
||||
cfg.StrOpt('ec2_path',
|
||||
default='/services/Cloud',
|
||||
help='The path prefix used to call the ec2 API server'),
|
||||
cfg.ListOpt('region_list',
|
||||
default=[],
|
||||
help='List of region=fqdn pairs separated by commas'),
|
||||
]
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(availability_zone_opts)
|
||||
|
|
|
@ -960,14 +960,9 @@ def _get_ec2_classic_os_network(context, neutron):
|
|||
|
||||
def get_password_data(context, instance_id):
|
||||
# NOTE(Alex): AWS supports one and only one instance_id here
|
||||
instance = ec2utils.get_db_items(context, 'i', [instance_id])[0]
|
||||
instance = ec2utils.get_db_item(context, 'i', instance_id)
|
||||
nova = clients.nova(context)
|
||||
os_instance = nova.servers.get(instance['os_id'])
|
||||
# NOTE(Alex) Commented section is a legacy password getting code
|
||||
# password = ''
|
||||
# for key in sorted(os_instance.metadata.keys()):
|
||||
# if key.startswith('password_'):
|
||||
# password += os_instance.metadata[key]
|
||||
password = os_instance.get_password()
|
||||
# NOTE(vish): this should be timestamp from the metadata fields
|
||||
# but it isn't important enough to implement properly
|
||||
|
@ -979,7 +974,7 @@ def get_password_data(context, instance_id):
|
|||
|
||||
def get_console_output(context, instance_id):
|
||||
# NOTE(Alex): AWS supports one and only one instance_id here
|
||||
instance = ec2utils.get_db_items(context, 'i', [instance_id])[0]
|
||||
instance = ec2utils.get_db_item(context, 'i', instance_id)
|
||||
nova = clients.nova(context)
|
||||
os_instance = nova.servers.get(instance['os_id'])
|
||||
console_output = os_instance.get_console_output()
|
||||
|
|
Loading…
Reference in New Issue