From b45c84282abd22ac9d36c5e70e0af2ff0624a9a7 Mon Sep 17 00:00:00 2001 From: Brian Waldon Date: Tue, 31 Jan 2012 20:50:48 -0800 Subject: [PATCH] Excise M2Crypto! This required rewriting our Diffie-Hellman-Merkle implementation for set_admin_password in xen. Fixes bug 917851. Change-Id: Ic4cdcc06221f003aec2dcd5ba05a1a9ad19d39c9 --- doc/source/devref/development.environment.rst | 12 ++------ nova/scheduler/distributed_scheduler.py | 28 ++++++------------- 2 files changed, 12 insertions(+), 28 deletions(-) diff --git a/doc/source/devref/development.environment.rst b/doc/source/devref/development.environment.rst index ce5b721b7..2b2bacb5b 100644 --- a/doc/source/devref/development.environment.rst +++ b/doc/source/devref/development.environment.rst @@ -54,22 +54,16 @@ Install the prerequisite packages. On Ubuntu:: - sudo apt-get install python-dev swig libssl-dev python-pip git-core + sudo apt-get install python-dev libssl-dev python-pip git-core On Fedora-based distributions (e.g., Fedora/RHEL/CentOS/Scientific Linux):: - sudo yum install python-devel swig openssl-devel python-pip git + sudo yum install python-devel openssl-devel python-pip git Mac OS X Systems ---------------- -Install swig, which is needed to build the M2Crypto Python package. If you are -using the `homebrew `_, package manager, -install swig by doing:: - - brew install swig - Install virtualenv:: sudo easy_install virtualenv @@ -120,7 +114,7 @@ You can manually install the virtual environment instead of having This will install all of the Python packages listed in the ``tools/pip-requires`` file into your virtualenv. There will also be some -additional packages (pip, distribute, greenlet, M2Crypto) that are installed +additional packages (pip, distribute, greenlet) that are installed by the ``tools/install_venv.py`` file into the virutalenv. If all goes well, you should get a message something like this:: diff --git a/nova/scheduler/distributed_scheduler.py b/nova/scheduler/distributed_scheduler.py index 16e688e6f..2dd7ea619 100644 --- a/nova/scheduler/distributed_scheduler.py +++ b/nova/scheduler/distributed_scheduler.py @@ -22,8 +22,6 @@ Weighing Functions. import json import operator -import M2Crypto - from novaclient import v1_1 as novaclient from novaclient import exceptions as novaclient_exceptions from nova import crypto @@ -43,11 +41,6 @@ FLAGS = flags.FLAGS LOG = logging.getLogger('nova.scheduler.distributed_scheduler') -class InvalidBlob(exception.NovaException): - message = _("Ill-formed or incorrectly routed 'blob' data sent " - "to instance create request.") - - class DistributedScheduler(driver.Scheduler): """Scheduler that can work across any nova deployment, from simple deployments to multiple nested zones. @@ -185,19 +178,16 @@ class DistributedScheduler(driver.Scheduler): or None if invalid. Broken out for testing. """ decryptor = crypto.decryptor(FLAGS.build_plan_encryption_key) - try: - json_entry = decryptor(blob) - # Extract our WeightedHost values - wh_dict = json.loads(json_entry) - host = wh_dict.get('host', None) - blob = wh_dict.get('blob', None) - zone = wh_dict.get('zone', None) - return least_cost.WeightedHost(wh_dict['weight'], - host_state=host_manager.HostState(host, 'compute'), - blob=blob, zone=zone) + json_entry = decryptor(blob) - except M2Crypto.EVP.EVPError: - raise InvalidBlob() + # Extract our WeightedHost values + wh_dict = json.loads(json_entry) + host = wh_dict.get('host', None) + blob = wh_dict.get('blob', None) + zone = wh_dict.get('zone', None) + return least_cost.WeightedHost(wh_dict['weight'], + host_state=host_manager.HostState(host, 'compute'), + blob=blob, zone=zone) def _ask_child_zone_to_create_instance(self, context, weighted_host, request_spec, kwargs):