vdsm-client接口编写
Posted li_Jiejun
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vdsm-client接口编写相关的知识,希望对你有一定的参考价值。
python2/3
>>> import yajsonrpc
>>> from yajsonrpc import stomp
>>> from yajsonrpc import stompclient
>>> import uuid
client = stompclient.SimpleClient('192.168.244.145', 54321, True, incoming_heartbeat=stomp.DEFAULT_INCOMING, outgoing_heartbeat=stomp.DEFAULT_OUTGOING, nr_retries=stomp.NR_RETRIES)
//ssl设置为False
client = stompclient.SimpleClient('192.168.244.145', 54321, False, incoming_heartbeat=stomp.DEFAULT_INCOMING, outgoing_heartbeat=stomp.DEFAULT_OUTGOING, nr_retries=stomp.NR_RETRIES)
lib/vdsm/jsonrpcvdscli.py文件内可找到
>>> method = 'Host.getVMList'
>>> timeout = 60
>>> kwargs='fullStatus': 'True'
>>> import uuid
>>> req = yajsonrpc.JsonRpcRequest(method, kwargs, reqId=str(uuid.uuid4()))
responses = client.call(req, timeout=timeout, flow_id='test')
responses[0].result
以上是关于vdsm-client接口编写的主要内容,如果未能解决你的问题,请参考以下文章
35.按要求编写Java程序: 编写一个接口:InterfaceA,只含有一个方法int method(int n); 编写一个类:ClassA来实现接口InterfaceA,实现int