コード例 #1
0
ファイル: VMTest.py プロジェクト: avenrainbow/aven_su
def testVmRestore():
    
    #连接参数
    dataConnect = DataConnect()
    dataConnect.ip = "192.168.100.19"
    dataConnect.port = "8080"
    dataConnect.account = "admin"
    dataConnect.password = "******"
    
    # 还原虚拟机参数,指定已备份的文件
    data = "{'shareName':'\\10.10.113.253\cifsserver','userName':'******','passwd':'test123','fileName':'d9ad6d9f-3e5f-1a40-48b8-1ffccd8eb5ed_97_201404071750.xva'}"
    taskId = VM.vmRestore(dataConnect, data);
    
    print taskId
コード例 #2
0
ファイル: VMTest.py プロジェクト: avenrainbow/aven_su
def testRecoverSnapshot():
    
    #连接参数
    dataConnect = DataConnect()
    dataConnect.ip = "192.168.100.19"
    dataConnect.port = "8080"
    dataConnect.account = "admin"
    dataConnect.password = "******"
    
    # 快照id,请使用真实存在的快照id
    snapshotId = "83"
    taskId = Snapshot.recoverSnapshot(dataConnect, snapshotId)
    
    print taskId
コード例 #3
0
def testDelete():
    
    #连接参数
    dataConnect = DataConnect()
    dataConnect.ip = "10.0.0.100"
    dataConnect.port = "8080"
    dataConnect.account = "admin"
    dataConnect.password = "******"
    
    apiKey = "wce/api/vms/{0}"
    params = ""
    placeholder = "515"
    data = ""
    RestHandler.deleteRest(dataConnect, apiKey, params, placeholder, data); 
コード例 #4
0
def testPut():
    
    #连接参数
    dataConnect = DataConnect()
    dataConnect.ip = "10.0.0.100"
    dataConnect.port = "8080"
    dataConnect.account = "admin"
    dataConnect.password = "******"
    
    apiKey = "wce/api/vms/{0}"
    params = ""
    placeholder = "449"
    data = "{'state':'OK'}"
    RestHandler.putRest(dataConnect, apiKey, params, placeholder, data);
コード例 #5
0
def testGet():
    
    #连接参数
    dataConnect = DataConnect()
    dataConnect.ip = "10.0.0.100"
    dataConnect.port = "8080"
    dataConnect.account = "admin"
    dataConnect.password = "******"
    
    apiKey = "wce/api/vms"
    params = "name=服务器"
    placeholder = ""
    data = ""
    RestHandler.getRest(dataConnect, apiKey, params, placeholder, data);
コード例 #6
0
ファイル: VMTest.py プロジェクト: avenrainbow/aven_su
def testAddSnapshot():
    
    #连接参数
    dataConnect = DataConnect()
    dataConnect.ip = "192.168.100.19"
    dataConnect.port = "8080"
    dataConnect.account = "admin"
    dataConnect.password = "******"
    
    # 创建快照参数
    data = "{'name':'python测试','vmId':'90','keepMem':'false','description':'python描述'}"
    
    taskId = Snapshot.addSnapshot(dataConnect, data)
    
    print taskId
コード例 #7
0
ファイル: VMTest.py プロジェクト: avenrainbow/aven_su
def testVmBackup():
    
    #连接参数
    dataConnect = DataConnect()
    dataConnect.ip = "192.168.100.19"
    dataConnect.port = "8080"
    dataConnect.account = "admin"
    dataConnect.password = "******"
    
    # 备份的虚拟机id
    vmId = "27"
    # 备份参数
    data = "{'shareName':'\\10.10.113.253\cifsserver','userName':'******','passwd':'test123','fileName':'kee'}"
    
    taskId = VM.vmBackup(dataConnect, vmId,data)
    
    print taskId
コード例 #8
0
def testPost():
    
    #连接参数
    dataConnect = DataConnect()
    dataConnect.ip = "10.0.0.100"
    dataConnect.port = "8080"
    dataConnect.account = "admin"
    dataConnect.password = "******"
    
    apiKey = "wce/api/vms"
    params = ""
    placeholder = ""
 
    data = '{"name":"kee_vm_中文","targetId":"17","state":"EXECUTING","targetType":"host","vcpu":"1","cpu":0.3,"memory":1024,"disk":"8","storagePoolId":"91","ip":"192.168.100.17","templateId":"169","vnetConfig":{    "vnetwokrId":"171",    "gateway":"192.168.100.1",    "netmask":"255.255.255.0",    "qos":""},"customization":    {"cpuWeight":384}}'
    
    
    RestHandler.postRest(dataConnect, apiKey, params, placeholder, data);