def __init__(self): ''' self.result为多快磁盘创建时记录创建状态 { “name”:0|1|2 #0表示创建中,1为创建完成,2为创建失败 } :return: ''' self.token_dict = get_token() self.project_id_dict = get_proid() self.result = {}
def get_keypairs(cls): ''' 获取密钥对 :return: ''' token = get_token() project_id = get_proid() path = url_keypairs.format(project_id=project_id) method = "GET" head = {"Content-Type": "application/json", "X-Auth-Token": token} params = "" ret = send_request(method, IP_nova, PORT_nova, path, params, head) assert ret != 1, "send_request error" return ret
def __init__(self): ''' result用来为多台虚拟机创建时存储状态,数据结构为: { “name_vm”:{ "status_vm":0|1|2, #0表示创建中,1为创建完成,2为创建失败 "status_disk":{ "name_disk":0|1|2 #0表示创建中,1为创建完成,2为创建失败 } } } :return: ''' self.token_dict = get_token() self.project_id_dict = get_proid() self.result = {}
def __init__(self): self.token_dict = get_token() self.project_id_dict = get_proid()