Skip to content

Commit

Permalink
Error out instance on set password failure.
Browse files Browse the repository at this point in the history
Fixes bug 920643

Change-Id: Ieb4724d44f50c217ce5f25d809c40ca6c6cdeed8
  • Loading branch information
rconradharris committed Jan 23, 2012
1 parent 152da40 commit c13078b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions nova/virt/xenapi/vmops.py
Expand Up @@ -930,8 +930,9 @@ def set_admin_password(self, instance, new_pass):
resp = self._make_agent_call('key_init', instance, '', key_init_args)
# Successful return code from key_init is 'D0'
if resp['returncode'] != 'D0':
LOG.error(_('Failed to exchange keys: %(resp)r') % locals())
return None
msg = _('Failed to exchange keys: %(resp)r') % locals()
LOG.error(msg)
raise Exception(msg)
# Some old versions of the Windows agent have a trailing \\r\\n
# (ie CRLF escaped) for some reason. Strip that off.
agent_pub = int(resp['message'].replace('\\r\\n', ''))
Expand All @@ -945,8 +946,9 @@ def set_admin_password(self, instance, new_pass):
resp = self._make_agent_call('password', instance, '', password_args)
# Successful return code from password is '0'
if resp['returncode'] != '0':
LOG.error(_('Failed to update password: %(resp)r') % locals())
return None
msg = _('Failed to update password: %(resp)r') % locals()
LOG.error(msg)
raise Exception(msg)
return resp['message']

def inject_file(self, instance, path, contents):
Expand Down

0 comments on commit c13078b

Please sign in to comment.