2013年5月15日 星期三

查閱XeAPI當中的session物件以及xenapi物件底下的method



#!/usr/bin/env python

import sys
import XenAPI
import pprint
import inspect

if __name__ == "__main__":
    url = sys.argv[1]
    username = sys.argv[2]
    password = sys.argv[3]

    session = XenAPI.Session(url)
    session.xenapi.login_with_password(username,password)
    print session.__dict__.items()
    print session.xenapi.__dict__.items()



root@StorageController:[~/xenapi-test](master) 4h5m $ python vdi-create.py https://ip:443  account password

[('last_login_method', 'login_with_password'), ('_ServerProxy__transport', <xmlrpclib.SafeTransport instance at 0x7f4a7640ccb0>), ('_ServerProxy__handler', '/RPC2'), ('_ServerProxy__host', '<ip>:443'), ('last_login_params', ('<acccount>', '<password>')), ('_ServerProxy__verbose', 0), ('_ServerProxy__allow_none', 1), ('_session', 'OpaqueRef:35bd0f38-b821-af71-eb26-e151370c6337'), ('API_version', '1.8'), ('_ServerProxy__encoding', None), ('transport', None)]

[('_Dispatcher__API_version', '1.8'), ('_Dispatcher__send', <bound method Session.xenapi_request of <ServerProxy for <ip>:443/RPC2>>), ('_Dispatcher__name', None)]

沒有留言:

張貼留言