Fix for EC2 API part of bug 897164
Change-Id: I96344eaccd2f42b70223b3c155a4793ab00d09d5
This commit is contained in:
parent
9c3502e13a
commit
88acbe869a
@ -1153,7 +1153,7 @@ class CloudController(object):
|
||||
floating_ip = ip_info['floating_ips'][0]
|
||||
if ip_info['fixed_ip6s']:
|
||||
i['dnsNameV6'] = ip_info['fixed_ip6s'][0]
|
||||
i['privateDnsName'] = fixed_ip
|
||||
i['privateDnsName'] = instance['hostname']
|
||||
i['privateIpAddress'] = fixed_ip
|
||||
i['publicDnsName'] = floating_ip
|
||||
i['ipAddress'] = floating_ip or fixed_ip
|
||||
|
@ -554,11 +554,13 @@ class CloudTestCase(test.TestCase):
|
||||
'image_ref': image_uuid,
|
||||
'instance_type_id': 1,
|
||||
'host': 'host1',
|
||||
'hostname': 'server-1234',
|
||||
'vm_state': 'active'})
|
||||
inst2 = db.instance_create(self.context, {'reservation_id': 'a',
|
||||
'image_ref': image_uuid,
|
||||
'instance_type_id': 1,
|
||||
'host': 'host2',
|
||||
'hostname': 'server-4321',
|
||||
'vm_state': 'active'})
|
||||
comp1 = db.service_create(self.context, {'host': 'host1',
|
||||
'availability_zone': 'zone1',
|
||||
@ -583,7 +585,7 @@ class CloudTestCase(test.TestCase):
|
||||
self.assertEqual(instance['publicDnsName'], '1.2.3.4')
|
||||
self.assertEqual(instance['ipAddress'], '1.2.3.4')
|
||||
self.assertEqual(instance['dnsName'], '1.2.3.4')
|
||||
self.assertEqual(instance['privateDnsName'], '192.168.0.3')
|
||||
self.assertEqual(instance['privateDnsName'], 'server-4321')
|
||||
self.assertEqual(instance['privateIpAddress'], '192.168.0.3')
|
||||
self.assertEqual(instance['dnsNameV6'],
|
||||
'fe80:b33f::a8bb:ccff:fedd:eeff')
|
||||
@ -603,6 +605,7 @@ class CloudTestCase(test.TestCase):
|
||||
inst1 = db.instance_create(self.context, {'reservation_id': 'a',
|
||||
'image_ref': image_uuid,
|
||||
'instance_type_id': 1,
|
||||
'hostname': 'server-1234',
|
||||
'vm_state': 'active'})
|
||||
comp1 = db.service_create(self.context, {'host': 'host1',
|
||||
'topic': "compute"})
|
||||
@ -615,7 +618,7 @@ class CloudTestCase(test.TestCase):
|
||||
self.assertEqual(instance['publicDnsName'], '1.2.3.4')
|
||||
self.assertEqual(instance['ipAddress'], '1.2.3.4')
|
||||
self.assertEqual(instance['dnsName'], '1.2.3.4')
|
||||
self.assertEqual(instance['privateDnsName'], '192.168.0.3')
|
||||
self.assertEqual(instance['privateDnsName'], 'server-1234')
|
||||
self.assertEqual(instance['privateIpAddress'], '192.168.0.3')
|
||||
self.assertNotIn('dnsNameV6', instance)
|
||||
db.instance_destroy(self.context, inst1['id'])
|
||||
|
@ -81,7 +81,7 @@ class InstanceTestsFromPublic(base.UserSmokeTestCase):
|
||||
time.sleep(1)
|
||||
else:
|
||||
self.fail('instance failed to start')
|
||||
ip = reservations[0].instances[0].private_dns_name
|
||||
ip = reservations[0].instances[0].private_ip_address
|
||||
self.failIf(ip == '0.0.0.0')
|
||||
self.data['private_ip'] = ip
|
||||
if FLAGS.use_ipv6:
|
||||
@ -124,7 +124,7 @@ class InstanceTestsFromPublic(base.UserSmokeTestCase):
|
||||
time.sleep(1)
|
||||
else:
|
||||
self.fail('instance failed to start')
|
||||
ip = reservations[0].instances[0].private_dns_name
|
||||
ip = reservations[0].instances[0].private_ip_address
|
||||
self.failIf(ip == '0.0.0.0')
|
||||
self.data['private_ip'] = ip
|
||||
if FLAGS.use_ipv6:
|
||||
|
@ -52,9 +52,9 @@ class AddressTests(base.UserSmokeTestCase):
|
||||
if not self.wait_for_running(self.data['instance']):
|
||||
self.fail('instance failed to start')
|
||||
self.data['instance'].update()
|
||||
if not self.wait_for_ping(self.data['instance'].private_dns_name):
|
||||
if not self.wait_for_ping(self.data['instance'].private_ip_address):
|
||||
self.fail('could not ping instance')
|
||||
if not self.wait_for_ssh(self.data['instance'].private_dns_name,
|
||||
if not self.wait_for_ssh(self.data['instance'].private_ip_address,
|
||||
TEST_KEY):
|
||||
self.fail('could not ssh to instance')
|
||||
|
||||
|
@ -166,14 +166,14 @@ class InstanceTests(base.UserSmokeTestCase):
|
||||
if not self.wait_for_running(self.data['instance']):
|
||||
self.fail('instance failed to start')
|
||||
self.data['instance'].update()
|
||||
ip = self.data['instance'].private_dns_name
|
||||
ip = self.data['instance'].private_ip_address
|
||||
self.failIf(ip == '0.0.0.0')
|
||||
if FLAGS.use_ipv6:
|
||||
ipv6 = self.data['instance'].dns_name_v6
|
||||
self.failIf(ipv6 is None)
|
||||
|
||||
def test_004_can_ping_private_ip(self):
|
||||
if not self.wait_for_ping(self.data['instance'].private_dns_name):
|
||||
if not self.wait_for_ping(self.data['instance'].private_ip_address):
|
||||
self.fail('could not ping instance')
|
||||
|
||||
if FLAGS.use_ipv6:
|
||||
@ -182,7 +182,7 @@ class InstanceTests(base.UserSmokeTestCase):
|
||||
self.fail('could not ping instance v6')
|
||||
|
||||
def test_005_can_ssh_to_private_ip(self):
|
||||
if not self.wait_for_ssh(self.data['instance'].private_dns_name,
|
||||
if not self.wait_for_ssh(self.data['instance'].private_ip_address,
|
||||
TEST_KEY):
|
||||
self.fail('could not ssh to instance')
|
||||
|
||||
@ -210,9 +210,9 @@ class VolumeTests(base.UserSmokeTestCase):
|
||||
if not self.wait_for_running(self.data['instance']):
|
||||
self.fail('instance failed to start')
|
||||
self.data['instance'].update()
|
||||
if not self.wait_for_ping(self.data['instance'].private_dns_name):
|
||||
if not self.wait_for_ping(self.data['instance'].private_ip_address):
|
||||
self.fail('could not ping instance')
|
||||
if not self.wait_for_ssh(self.data['instance'].private_dns_name,
|
||||
if not self.wait_for_ssh(self.data['instance'].private_ip_address,
|
||||
TEST_KEY):
|
||||
self.fail('could not ssh to instance')
|
||||
|
||||
@ -253,7 +253,7 @@ class VolumeTests(base.UserSmokeTestCase):
|
||||
time.sleep(5)
|
||||
|
||||
def test_003_can_mount_volume(self):
|
||||
ip = self.data['instance'].private_dns_name
|
||||
ip = self.data['instance'].private_ip_address
|
||||
conn = self.connect_ssh(ip, TEST_KEY)
|
||||
# NOTE(vish): this will create an dev for images that don't have
|
||||
# udev rules
|
||||
@ -273,7 +273,7 @@ class VolumeTests(base.UserSmokeTestCase):
|
||||
self.fail('Unable to mount: %s %s' % (out, stderr.read()))
|
||||
|
||||
def test_004_can_write_to_volume(self):
|
||||
ip = self.data['instance'].private_dns_name
|
||||
ip = self.data['instance'].private_ip_address
|
||||
conn = self.connect_ssh(ip, TEST_KEY)
|
||||
# FIXME(devcamcar): This doesn't fail if the volume hasn't been mounted
|
||||
stdin, stdout, stderr = conn.exec_command(
|
||||
@ -284,7 +284,7 @@ class VolumeTests(base.UserSmokeTestCase):
|
||||
self.fail('Unable to write to mount: %s' % (err))
|
||||
|
||||
def test_005_volume_is_correct_size(self):
|
||||
ip = self.data['instance'].private_dns_name
|
||||
ip = self.data['instance'].private_ip_address
|
||||
conn = self.connect_ssh(ip, TEST_KEY)
|
||||
stdin, stdout, stderr = conn.exec_command(
|
||||
"cat /sys/class/block/%s/size" % self.device.rpartition('/')[2])
|
||||
@ -297,7 +297,7 @@ class VolumeTests(base.UserSmokeTestCase):
|
||||
(out, stderr.read(), expected_size))
|
||||
|
||||
def test_006_me_can_umount_volume(self):
|
||||
ip = self.data['instance'].private_dns_name
|
||||
ip = self.data['instance'].private_ip_address
|
||||
conn = self.connect_ssh(ip, TEST_KEY)
|
||||
stdin, stdout, stderr = conn.exec_command('umount /mnt/vol')
|
||||
err = stderr.read()
|
||||
|
Loading…
Reference in New Issue
Block a user