diff --git a/nova/scheduler/distributed_scheduler.py b/nova/scheduler/distributed_scheduler.py index 16e688e6..2dd7ea61 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):