diff options
Diffstat (limited to 'nova/virt')
| -rw-r--r-- | nova/virt/xenapi/agent.py | 11 | ||||
| -rw-r--r-- | nova/virt/xenapi/vmops.py | 3 |
2 files changed, 10 insertions, 4 deletions
diff --git a/nova/virt/xenapi/agent.py b/nova/virt/xenapi/agent.py index e8a81f552..8220fb67b 100644 --- a/nova/virt/xenapi/agent.py +++ b/nova/virt/xenapi/agent.py @@ -123,8 +123,9 @@ def _get_agent_version(session, instance, vm_ref): class XenAPIBasedAgent(object): - def __init__(self, session, instance, vm_ref): + def __init__(self, session, virtapi, instance, vm_ref): self.session = session + self.virtapi = virtapi self.instance = instance self.vm_ref = vm_ref @@ -212,9 +213,13 @@ class XenAPIBasedAgent(object): sshkey = self.instance.get('key_data') if sshkey: + ctxt = context.get_admin_context() enc = crypto.ssh_encrypt_text(sshkey, new_pass) - password.set_password(context.get_admin_context(), - self.instance['uuid'], base64.b64encode(enc)) + sys_meta = utils.metadata_to_dict(self.instance['system_metadata']) + sys_meta.update(password.convert_password(ctxt, + base64.b64encode(enc))) + self.virtapi.instance_update(ctxt, self.instance['uuid'], + {'system_metadata': sys_meta}) return resp['message'] diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py index 8a76f3368..9124b4dbe 100644 --- a/nova/virt/xenapi/vmops.py +++ b/nova/virt/xenapi/vmops.py @@ -176,7 +176,8 @@ class VMOps(object): def _get_agent(self, instance, vm_ref): if self.agent_enabled: - return xapi_agent.XenAPIBasedAgent(self._session, instance, vm_ref) + return xapi_agent.XenAPIBasedAgent(self._session, self._virtapi, + instance, vm_ref) raise exception.NovaException(_("Error: Agent is disabled")) def list_instances(self): |
