#     nic.ip = "10.123.20.23";  # IP地址,系统内部分配或从虚拟机内部获取的IP。 添加网卡、创建虚拟机时入参不携带,查询网卡或虚拟机信息中携带的网卡信息中携带。
#     nic.mac = "28:6e:d4:88:b4:f3";  # Mac地址,系统系统内部分配。 添加网卡,创建虚拟机,模板部署虚拟机,虚拟机克隆为虚拟机,模板克隆为模板,虚拟机克隆为虚拟机模板时入参不携带时由系统自动分派。 查询网卡或虚拟机信息中携带的网卡信息中携带。 
#     nic.name = "sgdsgsdg";  # 【可选】虚拟机网卡名称。 注:当模板部署/克隆虚拟机,虚拟机克隆为模板/虚拟机时此参数需要与原虚拟机/模板的网卡名相同。 
#     nic.nicType = 1;  # 网卡类型:1:inic网卡,其他:普通网卡,仅在查询时有效。 
#     nic.portGroupName = "managePortgroup55555";  # 【可选】portGroup名称。 
#     nic.portGroupUrn = "urn:sites:4D9D0815:dvswitchs:1:portgroups:1";  # 必填,portGroup标识,创建网卡时必选,修改网卡时可选。 
#     nic.virtIo = 0;  # 【可选】网卡类型,0: HW_X_NET (默认值);1: HW_V_NET;不携带使用默认值。
#     config.nics = [dict(nic)]
# 
#     req.vmConfig = dict(config)  
#     req.isTemplate = True
#     
#     # req.vmDatas = [dict(nicSpecification)]
#     # req.vmDatas = ""#【可选】虚拟机自定义数据列表,fileNames有值时生效。 
    bbb = resorce.cloneVm("/service/sites/4D9D0815/vms/i-000002E6", dict(req))

#     bbb = resorce.cloneVm("/service/sites/4D9D0815/vms/i-0000028C", dict(req))
    return bbb


if __name__ == '__main__':
    client = RestClient()
    client.connetToServer(host='172.22.4.4', port=7443, protocol='https')
    login = AuthenticateResource()
    aaa = login.login('fc01', 'Huawei@123');
    
#    LogInit(LogConf("../../log.conf", "LOGCONF"))
    resorce = VmResource()
    
    exportVm()
import sys 
sys.path.append("..")

from com.huawei.client.log import *
from com.huawei.resources.common.AuthenticateResource import AuthenticateResource
from com.huawei.client.connection import RestClient

from com.huawei.resources.host.HostResource import HostResource
from com.huawei.model.host.QueryHostListReq import QueryHostListReq
from com.huawei.model.host.QueryHostListResp import QueryHostListResp
from com.huawei.model.host.HostInfo import HostInfo

if __name__ == '__main__':
    client = RestClient()
    client.connetToServer(host='172.22.4.4', port=7443, protocol='https')
    login = AuthenticateResource()
    aaa = login.login('fc01', 'Huawei@123');
    LogInit(logCog = LogConf(confFile='../../log.conf',sec='LOGCONF'))
    
    host = HostResource()
    
    
    b = host.queryHost('/service/sites/4D9D0815/hosts/134')
   # print b
    
    print '--------------------------------------------------'
    req=QueryHostListReq()
    req.limit = 1
    req.offset = 0
    b = host.queryHostList('/service/sites/4D9D0815',req)