diff options
| author | Naveed Massjouni <naveedm9@gmail.com> | 2011-04-05 17:48:38 -0400 |
|---|---|---|
| committer | Naveed Massjouni <naveedm9@gmail.com> | 2011-04-05 17:48:38 -0400 |
| commit | 092ac0dbaf5a5cd374004e5add4ba62c4b8aada4 (patch) | |
| tree | f7576a819d0253e3fd267f0058c1887327a6e4fb | |
| parent | e6505fd78cc28a5e91ec6fbf55e2e8de07679c7c (diff) | |
| parent | 94ccd2f4a1c42a8574fe65972650428130ae850d (diff) | |
| download | nova-092ac0dbaf5a5cd374004e5add4ba62c4b8aada4.tar.gz nova-092ac0dbaf5a5cd374004e5add4ba62c4b8aada4.tar.xz nova-092ac0dbaf5a5cd374004e5add4ba62c4b8aada4.zip | |
Merge from trunk
| -rw-r--r-- | Authors | 1 | ||||
| -rw-r--r-- | MANIFEST.in | 2 | ||||
| -rw-r--r-- | nova/CA/.gitignore (renamed from CA/.gitignore) | 0 | ||||
| -rwxr-xr-x | nova/CA/geninter.sh (renamed from CA/geninter.sh) | 2 | ||||
| -rwxr-xr-x | nova/CA/genrootca.sh (renamed from CA/genrootca.sh) | 3 | ||||
| -rwxr-xr-x | nova/CA/genvpn.sh (renamed from CA/genvpn.sh) | 0 | ||||
| -rw-r--r-- | nova/CA/newcerts/.placeholder (renamed from CA/newcerts/.placeholder) | 0 | ||||
| -rw-r--r-- | nova/CA/openssl.cnf.tmpl (renamed from CA/openssl.cnf.tmpl) | 0 | ||||
| -rw-r--r-- | nova/CA/private/.placeholder (renamed from CA/private/.placeholder) | 0 | ||||
| -rw-r--r-- | nova/CA/projects/.gitignore (renamed from CA/projects/.gitignore) | 0 | ||||
| -rw-r--r-- | nova/CA/projects/.placeholder (renamed from CA/projects/.placeholder) | 0 | ||||
| -rw-r--r-- | nova/CA/reqs/.gitignore (renamed from CA/reqs/.gitignore) | 0 | ||||
| -rw-r--r-- | nova/CA/reqs/.placeholder (renamed from CA/reqs/.placeholder) | 0 | ||||
| -rw-r--r-- | nova/api/ec2/cloud.py | 24 | ||||
| -rw-r--r-- | nova/crypto.py | 10 | ||||
| -rw-r--r-- | nova/tests/test_cloud.py | 33 | ||||
| -rw-r--r-- | nova/virt/libvirt_conn.py | 3 |
17 files changed, 63 insertions, 15 deletions
@@ -32,6 +32,7 @@ Jesse Andrews <anotherjesse@gmail.com> Joe Heck <heckj@mac.com> Joel Moore <joelbm24@gmail.com> John Dewey <john@dewey.ws> +John Tran <jtran@attinteractive.com> Jonathan Bryce <jbryce@jbryce.com> Jordan Rinke <jordan@openstack.org> Josh Durgin <joshd@hq.newdream.net> diff --git a/MANIFEST.in b/MANIFEST.in index bf30d1546..e7a6e7da4 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,7 +1,7 @@ include HACKING LICENSE run_tests.py run_tests.sh include README builddeb.sh exercise_rsapi.py include ChangeLog MANIFEST.in pylintrc Authors -graft CA +graft nova/CA graft doc graft smoketests graft tools diff --git a/CA/.gitignore b/nova/CA/.gitignore index fae0922bf..fae0922bf 100644 --- a/CA/.gitignore +++ b/nova/CA/.gitignore diff --git a/CA/geninter.sh b/nova/CA/geninter.sh index 1fbcc9e73..4b7f5a55c 100755 --- a/CA/geninter.sh +++ b/nova/CA/geninter.sh @@ -23,7 +23,7 @@ mkdir -p projects/$NAME cd projects/$NAME cp ../../openssl.cnf.tmpl openssl.cnf sed -i -e s/%USERNAME%/$NAME/g openssl.cnf -mkdir certs crl newcerts private +mkdir -p certs crl newcerts private openssl req -new -x509 -extensions v3_ca -keyout private/cakey.pem -out cacert.pem -days 365 -config ./openssl.cnf -batch -nodes echo "10" > serial touch index.txt diff --git a/CA/genrootca.sh b/nova/CA/genrootca.sh index 8f2c3ee3f..091cf17fc 100755 --- a/CA/genrootca.sh +++ b/nova/CA/genrootca.sh @@ -20,8 +20,9 @@ if [ -f "cacert.pem" ]; then echo "Not installing, it's already done." else - cp openssl.cnf.tmpl openssl.cnf + cp "$(dirname $0)/openssl.cnf.tmpl" openssl.cnf sed -i -e s/%USERNAME%/ROOT/g openssl.cnf + mkdir -p certs crl newcerts private openssl req -new -x509 -extensions v3_ca -keyout private/cakey.pem -out cacert.pem -days 365 -config ./openssl.cnf -batch -nodes touch index.txt echo "10" > serial diff --git a/CA/genvpn.sh b/nova/CA/genvpn.sh index 7e7db185d..7e7db185d 100755 --- a/CA/genvpn.sh +++ b/nova/CA/genvpn.sh diff --git a/CA/newcerts/.placeholder b/nova/CA/newcerts/.placeholder index e69de29bb..e69de29bb 100644 --- a/CA/newcerts/.placeholder +++ b/nova/CA/newcerts/.placeholder diff --git a/CA/openssl.cnf.tmpl b/nova/CA/openssl.cnf.tmpl index dd81f1c2b..dd81f1c2b 100644 --- a/CA/openssl.cnf.tmpl +++ b/nova/CA/openssl.cnf.tmpl diff --git a/CA/private/.placeholder b/nova/CA/private/.placeholder index e69de29bb..e69de29bb 100644 --- a/CA/private/.placeholder +++ b/nova/CA/private/.placeholder diff --git a/CA/projects/.gitignore b/nova/CA/projects/.gitignore index 72e8ffc0d..72e8ffc0d 100644 --- a/CA/projects/.gitignore +++ b/nova/CA/projects/.gitignore diff --git a/CA/projects/.placeholder b/nova/CA/projects/.placeholder index e69de29bb..e69de29bb 100644 --- a/CA/projects/.placeholder +++ b/nova/CA/projects/.placeholder diff --git a/CA/reqs/.gitignore b/nova/CA/reqs/.gitignore index 72e8ffc0d..72e8ffc0d 100644 --- a/CA/reqs/.gitignore +++ b/nova/CA/reqs/.gitignore diff --git a/CA/reqs/.placeholder b/nova/CA/reqs/.placeholder index e69de29bb..e69de29bb 100644 --- a/CA/reqs/.placeholder +++ b/nova/CA/reqs/.placeholder diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index 425784e8a..99520b302 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -103,10 +103,17 @@ class CloudController(object): # Gen root CA, if we don't have one root_ca_path = os.path.join(FLAGS.ca_path, FLAGS.ca_file) if not os.path.exists(root_ca_path): + genrootca_sh_path = os.path.join(os.path.dirname(__file__), + os.path.pardir, + os.path.pardir, + 'CA', + 'genrootca.sh') + start = os.getcwd() + os.makedirs(FLAGS.ca_path) os.chdir(FLAGS.ca_path) # TODO(vish): Do this with M2Crypto instead - utils.runthis(_("Generating root CA: %s"), "sh", "genrootca.sh") + utils.runthis(_("Generating root CA: %s"), "sh", genrootca_sh_path) os.chdir(start) def _get_mpi_data(self, context, project_id): @@ -886,10 +893,7 @@ class CloudController(object): image_type = image['properties'].get('type') ec2_id = self._image_ec2_id(image.get('id'), image_type) name = image.get('name') - if name: - i['imageId'] = "%s (%s)" % (ec2_id, name) - else: - i['imageId'] = ec2_id + i['imageId'] = ec2_id kernel_id = image['properties'].get('kernel_id') if kernel_id: i['kernelId'] = self._image_ec2_id(kernel_id, 'kernel') @@ -897,11 +901,15 @@ class CloudController(object): if ramdisk_id: i['ramdiskId'] = self._image_ec2_id(ramdisk_id, 'ramdisk') i['imageOwnerId'] = image['properties'].get('owner_id') - i['imageLocation'] = image['properties'].get('image_location') + if name: + i['imageLocation'] = "%s (%s)" % (image['properties']. + get('image_location'), name) + else: + i['imageLocation'] = image['properties'].get('image_location') i['imageState'] = image['properties'].get('image_state') - i['displayName'] = image.get('name') + i['displayName'] = name i['description'] = image.get('description') - i['type'] = image_type + i['imageType'] = image_type i['isPublic'] = str(image['properties'].get('is_public', '')) == 'True' i['architecture'] = image['properties'].get('architecture') return i diff --git a/nova/crypto.py b/nova/crypto.py index b112e5b92..2b122e560 100644 --- a/nova/crypto.py +++ b/nova/crypto.py @@ -215,9 +215,12 @@ def generate_x509_cert(user_id, project_id, bits=1024): def _ensure_project_folder(project_id): if not os.path.exists(ca_path(project_id)): + geninter_sh_path = os.path.join(os.path.dirname(__file__), + 'CA', + 'geninter.sh') start = os.getcwd() os.chdir(ca_folder()) - utils.execute('sh', 'geninter.sh', project_id, + utils.execute('sh', geninter_sh_path, project_id, _project_cert_subject(project_id)) os.chdir(start) @@ -227,13 +230,16 @@ def generate_vpn_files(project_id): csr_fn = os.path.join(project_folder, "server.csr") crt_fn = os.path.join(project_folder, "server.crt") + genvpn_sh_path = os.path.join(os.path.dirname(__file__), + 'CA', + 'geninter.sh') if os.path.exists(crt_fn): return _ensure_project_folder(project_id) start = os.getcwd() os.chdir(ca_folder()) # TODO(vish): the shell scripts could all be done in python - utils.execute('sh', 'genvpn.sh', + utils.execute('sh', genvpn_sh_path, project_id, _vpn_cert_subject(project_id)) with open(csr_fn, "r") as csrfile: csr_text = csrfile.read() diff --git a/nova/tests/test_cloud.py b/nova/tests/test_cloud.py index 00803d0ad..5cb969979 100644 --- a/nova/tests/test_cloud.py +++ b/nova/tests/test_cloud.py @@ -41,6 +41,7 @@ from nova.compute import power_state from nova.api.ec2 import cloud from nova.api.ec2 import ec2utils from nova.image import local +from nova.exception import NotFound FLAGS = flags.FLAGS @@ -71,7 +72,8 @@ class CloudTestCase(test.TestCase): host = self.network.get_network_host(self.context.elevated()) def fake_show(meh, context, id): - return {'id': 1, 'properties': {'kernel_id': 1, 'ramdisk_id': 1}} + return {'id': 1, 'properties': {'kernel_id': 1, 'ramdisk_id': 1, + 'type': 'machine'}} self.stubs.Set(local.LocalImageService, 'show', fake_show) self.stubs.Set(local.LocalImageService, 'show_by_name', fake_show) @@ -216,6 +218,35 @@ class CloudTestCase(test.TestCase): db.service_destroy(self.context, comp1['id']) db.service_destroy(self.context, comp2['id']) + def test_describe_images(self): + describe_images = self.cloud.describe_images + + def fake_detail(meh, context): + return [{'id': 1, 'properties': {'kernel_id': 1, 'ramdisk_id': 1, + 'type': 'machine'}}] + + def fake_show_none(meh, context, id): + raise NotFound + + self.stubs.Set(local.LocalImageService, 'detail', fake_detail) + # list all + result1 = describe_images(self.context) + result1 = result1['imagesSet'][0] + self.assertEqual(result1['imageId'], 'ami-00000001') + # provided a valid image_id + result2 = describe_images(self.context, ['ami-00000001']) + self.assertEqual(1, len(result2['imagesSet'])) + # provide more than 1 valid image_id + result3 = describe_images(self.context, ['ami-00000001', + 'ami-00000002']) + self.assertEqual(2, len(result3['imagesSet'])) + # provide an non-existing image_id + self.stubs.UnsetAll() + self.stubs.Set(local.LocalImageService, 'show', fake_show_none) + self.stubs.Set(local.LocalImageService, 'show_by_name', fake_show_none) + self.assertRaises(NotFound, describe_images, + self.context, ['ami-fake']) + def test_console_output(self): instance_type = FLAGS.default_instance_type max_count = 1 diff --git a/nova/virt/libvirt_conn.py b/nova/virt/libvirt_conn.py index babbc610d..2be190256 100644 --- a/nova/virt/libvirt_conn.py +++ b/nova/virt/libvirt_conn.py @@ -970,7 +970,8 @@ class LibvirtConnection(driver.ComputeDriver): 'nics': nics} if FLAGS.vnc_enabled: - xml_info['vncserver_host'] = FLAGS.vncserver_host + if FLAGS.libvirt_type != 'lxc': + xml_info['vncserver_host'] = FLAGS.vncserver_host if not rescue: if instance['kernel_id']: xml_info['kernel'] = xml_info['basepath'] + "/kernel" |
