'Call xvp to obfuscate passwords for config file.
Args:
- password: the password to encode, max 8 char for vm passwords,
and 16 chars for pool passwords. passwords will
be trimmed to max len before encoding.
- is_pool_password: True if this is the XenServer api password
False if it\'s a VM console password
(xvp uses different keys and max lengths for pool passwords)
Note that xvp\'s obfuscation should not be considered \'real\' encryption.
It simply DES encrypts the passwords with static keys plainly viewable
in the xvp source code.'

def _xvp_encrypt(self, password, is_pool_password=False):

    maxlen = 8
    flag = '-e'
    if is_pool_password:
        maxlen = 16
        flag = '-x'
    password = password[:maxlen]
    (out, err) = utils.execute('xvp', flag, process_input=password)
    if err:
        raise processutils.ProcessExecutionError(_('Failed    to    run    xvp.'))
    return out.strip()
