def export_vm(self, ref, destination, ref2=None, as_vm = False): if ref2: task_uuid = self.connection.task.create(self.session_uuid, "Exporting snapshot", "Exporting snapshot " + destina else: task_uuid = self.connection.task.create(self.session_uuid, "Exporting VM", "Exporting VM " + destination) self.track_tasks[task_uuid['Value']] = ref2 if ref2 else ref url = "http://%s/export?ref=%s&session_id=%s&task_id=%s" % (self.wine.selected_host, ref, self.session_uuid, task_uuid['Value']) Thread(target=self.download_export, args=(url,destination, ref, as_vm)).start()