def addSv2Vm(self,vm_id,sv_id,sv_file,contenttype): vm_ip=vmmanmod_client.get_vm_ip(vm_id) sv_url = 'http://'+vm_ip+":8091/v1/svs/"+sv_id sv_filename=sv_id+"."+sv_file.filename.split('.')[-1].strip() boundary=contenttype.split(';')[-1].split("=")[-1].strip() sv_data = self.multipartencode.encode(sv_filename,sv_file,boundary) self.upload_file(vm_ip, contenttype, sv_data) return sv_url
def getSvVmip(db_session,id): sql='selete vm_id from sv_tb where sv_id= '+id r=db_session.query(sql) vm_id=r[0][0] vm_ip=vmmanmod_client.get_vm_ip(vm_id) return vm_ip