diff options
author | Ed Leafe <ed@leafe.com> | 2011-01-10 15:33:10 -0600 |
---|---|---|
committer | Ed Leafe <ed@leafe.com> | 2011-01-10 15:33:10 -0600 |
commit | bae57e82767b4877bae5c2dcb6fe052291d16b32 (patch) | |
tree | 1881306eec886d4039d880e1e86519adf3f5c858 | |
parent | cb3667b95ceead8a677fdfa24abf2a56baf12992 (diff) | |
download | nova-bae57e82767b4877bae5c2dcb6fe052291d16b32.tar.gz nova-bae57e82767b4877bae5c2dcb6fe052291d16b32.tar.xz nova-bae57e82767b4877bae5c2dcb6fe052291d16b32.zip |
Fixed issues raised by reviews
-rw-r--r-- | nova/compute/api.py | 2 | ||||
-rw-r--r-- | nova/virt/xenapi/vmops.py | 15 | ||||
-rwxr-xr-x | plugins/xenserver/xenapi/etc/xapi.d/plugins/agent | 16 |
3 files changed, 8 insertions, 25 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py index a20dc59cb..10d7b67cf 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -297,7 +297,7 @@ class API(base.Base): host = instance['host'] if host: - self._cast_compute_message('snapshot_instance', context, + self._cast_compute_message('terminate_instance', context, instance_id, host) else: self.db.instance_destroy(context, instance_id) diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py index 78f35e9a7..206970c35 100644 --- a/nova/virt/xenapi/vmops.py +++ b/nova/virt/xenapi/vmops.py @@ -139,17 +139,19 @@ class VMOps(object): return instance_or_vm else: # Must be the instance name - instance = instance_or_vm + instance_name = instance_or_vm except (AttributeError, KeyError): # Note the the KeyError will only happen with fakes.py # Not a string; must be an ID or a vm instance if isinstance(instance_or_vm, (int, long)): - instance = instance_or_vm + ctx = context.get_admin_context() + instance_obj = db.instance_get_by_id(ctx, instance_or_vm) + instance_name = instance_obj.name else: - instance = instance_or_vm.name - vm = VMHelper.lookup(self._session, instance) + instance_name = instance_or_vm.name + vm = VMHelper.lookup(self._session, instance_name) if vm is None: - raise Exception(_('Instance not present %s') % instance) + raise Exception(_('Instance not present %s') % instance_name) return vm def snapshot(self, instance, name): @@ -378,9 +380,6 @@ class VMOps(object): rec = self._session.get_xenapi().VM.get_record(vm) args = {'dom_id': rec['domid'], 'path': path} args.update(addl_args) - # If the 'testing_mode' attribute is set, add that to the args. - if getattr(self, 'testing_mode', False): - args['testing_mode'] = 'true' try: task = self._session.async_call_plugin(plugin, method, args) ret = self._session.wait_for_task(instance_id, task) diff --git a/plugins/xenserver/xenapi/etc/xapi.d/plugins/agent b/plugins/xenserver/xenapi/etc/xapi.d/plugins/agent index 70726bf6f..82dd5466e 100755 --- a/plugins/xenserver/xenapi/etc/xapi.d/plugins/agent +++ b/plugins/xenserver/xenapi/etc/xapi.d/plugins/agent @@ -39,8 +39,6 @@ configure_logging("xenstore") import xenstore AGENT_TIMEOUT = 30 -# Used for simulating an external agent for testing -PRETEND_SECRET = 11111 def jsonify(fnc): @@ -158,13 +156,6 @@ def key_init(self, arg_dict): pub = int(arg_dict["pub"]) arg_dict["value"] = json.dumps({"name": "keyinit", "value": pub}) request_id = arg_dict["id"] - if arg_dict.get("testing_mode"): - # Pretend! - pretend = SimpleDH(secret=PRETEND_SECRET) - shared = pretend.compute_shared(pub) - # Simulate the agent's response - ret = {"returncode": "D0", "message": pretend.get_public(), "shared": shared} - return ret arg_dict["path"] = "data/host/%s" % request_id xenstore.write_record(self, arg_dict) try: @@ -184,13 +175,6 @@ def password(self, arg_dict): """ pub = int(arg_dict["pub"]) enc_pass = arg_dict["enc_pass"] - if arg_dict.get("testing_mode"): - # Decrypt the password, and send it back to verify - pretend = SimpleDH(secret=PRETEND_SECRET) - pretend.compute_shared(pub) - pw = pretend.decrypt(enc_pass) - ret = {"returncode": "0", "message": pw} - return ret arg_dict["value"] = json.dumps({"name": "password", "value": enc_pass}) request_id = arg_dict["id"] arg_dict["path"] = "data/host/%s" % request_id |