summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorMasanori Itoh <itoumsn@nttdata.co.jp>2011-04-13 02:42:37 +0900
committerMasanori Itoh <itoumsn@nttdata.co.jp>2011-04-13 02:42:37 +0900
commit7b4f593efa834ed87d4b5ed75bd06a2a7257e51f (patch)
tree5e57fcfc180c47507e74a13ef39fe08c8513c266 /nova
parenta4791a2d2b4f44c636b7f7694e92bed615309070 (diff)
parentaebcd4abd574b2edb8f2919cb4c2a77617eb97e9 (diff)
Rebased to trunk rev 980.
Diffstat (limited to 'nova')
-rw-r--r--nova/api/ec2/cloud.py5
-rw-r--r--nova/crypto.py2
-rw-r--r--nova/tests/test_cloud.py14
3 files changed, 20 insertions, 1 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py
index 651ec47f9..5e81878c4 100644
--- a/nova/api/ec2/cloud.py
+++ b/nova/api/ec2/cloud.py
@@ -142,6 +142,11 @@ class CloudController(object):
instance_ref = self.compute_api.get_all(ctxt, fixed_ip=address)
if instance_ref is None:
return None
+
+ # This ensures that all attributes of the instance
+ # are populated.
+ instance_ref = db.instance_get(ctxt, instance_ref['id'])
+
mpi = self._get_mpi_data(ctxt, instance_ref['project_id'])
if instance_ref['key_name']:
keys = {'0': {'_name': instance_ref['key_name'],
diff --git a/nova/crypto.py b/nova/crypto.py
index 9b1897926..605be2a32 100644
--- a/nova/crypto.py
+++ b/nova/crypto.py
@@ -232,7 +232,7 @@ def generate_vpn_files(project_id):
genvpn_sh_path = os.path.join(os.path.dirname(__file__),
'CA',
- 'geninter.sh')
+ 'genvpn.sh')
if os.path.exists(crt_fn):
return
_ensure_project_folder(project_id)
diff --git a/nova/tests/test_cloud.py b/nova/tests/test_cloud.py
index 5f76a9005..c45bdd12c 100644
--- a/nova/tests/test_cloud.py
+++ b/nova/tests/test_cloud.py
@@ -36,6 +36,7 @@ from nova import rpc
from nova import service
from nova import test
from nova import utils
+from nova import exception
from nova.auth import manager
from nova.compute import power_state
from nova.api.ec2 import cloud
@@ -372,6 +373,19 @@ class CloudTestCase(test.TestCase):
LOG.debug(_("Terminating instance %s"), instance_id)
rv = self.compute.terminate_instance(instance_id)
+ def test_terminate_instances(self):
+ inst1 = db.instance_create(self.context, {'reservation_id': 'a',
+ 'image_id': 1,
+ 'host': 'host1'})
+ terminate_instances = self.cloud.terminate_instances
+ # valid instance_id
+ result = terminate_instances(self.context, ['i-00000001'])
+ self.assertTrue(result)
+ # non-existing instance_id
+ self.assertRaises(exception.InstanceNotFound, terminate_instances,
+ self.context, ['i-2'])
+ db.instance_destroy(self.context, inst1['id'])
+
def test_update_of_instance_display_fields(self):
inst = db.instance_create(self.context, {})
ec2_id = ec2utils.id_to_ec2_id(inst['id'])